@@ -629,12 +629,14 @@ func TestEstimateGas(t *testing.T) {
629629 t .Parallel ()
630630 // Initialize test accounts
631631 var (
632- accounts = newAccounts (2 )
632+ accounts = newAccounts (4 )
633633 genesis = & core.Genesis {
634634 Config : params .MergedTestChainConfig ,
635635 Alloc : types.GenesisAlloc {
636636 accounts [0 ].addr : {Balance : big .NewInt (params .Ether )},
637637 accounts [1 ].addr : {Balance : big .NewInt (params .Ether )},
638+ accounts [2 ].addr : {Balance : big .NewInt (params .Ether ), Code : append (types .DelegationPrefix , accounts [3 ].addr .Bytes ()... )},
639+ // accounts[3].addr: {Code: []byte{byte(vm.ADDRESS), byte(vm.PUSH0), byte(vm.SSTORE)}},
638640 },
639641 }
640642 genBlocks = 10
@@ -819,6 +821,26 @@ func TestEstimateGas(t *testing.T) {
819821 blockOverrides : override.BlockOverrides {Number : (* hexutil .Big )(big .NewInt (11 ))},
820822 expectErr : newRevertError (packRevert ("block 11" )),
821823 },
824+ // Should be able to send to an EIP-7702 delegated account.
825+ {
826+ blockNumber : rpc .LatestBlockNumber ,
827+ call : TransactionArgs {
828+ From : & accounts [0 ].addr ,
829+ To : & accounts [2 ].addr ,
830+ Value : (* hexutil .Big )(big .NewInt (1 )),
831+ },
832+ want : 21000 ,
833+ },
834+ // Should be able to send as EIP-7702 delegated account.
835+ {
836+ blockNumber : rpc .LatestBlockNumber ,
837+ call : TransactionArgs {
838+ From : & accounts [2 ].addr ,
839+ To : & accounts [1 ].addr ,
840+ Value : (* hexutil .Big )(big .NewInt (1 )),
841+ },
842+ want : 21000 ,
843+ },
822844 }
823845 for i , tc := range testSuite {
824846 result , err := api .EstimateGas (context .Background (), tc .call , & rpc.BlockNumberOrHash {BlockNumber : & tc .blockNumber }, & tc .overrides , & tc .blockOverrides )
0 commit comments