From 443f7703a24a09709b66d9f47b951aac452abf48 Mon Sep 17 00:00:00 2001 From: Somnath Date: Mon, 10 Feb 2025 17:27:04 +0400 Subject: [PATCH] Pectra devnet 6 commits to E2 (#13718) --- .github/workflows/test-hive-eest.yml | 2 +- .github/workflows/test-hive.yml | 2 +- Makefile | 18 +++++++++--------- core/types/transaction_marshalling.go | 6 +++--- core/vm/instructions.go | 18 +----------------- params/protocol_params.go | 6 +++--- tests/execution-spec-tests | 2 +- turbo/engineapi/engine_server.go | 4 +++- turbo/execution/eth1/block_building.go | 5 ++--- turbo/jsonrpc/eth_block.go | 13 ------------- 10 files changed, 24 insertions(+), 52 deletions(-) diff --git a/.github/workflows/test-hive-eest.yml b/.github/workflows/test-hive-eest.yml index 8b7e5dad957..b73fab39e70 100644 --- a/.github/workflows/test-hive-eest.yml +++ b/.github/workflows/test-hive-eest.yml @@ -50,7 +50,7 @@ jobs: echo -e "\n\n============================================================" echo "Running test: ${1}" echo -e "\n" - ./hive --sim 'ethereum/eest/consume-engine' --client erigon --sim.buildarg fixtures=https://github.com/ethereum/execution-spec-tests/releases/download/pectra-devnet-5%40v1.3.0/fixtures_pectra-devnet-5.tar.gz --sim.buildarg branch=pectra-devnet-5 2>&1 | tee output.log || { + ./hive --sim 'ethereum/eest/consume-engine' --client erigon --sim.buildarg fixtures=https://github.com/ethereum/execution-spec-tests/releases/download/pectra-devnet-6%40v1.0.0/fixtures_pectra-devnet-6.tar.gz 2>&1 | tee output.log || { if [ $? -gt 0 ]; then echo "Exitcode gt 0" fi diff --git a/.github/workflows/test-hive.yml b/.github/workflows/test-hive.yml index 9dd0b5bca91..7095f1df036 100644 --- a/.github/workflows/test-hive.yml +++ b/.github/workflows/test-hive.yml @@ -86,7 +86,7 @@ jobs: run_suite engine cancun run_suite engine api run_suite engine auth - run_suite rpc compat + # run_suite rpc compat continue-on-error: true - name: Upload output log uses: actions/upload-artifact@v4 diff --git a/Makefile b/Makefile index bda2061d299..eba5156b484 100644 --- a/Makefile +++ b/Makefile @@ -197,9 +197,9 @@ test-hive: # Define the run_suite function define run_suite - echo -e "\n\n============================================================"; \ + printf "\n\n============================================================"; \ echo "Running test: $1-$2"; \ - echo -e "\n"; \ + printf "\n"; \ ./hive --sim ethereum/$1 --sim.limit=$2 --sim.parallelism=8 --client erigon $3 2>&1 | tee output.log; \ if [ $$? -gt 0 ]; then \ echo "Exitcode gt 0"; \ @@ -212,28 +212,28 @@ define run_suite fi; \ tests=$$(echo "$$status_line" | sed -n 's/.*tests=\([0-9]*\).*/\1/p'); \ failed=$$(echo "$$status_line" | sed -n 's/.*failed=\([0-9]*\).*/\1/p'); \ - echo -e "\n"; \ + printf "\n"; \ echo "----------- Results for $1-$2 -----------"; \ echo "Tests: $$tests, Failed: $$failed"; \ - echo -e "\n\n============================================================" + printf "\n\n============================================================" endef hive-local: docker build -t "test/erigon:$(SHORT_COMMIT)" . - rm -rf "hive-test-$(SHORT_COMMIT)" && mkdir "hive-local-$(SHORT_COMMIT)" + rm -rf "hive-local-$(SHORT_COMMIT)" && mkdir "hive-local-$(SHORT_COMMIT)" cd "hive-local-$(SHORT_COMMIT)" && git clone https://github.com/ethereum/hive cd "hive-local-$(SHORT_COMMIT)/hive" && \ sed -i "s/^ARG baseimage=erigontech\/erigon$$/ARG baseimage=test\/erigon/" clients/erigon/Dockerfile && \ sed -i "s/^ARG tag=main-latest$$/ARG tag=$(SHORT_COMMIT)/" clients/erigon/Dockerfile cd "hive-local-$(SHORT_COMMIT)/hive" && go build . 2>&1 | tee buildlogs.log - cd "hive-local-$(SHORT_COMMIT)/hive" && go build ./cmd/hiveview && ./hiveview --serve --logdir ./workspace/logs + cd "hive-local-$(SHORT_COMMIT)/hive" && go build ./cmd/hiveview && ./hiveview --serve --logdir ./workspace/logs & cd "hive-local-$(SHORT_COMMIT)/hive" && $(call run_suite,engine,exchange-capabilities) cd "hive-local-$(SHORT_COMMIT)/hive" && $(call run_suite,engine,withdrawals) cd "hive-local-$(SHORT_COMMIT)/hive" && $(call run_suite,engine,cancun) cd "hive-local-$(SHORT_COMMIT)/hive" && $(call run_suite,engine,api) cd "hive-local-$(SHORT_COMMIT)/hive" && $(call run_suite,engine,auth) - cd "hive-local-$(SHORT_COMMIT)/hive" && $(call run_suite,rpc,compat) + cd "hive-local-$(SHORT_COMMIT)/hive" && $(call run_suite,rpc-compat,) eest-hive: docker build -t "test/erigon:$(SHORT_COMMIT)" . @@ -244,8 +244,8 @@ eest-hive: sed -i "s/^ARG baseimage=erigontech\/erigon$$/ARG baseimage=test\/erigon/" clients/erigon/Dockerfile && \ sed -i "s/^ARG tag=main-latest$$/ARG tag=$(SHORT_COMMIT)/" clients/erigon/Dockerfile cd "eest-hive-$(SHORT_COMMIT)/hive" && go build . 2>&1 | tee buildlogs.log - cd "eest-hive-$(SHORT_COMMIT)/hive" && go build ./cmd/hiveview && ./hiveview --serve --logdir ./workspace/logs - cd "eest-hive-$(SHORT_COMMIT)/hive" && $(call run_suite,eest/consume-engine,"",--sim.buildarg fixtures=https://github.com/ethereum/execution-spec-tests/releases/download/pectra-devnet-5%40v1.1.0/fixtures_pectra-devnet-5.tar.gz --sim.buildarg branch=pectra-devnet-5) + cd "eest-hive-$(SHORT_COMMIT)/hive" && go build ./cmd/hiveview && ./hiveview --serve --logdir ./workspace/logs & + cd "eest-hive-$(SHORT_COMMIT)/hive" && $(call run_suite,eest/consume-engine,"",--sim.buildarg fixtures=https://github.com/ethereum/execution-spec-tests/releases/download/pectra-devnet-6%40v1.0.0/fixtures_pectra-devnet-6.tar.gz) ## lint-deps: install lint dependencies lint-deps: diff --git a/core/types/transaction_marshalling.go b/core/types/transaction_marshalling.go index 2003af89b0c..598bbb501cb 100644 --- a/core/types/transaction_marshalling.go +++ b/core/types/transaction_marshalling.go @@ -54,7 +54,7 @@ type JsonAuthorization struct { ChainID hexutil.Big `json:"chainId"` Address libcommon.Address `json:"address"` Nonce hexutil.Uint64 `json:"nonce"` - V hexutil.Uint64 `json:"v"` + YParity hexutil.Uint64 `json:"yParity"` R hexutil.Big `json:"r"` S hexutil.Big `json:"s"` } @@ -64,7 +64,7 @@ func (a JsonAuthorization) FromAuthorization(authorization Authorization) JsonAu a.Address = authorization.Address a.Nonce = (hexutil.Uint64)(authorization.Nonce) - a.V = (hexutil.Uint64)(authorization.YParity) + a.YParity = (hexutil.Uint64)(authorization.YParity) a.R = hexutil.Big(*authorization.R.ToBig()) a.S = hexutil.Big(*authorization.S.ToBig()) return a @@ -80,7 +80,7 @@ func (a JsonAuthorization) ToAuthorization() (Authorization, error) { return auth, errors.New("chainId in authorization does not fit in 256 bits") } auth.ChainID = *chainId - yParity := a.V.Uint64() + yParity := a.YParity.Uint64() if yParity >= 1<<8 { return auth, errors.New("y parity in authorization does not fit in 8 bits") } diff --git a/core/vm/instructions.go b/core/vm/instructions.go index 043ce17bbaf..1bcbe38d73b 100644 --- a/core/vm/instructions.go +++ b/core/vm/instructions.go @@ -377,12 +377,6 @@ func opExtCodeSize(pc *uint64, interpreter *EVMInterpreter, scope *ScopeContext) slot := scope.Stack.Peek() addr := slot.Bytes20() codeSize := interpreter.evm.IntraBlockState().GetCodeSize(addr) - if codeSize == types.DelegateDesignationCodeSize { - _, ok := interpreter.evm.IntraBlockState().GetDelegatedDesignation(addr) - if ok { - codeSize = 2 // first two bytes only: EIP-7702 - } - } slot.SetUint64(uint64(codeSize)) return nil, nil } @@ -419,12 +413,7 @@ func opExtCodeCopy(pc *uint64, interpreter *EVMInterpreter, scope *ScopeContext) ) addr := libcommon.Address(a.Bytes20()) len64 := length.Uint64() - code := interpreter.evm.IntraBlockState().GetCode(addr) - if _, ok := types.ParseDelegation(code); ok { - code = append([]byte{}, (params.DelegatedDesignationPrefix[0:2])...) - } - codeCopy := getDataBig(code, &codeOffset, len64) scope.Memory.Set(memOffset.Uint64(), len64, codeCopy) return nil, nil @@ -475,12 +464,7 @@ func opExtCodeHash(pc *uint64, interpreter *EVMInterpreter, scope *ScopeContext) slot.Clear() } else { var codeHash libcommon.Hash - _, ok := interpreter.evm.IntraBlockState().GetDelegatedDesignation(address) - if ok { - codeHash = params.DelegatedCodeHash - } else { - codeHash = interpreter.evm.IntraBlockState().GetCodeHash(address) - } + codeHash = interpreter.evm.IntraBlockState().GetCodeHash(address) slot.SetBytes(codeHash.Bytes()) } return nil, nil diff --git a/params/protocol_params.go b/params/protocol_params.go index ecac3a8c2fe..f11e65ae40f 100644 --- a/params/protocol_params.go +++ b/params/protocol_params.go @@ -189,13 +189,13 @@ var DelegatedCodeHash = common.HexToHash("0xeadcdba66a79ab5dce91622d1d75c8cff5cf var BeaconRootsAddress = common.HexToAddress("0x000F3df6D732807Ef1319fB7B8bB8522d0Beac02") // EIP-2935: Historical block hashes in state -var HistoryStorageAddress = common.HexToAddress("0x0F792be4B0c0cb4DAE440Ef133E90C0eCD48CCCC") +var HistoryStorageAddress = common.HexToAddress("0x0000F90827F1C53a10cb7A02335B175320002935") // EIP-7002: Execution layer triggerable withdrawals -var WithdrawalRequestAddress = common.HexToAddress("0x0c15F14308530b7CDB8460094BbB9cC28b9AaaAA") +var WithdrawalRequestAddress = common.HexToAddress("0x00000961Ef480Eb55e80D19ad83579A64c007002") // EIP-7251 -var ConsolidationRequestAddress = common.HexToAddress("0x00431F263cE400f4455c2dCf564e53007Ca4bbBb") +var ConsolidationRequestAddress = common.HexToAddress("0x0000BBdDc7CE488642fb579F8B00f3a590007251") // Gas discount table for BLS12-381 G1 and G2 multi exponentiation operations var Bls12381MSMDiscountTableG1 = [128]uint64{1000, 949, 848, 797, 764, 750, 738, 728, 719, 712, 705, 698, 692, 687, 682, 677, 673, 669, 665, 661, 658, 654, 651, 648, 645, 642, 640, 637, 635, 632, 630, 627, 625, 623, 621, 619, 617, 615, 613, 611, 609, 608, 606, 604, 603, 601, 599, 598, 596, 595, 593, 592, 591, 589, 588, 586, 585, 584, 582, 581, 580, 579, 577, 576, 575, 574, 573, 572, 570, 569, 568, 567, 566, 565, 564, 563, 562, 561, 560, 559, 558, 557, 556, 555, 554, 553, 552, 551, 550, 549, 548, 547, 547, 546, 545, 544, 543, 542, 541, 540, 540, 539, 538, 537, 536, 536, 535, 534, 533, 532, 532, 531, 530, 529, 528, 528, 527, 526, 525, 525, 524, 523, 522, 522, 521, 520, 520, 519} diff --git a/tests/execution-spec-tests b/tests/execution-spec-tests index 29da80ec0cc..fe8f3471a93 160000 --- a/tests/execution-spec-tests +++ b/tests/execution-spec-tests @@ -1 +1 @@ -Subproject commit 29da80ec0ccb815f2a6f2ad177e7ec0ddb865086 +Subproject commit fe8f3471a93c313a8cc1fc902c72d6c1cdf64dab diff --git a/turbo/engineapi/engine_server.go b/turbo/engineapi/engine_server.go index 3d0c6480c6c..8c7fa76f43a 100644 --- a/turbo/engineapi/engine_server.go +++ b/turbo/engineapi/engine_server.go @@ -178,10 +178,12 @@ func (s *EngineServer) newPayload(ctx context.Context, req *engine_types.Executi } if version >= clparams.ElectraVersion { requests = make(types.FlatRequests, 0) + lastReqType := -1 for i, r := range executionRequests { - if len(r) <= 1 { + if len(r) <= 1 || lastReqType >= 0 && int(r[0]) <= lastReqType { return nil, &rpc.InvalidParamsError{Message: fmt.Sprintf("Invalid Request at index %d", i)} } + lastReqType = int(r[0]) requests = append(requests, types.FlatRequest{Type: r[0], RequestData: r[1:]}) } rh := requests.Hash() diff --git a/turbo/execution/eth1/block_building.go b/turbo/execution/eth1/block_building.go index 0a2b1f2b9d7..6c5d6c04dd0 100644 --- a/turbo/execution/eth1/block_building.go +++ b/turbo/execution/eth1/block_building.go @@ -203,9 +203,8 @@ func (e *EthereumExecutionModule) GetAssembledBlock(ctx context.Context, req *ex if blockWithReceipts.Requests != nil { requestsBundle = &types2.RequestsBundle{} requests := make([][]byte, 0) - for i, r := range blockWithReceipts.Requests { - requests[i] = make([]byte, 0) - requests[i] = append(requests[i], r.RequestData...) + for _, r := range blockWithReceipts.Requests { + requests = append(requests, r.RequestData) } requestsBundle.Requests = requests } diff --git a/turbo/jsonrpc/eth_block.go b/turbo/jsonrpc/eth_block.go index bc411ddedc8..b7ac7fe75a9 100644 --- a/turbo/jsonrpc/eth_block.go +++ b/turbo/jsonrpc/eth_block.go @@ -208,13 +208,6 @@ func (api *APIImpl) GetBlockByNumber(ctx context.Context, number rpc.BlockNumber return nil, nil } additionalFields := make(map[string]interface{}) - td, err := rawdb.ReadTd(tx, b.Hash(), b.NumberU64()) - if err != nil { - return nil, err - } - if td != nil { - additionalFields["totalDifficulty"] = (*hexutil.Big)(td) - } chainConfig, err := api.chainConfig(ctx, tx) if err != nil { @@ -275,12 +268,6 @@ func (api *APIImpl) GetBlockByHash(ctx context.Context, numberOrHash rpc.BlockNu } number := block.NumberU64() - td, err := rawdb.ReadTd(tx, hash, number) - if err != nil { - return nil, err - } - additionalFields["totalDifficulty"] = (*hexutil.Big)(td) - chainConfig, err := api.chainConfig(ctx, tx) if err != nil { return nil, err