add EF consensus spec test Electra execution payload operations fixture (#6246)

This commit is contained in:
tersec 2024-04-26 16:02:15 +00:00 committed by GitHub
parent 63d00931a3
commit 8f0a61b964
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 114 additions and 27 deletions

View File

@ -2638,7 +2638,7 @@ OK: 11/11 Fail: 0/11 Skip: 0/11
+ [Valid] EF - Electra - Operations - Deposit - top_up__zero_balance OK
```
OK: 21/21 Fail: 0/21 Skip: 0/21
## EF - Electra - Operations - Deposit Receipt [Preset: mainnet]
## EF - Electra - Operations - Deposit Receipt [Preset: mainnet]
```diff
+ [Valid] EF - Electra - Operations - Deposit Receipt - correct_sig_but_forked_state OK
+ [Valid] EF - Electra - Operations - Deposit Receipt - effective_deposit_with_genesis_for OK
@ -2677,6 +2677,48 @@ OK: 17/17 Fail: 0/17 Skip: 0/17
+ [Valid] EF - Electra - Operations - Execution Layer Withdrawal Request - pending_withdra OK
```
OK: 14/14 Fail: 0/14 Skip: 0/14
## EF - Electra - Operations - Execution Payload [Preset: mainnet]
```diff
+ [Invalid] EF - Electra - Operations - Execution Payload - invalid_bad_everything_first_pay OK
+ [Invalid] EF - Electra - Operations - Execution Payload - invalid_bad_everything_regular_p OK
+ [Invalid] EF - Electra - Operations - Execution Payload - invalid_bad_execution_first_payl OK
+ [Invalid] EF - Electra - Operations - Execution Payload - invalid_bad_execution_regular_pa OK
+ [Invalid] EF - Electra - Operations - Execution Payload - invalid_bad_parent_hash_first_pa OK
+ [Invalid] EF - Electra - Operations - Execution Payload - invalid_bad_parent_hash_regular_ OK
+ [Invalid] EF - Electra - Operations - Execution Payload - invalid_bad_pre_randao_regular_p OK
+ [Invalid] EF - Electra - Operations - Execution Payload - invalid_bad_prev_randao_first_pa OK
+ [Invalid] EF - Electra - Operations - Execution Payload - invalid_correct_input__execution OK
+ [Invalid] EF - Electra - Operations - Execution Payload - invalid_exceed_max_blobs_per_blo OK
+ [Invalid] EF - Electra - Operations - Execution Payload - invalid_future_timestamp_first_p OK
+ [Invalid] EF - Electra - Operations - Execution Payload - invalid_future_timestamp_regular OK
+ [Invalid] EF - Electra - Operations - Execution Payload - invalid_past_timestamp_first_pay OK
+ [Invalid] EF - Electra - Operations - Execution Payload - invalid_past_timestamp_regular_p OK
+ [Invalid] EF - Electra - Operations - Execution Payload - invalid_randomized_non_validated OK
+ [Invalid] EF - Electra - Operations - Execution Payload - invalid_randomized_non_validated OK
+ [Valid] EF - Electra - Operations - Execution Payload - incorrect_blob_tx_type OK
+ [Valid] EF - Electra - Operations - Execution Payload - incorrect_block_hash OK
+ [Valid] EF - Electra - Operations - Execution Payload - incorrect_commitment OK
+ [Valid] EF - Electra - Operations - Execution Payload - incorrect_commitments_order OK
+ [Valid] EF - Electra - Operations - Execution Payload - incorrect_transaction_length_1_b OK
+ [Valid] EF - Electra - Operations - Execution Payload - incorrect_transaction_length_1_e OK
+ [Valid] EF - Electra - Operations - Execution Payload - incorrect_transaction_length_32_ OK
+ [Valid] EF - Electra - Operations - Execution Payload - incorrect_transaction_length_emp OK
+ [Valid] EF - Electra - Operations - Execution Payload - no_transactions_with_commitments OK
+ [Valid] EF - Electra - Operations - Execution Payload - non_empty_extra_data_first_paylo OK
+ [Valid] EF - Electra - Operations - Execution Payload - non_empty_extra_data_regular_pay OK
+ [Valid] EF - Electra - Operations - Execution Payload - non_empty_transactions_first_pay OK
+ [Valid] EF - Electra - Operations - Execution Payload - non_empty_transactions_regular_p OK
+ [Valid] EF - Electra - Operations - Execution Payload - randomized_non_validated_executi OK
+ [Valid] EF - Electra - Operations - Execution Payload - randomized_non_validated_executi OK
+ [Valid] EF - Electra - Operations - Execution Payload - success_first_payload OK
+ [Valid] EF - Electra - Operations - Execution Payload - success_first_payload_with_gap_s OK
+ [Valid] EF - Electra - Operations - Execution Payload - success_regular_payload OK
+ [Valid] EF - Electra - Operations - Execution Payload - success_regular_payload_with_gap OK
+ [Valid] EF - Electra - Operations - Execution Payload - zero_length_transaction_first_pa OK
+ [Valid] EF - Electra - Operations - Execution Payload - zero_length_transaction_regular_ OK
+ [Valid] EF - Electra - Operations - Execution Payload - zeroed_commitment OK
```
OK: 38/38 Fail: 0/38 Skip: 0/38
## EF - Electra - Operations - Proposer Slashing [Preset: mainnet]
```diff
+ [Invalid] EF - Electra - Operations - Proposer Slashing - invalid_different_proposer_indic OK
@ -3443,4 +3485,4 @@ OK: 69/88 Fail: 0/88 Skip: 19/88
OK: 3/3 Fail: 0/3 Skip: 0/3
---TOTAL---
OK: 2754/2773 Fail: 0/2773 Skip: 19/2773
OK: 2792/2811 Fail: 0/2811 Skip: 19/2811

View File

@ -2774,7 +2774,7 @@ OK: 20/20 Fail: 0/20 Skip: 0/20
+ [Valid] EF - Electra - Operations - Deposit - top_up__zero_balance OK
```
OK: 21/21 Fail: 0/21 Skip: 0/21
## EF - Electra - Operations - Deposit Receipt [Preset: minimal]
## EF - Electra - Operations - Deposit Receipt [Preset: minimal]
```diff
+ [Valid] EF - Electra - Operations - Deposit Receipt - correct_sig_but_forked_state OK
+ [Valid] EF - Electra - Operations - Deposit Receipt - effective_deposit_with_genesis_for OK
@ -2823,6 +2823,48 @@ OK: 17/17 Fail: 0/17 Skip: 0/17
+ [Valid] EF - Electra - Operations - Execution Layer Withdrawal Request - pending_withdra OK
```
OK: 24/24 Fail: 0/24 Skip: 0/24
## EF - Electra - Operations - Execution Payload [Preset: minimal]
```diff
+ [Invalid] EF - Electra - Operations - Execution Payload - invalid_bad_everything_first_pay OK
+ [Invalid] EF - Electra - Operations - Execution Payload - invalid_bad_everything_regular_p OK
+ [Invalid] EF - Electra - Operations - Execution Payload - invalid_bad_execution_first_payl OK
+ [Invalid] EF - Electra - Operations - Execution Payload - invalid_bad_execution_regular_pa OK
+ [Invalid] EF - Electra - Operations - Execution Payload - invalid_bad_parent_hash_first_pa OK
+ [Invalid] EF - Electra - Operations - Execution Payload - invalid_bad_parent_hash_regular_ OK
+ [Invalid] EF - Electra - Operations - Execution Payload - invalid_bad_pre_randao_regular_p OK
+ [Invalid] EF - Electra - Operations - Execution Payload - invalid_bad_prev_randao_first_pa OK
+ [Invalid] EF - Electra - Operations - Execution Payload - invalid_correct_input__execution OK
+ [Invalid] EF - Electra - Operations - Execution Payload - invalid_exceed_max_blobs_per_blo OK
+ [Invalid] EF - Electra - Operations - Execution Payload - invalid_future_timestamp_first_p OK
+ [Invalid] EF - Electra - Operations - Execution Payload - invalid_future_timestamp_regular OK
+ [Invalid] EF - Electra - Operations - Execution Payload - invalid_past_timestamp_first_pay OK
+ [Invalid] EF - Electra - Operations - Execution Payload - invalid_past_timestamp_regular_p OK
+ [Invalid] EF - Electra - Operations - Execution Payload - invalid_randomized_non_validated OK
+ [Invalid] EF - Electra - Operations - Execution Payload - invalid_randomized_non_validated OK
+ [Valid] EF - Electra - Operations - Execution Payload - incorrect_blob_tx_type OK
+ [Valid] EF - Electra - Operations - Execution Payload - incorrect_block_hash OK
+ [Valid] EF - Electra - Operations - Execution Payload - incorrect_commitment OK
+ [Valid] EF - Electra - Operations - Execution Payload - incorrect_commitments_order OK
+ [Valid] EF - Electra - Operations - Execution Payload - incorrect_transaction_length_1_b OK
+ [Valid] EF - Electra - Operations - Execution Payload - incorrect_transaction_length_1_e OK
+ [Valid] EF - Electra - Operations - Execution Payload - incorrect_transaction_length_32_ OK
+ [Valid] EF - Electra - Operations - Execution Payload - incorrect_transaction_length_emp OK
+ [Valid] EF - Electra - Operations - Execution Payload - no_transactions_with_commitments OK
+ [Valid] EF - Electra - Operations - Execution Payload - non_empty_extra_data_first_paylo OK
+ [Valid] EF - Electra - Operations - Execution Payload - non_empty_extra_data_regular_pay OK
+ [Valid] EF - Electra - Operations - Execution Payload - non_empty_transactions_first_pay OK
+ [Valid] EF - Electra - Operations - Execution Payload - non_empty_transactions_regular_p OK
+ [Valid] EF - Electra - Operations - Execution Payload - randomized_non_validated_executi OK
+ [Valid] EF - Electra - Operations - Execution Payload - randomized_non_validated_executi OK
+ [Valid] EF - Electra - Operations - Execution Payload - success_first_payload OK
+ [Valid] EF - Electra - Operations - Execution Payload - success_first_payload_with_gap_s OK
+ [Valid] EF - Electra - Operations - Execution Payload - success_regular_payload OK
+ [Valid] EF - Electra - Operations - Execution Payload - success_regular_payload_with_gap OK
+ [Valid] EF - Electra - Operations - Execution Payload - zero_length_transaction_first_pa OK
+ [Valid] EF - Electra - Operations - Execution Payload - zero_length_transaction_regular_ OK
+ [Valid] EF - Electra - Operations - Execution Payload - zeroed_commitment OK
```
OK: 38/38 Fail: 0/38 Skip: 0/38
## EF - Electra - Operations - Proposer Slashing [Preset: minimal]
```diff
+ [Invalid] EF - Electra - Operations - Proposer Slashing - invalid_different_proposer_indic OK
@ -3745,4 +3787,4 @@ OK: 185/207 Fail: 0/207 Skip: 22/207
OK: 3/3 Fail: 0/3 Skip: 0/3
---TOTAL---
OK: 3025/3047 Fail: 0/3047 Skip: 22/3047
OK: 3063/3085 Fail: 0/3085 Skip: 22/3085

View File

@ -822,7 +822,7 @@ type SomeElectraBeaconBlockBody =
electra.BeaconBlockBody | electra.SigVerifiedBeaconBlockBody |
electra.TrustedBeaconBlockBody
# TODO spec ref URL when available
# https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.0/specs/electra/beacon-chain.md#modified-process_execution_payload
proc process_execution_payload*(
state: var electra.BeaconState, body: SomeElectraBeaconBlockBody,
notify_new_payload: electra.ExecutePayload): Result[void, cstring] =
@ -868,7 +868,11 @@ proc process_execution_payload*(
transactions_root: hash_tree_root(payload.transactions),
withdrawals_root: hash_tree_root(payload.withdrawals),
blob_gas_used: payload.blob_gas_used,
excess_blob_gas: payload.excess_blob_gas)
excess_blob_gas: payload.excess_blob_gas,
deposit_receipts_root:
hash_tree_root(payload.deposit_receipts), # [New in Electra:EIP6110]
withdrawal_requests_root:
hash_tree_root(payload.withdrawal_requests)) # [New in Electra:EIP7002:EIP7251]
ok()

