Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion application/src/actor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -452,14 +452,22 @@ impl<
aux_data.forkchoice,
current,
withdrawals,
Default::default(),
None,
parent_block.height(),
)
.await
}
#[cfg(not(feature = "bench"))]
{
self.engine_client
.start_building_block(aux_data.forkchoice, current, withdrawals)
.start_building_block(
aux_data.forkchoice,
current,
withdrawals,
aux_data.withdrawal_credentials,
Some(parent.1.0.into()),
)
.await
}
}
Expand Down
2 changes: 1 addition & 1 deletion example_genesis.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
eth_genesis_hash = "0xda190bd7877d50c8d16bb9cacb68e54a280ce203fb8b3b838637b39265c1d3b5"
eth_genesis_hash = "0x3bba1a6bb7df768e68169e3d62d8c1aea0461bfa967184593bec516fa507eca5"
leader_timeout_ms = 2000
notarization_timeout_ms = 4000
nullify_timeout_ms = 4000
Expand Down
12 changes: 12 additions & 0 deletions finalizer/src/actor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -767,6 +767,16 @@ impl<
return;
};

let withdrawal_credentials = state
.get_account(
self.node_public_key
.as_ref()
.try_into()
.expect("Safe: Ed pub key always 32 bytes"),
)
.map(|account| account.withdrawal_credentials)
.unwrap_or_default();

