Skip to content

Commit 2a96e60

Browse files
committed
Update consensus-spec-tests to v1.6.1
1 parent d7c396a commit 2a96e60

File tree

7 files changed

+38
-15
lines changed

7 files changed

+38
-15
lines changed

helper_functions/src/fork.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -841,6 +841,11 @@ pub fn upgrade_to_gloas<P: Preset>(
841841
epoch,
842842
};
843843

844+
let latest_execution_payload_bid = ExecutionPayloadBid {
845+
block_hash: latest_execution_payload_header.block_hash,
846+
..Default::default()
847+
};
848+
844849
GloasBeaconState {
845850
// > Versioning
846851
genesis_time,
@@ -877,7 +882,7 @@ pub fn upgrade_to_gloas<P: Preset>(
877882
current_sync_committee,
878883
next_sync_committee,
879884
// > Execution
880-
latest_execution_payload_bid: ExecutionPayloadBid::default(),
885+
latest_execution_payload_bid,
881886
// > Withdrawals
882887
next_withdrawal_index,
883888
next_withdrawal_validator_index,

scripts/download_spec_tests.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/usr/bin/env bash
22
set -euo pipefail
33

4-
SPEC_VERSION="${SPEC_VERSION:-v1.6.0}"
4+
SPEC_VERSION="${SPEC_VERSION:-v1.6.1}"
55
TESTS_DIR="consensus-spec-tests"
66
VERSION_FILE="${TESTS_DIR}/.version"
77
BASE_URL="https://github.com/ethereum/consensus-specs/releases/download/${SPEC_VERSION}"

transition_functions/src/gloas/block_processing.rs

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ use helper_functions::{
77
accessors::{
88
self, attestation_epoch, get_attestation_participation_flags, get_base_reward,
99
get_base_reward_per_increment, get_beacon_proposer_index, get_current_epoch,
10-
get_indexed_payload_attestation, get_previous_epoch, initialize_shuffled_indices,
10+
get_indexed_payload_attestation, get_previous_epoch, get_randao_mix,
11+
initialize_shuffled_indices,
1112
},
1213
electra::{
1314
get_attesting_indices, get_indexed_attestation, is_fully_withdrawable_validator,
@@ -482,6 +483,7 @@ fn validate_execution_payload_bid<P: Preset>(
482483
slot,
483484
parent_block_hash,
484485
parent_block_root,
486+
prev_randao,
485487
..
486488
} = signed_bid.message;
487489
let builder = state.validators().get(builder_index)?;
@@ -511,6 +513,7 @@ fn validate_execution_payload_bid<P: Preset>(
511513
);
512514
}
513515

516+
// > Check that the builder is active, non-slashed
514517
let current_epoch = get_current_epoch(state);
515518
ensure!(
516519
is_active_validator(builder, current_epoch),
@@ -527,7 +530,7 @@ fn validate_execution_payload_bid<P: Preset>(
527530
}
528531
);
529532

530-
// > Check that the builder is active, non-slashed, and has funds to cover the bid
533+
// > Check that builder has funds to cover the bid
531534
let builder_balance = *state.balances().get(builder_index)?;
532535
let pending_withdrawals = state
533536
.builder_pending_withdrawals()
@@ -579,6 +582,16 @@ fn validate_execution_payload_bid<P: Preset>(
579582
}
580583
);
581584

585+
// > Verify prev_randao
586+
let in_state = get_randao_mix(state, current_epoch);
587+
ensure!(
588+
prev_randao == in_state,
589+
Error::<P>::BidPrevRandaoMismatch {
590+
in_bid: prev_randao,
591+
in_state,
592+
},
593+
);
594+
582595
Ok(())
583596
}
584597

@@ -596,6 +609,7 @@ pub fn process_execution_payload_bid<P: Preset>(
596609
fee_recipient,
597610
..
598611
} = signed_bid.message;
612+
599613
validate_execution_payload_bid(config, pubkey_cache, state, block)?;
600614

601615
// > Record the pending payment if there is some payment

transition_functions/src/gloas/epoch_processing.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,8 @@ pub fn process_epoch(
7575
unphased::process_eth1_data_reset(state);
7676
electra::process_pending_deposits(config, pubkey_cache, state)?;
7777
electra::process_pending_consolidations(state)?;
78+
79+
process_builder_pending_payments(config, state)?;
7880
electra::process_effective_balance_updates(state);
7981
unphased::process_slashings_reset(state);
8082
unphased::process_randao_mixes_reset(state);
@@ -87,8 +89,6 @@ pub fn process_epoch(
8789

8890
fulu::process_proposer_lookahead(config, state)?;
8991

90-
process_builder_pending_payments(config, state)?;
91-
9292
state.cache.advance_epoch();
9393

9494
Ok(())

transition_functions/src/gloas/execution_payload_processing.rs

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use anyhow::{ensure, Result};
22
use execution_engine::ExecutionEngine;
33
use helper_functions::{
4-
accessors::{get_current_epoch, get_randao_mix},
4+
accessors::get_current_epoch,
55
error::SignatureKind,
66
misc::{self, compute_timestamp_at_slot, kzg_commitment_to_versioned_hash},
77
mutators::compute_exit_epoch_and_update_churn,
@@ -130,6 +130,13 @@ pub fn validate_execution_payload<P: Preset>(
130130
}
131131
);
132132

133+
let in_state = committed_bid.prev_randao;
134+
let in_block = payload.prev_randao;
135+
ensure!(
136+
in_state == in_block,
137+
Error::<P>::ExecutionPayloadPrevRandaoMismatch { in_state, in_block },
138+
);
139+
133140
// > Verify the withdrawals root
134141
let in_payload = payload.withdrawals.hash_tree_root();
135142
let in_state = state.latest_withdrawals_root();
@@ -171,14 +178,6 @@ pub fn validate_execution_payload<P: Preset>(
171178
Error::<P>::ExecutionPayloadParentHashMismatch { in_state, in_block },
172179
);
173180

174-
// > Verify prev_randao
175-
let in_state = get_randao_mix(state, get_current_epoch(state));
176-
let in_block = payload.prev_randao;
177-
ensure!(
178-
in_state == in_block,
179-
Error::<P>::ExecutionPayloadPrevRandaoMismatch { in_state, in_block },
180-
);
181-
182181
Ok(())
183182
}
184183

transition_functions/src/unphased/error.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,8 @@ pub enum Error<P: Preset> {
5050
},
5151
#[error("bid parent block root ({in_bid:?}) does not match in block ({in_block:?})")]
5252
BidParentBlockRootMismatch { in_bid: H256, in_block: H256 },
53+
#[error("bid prev randao ({in_bid:?}) does not match in state ({in_state:?})")]
54+
BidPrevRandaoMismatch { in_bid: H256, in_state: H256 },
5355
#[error("block is not newer than latest block header ({block_slot} <= {block_header_slot})")]
5456
BlockNotNewerThanLatestBlockHeader {
5557
block_slot: Slot,

types/src/gloas/containers.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ pub struct ExecutionPayloadBid {
9595
pub parent_block_hash: ExecutionBlockHash,
9696
pub parent_block_root: H256,
9797
pub block_hash: ExecutionBlockHash,
98+
pub prev_randao: H256,
9899
pub fee_recipient: ExecutionAddress,
99100
#[serde(with = "serde_utils::string_or_native")]
100101
pub gas_limit: Gas,
@@ -104,6 +105,8 @@ pub struct ExecutionPayloadBid {
104105
pub slot: Slot,
105106
#[serde(with = "serde_utils::string_or_native")]
106107
pub value: Gwei,
108+
#[serde(with = "serde_utils::string_or_native")]
109+
pub execution_payment: Gwei,
107110
pub blob_kzg_commitments_root: H256,
108111
}
109112

0 commit comments

Comments
 (0)