Skip to content

Commit

Permalink
Pectra devnet 6 commits to E2 (#13718)
Browse files Browse the repository at this point in the history
  • Loading branch information
somnathb1 authored Feb 10, 2025
1 parent cebcd1c commit 443f770
Show file tree
Hide file tree
Showing 10 changed files with 24 additions and 52 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test-hive-eest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test-hive.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
18 changes: 9 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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"; \
Expand All @@ -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)" .
Expand All @@ -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:
Expand Down
6 changes: 3 additions & 3 deletions core/types/transaction_marshalling.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"`
}
Expand All @@ -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
Expand All @@ -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")
}
Expand Down
18 changes: 1 addition & 17 deletions core/vm/instructions.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions params/protocol_params.go
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down
2 changes: 1 addition & 1 deletion tests/execution-spec-tests
4 changes: 3 additions & 1 deletion turbo/engineapi/engine_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
5 changes: 2 additions & 3 deletions turbo/execution/eth1/block_building.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
13 changes: 0 additions & 13 deletions turbo/jsonrpc/eth_block.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 443f770

Please sign in to comment.