Merge branch 'unstable' into vc-fallback

This commit is contained in:
Mac L
2023-12-01 12:52:54 +11:00
120 changed files with 4745 additions and 2348 deletions

View File

@@ -4,7 +4,8 @@ use crate::execution_engine::{
use crate::transactions::transactions;
use ethers_providers::Middleware;
use execution_layer::{
BuilderParams, ChainHealth, ExecutionLayer, PayloadAttributes, PayloadStatus,
BlockProposalContentsType, BuilderParams, ChainHealth, ExecutionLayer, PayloadAttributes,
PayloadStatus,
};
use fork_choice::ForkchoiceUpdateParameters;
use reqwest::{header::CONTENT_TYPE, Client};
@@ -14,9 +15,10 @@ use std::sync::Arc;
use std::time::{Duration, Instant, SystemTime, UNIX_EPOCH};
use task_executor::TaskExecutor;
use tokio::time::sleep;
use types::payload::BlockProductionVersion;
use types::{
Address, ChainSpec, EthSpec, ExecutionBlockHash, ExecutionPayload, ExecutionPayloadHeader,
ForkName, FullPayload, Hash256, MainnetEthSpec, PublicKeyBytes, Slot, Uint256,
ForkName, Hash256, MainnetEthSpec, PublicKeyBytes, Slot, Uint256,
};
const EXECUTION_ENGINE_START_TIMEOUT: Duration = Duration::from_secs(60);
@@ -322,21 +324,26 @@ impl<E: GenericExecutionEngine> TestRig<E> {
Some(vec![]),
None,
);
let valid_payload = self
let block_proposal_content_type = self
.ee_a
.execution_layer
.get_payload::<FullPayload<MainnetEthSpec>>(
.get_payload(
parent_hash,
&payload_attributes,
forkchoice_update_params,
builder_params,
TEST_FORK,
&self.spec,
BlockProductionVersion::FullV2,
)
.await
.unwrap()
.to_payload()
.execution_payload();
.unwrap();
let valid_payload = match block_proposal_content_type {
BlockProposalContentsType::Full(block) => block.to_payload().execution_payload(),
BlockProposalContentsType::Blinded(_) => panic!("Should always be a full payload"),
};
assert_eq!(valid_payload.transactions().len(), pending_txs.len());
/*
@@ -468,21 +475,25 @@ impl<E: GenericExecutionEngine> TestRig<E> {
Some(vec![]),
None,
);
let second_payload = self
let block_proposal_content_type = self
.ee_a
.execution_layer
.get_payload::<FullPayload<MainnetEthSpec>>(
.get_payload(
parent_hash,
&payload_attributes,
forkchoice_update_params,
builder_params,
TEST_FORK,
&self.spec,
BlockProductionVersion::FullV2,
)
.await
.unwrap()
.to_payload()
.execution_payload();
.unwrap();
let second_payload = match block_proposal_content_type {
BlockProposalContentsType::Full(block) => block.to_payload().execution_payload(),
BlockProposalContentsType::Blinded(_) => panic!("Should always be a full payload"),
};
/*
* Execution Engine A:

View File

@@ -11,7 +11,7 @@ types = { workspace = true }
tempfile = { workspace = true }
eth2 = { workspace = true }
validator_client = { workspace = true }
validator_dir = { workspace = true }
validator_dir = { workspace = true, features = ["insecure_keys"] }
sensitive_url = { workspace = true }
execution_layer = { workspace = true }
tokio = { workspace = true }

View File

@@ -21,7 +21,7 @@ pub use eth2;
pub use execution_layer::test_utils::{
Config as MockServerConfig, MockExecutionConfig, MockServer,
};
pub use validator_client::Config as ValidatorConfig;
pub use validator_client::{ApiTopic, Config as ValidatorConfig};
/// The global timeout for HTTP requests to the beacon node.
const HTTP_TIMEOUT: Duration = Duration::from_secs(8);

View File

@@ -7,7 +7,7 @@ use crate::retry::with_retry;
use futures::prelude::*;
use node_test_rig::{
environment::{EnvironmentBuilder, LoggerConfig},
testing_validator_config, ValidatorFiles,
testing_validator_config, ApiTopic, ValidatorFiles,
};
use rayon::prelude::*;
use std::cmp::max;
@@ -154,10 +154,25 @@ pub fn run_eth1_sim(matches: &ArgMatches) -> Result<(), String> {
validator_config.fee_recipient = Some(SUGGESTED_FEE_RECIPIENT.into());
}
println!("Adding validator client {}", i);
network_1
.add_validator_client(validator_config, i, files, i % 2 == 0)
.await
.expect("should add validator");
// Enable broadcast on every 4th node.
if i % 4 == 0 {
validator_config.broadcast_topics = ApiTopic::all();
let beacon_nodes = vec![i, (i + 1) % node_count];
network_1
.add_validator_client_with_fallbacks(
validator_config,
i,
beacon_nodes,
files,
)
.await
} else {
network_1
.add_validator_client(validator_config, i, files, i % 2 == 0)
.await
}
.expect("should add validator");
},
"vc",
);

View File

@@ -127,7 +127,7 @@ vectors_and_tests!(
ExitTest {
block_modifier: Box::new(|_, block| {
// Duplicate the exit
let exit = block.body().voluntary_exits().get(0).unwrap().clone();
let exit = block.body().voluntary_exits().first().unwrap().clone();
block.body_mut().voluntary_exits_mut().push(exit).unwrap();
}),
expected: Err(BlockProcessingError::ExitInvalid {