@@ -29,7 +29,6 @@ import (
2929 "github.com/ethereum/go-ethereum"
3030 "github.com/ethereum/go-ethereum/accounts/abi"
3131 "github.com/ethereum/go-ethereum/common"
32- "github.com/ethereum/go-ethereum/common/hexutil"
3332 "github.com/ethereum/go-ethereum/consensus/beacon"
3433 "github.com/ethereum/go-ethereum/consensus/ethash"
3534 "github.com/ethereum/go-ethereum/core"
@@ -38,6 +37,7 @@ import (
3837 "github.com/ethereum/go-ethereum/eth"
3938 "github.com/ethereum/go-ethereum/eth/ethconfig"
4039 "github.com/ethereum/go-ethereum/ethclient"
40+ "github.com/ethereum/go-ethereum/ethclient/gethclient"
4141 "github.com/ethereum/go-ethereum/node"
4242 "github.com/ethereum/go-ethereum/params"
4343 "github.com/ethereum/go-ethereum/rpc"
@@ -777,20 +777,20 @@ func TestSimulateV1(t *testing.T) {
777777 // Simple test: transfer ETH from one account to another
778778 from := testAddr
779779 to := common .HexToAddress ("0x0000000000000000000000000000000000000001" )
780- value := hexutil . Big ( * big .NewInt (100 ) )
781- gas := hexutil . Uint64 (100000 )
782- maxFeePerGas := hexutil . Big ( * new (big.Int ).Mul (header .BaseFee , big .NewInt (2 ) ))
780+ value := big .NewInt (100 )
781+ gas := uint64 (100000 )
782+ maxFeePerGas := new (big.Int ).Mul (header .BaseFee , big .NewInt (2 ))
783783
784784 opts := ethclient.SimulateOptions {
785785 BlockStateCalls : []ethclient.SimulateBlock {
786786 {
787- Calls : []ethclient. CallArgs {
787+ Calls : []ethereum. CallMsg {
788788 {
789- From : & from ,
790- To : & to ,
791- Value : & value ,
792- Gas : & gas ,
793- MaxFeePerGas : & maxFeePerGas ,
789+ From : from ,
790+ To : & to ,
791+ Value : value ,
792+ Gas : gas ,
793+ GasFeeCap : maxFeePerGas ,
794794 },
795795 },
796796 },
@@ -841,26 +841,26 @@ func TestSimulateV1WithBlockOverrides(t *testing.T) {
841841
842842 from := testAddr
843843 to := common .HexToAddress ("0x0000000000000000000000000000000000000001" )
844- value := hexutil . Big ( * big .NewInt (100 ) )
845- gas := hexutil . Uint64 (100000 )
846- maxFeePerGas := hexutil . Big ( * new (big.Int ).Mul (header .BaseFee , big .NewInt (2 ) ))
844+ value := big .NewInt (100 )
845+ gas := uint64 (100000 )
846+ maxFeePerGas := new (big.Int ).Mul (header .BaseFee , big .NewInt (2 ))
847847
848848 // Override timestamp only
849- timestamp := hexutil . Uint64 (1234567890 )
849+ timestamp := uint64 (1234567890 )
850850
851851 opts := ethclient.SimulateOptions {
852852 BlockStateCalls : []ethclient.SimulateBlock {
853853 {
854- BlockOverrides : & ethclient .BlockOverrides {
855- Time : & timestamp ,
854+ BlockOverrides : & gethclient .BlockOverrides {
855+ Time : timestamp ,
856856 },
857- Calls : []ethclient. CallArgs {
857+ Calls : []ethereum. CallMsg {
858858 {
859- From : & from ,
860- To : & to ,
861- Value : & value ,
862- Gas : & gas ,
863- MaxFeePerGas : & maxFeePerGas ,
859+ From : from ,
860+ To : & to ,
861+ Value : value ,
862+ Gas : gas ,
863+ GasFeeCap : maxFeePerGas ,
864864 },
865865 },
866866 },
@@ -878,7 +878,7 @@ func TestSimulateV1WithBlockOverrides(t *testing.T) {
878878 }
879879
880880 // Verify the timestamp was overridden
881- if results [0 ].Timestamp != timestamp {
881+ if uint64 ( results [0 ].Timestamp ) != timestamp {
882882 t .Errorf ("expected timestamp %d, got %d" , timestamp , results [0 ].Timestamp )
883883 }
884884}
@@ -903,30 +903,32 @@ func TestSimulateV1WithStateOverrides(t *testing.T) {
903903
904904 from := testAddr
905905 to := common .HexToAddress ("0x0000000000000000000000000000000000000001" )
906- value := hexutil . Big ( * big .NewInt (1000000000000000000 ) ) // 1 ETH
907- gas := hexutil . Uint64 (100000 )
908- maxFeePerGas := hexutil . Big ( * new (big.Int ).Mul (header .BaseFee , big .NewInt (2 ) ))
906+ value := big .NewInt (1000000000000000000 ) // 1 ETH
907+ gas := uint64 (100000 )
908+ maxFeePerGas := new (big.Int ).Mul (header .BaseFee , big .NewInt (2 ))
909909
910910 // Override the balance of the 'from' address
911911 balanceStr := "1000000000000000000000"
912912 balance := new (big.Int )
913913 balance .SetString (balanceStr , 10 )
914914
915+ stateOverrides := map [common.Address ]gethclient.OverrideAccount {
916+ from : {
917+ Balance : balance ,
918+ },
919+ }
920+
915921 opts := ethclient.SimulateOptions {
916922 BlockStateCalls : []ethclient.SimulateBlock {
917923 {
918- StateOverrides : & ethclient.StateOverride {
919- from : ethclient.OverrideAccount {
920- Balance : (* hexutil .Big )(balance ),
921- },
922- },
923- Calls : []ethclient.CallArgs {
924+ StateOverrides : & stateOverrides ,
925+ Calls : []ethereum.CallMsg {
924926 {
925- From : & from ,
926- To : & to ,
927- Value : & value ,
928- Gas : & gas ,
929- MaxFeePerGas : & maxFeePerGas ,
927+ From : from ,
928+ To : & to ,
929+ Value : value ,
930+ Gas : gas ,
931+ GasFeeCap : maxFeePerGas ,
930932 },
931933 },
932934 },
@@ -968,20 +970,20 @@ func TestSimulateV1WithBlockNumberOrHash(t *testing.T) {
968970
969971 from := testAddr
970972 to := common .HexToAddress ("0x0000000000000000000000000000000000000001" )
971- value := hexutil . Big ( * big .NewInt (100 ) )
972- gas := hexutil . Uint64 (100000 )
973- maxFeePerGas := hexutil . Big ( * new (big.Int ).Mul (header .BaseFee , big .NewInt (2 ) ))
973+ value := big .NewInt (100 )
974+ gas := uint64 (100000 )
975+ maxFeePerGas := new (big.Int ).Mul (header .BaseFee , big .NewInt (2 ))
974976
975977 opts := ethclient.SimulateOptions {
976978 BlockStateCalls : []ethclient.SimulateBlock {
977979 {
978- Calls : []ethclient. CallArgs {
980+ Calls : []ethereum. CallMsg {
979981 {
980- From : & from ,
981- To : & to ,
982- Value : & value ,
983- Gas : & gas ,
984- MaxFeePerGas : & maxFeePerGas ,
982+ From : from ,
983+ To : & to ,
984+ Value : value ,
985+ Gas : gas ,
986+ GasFeeCap : maxFeePerGas ,
985987 },
986988 },
987989 },
0 commit comments