View File

@ -142,7 +142,7 @@ suite baseDescription & "BLS to execution change " & preset():
from ".."/".."/".."/beacon_chain/bloomfilter import constructBloomFilter
suite baseDescription & "Deposit " & preset():
proc applyDeposit(
func applyDeposit(
preState: var capella.BeaconState, deposit: Deposit):
Result[void, cstring] =
process_deposit(
@ -154,7 +154,7 @@ suite baseDescription & "Deposit " & preset():
OpDepositsDir, suiteName, "Deposit", "deposit", applyDeposit, path)
suite baseDescription & "Execution Payload " & preset():
proc makeApplyExecutionPayloadCb(path: string): auto =
func makeApplyExecutionPayloadCb(path: string): auto =
return proc(
preState: var capella.BeaconState, body: capella.BeaconBlockBody):
Result[void, cstring] {.raises: [IOError].} =
@ -219,7 +219,7 @@ suite baseDescription & "Voluntary Exit " & preset():
applyVoluntaryExit, path)
suite baseDescription & "Withdrawals " & preset():
proc applyWithdrawals(
func applyWithdrawals(
preState: var capella.BeaconState,
executionPayload: capella.ExecutionPayload): Result[void, cstring] =
process_withdrawals(preState, executionPayload)

View File

@ -22,7 +22,7 @@ import
../../helpers/debug_state
from std/sequtils import mapIt, toSeq
#from std/strutils import contains
from std/strutils import contains
from ../../../beacon_chain/spec/beaconstate import
get_base_reward_per_increment, get_state_exit_queue_info,
get_total_active_balance, process_attestation
@ -183,7 +183,7 @@ suite baseDescription & "Deposit " & preset():
runTest[Deposit, typeof applyDeposit](
OpDepositsDir, suiteName, "Deposit", "deposit", applyDeposit, path)
suite baseDescription & "Deposit Receipt" & preset():
suite baseDescription & "Deposit Receipt " & preset():
func applyDepositReceipt(
preState: var electra.BeaconState, depositReceipt: DepositReceipt):
Result[void, cstring] =
@ -196,23 +196,22 @@ suite baseDescription & "Deposit Receipt" & preset():
OpDepositReceiptDir, suiteName, "Deposit Receipt", "deposit_receipt",
applyDepositReceipt, path)
when false:
suite baseDescription & "Execution Payload " & preset():
func makeApplyExecutionPayloadCb(path: string): auto =
return proc(
preState: var electra.BeaconState, body: electra.BeaconBlockBody):
Result[void, cstring] {.raises: [IOError].} =
let payloadValid = os_ops.readFile(
OpExecutionPayloadDir/"pyspec_tests"/path/"execution.yaml"
).contains("execution_valid: true")
func executePayload(_: electra.ExecutionPayload): bool = payloadValid
process_execution_payload(preState, body, executePayload)
suite baseDescription & "Execution Payload " & preset():
func makeApplyExecutionPayloadCb(path: string): auto =
return proc(
preState: var electra.BeaconState, body: electra.BeaconBlockBody):
Result[void, cstring] {.raises: [IOError].} =
let payloadValid = os_ops.readFile(
OpExecutionPayloadDir/"pyspec_tests"/path/"execution.yaml"
).contains("execution_valid: true")
func executePayload(_: electra.ExecutionPayload): bool = payloadValid
process_execution_payload(preState, body, executePayload)
for path in walkTests(OpExecutionPayloadDir):
let applyExecutionPayload = makeApplyExecutionPayloadCb(path)
runTest[electra.BeaconBlockBody, typeof applyExecutionPayload](
OpExecutionPayloadDir, suiteName, "Execution Payload", "body",
applyExecutionPayload, path)
for path in walkTests(OpExecutionPayloadDir):
let applyExecutionPayload = makeApplyExecutionPayloadCb(path)
runTest[electra.BeaconBlockBody, typeof applyExecutionPayload](
OpExecutionPayloadDir, suiteName, "Execution Payload", "body",
applyExecutionPayload, path)
suite baseDescription & "Execution Layer Withdrawal Request " & preset():
func applyExecutionLayerWithdrawalRequest(