diff --git a/application/src/actor.rs b/application/src/actor.rs index af447af..4a02915 100644 --- a/application/src/actor.rs +++ b/application/src/actor.rs @@ -452,6 +452,8 @@ impl< aux_data.forkchoice, current, withdrawals, + Default::default(), + None, parent_block.height(), ) .await @@ -459,7 +461,13 @@ impl< #[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 } } diff --git a/example_genesis.toml b/example_genesis.toml index 000b9dc..a163638 100644 --- a/example_genesis.toml +++ b/example_genesis.toml @@ -1,4 +1,4 @@ -eth_genesis_hash = "0xda190bd7877d50c8d16bb9cacb68e54a280ce203fb8b3b838637b39265c1d3b5" +eth_genesis_hash = "0x3bba1a6bb7df768e68169e3d62d8c1aea0461bfa967184593bec516fa507eca5" leader_timeout_ms = 2000 notarization_timeout_ms = 4000 nullify_timeout_ms = 4000 diff --git a/finalizer/src/actor.rs b/finalizer/src/actor.rs index 99a7980..9991cf8 100644 --- a/finalizer/src/actor.rs +++ b/finalizer/src/actor.rs @@ -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. @@ -815,6 +825,7 @@ impl< .unwrap_or_default(), removed_validators: state.removed_validators.clone(), forkchoice: state.forkchoice, + withdrawal_credentials, } } else { BlockAuxData { @@ -825,6 +836,7 @@ impl< added_validators: vec![], removed_validators: vec![], forkchoice: state.forkchoice, + withdrawal_credentials, } }; trace!( diff --git a/finalizer/src/tests/mocks.rs b/finalizer/src/tests/mocks.rs index 517c3e5..999de7a 100644 --- a/finalizer/src/tests/mocks.rs +++ b/finalizer/src/tests/mocks.rs @@ -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, @@ -19,6 +19,8 @@ impl EngineClient for MockEngineClient { _fork_choice_state: ForkchoiceState, _timestamp: u64, _withdrawals: Vec, + _suggested_fee_recipient: Address, + _parent_beacon_block_root: Option>, #[cfg(feature = "bench")] height: u64, ) -> Option { Some(PayloadId::new([0u8; 8])) diff --git a/node/src/bin/execute_blocks.rs b/node/src/bin/execute_blocks.rs index 8bdc30d..0c9c973 100644 --- a/node/src/bin/execute_blocks.rs +++ b/node/src/bin/execute_blocks.rs @@ -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; diff --git a/node/src/test_harness/mock_engine_client.rs b/node/src/test_harness/mock_engine_client.rs index 6592d86..2c7cf96 100644 --- a/node/src/test_harness/mock_engine_client.rs +++ b/node/src/test_harness/mock_engine_client.rs @@ -314,6 +314,8 @@ impl EngineClient for MockEngineClient { fork_choice_state: ForkchoiceState, timestamp: u64, withdrawals: Vec, + _suggested_fee_recipient: Address, + _parent_beacon_block_root: Option>, #[cfg(feature = "bench")] height: u64, ) -> Option { let mut state = self.state.lock().unwrap(); @@ -674,6 +676,8 @@ mod tests { genesis_state, 1000, vec![], + Default::default(), + None, #[cfg(feature = "bench")] 0, ) @@ -742,6 +746,8 @@ mod tests { genesis_state, 1000, vec![], + Default::default(), + None, #[cfg(feature = "bench")] 0, ) @@ -824,6 +830,8 @@ mod tests { fork_choice, (round * 1000) as u64, vec![], + Default::default(), + None, #[cfg(feature = "bench")] round, ) @@ -912,6 +920,8 @@ mod tests { genesis_state, 1000, vec![withdrawal.clone()], + Default::default(), + None, #[cfg(feature = "bench")] 0, ) @@ -997,6 +1007,8 @@ mod tests { genesis_state, 1000, vec![], + Default::default(), + None, #[cfg(feature = "bench")] 0, ) @@ -1011,6 +1023,8 @@ mod tests { genesis_state, 1000, vec![], + Default::default(), + None, #[cfg(feature = "bench")] 0, ) diff --git a/types/src/engine_client.rs b/types/src/engine_client.rs index b04cd8f..fec9eb2 100644 --- a/types/src/engine_client.rs +++ b/types/src/engine_client.rs @@ -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, @@ -34,6 +35,8 @@ pub trait EngineClient: Clone + Send + Sync + 'static { fork_choice_state: ForkchoiceState, timestamp: u64, withdrawals: Vec, + suggested_fee_recipient: Address, + parent_beacon_block_root: Option>, #[cfg(feature = "bench")] height: u64, ) -> impl Future> + Send; @@ -90,16 +93,18 @@ impl EngineClient for RethEngineClient { fork_choice_state: ForkchoiceState, timestamp: u64, withdrawals: Vec, + suggested_fee_recipient: Address, + parent_beacon_block_root: Option>, #[cfg(feature = "bench")] _height: u64, ) -> Option { 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 @@ -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, @@ -230,6 +235,8 @@ pub mod benchmarking { _fork_choice_state: ForkchoiceState, _timestamp: u64, _withdrawals: Vec, + _suggested_fee_recipient: Address, + _parent_beacon_block_hash: Option>, #[cfg(feature = "bench")] height: u64, ) -> Option { let next_block_num = height + 1; diff --git a/types/src/lib.rs b/types/src/lib.rs index 65f3932..f47d7a4 100644 --- a/types/src/lib.rs +++ b/types/src/lib.rs @@ -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::*; @@ -44,6 +45,7 @@ pub struct BlockAuxData { pub added_validators: Vec, pub removed_validators: Vec, pub forkchoice: ForkchoiceState, + pub withdrawal_credentials: Address, } pub use commonware_cryptography::bls12381;