diff --git a/core/state_transition.go b/core/state_transition.go index 497c01f5eec..c8c580722c1 100644 --- a/core/state_transition.go +++ b/core/state_transition.go @@ -405,7 +405,11 @@ func (st *StateTransition) TransitionDb(refunds bool, gasBailout bool) (*evmtype } // 7. set authority code - st.state.SetCode(authority, types.AddressToDelegation(auth.Address)) + if auth.Address == (libcommon.Address{}) { + st.state.SetCode(authority, nil) + } else { + st.state.SetCode(authority, types.AddressToDelegation(auth.Address)) + } // 8. increase the nonce of authority st.state.SetNonce(authority, authorityNonce+1) diff --git a/core/types/authorization.go b/core/types/authorization.go index a4dea12e02b..7c6acbfbb85 100644 --- a/core/types/authorization.go +++ b/core/types/authorization.go @@ -71,6 +71,16 @@ func (ath *Authorization) RecoverSigner(data *bytes.Buffer, b []byte) (*libcommo copy(sig[32-len(r):32], r) copy(sig[64-len(s):64], s) + if ath.Nonce == 1<<64-1 { + return nil, errors.New("Failed assertion: auth.nonce < 2**64 - 1") + } + if _, overflow := ath.ChainID.Uint64WithOverflow(); overflow { + return nil, errors.New("Failed assertion: auth.chain_id < 2**64") + } + if ath.V.GtUint64(1 << 8) { + return nil, errors.New("Failed assertion: auth.y_parity < 2**8") + } + if ath.V.Eq(u256.Num0) || ath.V.Eq(u256.Num1) { sig[64] = byte(ath.V.Uint64()) } else { diff --git a/erigon-lib/common/fixedgas/protocol.go b/erigon-lib/common/fixedgas/protocol.go index 03590bb2b1a..cc73737a733 100644 --- a/erigon-lib/common/fixedgas/protocol.go +++ b/erigon-lib/common/fixedgas/protocol.go @@ -39,5 +39,5 @@ const ( // EIP-7702: set code tx PerEmptyAccountCost = 25000 - PerAuthBaseCost = 2500 + PerAuthBaseCost = 12500 ) diff --git a/tests/exec_spec_test.go b/tests/exec_spec_test.go index 4a21a237acd..d8ea375f79a 100644 --- a/tests/exec_spec_test.go +++ b/tests/exec_spec_test.go @@ -32,15 +32,6 @@ func TestExecutionSpec(t *testing.T) { bt := new(testMatcher) dir := filepath.Join(".", "execution-spec-tests") - - // bt.skipLoad(`^`) - - // // TODO(yperbasis) make it work - // bt.skipLoad(`^prague/eip2935_historical_block_hashes_from_state/block_hashes/block_hashes_history.json`) - // bt.skipLoad(`^prague/eip7251_consolidations/`) - // bt.skipLoad(`^prague/eip7685_general_purpose_el_requests/`) - // bt.skipLoad(`^prague/eip7002_el_triggerable_withdrawals/`) - bt.skipLoad(`^prague/eip7702_set_code_tx/`) checkStateRoot := true bt.walk(t, dir, func(t *testing.T, name string, test *BlockTest) {