fix block overrides in gethclient

This commit is contained in:
Sina Mahmoodi 2024-01-04 17:05:02 +03:30
parent fd0f626f67
commit 1e7b497fb3
2 changed files with 5 additions and 5 deletions

View file

@ -313,9 +313,9 @@ func (o BlockOverrides) MarshalJSON() ([]byte, error) {
Difficulty *hexutil.Big `json:"difficulty,omitempty"` Difficulty *hexutil.Big `json:"difficulty,omitempty"`
Time hexutil.Uint64 `json:"time,omitempty"` Time hexutil.Uint64 `json:"time,omitempty"`
GasLimit hexutil.Uint64 `json:"gasLimit,omitempty"` GasLimit hexutil.Uint64 `json:"gasLimit,omitempty"`
Coinbase *common.Address `json:"coinbase,omitempty"` Coinbase *common.Address `json:"feeRecipient,omitempty"`
Random *common.Hash `json:"random,omitempty"` Random *common.Hash `json:"prevRandao,omitempty"`
BaseFee *hexutil.Big `json:"baseFee,omitempty"` BaseFee *hexutil.Big `json:"baseFeePerGas,omitempty"`
} }
output := override{ output := override{

View file

@ -510,7 +510,7 @@ func TestBlockOverridesMarshal(t *testing.T) {
bo: BlockOverrides{ bo: BlockOverrides{
Coinbase: common.HexToAddress("0x1111111111111111111111111111111111111111"), Coinbase: common.HexToAddress("0x1111111111111111111111111111111111111111"),
}, },
want: `{"coinbase":"0x1111111111111111111111111111111111111111"}`, want: `{"feeRecipient":"0x1111111111111111111111111111111111111111"}`,
}, },
{ {
bo: BlockOverrides{ bo: BlockOverrides{
@ -520,7 +520,7 @@ func TestBlockOverridesMarshal(t *testing.T) {
GasLimit: 4, GasLimit: 4,
BaseFee: big.NewInt(5), BaseFee: big.NewInt(5),
}, },
want: `{"number":"0x1","difficulty":"0x2","time":"0x3","gasLimit":"0x4","baseFee":"0x5"}`, want: `{"number":"0x1","difficulty":"0x2","time":"0x3","gasLimit":"0x4","baseFeePerGas":"0x5"}`,
}, },
} { } {
marshalled, err := json.Marshal(&tt.bo) marshalled, err := json.Marshal(&tt.bo)