From c1c3287f79cd53b827eb4dd3f3b2e060a8a94ec1 Mon Sep 17 00:00:00 2001 From: Martin Holst Swende Date: Tue, 5 Dec 2023 09:37:48 +0100 Subject: [PATCH 1/6] eth/tracers/logger: make structlog/json-log stack hex again (#28628) * common/hexutil: define hex wrappers for uint256.Int * eth/tracers/logger: make structlog/json-log stack hex again * common/hexutil: goimports --- common/hexutil/json.go | 45 ++++++++++++++++++++++ common/hexutil/json_test.go | 60 +++++++++++++++++++++++++++++ eth/tracers/logger/gen_structlog.go | 16 ++++++-- eth/tracers/logger/logger.go | 1 + 4 files changed, 118 insertions(+), 4 deletions(-) diff --git a/common/hexutil/json.go b/common/hexutil/json.go index 50db20811..e0ac98f52 100644 --- a/common/hexutil/json.go +++ b/common/hexutil/json.go @@ -23,6 +23,8 @@ import ( "math/big" "reflect" "strconv" + + "github.com/holiman/uint256" ) var ( @@ -30,6 +32,7 @@ var ( bigT = reflect.TypeOf((*Big)(nil)) uintT = reflect.TypeOf(Uint(0)) uint64T = reflect.TypeOf(Uint64(0)) + u256T = reflect.TypeOf((*uint256.Int)(nil)) ) // Bytes marshals/unmarshals as a JSON string with 0x prefix. @@ -225,6 +228,48 @@ func (b *Big) UnmarshalGraphQL(input interface{}) error { return err } +// U256 marshals/unmarshals as a JSON string with 0x prefix. +// The zero value marshals as "0x0". +type U256 uint256.Int + +// MarshalText implements encoding.TextMarshaler +func (b U256) MarshalText() ([]byte, error) { + u256 := (*uint256.Int)(&b) + return []byte(u256.Hex()), nil +} + +// UnmarshalJSON implements json.Unmarshaler. +func (b *U256) UnmarshalJSON(input []byte) error { + // The uint256.Int.UnmarshalJSON method accepts "dec", "0xhex"; we must be + // more strict, hence we check string and invoke SetFromHex directly. + if !isString(input) { + return errNonString(u256T) + } + // The hex decoder needs to accept empty string ("") as '0', which uint256.Int + // would reject. + if len(input) == 2 { + (*uint256.Int)(b).Clear() + return nil + } + err := (*uint256.Int)(b).SetFromHex(string(input[1 : len(input)-1])) + if err != nil { + return &json.UnmarshalTypeError{Value: err.Error(), Type: u256T} + } + return nil +} + +// UnmarshalText implements encoding.TextUnmarshaler +func (b *U256) UnmarshalText(input []byte) error { + // The uint256.Int.UnmarshalText method accepts "dec", "0xhex"; we must be + // more strict, hence we check string and invoke SetFromHex directly. + return (*uint256.Int)(b).SetFromHex(string(input)) +} + +// String returns the hex encoding of b. +func (b *U256) String() string { + return (*uint256.Int)(b).Hex() +} + // Uint64 marshals/unmarshals as a JSON string with 0x prefix. // The zero value marshals as "0x0". type Uint64 uint64 diff --git a/common/hexutil/json_test.go b/common/hexutil/json_test.go index ed7d6fad1..7cca30095 100644 --- a/common/hexutil/json_test.go +++ b/common/hexutil/json_test.go @@ -23,6 +23,8 @@ import ( "errors" "math/big" "testing" + + "github.com/holiman/uint256" ) func checkError(t *testing.T, input string, got, want error) bool { @@ -176,6 +178,64 @@ func TestUnmarshalBig(t *testing.T) { } } +var unmarshalU256Tests = []unmarshalTest{ + // invalid encoding + {input: "", wantErr: errJSONEOF}, + {input: "null", wantErr: errNonString(u256T)}, + {input: "10", wantErr: errNonString(u256T)}, + {input: `"0"`, wantErr: wrapTypeError(ErrMissingPrefix, u256T)}, + {input: `"0x"`, wantErr: wrapTypeError(ErrEmptyNumber, u256T)}, + {input: `"0x01"`, wantErr: wrapTypeError(ErrLeadingZero, u256T)}, + {input: `"0xx"`, wantErr: wrapTypeError(ErrSyntax, u256T)}, + {input: `"0x1zz01"`, wantErr: wrapTypeError(ErrSyntax, u256T)}, + { + input: `"0x10000000000000000000000000000000000000000000000000000000000000000"`, + wantErr: wrapTypeError(ErrBig256Range, u256T), + }, + + // valid encoding + {input: `""`, want: big.NewInt(0)}, + {input: `"0x0"`, want: big.NewInt(0)}, + {input: `"0x2"`, want: big.NewInt(0x2)}, + {input: `"0x2F2"`, want: big.NewInt(0x2f2)}, + {input: `"0X2F2"`, want: big.NewInt(0x2f2)}, + {input: `"0x1122aaff"`, want: big.NewInt(0x1122aaff)}, + {input: `"0xbBb"`, want: big.NewInt(0xbbb)}, + {input: `"0xfffffffff"`, want: big.NewInt(0xfffffffff)}, + { + input: `"0x112233445566778899aabbccddeeff"`, + want: referenceBig("112233445566778899aabbccddeeff"), + }, + { + input: `"0xffffffffffffffffffffffffffffffffffff"`, + want: referenceBig("ffffffffffffffffffffffffffffffffffff"), + }, + { + input: `"0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"`, + want: referenceBig("ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"), + }, +} + +func TestUnmarshalU256(t *testing.T) { + for _, test := range unmarshalU256Tests { + var v U256 + err := json.Unmarshal([]byte(test.input), &v) + if !checkError(t, test.input, err, test.wantErr) { + continue + } + if test.want == nil { + continue + } + want := new(uint256.Int) + want.SetFromBig(test.want.(*big.Int)) + have := (*uint256.Int)(&v) + if want.Cmp(have) != 0 { + t.Errorf("input %s: value mismatch: have %x, want %x", test.input, have, want) + continue + } + } +} + func BenchmarkUnmarshalBig(b *testing.B) { input := []byte(`"0x123456789abcdef123456789abcdef"`) for i := 0; i < b.N; i++ { diff --git a/eth/tracers/logger/gen_structlog.go b/eth/tracers/logger/gen_structlog.go index df06a9ee6..b406cb344 100644 --- a/eth/tracers/logger/gen_structlog.go +++ b/eth/tracers/logger/gen_structlog.go @@ -23,7 +23,7 @@ func (s StructLog) MarshalJSON() ([]byte, error) { GasCost math.HexOrDecimal64 `json:"gasCost"` Memory hexutil.Bytes `json:"memory,omitempty"` MemorySize int `json:"memSize"` - Stack []uint256.Int `json:"stack"` + Stack []hexutil.U256 `json:"stack"` ReturnData hexutil.Bytes `json:"returnData,omitempty"` Storage map[common.Hash]common.Hash `json:"-"` Depth int `json:"depth"` @@ -39,7 +39,12 @@ func (s StructLog) MarshalJSON() ([]byte, error) { enc.GasCost = math.HexOrDecimal64(s.GasCost) enc.Memory = s.Memory enc.MemorySize = s.MemorySize - enc.Stack = s.Stack + if s.Stack != nil { + enc.Stack = make([]hexutil.U256, len(s.Stack)) + for k, v := range s.Stack { + enc.Stack[k] = hexutil.U256(v) + } + } enc.ReturnData = s.ReturnData enc.Storage = s.Storage enc.Depth = s.Depth @@ -59,7 +64,7 @@ func (s *StructLog) UnmarshalJSON(input []byte) error { GasCost *math.HexOrDecimal64 `json:"gasCost"` Memory *hexutil.Bytes `json:"memory,omitempty"` MemorySize *int `json:"memSize"` - Stack []uint256.Int `json:"stack"` + Stack []hexutil.U256 `json:"stack"` ReturnData *hexutil.Bytes `json:"returnData,omitempty"` Storage map[common.Hash]common.Hash `json:"-"` Depth *int `json:"depth"` @@ -89,7 +94,10 @@ func (s *StructLog) UnmarshalJSON(input []byte) error { s.MemorySize = *dec.MemorySize } if dec.Stack != nil { - s.Stack = dec.Stack + s.Stack = make([]uint256.Int, len(dec.Stack)) + for k, v := range dec.Stack { + s.Stack[k] = uint256.Int(v) + } } if dec.ReturnData != nil { s.ReturnData = *dec.ReturnData diff --git a/eth/tracers/logger/logger.go b/eth/tracers/logger/logger.go index 480876dd4..5fad1cdb7 100644 --- a/eth/tracers/logger/logger.go +++ b/eth/tracers/logger/logger.go @@ -83,6 +83,7 @@ type structLogMarshaling struct { GasCost math.HexOrDecimal64 Memory hexutil.Bytes ReturnData hexutil.Bytes + Stack []hexutil.U256 OpName string `json:"opName"` // adds call to OpName() in MarshalJSON ErrorString string `json:"error,omitempty"` // adds call to ErrorString() in MarshalJSON } From 8159207df2f8736249c8a1be657689420108f5e6 Mon Sep 17 00:00:00 2001 From: Tran Tien Duc Date: Wed, 19 Mar 2025 16:14:18 +0700 Subject: [PATCH 2/6] pick up ethereum/go-ethereum#30926 https://github.com/ethereum/go-ethereum/pull/30926 --- core/types/gen_authorization.go | 16 ++++++++-------- core/types/setcode_tx.go | 2 ++ 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/core/types/gen_authorization.go b/core/types/gen_authorization.go index b598b64ff..cc8fe138e 100644 --- a/core/types/gen_authorization.go +++ b/core/types/gen_authorization.go @@ -20,16 +20,16 @@ func (a Authorization) MarshalJSON() ([]byte, error) { Address common.Address `json:"address" gencodec:"required"` Nonce hexutil.Uint64 `json:"nonce" gencodec:"required"` V hexutil.Uint64 `json:"v" gencodec:"required"` - R uint256.Int `json:"r" gencodec:"required"` - S uint256.Int `json:"s" gencodec:"required"` + R hexutil.U256 `json:"r" gencodec:"required"` + S hexutil.U256 `json:"s" gencodec:"required"` } var enc Authorization enc.ChainID = hexutil.Uint64(a.ChainID) enc.Address = a.Address enc.Nonce = hexutil.Uint64(a.Nonce) enc.V = hexutil.Uint64(a.V) - enc.R = a.R - enc.S = a.S + enc.R = hexutil.U256(a.R) + enc.S = hexutil.U256(a.S) return json.Marshal(&enc) } @@ -40,8 +40,8 @@ func (a *Authorization) UnmarshalJSON(input []byte) error { Address *common.Address `json:"address" gencodec:"required"` Nonce *hexutil.Uint64 `json:"nonce" gencodec:"required"` V *hexutil.Uint64 `json:"v" gencodec:"required"` - R *uint256.Int `json:"r" gencodec:"required"` - S *uint256.Int `json:"s" gencodec:"required"` + R *hexutil.U256 `json:"r" gencodec:"required"` + S *hexutil.U256 `json:"s" gencodec:"required"` } var dec Authorization if err := json.Unmarshal(input, &dec); err != nil { @@ -66,10 +66,10 @@ func (a *Authorization) UnmarshalJSON(input []byte) error { if dec.R == nil { return errors.New("missing required field 'r' for Authorization") } - a.R = *dec.R + a.R = uint256.Int(*dec.R) if dec.S == nil { return errors.New("missing required field 's' for Authorization") } - a.S = *dec.S + a.S = uint256.Int(*dec.S) return nil } diff --git a/core/types/setcode_tx.go b/core/types/setcode_tx.go index fcfdc2f00..30355b674 100644 --- a/core/types/setcode_tx.go +++ b/core/types/setcode_tx.go @@ -83,6 +83,8 @@ type authorizationMarshaling struct { ChainID hexutil.Uint64 Nonce hexutil.Uint64 V hexutil.Uint64 + R hexutil.U256 + S hexutil.U256 } // SignAuth signs the provided authorization. From fe39201a57471542e6f0eb6a937daaf31fb44eff Mon Sep 17 00:00:00 2001 From: Tran Tien Duc Date: Wed, 19 Mar 2025 16:31:49 +0700 Subject: [PATCH 3/6] pick up ethereum/go-ethereum#30933 https://github.com/ethereum/go-ethereum/pull/30933 --- accounts/abi/bind/backends/simulated.go | 24 +++++------ core/blockchain_test.go | 10 ++--- core/state_processor_test.go | 2 +- core/state_transition.go | 8 ++-- core/types/gen_authorization.go | 48 ++++++++++----------- core/types/setcode_tx.go | 36 +++++++--------- core/types/transaction.go | 12 +++--- core/types/transaction_marshalling.go | 28 ++++++------- internal/ethapi/api.go | 56 ++++++++++++------------- internal/ethapi/transaction_args.go | 2 +- tests/state_test_util.go | 6 +-- 11 files changed, 113 insertions(+), 119 deletions(-) diff --git a/accounts/abi/bind/backends/simulated.go b/accounts/abi/bind/backends/simulated.go index 05648a096..4aec7734d 100644 --- a/accounts/abi/bind/backends/simulated.go +++ b/accounts/abi/bind/backends/simulated.go @@ -801,18 +801,18 @@ type callMsg struct { ethereum.CallMsg } -func (m callMsg) From() common.Address { return m.CallMsg.From } -func (m callMsg) Nonce() uint64 { return 0 } -func (m callMsg) IsFake() bool { return true } -func (m callMsg) To() *common.Address { return m.CallMsg.To } -func (m callMsg) GasPrice() *big.Int { return m.CallMsg.GasPrice } -func (m callMsg) GasFeeCap() *big.Int { return m.CallMsg.GasFeeCap } -func (m callMsg) GasTipCap() *big.Int { return m.CallMsg.GasTipCap } -func (m callMsg) Gas() uint64 { return m.CallMsg.Gas } -func (m callMsg) Value() *big.Int { return m.CallMsg.Value } -func (m callMsg) Data() []byte { return m.CallMsg.Data } -func (m callMsg) AccessList() types.AccessList { return m.CallMsg.AccessList } -func (m callMsg) AuthList() []types.Authorization { return nil } +func (m callMsg) From() common.Address { return m.CallMsg.From } +func (m callMsg) Nonce() uint64 { return 0 } +func (m callMsg) IsFake() bool { return true } +func (m callMsg) To() *common.Address { return m.CallMsg.To } +func (m callMsg) GasPrice() *big.Int { return m.CallMsg.GasPrice } +func (m callMsg) GasFeeCap() *big.Int { return m.CallMsg.GasFeeCap } +func (m callMsg) GasTipCap() *big.Int { return m.CallMsg.GasTipCap } +func (m callMsg) Gas() uint64 { return m.CallMsg.Gas } +func (m callMsg) Value() *big.Int { return m.CallMsg.Value } +func (m callMsg) Data() []byte { return m.CallMsg.Data } +func (m callMsg) AccessList() types.AccessList { return m.CallMsg.AccessList } +func (m callMsg) AuthList() []types.SetCodeAuthorization { return nil } // FIXME: support sponsored transaction in callMsg func (m callMsg) Payer() common.Address { return m.CallMsg.From } diff --git a/core/blockchain_test.go b/core/blockchain_test.go index a9fce8c03..926145cf0 100644 --- a/core/blockchain_test.go +++ b/core/blockchain_test.go @@ -4780,16 +4780,16 @@ func TestEIP7702(t *testing.T) { // 1. tx -> addr1 which is delegated to 0xaaaa // 2. addr1:0xaaaa calls into addr2:0xbbbb // 3. addr2:0xbbbb writes to storage - auth1, _ := types.SignAuth(types.Authorization{ + auth1, _ := types.SignSetCode(key1, types.SetCodeAuthorization{ ChainID: gspec.Config.ChainID.Uint64(), Address: aa, Nonce: 1, - }, key1) - auth2, _ := types.SignAuth(types.Authorization{ + }) + auth2, _ := types.SignSetCode(key2, types.SetCodeAuthorization{ ChainID: 0, Address: bb, Nonce: 0, - }, key2) + }) _, blocks, _ := GenerateChainWithGenesis(gspec, engine, 1, func(i int, b *BlockGen) { b.SetCoinbase(aa) @@ -4800,7 +4800,7 @@ func TestEIP7702(t *testing.T) { Gas: 500000, GasFeeCap: uint256.MustFromBig(newGwei(5)), GasTipCap: uint256.NewInt(2), - AuthList: []types.Authorization{auth1, auth2}, + AuthList: []types.SetCodeAuthorization{auth1, auth2}, } tx := types.MustSignNewTx(key1, signer, txdata) b.AddTx(tx) diff --git a/core/state_processor_test.go b/core/state_processor_test.go index caeaf3fe8..983e7b15d 100644 --- a/core/state_processor_test.go +++ b/core/state_processor_test.go @@ -94,7 +94,7 @@ func TestStateProcessorErrors(t *testing.T) { }), signer, key1) return tx } - var mkSetCodeTx = func(nonce uint64, to common.Address, gasLimit uint64, gasTipCap, gasFeeCap *big.Int, authlist []types.Authorization) *types.Transaction { + var mkSetCodeTx = func(nonce uint64, to common.Address, gasLimit uint64, gasTipCap, gasFeeCap *big.Int, authlist []types.SetCodeAuthorization) *types.Transaction { tx, err := types.SignTx(types.NewTx(&types.SetCodeTx{ Nonce: nonce, GasTipCap: uint256.MustFromBig(gasTipCap), diff --git a/core/state_transition.go b/core/state_transition.go index ad69519b0..7c22df768 100644 --- a/core/state_transition.go +++ b/core/state_transition.go @@ -82,7 +82,7 @@ type Message interface { IsFake() bool Data() []byte AccessList() types.AccessList - AuthList() []types.Authorization + AuthList() []types.SetCodeAuthorization // In legacy transaction, this is the same as From. // In sponsored transaction, this is the payer's @@ -131,7 +131,7 @@ func (result *ExecutionResult) Revert() []byte { } // IntrinsicGas computes the 'intrinsic gas' for a message with the given data. -func IntrinsicGas(data []byte, accessList types.AccessList, authList []types.Authorization, isContractCreation, isHomestead, isEIP2028, isEIP3860 bool) (uint64, error) { +func IntrinsicGas(data []byte, accessList types.AccessList, authList []types.SetCodeAuthorization, isContractCreation, isHomestead, isEIP2028, isEIP3860 bool) (uint64, error) { // Set the starting gas for the raw transaction var gas uint64 if isContractCreation && isHomestead { @@ -556,7 +556,7 @@ func (st *StateTransition) TransitionDb() (*ExecutionResult, error) { } // validateAuthorization validates an EIP-7702 authorization against the state. -func (st *StateTransition) validateAuthorization(auth *types.Authorization) (authority common.Address, err error) { +func (st *StateTransition) validateAuthorization(auth *types.SetCodeAuthorization) (authority common.Address, err error) { // Verify chain ID is 0 or equal to current chain ID. if auth.ChainID != 0 && st.evm.ChainConfig().ChainID.Uint64() != auth.ChainID { return authority, ErrAuthorizationWrongChainID @@ -587,7 +587,7 @@ func (st *StateTransition) validateAuthorization(auth *types.Authorization) (aut } // applyAuthorization applies an EIP-7702 code delegation to the state. -func (st *StateTransition) applyAuthorization(auth *types.Authorization) error { +func (st *StateTransition) applyAuthorization(auth *types.SetCodeAuthorization) error { authority, err := st.validateAuthorization(auth) if err != nil { return err diff --git a/core/types/gen_authorization.go b/core/types/gen_authorization.go index cc8fe138e..c9ab3590b 100644 --- a/core/types/gen_authorization.go +++ b/core/types/gen_authorization.go @@ -14,8 +14,8 @@ import ( var _ = (*authorizationMarshaling)(nil) // MarshalJSON marshals as JSON. -func (a Authorization) MarshalJSON() ([]byte, error) { - type Authorization struct { +func (s SetCodeAuthorization) MarshalJSON() ([]byte, error) { + type SetCodeAuthorization struct { ChainID hexutil.Uint64 `json:"chainId" gencodec:"required"` Address common.Address `json:"address" gencodec:"required"` Nonce hexutil.Uint64 `json:"nonce" gencodec:"required"` @@ -23,19 +23,19 @@ func (a Authorization) MarshalJSON() ([]byte, error) { R hexutil.U256 `json:"r" gencodec:"required"` S hexutil.U256 `json:"s" gencodec:"required"` } - var enc Authorization - enc.ChainID = hexutil.Uint64(a.ChainID) - enc.Address = a.Address - enc.Nonce = hexutil.Uint64(a.Nonce) - enc.V = hexutil.Uint64(a.V) - enc.R = hexutil.U256(a.R) - enc.S = hexutil.U256(a.S) + var enc SetCodeAuthorization + enc.ChainID = hexutil.Uint64(s.ChainID) + enc.Address = s.Address + enc.Nonce = hexutil.Uint64(s.Nonce) + enc.V = hexutil.Uint64(s.V) + enc.R = hexutil.U256(s.R) + enc.S = hexutil.U256(s.S) return json.Marshal(&enc) } // UnmarshalJSON unmarshals from JSON. -func (a *Authorization) UnmarshalJSON(input []byte) error { - type Authorization struct { +func (s *SetCodeAuthorization) UnmarshalJSON(input []byte) error { + type SetCodeAuthorization struct { ChainID *hexutil.Uint64 `json:"chainId" gencodec:"required"` Address *common.Address `json:"address" gencodec:"required"` Nonce *hexutil.Uint64 `json:"nonce" gencodec:"required"` @@ -43,33 +43,33 @@ func (a *Authorization) UnmarshalJSON(input []byte) error { R *hexutil.U256 `json:"r" gencodec:"required"` S *hexutil.U256 `json:"s" gencodec:"required"` } - var dec Authorization + var dec SetCodeAuthorization if err := json.Unmarshal(input, &dec); err != nil { return err } if dec.ChainID == nil { - return errors.New("missing required field 'chainId' for Authorization") + return errors.New("missing required field 'chainId' for SetCodeAuthorization") } - a.ChainID = uint64(*dec.ChainID) + s.ChainID = uint64(*dec.ChainID) if dec.Address == nil { - return errors.New("missing required field 'address' for Authorization") + return errors.New("missing required field 'address' for SetCodeAuthorization") } - a.Address = *dec.Address + s.Address = *dec.Address if dec.Nonce == nil { - return errors.New("missing required field 'nonce' for Authorization") + return errors.New("missing required field 'nonce' for SetCodeAuthorization") } - a.Nonce = uint64(*dec.Nonce) + s.Nonce = uint64(*dec.Nonce) if dec.V == nil { - return errors.New("missing required field 'v' for Authorization") + return errors.New("missing required field 'v' for SetCodeAuthorization") } - a.V = uint8(*dec.V) + s.V = uint8(*dec.V) if dec.R == nil { - return errors.New("missing required field 'r' for Authorization") + return errors.New("missing required field 'r' for SetCodeAuthorization") } - a.R = uint256.Int(*dec.R) + s.R = uint256.Int(*dec.R) if dec.S == nil { - return errors.New("missing required field 's' for Authorization") + return errors.New("missing required field 's' for SetCodeAuthorization") } - a.S = uint256.Int(*dec.S) + s.S = uint256.Int(*dec.S) return nil } diff --git a/core/types/setcode_tx.go b/core/types/setcode_tx.go index 30355b674..7be73e263 100644 --- a/core/types/setcode_tx.go +++ b/core/types/setcode_tx.go @@ -58,7 +58,7 @@ type SetCodeTx struct { Value *uint256.Int Data []byte AccessList AccessList - AuthList []Authorization + AuthList []SetCodeAuthorization // Signature values V *uint256.Int `json:"v" gencodec:"required"` @@ -66,10 +66,10 @@ type SetCodeTx struct { S *uint256.Int `json:"s" gencodec:"required"` } -//go:generate go run github.com/fjl/gencodec -type Authorization -field-override authorizationMarshaling -out gen_authorization.go +//go:generate go run github.com/fjl/gencodec -type SetCodeAuthorization -field-override authorizationMarshaling -out gen_authorization.go -// Authorization is an authorization from an account to deploy code at its address. -type Authorization struct { +// SetCodeAuthorization is an authorization from an account to deploy code at its address. +type SetCodeAuthorization struct { ChainID uint64 `json:"chainId" gencodec:"required"` Address common.Address `json:"address" gencodec:"required"` Nonce uint64 `json:"nonce" gencodec:"required"` @@ -87,31 +87,25 @@ type authorizationMarshaling struct { S hexutil.U256 } -// SignAuth signs the provided authorization. -func SignAuth(auth Authorization, prv *ecdsa.PrivateKey) (Authorization, error) { +// SignSetCode creates a signed the SetCode authorization. +func SignSetCode(prv *ecdsa.PrivateKey, auth SetCodeAuthorization) (SetCodeAuthorization, error) { sighash := auth.sigHash() sig, err := crypto.Sign(sighash[:], prv) if err != nil { - return Authorization{}, err + return SetCodeAuthorization{}, err } - return auth.withSignature(sig), nil -} - -// withSignature updates the signature of an Authorization to be equal the -// decoded signature provided in sig. -func (a *Authorization) withSignature(sig []byte) Authorization { r, s, _ := decodeSignature(sig) - return Authorization{ - ChainID: a.ChainID, - Address: a.Address, - Nonce: a.Nonce, + return SetCodeAuthorization{ + ChainID: auth.ChainID, + Address: auth.Address, + Nonce: auth.Nonce, V: sig[64], R: *uint256.MustFromBig(r), S: *uint256.MustFromBig(s), - } + }, nil } -func (a *Authorization) sigHash() common.Hash { +func (a *SetCodeAuthorization) sigHash() common.Hash { return prefixedRlpHash(0x05, []any{ a.ChainID, a.Address, @@ -120,7 +114,7 @@ func (a *Authorization) sigHash() common.Hash { } // Authority recovers the the authorizing account of an authorization. -func (a *Authorization) Authority() (common.Address, error) { +func (a *SetCodeAuthorization) Authority() (common.Address, error) { sighash := a.sigHash() if !crypto.ValidateSignatureValues(a.V, a.R.ToBig(), a.S.ToBig(), true) { return common.Address{}, ErrInvalidSig @@ -152,7 +146,7 @@ func (tx *SetCodeTx) copy() TxData { Gas: tx.Gas, // These are copied below. AccessList: make(AccessList, len(tx.AccessList)), - AuthList: make([]Authorization, len(tx.AuthList)), + AuthList: make([]SetCodeAuthorization, len(tx.AuthList)), Value: new(uint256.Int), ChainID: tx.ChainID, GasTipCap: new(uint256.Int), diff --git a/core/types/transaction.go b/core/types/transaction.go index 75c003233..780efb5da 100644 --- a/core/types/transaction.go +++ b/core/types/transaction.go @@ -463,7 +463,7 @@ func (tx *Transaction) WithBlobTxSidecar(sideCar *BlobTxSidecar) *Transaction { } // AuthList returns the authorizations list of the transaction. -func (tx *Transaction) AuthList() []Authorization { +func (tx *Transaction) AuthList() []SetCodeAuthorization { setcodetx, ok := tx.inner.(*SetCodeTx) if !ok { return nil @@ -611,7 +611,7 @@ type Message struct { expiredTime uint64 blobGasFeeCap *big.Int blobHashes []common.Hash - authList []Authorization + authList []SetCodeAuthorization } // Create a new message with payer is the same as from, expired time = 0 @@ -627,7 +627,7 @@ func NewMessage( isFake bool, blobFeeCap *big.Int, blobHashes []common.Hash, - authList []Authorization, + authList []SetCodeAuthorization, ) Message { return Message{ from: from, @@ -708,9 +708,9 @@ func (m Message) IsFake() bool { return m.isFake } func (m Message) Payer() common.Address { return m.payer } func (m Message) ExpiredTime() uint64 { return m.expiredTime } -func (m Message) BlobHashes() []common.Hash { return m.blobHashes } -func (m Message) BlobGasFeeCap() *big.Int { return m.blobGasFeeCap } -func (m Message) AuthList() []Authorization { return m.authList } +func (m Message) BlobHashes() []common.Hash { return m.blobHashes } +func (m Message) BlobGasFeeCap() *big.Int { return m.blobGasFeeCap } +func (m Message) AuthList() []SetCodeAuthorization { return m.authList } // copyAddressPtr copies an address. func copyAddressPtr(a *common.Address) *common.Address { diff --git a/core/types/transaction_marshalling.go b/core/types/transaction_marshalling.go index 46f802fe3..43c9c60be 100644 --- a/core/types/transaction_marshalling.go +++ b/core/types/transaction_marshalling.go @@ -32,20 +32,20 @@ type txJSON struct { Type hexutil.Uint64 `json:"type"` // Common transaction fields: - Nonce *hexutil.Uint64 `json:"nonce"` - GasPrice *hexutil.Big `json:"gasPrice"` - MaxPriorityFeePerGas *hexutil.Big `json:"maxPriorityFeePerGas"` - MaxFeePerGas *hexutil.Big `json:"maxFeePerGas"` - MaxFeePerBlobGas *hexutil.Big `json:"maxFeePerBlobGas,omitempty"` - Gas *hexutil.Uint64 `json:"gas"` - Value *hexutil.Big `json:"value"` - Data *hexutil.Bytes `json:"input"` - V *hexutil.Big `json:"v"` - R *hexutil.Big `json:"r"` - S *hexutil.Big `json:"s"` - To *common.Address `json:"to"` - AuthorizationList []Authorization `json:"authorizationList,omitempty"` - YParity *hexutil.Uint64 `json:"yParity,omitempty"` + Nonce *hexutil.Uint64 `json:"nonce"` + GasPrice *hexutil.Big `json:"gasPrice"` + MaxPriorityFeePerGas *hexutil.Big `json:"maxPriorityFeePerGas"` + MaxFeePerGas *hexutil.Big `json:"maxFeePerGas"` + MaxFeePerBlobGas *hexutil.Big `json:"maxFeePerBlobGas,omitempty"` + Gas *hexutil.Uint64 `json:"gas"` + Value *hexutil.Big `json:"value"` + Data *hexutil.Bytes `json:"input"` + V *hexutil.Big `json:"v"` + R *hexutil.Big `json:"r"` + S *hexutil.Big `json:"s"` + To *common.Address `json:"to"` + AuthorizationList []SetCodeAuthorization `json:"authorizationList,omitempty"` + YParity *hexutil.Uint64 `json:"yParity,omitempty"` // Access list transaction fields: ChainID *hexutil.Big `json:"chainId,omitempty"` diff --git a/internal/ethapi/api.go b/internal/ethapi/api.go index b2ca686af..5033137ec 100644 --- a/internal/ethapi/api.go +++ b/internal/ethapi/api.go @@ -1366,34 +1366,34 @@ func (s *PublicBlockChainAPI) rpcMarshalBlock(ctx context.Context, b *types.Bloc // RPCTransaction represents a transaction that will serialize to the RPC representation of a transaction type RPCTransaction struct { - BlockHash *common.Hash `json:"blockHash"` - BlockNumber *hexutil.Big `json:"blockNumber"` - From common.Address `json:"from"` - Gas hexutil.Uint64 `json:"gas"` - GasPrice *hexutil.Big `json:"gasPrice"` - GasFeeCap *hexutil.Big `json:"maxFeePerGas,omitempty"` - GasTipCap *hexutil.Big `json:"maxPriorityFeePerGas,omitempty"` - MaxFeePerBlobGas *hexutil.Big `json:"maxFeePerBlobGas,omitempty"` - Hash common.Hash `json:"hash"` - Input hexutil.Bytes `json:"input"` - Nonce hexutil.Uint64 `json:"nonce"` - To *common.Address `json:"to"` - TransactionIndex *hexutil.Uint64 `json:"transactionIndex"` - Value *hexutil.Big `json:"value"` - Type hexutil.Uint64 `json:"type"` - Accesses *types.AccessList `json:"accessList,omitempty"` - ChainID *hexutil.Big `json:"chainId,omitempty"` - BlobVersionedHashes []common.Hash `json:"blobVersionedHashes,omitempty"` - AuthorizationList []types.Authorization `json:"authorizationList,omitempty"` - V *hexutil.Big `json:"v"` - R *hexutil.Big `json:"r"` - S *hexutil.Big `json:"s"` - YParity *hexutil.Uint64 `json:"yParity,omitempty"` - Payer *common.Address `json:"payer,omitempty"` - ExpiredTime *hexutil.Uint64 `json:"expiredTime,omitempty"` - PayerV *hexutil.Big `json:"payerV,omitempty"` - PayerR *hexutil.Big `json:"payerR,omitempty"` - PayerS *hexutil.Big `json:"payerS,omitempty"` + BlockHash *common.Hash `json:"blockHash"` + BlockNumber *hexutil.Big `json:"blockNumber"` + From common.Address `json:"from"` + Gas hexutil.Uint64 `json:"gas"` + GasPrice *hexutil.Big `json:"gasPrice"` + GasFeeCap *hexutil.Big `json:"maxFeePerGas,omitempty"` + GasTipCap *hexutil.Big `json:"maxPriorityFeePerGas,omitempty"` + MaxFeePerBlobGas *hexutil.Big `json:"maxFeePerBlobGas,omitempty"` + Hash common.Hash `json:"hash"` + Input hexutil.Bytes `json:"input"` + Nonce hexutil.Uint64 `json:"nonce"` + To *common.Address `json:"to"` + TransactionIndex *hexutil.Uint64 `json:"transactionIndex"` + Value *hexutil.Big `json:"value"` + Type hexutil.Uint64 `json:"type"` + Accesses *types.AccessList `json:"accessList,omitempty"` + ChainID *hexutil.Big `json:"chainId,omitempty"` + BlobVersionedHashes []common.Hash `json:"blobVersionedHashes,omitempty"` + AuthorizationList []types.SetCodeAuthorization `json:"authorizationList,omitempty"` + V *hexutil.Big `json:"v"` + R *hexutil.Big `json:"r"` + S *hexutil.Big `json:"s"` + YParity *hexutil.Uint64 `json:"yParity,omitempty"` + Payer *common.Address `json:"payer,omitempty"` + ExpiredTime *hexutil.Uint64 `json:"expiredTime,omitempty"` + PayerV *hexutil.Big `json:"payerV,omitempty"` + PayerR *hexutil.Big `json:"payerR,omitempty"` + PayerS *hexutil.Big `json:"payerS,omitempty"` } // newRPCTransaction returns a transaction that will serialize to the RPC diff --git a/internal/ethapi/transaction_args.go b/internal/ethapi/transaction_args.go index bae02e669..9ceee31ce 100644 --- a/internal/ethapi/transaction_args.go +++ b/internal/ethapi/transaction_args.go @@ -67,7 +67,7 @@ type TransactionArgs struct { Proofs []kzg4844.Proof `json:"proofs"` // For SetCodeTxType - AuthorizationList []types.Authorization `json:"authorizationList"` + AuthorizationList []types.SetCodeAuthorization `json:"authorizationList"` // This configures whether blobs are allowed to be passed. blobSidecarAllowed bool diff --git a/tests/state_test_util.go b/tests/state_test_util.go index ac5b6fa45..e817ec1a1 100644 --- a/tests/state_test_util.go +++ b/tests/state_test_util.go @@ -393,11 +393,11 @@ func (tx *stTransaction) toMessage(ps stPostState, baseFee *big.Int) (core.Messa if gasPrice == nil { return nil, fmt.Errorf("no gas price provided") } - var authList []types.Authorization + var authList []types.SetCodeAuthorization if tx.AuthorizationList != nil { - authList = make([]types.Authorization, len(tx.AuthorizationList)) + authList = make([]types.SetCodeAuthorization, len(tx.AuthorizationList)) for i, auth := range tx.AuthorizationList { - authList[i] = types.Authorization{ + authList[i] = types.SetCodeAuthorization{ ChainID: auth.ChainID.Uint64(), Address: auth.Address, Nonce: auth.Nonce, From 9ffbaf9f0ffa021d65217a307d04a48baa1f4215 Mon Sep 17 00:00:00 2001 From: Felix Lange Date: Wed, 18 Dec 2024 19:46:15 +0100 Subject: [PATCH 4/6] core/types: rename SetCodeAuthorization 'v' to 'yParity' The API spec requires the name yParity. --- core/types/gen_authorization.go | 6 +++--- core/types/setcode_tx.go | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/core/types/gen_authorization.go b/core/types/gen_authorization.go index c9ab3590b..be5467c50 100644 --- a/core/types/gen_authorization.go +++ b/core/types/gen_authorization.go @@ -19,7 +19,7 @@ func (s SetCodeAuthorization) MarshalJSON() ([]byte, error) { ChainID hexutil.Uint64 `json:"chainId" gencodec:"required"` Address common.Address `json:"address" gencodec:"required"` Nonce hexutil.Uint64 `json:"nonce" gencodec:"required"` - V hexutil.Uint64 `json:"v" gencodec:"required"` + V hexutil.Uint64 `json:"yParity" gencodec:"required"` R hexutil.U256 `json:"r" gencodec:"required"` S hexutil.U256 `json:"s" gencodec:"required"` } @@ -39,7 +39,7 @@ func (s *SetCodeAuthorization) UnmarshalJSON(input []byte) error { ChainID *hexutil.Uint64 `json:"chainId" gencodec:"required"` Address *common.Address `json:"address" gencodec:"required"` Nonce *hexutil.Uint64 `json:"nonce" gencodec:"required"` - V *hexutil.Uint64 `json:"v" gencodec:"required"` + V *hexutil.Uint64 `json:"yParity" gencodec:"required"` R *hexutil.U256 `json:"r" gencodec:"required"` S *hexutil.U256 `json:"s" gencodec:"required"` } @@ -60,7 +60,7 @@ func (s *SetCodeAuthorization) UnmarshalJSON(input []byte) error { } s.Nonce = uint64(*dec.Nonce) if dec.V == nil { - return errors.New("missing required field 'v' for SetCodeAuthorization") + return errors.New("missing required field 'yParity' for SetCodeAuthorization") } s.V = uint8(*dec.V) if dec.R == nil { diff --git a/core/types/setcode_tx.go b/core/types/setcode_tx.go index 7be73e263..861fb7e5c 100644 --- a/core/types/setcode_tx.go +++ b/core/types/setcode_tx.go @@ -73,7 +73,7 @@ type SetCodeAuthorization struct { ChainID uint64 `json:"chainId" gencodec:"required"` Address common.Address `json:"address" gencodec:"required"` Nonce uint64 `json:"nonce" gencodec:"required"` - V uint8 `json:"v" gencodec:"required"` + V uint8 `json:"yParity" gencodec:"required"` R uint256.Int `json:"r" gencodec:"required"` S uint256.Int `json:"s" gencodec:"required"` } From 512e69e2bc13e7da0b962e778b06d9c809be9db4 Mon Sep 17 00:00:00 2001 From: Tran Tien Duc Date: Wed, 19 Mar 2025 16:45:43 +0700 Subject: [PATCH 5/6] pick up ethereum/go-ethereum#30935 https://github.com/ethereum/go-ethereum/pull/30935 --- accounts/abi/bind/backends/simulated.go | 24 ++++++++++++------------ core/state_transition.go | 12 ++++++------ core/txpool/validation.go | 2 +- core/types/transaction.go | 12 ++++++------ core/types/transaction_signing.go | 2 +- eth/gasestimator/gasestimator.go | 2 +- internal/ethapi/api.go | 2 +- tests/transaction_test_util.go | 2 +- 8 files changed, 29 insertions(+), 29 deletions(-) diff --git a/accounts/abi/bind/backends/simulated.go b/accounts/abi/bind/backends/simulated.go index 4aec7734d..5be382748 100644 --- a/accounts/abi/bind/backends/simulated.go +++ b/accounts/abi/bind/backends/simulated.go @@ -801,18 +801,18 @@ type callMsg struct { ethereum.CallMsg } -func (m callMsg) From() common.Address { return m.CallMsg.From } -func (m callMsg) Nonce() uint64 { return 0 } -func (m callMsg) IsFake() bool { return true } -func (m callMsg) To() *common.Address { return m.CallMsg.To } -func (m callMsg) GasPrice() *big.Int { return m.CallMsg.GasPrice } -func (m callMsg) GasFeeCap() *big.Int { return m.CallMsg.GasFeeCap } -func (m callMsg) GasTipCap() *big.Int { return m.CallMsg.GasTipCap } -func (m callMsg) Gas() uint64 { return m.CallMsg.Gas } -func (m callMsg) Value() *big.Int { return m.CallMsg.Value } -func (m callMsg) Data() []byte { return m.CallMsg.Data } -func (m callMsg) AccessList() types.AccessList { return m.CallMsg.AccessList } -func (m callMsg) AuthList() []types.SetCodeAuthorization { return nil } +func (m callMsg) From() common.Address { return m.CallMsg.From } +func (m callMsg) Nonce() uint64 { return 0 } +func (m callMsg) IsFake() bool { return true } +func (m callMsg) To() *common.Address { return m.CallMsg.To } +func (m callMsg) GasPrice() *big.Int { return m.CallMsg.GasPrice } +func (m callMsg) GasFeeCap() *big.Int { return m.CallMsg.GasFeeCap } +func (m callMsg) GasTipCap() *big.Int { return m.CallMsg.GasTipCap } +func (m callMsg) Gas() uint64 { return m.CallMsg.Gas } +func (m callMsg) Value() *big.Int { return m.CallMsg.Value } +func (m callMsg) Data() []byte { return m.CallMsg.Data } +func (m callMsg) AccessList() types.AccessList { return m.CallMsg.AccessList } +func (m callMsg) SetCodeAuthorizations() []types.SetCodeAuthorization { return nil } // FIXME: support sponsored transaction in callMsg func (m callMsg) Payer() common.Address { return m.CallMsg.From } diff --git a/core/state_transition.go b/core/state_transition.go index 7c22df768..1705c50b3 100644 --- a/core/state_transition.go +++ b/core/state_transition.go @@ -82,7 +82,7 @@ type Message interface { IsFake() bool Data() []byte AccessList() types.AccessList - AuthList() []types.SetCodeAuthorization + SetCodeAuthorizations() []types.SetCodeAuthorization // In legacy transaction, this is the same as From. // In sponsored transaction, this is the payer's @@ -397,11 +397,11 @@ func (st *StateTransition) preCheck() error { } // Check that EIP-7702 authorization list signatures are well formed. - if msg.AuthList() != nil { + if msg.SetCodeAuthorizations() != nil { if msg.To() == nil { return fmt.Errorf("%w (sender %v)", ErrSetCodeTxCreate, msg.From()) } - if len(msg.AuthList()) == 0 { + if len(msg.SetCodeAuthorizations()) == 0 { return fmt.Errorf("%w (sender %v)", ErrEmptyAuthList, msg.From()) } } @@ -458,7 +458,7 @@ func (st *StateTransition) TransitionDb() (*ExecutionResult, error) { // Check clauses 4-5, subtract intrinsic gas if everything is correct if !st.evm.Config.IsSystemTransaction { - gas, err := IntrinsicGas(st.data, st.msg.AccessList(), st.msg.AuthList(), contractCreation, rules.IsHomestead, rules.IsIstanbul, rules.IsShanghai) + gas, err := IntrinsicGas(st.data, st.msg.AccessList(), st.msg.SetCodeAuthorizations(), contractCreation, rules.IsHomestead, rules.IsIstanbul, rules.IsShanghai) if err != nil { return nil, err } @@ -494,8 +494,8 @@ func (st *StateTransition) TransitionDb() (*ExecutionResult, error) { st.state.SetNonce(msg.From(), st.state.GetNonce(msg.From())+1) // Apply EIP-7702 authorizations. - if msg.AuthList() != nil { - for _, auth := range msg.AuthList() { + if msg.SetCodeAuthorizations() != nil { + for _, auth := range msg.SetCodeAuthorizations() { // Note errors are ignored, we simply skip invalid authorizations here. st.applyAuthorization(&auth) } diff --git a/core/txpool/validation.go b/core/txpool/validation.go index 31c95f579..a18baf0f2 100644 --- a/core/txpool/validation.go +++ b/core/txpool/validation.go @@ -131,7 +131,7 @@ func ValidateTransaction(tx *types.Transaction, head *types.Header, signer types } // Ensure the transaction has more gas than the bare minimum needed to cover // the transaction metadata - intrGas, err := core.IntrinsicGas(tx.Data(), tx.AccessList(), tx.AuthList(), tx.To() == nil, true, opts.Config.IsIstanbul(head.Number), opts.Config.IsShanghai(head.Number)) + intrGas, err := core.IntrinsicGas(tx.Data(), tx.AccessList(), tx.SetCodeAuthorizations(), tx.To() == nil, true, opts.Config.IsIstanbul(head.Number), opts.Config.IsShanghai(head.Number)) if err != nil { return err } diff --git a/core/types/transaction.go b/core/types/transaction.go index 780efb5da..1bd56660e 100644 --- a/core/types/transaction.go +++ b/core/types/transaction.go @@ -462,8 +462,8 @@ func (tx *Transaction) WithBlobTxSidecar(sideCar *BlobTxSidecar) *Transaction { return cpy } -// AuthList returns the authorizations list of the transaction. -func (tx *Transaction) AuthList() []SetCodeAuthorization { +// SetCodeAuthorizations returns the authorizations list of the transaction. +func (tx *Transaction) SetCodeAuthorizations() []SetCodeAuthorization { setcodetx, ok := tx.inner.(*SetCodeTx) if !ok { return nil @@ -665,7 +665,7 @@ func (tx *Transaction) AsMessage(s Signer, baseFee *big.Int) (Message, error) { expiredTime: tx.ExpiredTime(), blobGasFeeCap: tx.BlobGasFeeCap(), blobHashes: tx.BlobHashes(), - authList: tx.AuthList(), + authList: tx.SetCodeAuthorizations(), } // If baseFee provided, set gasPrice to effectiveGasPrice. if baseFee != nil { @@ -708,9 +708,9 @@ func (m Message) IsFake() bool { return m.isFake } func (m Message) Payer() common.Address { return m.payer } func (m Message) ExpiredTime() uint64 { return m.expiredTime } -func (m Message) BlobHashes() []common.Hash { return m.blobHashes } -func (m Message) BlobGasFeeCap() *big.Int { return m.blobGasFeeCap } -func (m Message) AuthList() []SetCodeAuthorization { return m.authList } +func (m Message) BlobHashes() []common.Hash { return m.blobHashes } +func (m Message) BlobGasFeeCap() *big.Int { return m.blobGasFeeCap } +func (m Message) SetCodeAuthorizations() []SetCodeAuthorization { return m.authList } // copyAddressPtr copies an address. func copyAddressPtr(a *common.Address) *common.Address { diff --git a/core/types/transaction_signing.go b/core/types/transaction_signing.go index ce9fe342f..643a42a88 100644 --- a/core/types/transaction_signing.go +++ b/core/types/transaction_signing.go @@ -311,7 +311,7 @@ func (s pragueSigner) Hash(tx *Transaction) common.Hash { tx.Value(), tx.Data(), tx.AccessList(), - tx.AuthList(), + tx.SetCodeAuthorizations(), }) } diff --git a/eth/gasestimator/gasestimator.go b/eth/gasestimator/gasestimator.go index ea4235258..f9d59b9ed 100644 --- a/eth/gasestimator/gasestimator.go +++ b/eth/gasestimator/gasestimator.go @@ -211,7 +211,7 @@ func execute(ctx context.Context, call core.Message, opts *Options, gasLimit uin true, call.BlobGasFeeCap(), call.BlobHashes(), - call.AuthList(), + call.SetCodeAuthorizations(), ) // Execute the call and separate execution faults caused by a lack of gas or diff --git a/internal/ethapi/api.go b/internal/ethapi/api.go index 5033137ec..7903d2984 100644 --- a/internal/ethapi/api.go +++ b/internal/ethapi/api.go @@ -1494,7 +1494,7 @@ func newRPCTransaction(tx *types.Transaction, blockHash common.Hash, blockNumber } else { result.GasPrice = (*hexutil.Big)(tx.GasFeeCap()) } - result.AuthorizationList = tx.AuthList() + result.AuthorizationList = tx.SetCodeAuthorizations() } return result } diff --git a/tests/transaction_test_util.go b/tests/transaction_test_util.go index 51917b51d..4d525ea8a 100644 --- a/tests/transaction_test_util.go +++ b/tests/transaction_test_util.go @@ -55,7 +55,7 @@ func (tt *TransactionTest) Run(config *params.ChainConfig) error { return nil, nil, err } // Intrinsic gas - requiredGas, err := core.IntrinsicGas(tx.Data(), tx.AccessList(), tx.AuthList(), tx.To() == nil, isHomestead, isIstanbul, false) + requiredGas, err := core.IntrinsicGas(tx.Data(), tx.AccessList(), tx.SetCodeAuthorizations(), tx.To() == nil, isHomestead, isIstanbul, false) if err != nil { return nil, nil, err } From 89c49d2493c81122f5fb132fe7cbd8a250800b06 Mon Sep 17 00:00:00 2001 From: Tran Tien Duc Date: Wed, 19 Mar 2025 16:51:44 +0700 Subject: [PATCH 6/6] fixup! pick up ethereum/go-ethereum#30935 --- cmd/evm/internal/t8ntool/transaction.go | 2 +- light/txpool.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/cmd/evm/internal/t8ntool/transaction.go b/cmd/evm/internal/t8ntool/transaction.go index 61d8ebcb5..a52059d98 100644 --- a/cmd/evm/internal/t8ntool/transaction.go +++ b/cmd/evm/internal/t8ntool/transaction.go @@ -139,7 +139,7 @@ func Transaction(ctx *cli.Context) error { r.Address = sender } // Check intrinsic gas - if gas, err := core.IntrinsicGas(tx.Data(), tx.AccessList(), tx.AuthList(), tx.To() == nil, + if gas, err := core.IntrinsicGas(tx.Data(), tx.AccessList(), tx.SetCodeAuthorizations(), tx.To() == nil, chainConfig.IsHomestead(new(big.Int)), chainConfig.IsIstanbul(new(big.Int)), chainConfig.IsShanghai(new(big.Int))); err != nil { r.Error = err results = append(results, r) diff --git a/light/txpool.go b/light/txpool.go index e50d662cf..7c3d5d0bf 100644 --- a/light/txpool.go +++ b/light/txpool.go @@ -388,7 +388,7 @@ func (pool *TxPool) validateTx(ctx context.Context, tx *types.Transaction) error } // Should supply enough intrinsic gas - gas, err := core.IntrinsicGas(tx.Data(), tx.AccessList(), tx.AuthList(), tx.To() == nil, true, pool.istanbul, pool.shanghai) + gas, err := core.IntrinsicGas(tx.Data(), tx.AccessList(), tx.SetCodeAuthorizations(), tx.To() == nil, true, pool.istanbul, pool.shanghai) if err != nil { return err }