mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-09 11:41:51 +00:00
Lenient duplicate checks on HTTP API for block publication (#5574)
* start splitting gossip verification * WIP * Gossip verify separate (#7) * save * save * make ProvenancedBlock concrete * delete into gossip verified block contents * get rid of IntoBlobSidecar trait * remove IntoGossipVerified trait * get tests compiling * don't check sidecar slashability in publish * remove second publish closure * drop blob bool. also prefer using message index over index of position in list * Merge remote-tracking branch 'origin/unstable' into gossip-verify-separate * Fix low-hanging tests * Fix tests and clean up * Clean up imports * more cleanup * Merge remote-tracking branch 'origin/unstable' into gossip-verify-separate * Further refine behaviour and add tests * Merge remote-tracking branch 'origin/unstable' into gossip-verify-separate * Merge remote-tracking branch 'origin/unstable' into gossip-verify-separate * Remove empty line * Fix test (block is not fully imported just gossip verified) * Merge remote-tracking branch 'origin/unstable' into gossip-verify-separate * Update for unstable & use empty blob list * Update comment * Add test for duplicate block case * Merge remote-tracking branch 'origin/unstable' into gossip-verify-separate * Clarify unreachable case * Fix another publish_block case * Remove unreachable case in filter chain segment * Revert unrelated blob optimisation * Merge remote-tracking branch 'origin/unstable' into gossip-verify-separate * Merge remote-tracking branch 'origin/unstable' into gossip-verify-separate * Fix merge conflicts * Merge remote-tracking branch 'origin/unstable' into gossip-verify-separate * Fix some compilation issues. Impl is fucked though * Support peerDAS * Fix tests * Merge remote-tracking branch 'origin/unstable' into gossip-verify-separate * Fix conflict * Merge remote-tracking branch 'origin/unstable' into gossip-verify-separate * Address review comments * Merge remote-tracking branch 'origin/unstable' into gossip-verify-separate
This commit is contained in:
@@ -61,7 +61,8 @@ type Mutator<E> = BoxedMutator<E, MemoryStore<E>, MemoryStore<E>>;
|
||||
|
||||
impl<E: EthSpec> InteractiveTester<E> {
|
||||
pub async fn new(spec: Option<ChainSpec>, validator_count: usize) -> Self {
|
||||
Self::new_with_initializer_and_mutator(spec, validator_count, None, None).await
|
||||
Self::new_with_initializer_and_mutator(spec, validator_count, None, None, Config::default())
|
||||
.await
|
||||
}
|
||||
|
||||
pub async fn new_with_initializer_and_mutator(
|
||||
@@ -69,6 +70,7 @@ impl<E: EthSpec> InteractiveTester<E> {
|
||||
validator_count: usize,
|
||||
initializer: Option<Initializer<E>>,
|
||||
mutator: Option<Mutator<E>>,
|
||||
config: Config,
|
||||
) -> Self {
|
||||
let mut harness_builder = BeaconChainHarness::builder(E::default())
|
||||
.spec_or_default(spec.map(Arc::new))
|
||||
@@ -99,8 +101,9 @@ impl<E: EthSpec> InteractiveTester<E> {
|
||||
listening_socket,
|
||||
network_rx,
|
||||
..
|
||||
} = create_api_server(
|
||||
} = create_api_server_with_config(
|
||||
harness.chain.clone(),
|
||||
config,
|
||||
&harness.runtime,
|
||||
harness.logger().clone(),
|
||||
)
|
||||
@@ -131,6 +134,15 @@ pub async fn create_api_server<T: BeaconChainTypes>(
|
||||
chain: Arc<BeaconChain<T>>,
|
||||
test_runtime: &TestRuntime,
|
||||
log: Logger,
|
||||
) -> ApiServer<T, impl Future<Output = ()>> {
|
||||
create_api_server_with_config(chain, Config::default(), test_runtime, log).await
|
||||
}
|
||||
|
||||
pub async fn create_api_server_with_config<T: BeaconChainTypes>(
|
||||
chain: Arc<BeaconChain<T>>,
|
||||
http_config: Config,
|
||||
test_runtime: &TestRuntime,
|
||||
log: Logger,
|
||||
) -> ApiServer<T, impl Future<Output = ()>> {
|
||||
// Use port 0 to allocate a new unused port.
|
||||
let port = 0;
|
||||
@@ -220,12 +232,14 @@ pub async fn create_api_server<T: BeaconChainTypes>(
|
||||
.unwrap();
|
||||
|
||||
let ctx = Arc::new(Context {
|
||||
// Override several config fields with defaults. If these need to be tweaked in future
|
||||
// we could remove these overrides.
|
||||
config: Config {
|
||||
enabled: true,
|
||||
listen_port: port,
|
||||
data_dir: std::path::PathBuf::from(DEFAULT_ROOT_DIR),
|
||||
enable_light_client_server: true,
|
||||
..Config::default()
|
||||
..http_config
|
||||
},
|
||||
chain: Some(chain),
|
||||
network_senders: Some(network_senders),
|
||||
|
||||
Reference in New Issue
Block a user