Skip to content

Commit 6996638

Browse files
tersecTomi-3-0
andauthored
use v1.6.1 consensus reference tests (#7737)
* use v1.6.1 consensus reference tests * complete update --------- Co-authored-by: Caleb <[email protected]>
1 parent 9dea200 commit 6996638

File tree

10 files changed

+20
-27
lines changed

10 files changed

+20
-27
lines changed

ConsensusSpecPreset-mainnet.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3810,6 +3810,7 @@ ConsensusSpecPreset-mainnet
38103810
+ [Invalid] EF - Gloas - Operations - Execution Payload - invalid_future_timestamp_regular_p OK
38113811
+ [Invalid] EF - Gloas - Operations - Execution Payload - invalid_past_timestamp_first_paylo OK
38123812
+ [Invalid] EF - Gloas - Operations - Execution Payload - invalid_past_timestamp_regular_pay OK
3813+
+ [Invalid] EF - Gloas - Operations - Execution Payload - process_execution_payload_bid_prev OK
38133814
+ [Invalid] EF - Gloas - Operations - Execution Payload - process_execution_payload_executio OK
38143815
+ [Invalid] EF - Gloas - Operations - Execution Payload - process_execution_payload_invalid_ OK
38153816
+ [Invalid] EF - Gloas - Operations - Execution Payload - process_execution_payload_wrong_be OK
@@ -3854,6 +3855,7 @@ ConsensusSpecPreset-mainnet
38543855
+ [Invalid] EF - Gloas - Operations - Execution Payload Bid - process_execution_payload_bid_ OK
38553856
+ [Invalid] EF - Gloas - Operations - Execution Payload Bid - process_execution_payload_bid_ OK
38563857
+ [Invalid] EF - Gloas - Operations - Execution Payload Bid - process_execution_payload_bid_ OK
3858+
+ [Invalid] EF - Gloas - Operations - Execution Payload Bid - process_execution_payload_bid_ OK
38573859
+ [Valid] EF - Gloas - Operations - Execution Payload Bid - process_execution_payload_bid_ OK
38583860
+ [Valid] EF - Gloas - Operations - Execution Payload Bid - process_execution_payload_bid_ OK
38593861
+ [Valid] EF - Gloas - Operations - Execution Payload Bid - process_execution_payload_bid_ OK

ConsensusSpecPreset-minimal.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4064,6 +4064,7 @@ ConsensusSpecPreset-minimal
40644064
+ [Invalid] EF - Gloas - Operations - Execution Payload - invalid_future_timestamp_regular_p OK
40654065
+ [Invalid] EF - Gloas - Operations - Execution Payload - invalid_past_timestamp_first_paylo OK
40664066
+ [Invalid] EF - Gloas - Operations - Execution Payload - invalid_past_timestamp_regular_pay OK
4067+
+ [Invalid] EF - Gloas - Operations - Execution Payload - process_execution_payload_bid_prev OK
40674068
+ [Invalid] EF - Gloas - Operations - Execution Payload - process_execution_payload_executio OK
40684069
+ [Invalid] EF - Gloas - Operations - Execution Payload - process_execution_payload_invalid_ OK
40694070
+ [Invalid] EF - Gloas - Operations - Execution Payload - process_execution_payload_wrong_be OK
@@ -4108,6 +4109,7 @@ ConsensusSpecPreset-minimal
41084109
+ [Invalid] EF - Gloas - Operations - Execution Payload Bid - process_execution_payload_bid_ OK
41094110
+ [Invalid] EF - Gloas - Operations - Execution Payload Bid - process_execution_payload_bid_ OK
41104111
+ [Invalid] EF - Gloas - Operations - Execution Payload Bid - process_execution_payload_bid_ OK
4112+
+ [Invalid] EF - Gloas - Operations - Execution Payload Bid - process_execution_payload_bid_ OK
41114113
+ [Valid] EF - Gloas - Operations - Execution Payload Bid - process_execution_payload_bid_ OK
41124114
+ [Valid] EF - Gloas - Operations - Execution Payload Bid - process_execution_payload_bid_ OK
41134115
+ [Valid] EF - Gloas - Operations - Execution Payload Bid - process_execution_payload_bid_ OK

beacon_chain/spec/beaconstate.nim

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2550,7 +2550,7 @@ func upgrade_to_next*(
25502550
proposer_lookahead: initialize_proposer_lookahead(pre, cache)
25512551
)
25522552

2553-
# https://github.com/ethereum/consensus-specs/blob/v1.6.0-beta.0/specs/gloas/fork.md#upgrading-the-state
2553+
# https://github.com/ethereum/consensus-specs/blob/v1.6.1/specs/gloas/fork.md#upgrading-the-state
25542554
# upgrade_to_gloas
25552555
func upgrade_to_next*(
25562556
cfg: RuntimeConfig, pre: fulu.BeaconState, _: var StateCache): gloas.BeaconState =
@@ -2612,7 +2612,9 @@ func upgrade_to_next*(
26122612
next_sync_committee: pre.next_sync_committee,
26132613

26142614
# [Modified in Gloas:EIP7732]
2615-
latest_execution_payload_bid: gloas.ExecutionPayloadBid(),
2615+
latest_execution_payload_bid: gloas.ExecutionPayloadBid(
2616+
block_hash: pre.latest_execution_payload_header.block_hash
2617+
),
26162618
next_withdrawal_index: pre.next_withdrawal_index,
26172619
next_withdrawal_validator_index: pre.next_withdrawal_validator_index,
26182620
historical_summaries: pre.historical_summaries,

beacon_chain/spec/datatypes/base.nim

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ export
8080
eth_types_json_serialization.writeValue
8181

8282
# https://github.com/ethereum/consensus-specs/releases
83-
const SPEC_VERSION* = "1.6.0"
83+
const SPEC_VERSION* = "1.6.1"
8484
## Spec version we're aiming to be compatible with, right now
8585

8686
const

beacon_chain/spec/datatypes/gloas.nim

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,17 +74,18 @@ type
7474
blobsBundle*: fulu.BlobsBundle # [New in Fulu]
7575
executionRequests*: seq[seq[byte]]
7676

77-
# https://github.com/ethereum/consensus-specs/blob/v1.6.0-beta.0/specs/gloas/beacon-chain.md#executionpayloadbid
77+
# https://github.com/ethereum/consensus-specs/blob/v1.6.1/specs/gloas/beacon-chain.md#executionpayloadbid
7878
ExecutionPayloadBid* = object
79-
# Execution block header fields
8079
parent_block_hash*: Eth2Digest
8180
parent_block_root*: Eth2Digest
8281
block_hash*: Eth2Digest
82+
prev_randao*: Eth2Digest
8383
fee_recipient*: ExecutionAddress
8484
gas_limit*: uint64
8585
builder_index*: uint64
8686
slot*: Slot
8787
value*: Gwei
88+
execution_payment*: Gwei
8889
blob_kzg_commitments_root*: Eth2Digest
8990

9091
# https://github.com/ethereum/consensus-specs/blob/v1.6.0-beta.0/specs/gloas/beacon-chain.md#signedexecutionpayloadbid

beacon_chain/spec/state_transition_block.nim

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1124,7 +1124,7 @@ proc process_execution_payload*(
11241124

11251125
ok()
11261126

1127-
# https://github.com/ethereum/consensus-specs/blob/v1.6.0-beta.0/specs/gloas/beacon-chain.md#new-process_execution_payload
1127+
# https://github.com/ethereum/consensus-specs/blob/v1.6.1/specs/gloas/beacon-chain.md#new-process_execution_payload
11281128
proc process_execution_payload*(
11291129
cfg: RuntimeConfig, state: var gloas.HashedBeaconState,
11301130
signed_envelope: SignedExecutionPayloadEnvelope,
@@ -1163,6 +1163,8 @@ proc process_execution_payload*(
11631163
if committed_bid.blob_kzg_commitments_root !=
11641164
hash_tree_root(envelope.blob_kzg_commitments):
11651165
return err("process_execution_payload: blob KZG commitments root mismatch")
1166+
if not(committed_bid.prev_randao == payload.prev_randao):
1167+
return err("process_execution_payload: prev_randao mismatch")
11661168

11671169
# Verify the withdrawals root
11681170
if hash_tree_root(payload.withdrawals) != state.data.latest_withdrawals_root:
@@ -1180,11 +1182,6 @@ proc process_execution_payload*(
11801182
if payload.parent_hash != state.data.latest_block_hash:
11811183
return err("process_execution_payload: parent hash mismatch")
11821184

1183-
# Verify prev_randao
1184-
if payload.prev_randao !=
1185-
get_randao_mix(state.data, get_current_epoch(state.data)):
1186-
return err("process_execution_payload: prev_randao mismatch")
1187-
11881185
# Verify timestamp
11891186
if payload.timestamp != cfg.timeParams
11901187
.compute_timestamp_at_slot(state.data, state.data.slot):

beacon_chain/spec/state_transition_epoch.nim

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1601,7 +1601,7 @@ proc process_epoch*(
16011601

16021602
ok()
16031603

1604-
# https://github.com/ethereum/consensus-specs/blob/v1.6.0-alpha.6/specs/gloas/beacon-chain.md#modified-process_epoch
1604+
# https://github.com/ethereum/consensus-specs/blob/v1.6.1/specs/gloas/beacon-chain.md#modified-process_epoch
16051605
proc process_epoch*(
16061606
cfg: RuntimeConfig, state: var gloas.BeaconState,
16071607
flags: UpdateFlags, cache: var StateCache, info: var altair.EpochInfo):
@@ -1628,6 +1628,7 @@ proc process_epoch*(
16281628
process_slashings(state, info.balances.current_epoch)
16291629
process_eth1_data_reset(state)
16301630
? process_pending_deposits(cfg, state, cache)
1631+
? process_builder_pending_payments(cfg, state, cache) # [New in Gloas:EIP7732]
16311632
? process_pending_consolidations(cfg, state)
16321633
process_effective_balance_updates(state)
16331634
process_slashings_reset(state)
@@ -1636,6 +1637,5 @@ proc process_epoch*(
16361637
process_participation_flag_updates(state)
16371638
process_sync_committee_updates(state)
16381639
? process_proposer_lookahead(state, cache)
1639-
? process_builder_pending_payments(cfg, state, cache) # [New in Gloas:EIP7732]
16401640

16411641
ok()

tests/consensus_spec/gloas/test_fixture_operations.nim

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -219,20 +219,9 @@ suite baseDescription & "Execution Payload " & preset():
219219
res
220220

221221
for path in walkTests(OpExecutionPayloadDir):
222-
let
223-
testDir = OpExecutionPayloadDir / "pyspec_tests" / path
224-
inputFile =
225-
if fileExists(testDir/"signed_envelope.ssz_snappy"):
226-
"signed_envelope"
227-
# Skip test vectors with missing signed envelope files
228-
# will be fixed in next consensus-spec-tests release
229-
# https://github.com/ethereum/consensus-specs/issues/4545
230-
else:
231-
continue
232-
233222
let applyExecutionPayload = makeApplyExecutionPayloadCb(path)
234223
runTest[SignedExecutionPayloadEnvelope, typeof applyExecutionPayload](
235-
OpExecutionPayloadDir, suiteName, "Execution Payload", inputFile,
224+
OpExecutionPayloadDir, suiteName, "Execution Payload", "signed_envelope",
236225
applyExecutionPayload, path)
237226

238227
suite baseDescription & "Execution Payload Bid " & preset():

tests/consensus_spec/test_fixture_fork_choice.nim

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,7 @@ proc stepOnBlock(
270270

271271
let blockAdded = dag.addHeadBlock(verifier, signedBlock) do (
272272
blckRef: BlockRef, signedBlock: consensusFork.TrustedSignedBeaconBlock,
273-
state: consensusFork.Beaconstate,
273+
state: consensusFork.BeaconState,
274274
epochRef: EpochRef, unrealized: FinalityCheckpoints):
275275

276276
# 4. Update fork choice if valid

vendor/nim-eth2-scenarios

0 commit comments

Comments
 (0)