// Create checkpoint if we're at an epoch boundary.
// The consensus state is saved every `epoch_num_blocks` blocks.
// The proposed block will contain the checkpoint that was saved at the previous height.
Expand Down Expand Up @@ -815,6 +825,7 @@ impl<
.unwrap_or_default(),
removed_validators: state.removed_validators.clone(),
forkchoice: state.forkchoice,
withdrawal_credentials,
}
} else {
BlockAuxData {
Expand All @@ -825,6 +836,7 @@ impl<
added_validators: vec![],
removed_validators: vec![],
forkchoice: state.forkchoice,
withdrawal_credentials,
}
};
trace!(
Expand Down
4 changes: 3 additions & 1 deletion finalizer/src/tests/mocks.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//! Mock implementations for finalizer tests.

use alloy_primitives::U256;
use alloy_primitives::{Address, FixedBytes, U256};
use alloy_rpc_types_engine::{
ExecutionPayloadEnvelopeV3, ExecutionPayloadEnvelopeV4, ExecutionPayloadV1, ExecutionPayloadV2,
ExecutionPayloadV3, ForkchoiceState, PayloadId, PayloadStatus, PayloadStatusEnum,
Expand All @@ -19,6 +19,8 @@ impl EngineClient for MockEngineClient {
_fork_choice_state: ForkchoiceState,
_timestamp: u64,
_withdrawals: Vec<alloy_eips::eip4895::Withdrawal>,
_suggested_fee_recipient: Address,
_parent_beacon_block_root: Option<FixedBytes<32>>,
#[cfg(feature = "bench")] height: u64,
) -> Option<PayloadId> {
Some(PayloadId::new([0u8; 8]))
Expand Down
13 changes: 11 additions & 2 deletions node/src/bin/execute_blocks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,19 @@ async fn main() -> Result<()> {
println!("Block number: {}", block_number);
#[cfg(feature = "bench")]
let result = client
.start_building_block(forkchoice, 0, vec![], block_number)
.start_building_block(
forkchoice,
0,
vec![],
Default::default(),
None,
block_number,
)
.await;
#[cfg(not(feature = "bench"))]
let result = client.start_building_block(forkchoice, 0, vec![]).await;
let result = client
.start_building_block(forkchoice, 0, vec![], Default::default(), None)
.await;
match result {
Some(payload_id) => {
let payload = client.get_payload(payload_id).await;
Expand Down
14 changes: 14 additions & 0 deletions node/src/test_harness/mock_engine_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,8 @@ impl EngineClient for MockEngineClient {
fork_choice_state: ForkchoiceState,
timestamp: u64,
withdrawals: Vec<Withdrawal>,
_suggested_fee_recipient: Address,
_parent_beacon_block_root: Option<FixedBytes<32>>,
#[cfg(feature = "bench")] height: u64,
) -> Option<PayloadId> {
let mut state = self.state.lock().unwrap();
Expand Down Expand Up @@ -674,6 +676,8 @@ mod tests {
genesis_state,
1000,
vec![],
Default::default(),
None,
#[cfg(feature = "bench")]
0,
)
Expand Down Expand Up @@ -742,6 +746,8 @@ mod tests {
genesis_state,
1000,
vec![],
Default::default(),
None,
#[cfg(feature = "bench")]
0,
)
Expand Down Expand Up @@ -824,6 +830,8 @@ mod tests {
fork_choice,
(round * 1000) as u64,
vec![],
Default::default(),
None,
#[cfg(feature = "bench")]
round,
)
Expand Down Expand Up @@ -912,6 +920,8 @@ mod tests {
genesis_state,
1000,
vec![withdrawal.clone()],
Default::default(),
None,
#[cfg(feature = "bench")]
0,
)
Expand Down Expand Up @@ -997,6 +1007,8 @@ mod tests {
genesis_state,
1000,
vec![],
Default::default(),
None,
#[cfg(feature = "bench")]
0,
)
Expand All @@ -1011,6 +1023,8 @@ mod tests {
genesis_state,
1000,
vec![],
Default::default(),
None,
#[cfg(feature = "bench")]
0,
)
Expand Down
13 changes: 10 additions & 3 deletions types/src/engine_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ engine_newPayloadV3 : This is called to store(not commit) and validate blocks re

*/
use alloy_eips::eip4895::Withdrawal;
use alloy_primitives::{Address, FixedBytes};
use alloy_provider::{ProviderBuilder, RootProvider, ext::EngineApi};
use alloy_rpc_types_engine::{
ExecutionPayloadEnvelopeV4, ForkchoiceState, PayloadAttributes, PayloadId, PayloadStatus,
Expand All @@ -34,6 +35,8 @@ pub trait EngineClient: Clone + Send + Sync + 'static {
fork_choice_state: ForkchoiceState,
timestamp: u64,
withdrawals: Vec<Withdrawal>,
suggested_fee_recipient: Address,
parent_beacon_block_root: Option<FixedBytes<32>>,
#[cfg(feature = "bench")] height: u64,
) -> impl Future<Output = Option<PayloadId>> + Send;

Expand Down Expand Up @@ -90,16 +93,18 @@ impl EngineClient for RethEngineClient {
fork_choice_state: ForkchoiceState,
timestamp: u64,
withdrawals: Vec<Withdrawal>,
suggested_fee_recipient: Address,
parent_beacon_block_root: Option<FixedBytes<32>>,
#[cfg(feature = "bench")] _height: u64,
) -> Option<PayloadId> {
let payload_attributes = PayloadAttributes {
timestamp,
prev_randao: [0; 32].into(),
// todo(dalton): this should be the validators public key
suggested_fee_recipient: [1; 20].into(),
suggested_fee_recipient,
withdrawals: Some(withdrawals),
// todo(dalton): we should make this something that we can associate with the simplex height
parent_beacon_block_root: Some([1; 32].into()),
parent_beacon_block_root,
};

let res = match self
Expand Down Expand Up @@ -195,7 +200,7 @@ pub mod benchmarking {
use crate::{Block, Digest};
use alloy_eips::eip4895::Withdrawal;
use alloy_eips::eip7685::Requests;
use alloy_primitives::{B256, FixedBytes, U256};
use alloy_primitives::{Address, B256, FixedBytes, U256};
use alloy_provider::{ProviderBuilder, RootProvider, ext::EngineApi};
use alloy_rpc_types_engine::{
ExecutionPayloadEnvelopeV3, ExecutionPayloadEnvelopeV4, ExecutionPayloadV3,
Expand Down Expand Up @@ -230,6 +235,8 @@ pub mod benchmarking {
_fork_choice_state: ForkchoiceState,
_timestamp: u64,
_withdrawals: Vec<Withdrawal>,
_suggested_fee_recipient: Address,
_parent_beacon_block_hash: Option<FixedBytes<32>>,
#[cfg(feature = "bench")] height: u64,
) -> Option<PayloadId> {
let next_block_num = height + 1;
Expand Down
2 changes: 2 additions & 0 deletions types/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ pub mod scheme;
pub mod utils;
pub mod withdrawal;

use alloy_primitives::Address;
use alloy_rpc_types_engine::ForkchoiceState;
pub use block::*;
pub use engine_client::*;
Expand All @@ -44,6 +45,7 @@ pub struct BlockAuxData {
pub added_validators: Vec<AddedValidator>,
pub removed_validators: Vec<PublicKey>,
pub forkchoice: ForkchoiceState,
pub withdrawal_credentials: Address,
}

pub use commonware_cryptography::bls12381;
Expand Down