Skip to content

Commit 87a2c3a

Browse files
committed
Clean up and reduce max blobs per block for testing PeerDAS.
1 parent 31344ce commit 87a2c3a

File tree

4 files changed

+37
-20
lines changed

4 files changed

+37
-20
lines changed

consensus/types/src/chain_spec.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ pub struct ChainSpec {
243243
/*
244244
* Networking Fulu
245245
*/
246-
max_blobs_per_block_fulu: u64,
246+
pub max_blobs_per_block_fulu: u64,
247247

248248
/*
249249
* Networking Derived

testing/simulator/src/basic_sim.rs

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,7 @@ pub fn run_basic_sim(matches: &ArgMatches) -> Result<(), String> {
153153
spec.deneb_fork_epoch = Some(Epoch::new(DENEB_FORK_EPOCH));
154154
spec.electra_fork_epoch = Some(Epoch::new(ELECTRA_FORK_EPOCH));
155155
spec.fulu_fork_epoch = Some(Epoch::new(FULU_FORK_EPOCH));
156+
spec.max_blobs_per_block_fulu = 9;
156157
let spec = Arc::new(spec);
157158
env.eth2_config.spec = spec.clone();
158159

@@ -185,29 +186,30 @@ pub fn run_basic_sim(matches: &ArgMatches) -> Result<(), String> {
185186

186187
// Add nodes to the network.
187188
for i in 0..node_count {
188-
let mut beacon_config = beacon_config.clone();
189-
// Run one PeerDAS supernode.
190-
if i == 0 {
191-
beacon_config.network.subscribe_all_data_column_subnets = true;
192-
}
189+
// Run two PeerDAS supernodes.
190+
let is_supernode = i < 2;
193191
network
194-
.add_beacon_node(beacon_config, mock_execution_config.clone(), false)
192+
.add_beacon_node(
193+
beacon_config.clone(),
194+
mock_execution_config.clone(),
195+
false,
196+
is_supernode,
197+
)
195198
.await?;
196199
}
197200

198201
/*
199202
* One by one, add proposer nodes to the network.
200203
*/
201-
for i in 0..proposer_nodes {
202-
let mut beacon_config = beacon_config.clone();
203-
// Run one PeerDAS proposer supernode.
204-
if i == 0 {
205-
beacon_config.network.subscribe_all_data_column_subnets = true;
206-
}
207-
204+
for _ in 0..proposer_nodes {
208205
println!("Adding a proposer node");
209206
network
210-
.add_beacon_node(beacon_config.clone(), mock_execution_config.clone(), true)
207+
.add_beacon_node(
208+
beacon_config.clone(),
209+
mock_execution_config.clone(),
210+
true,
211+
false,
212+
)
211213
.await?;
212214
}
213215

testing/simulator/src/fallback_sim.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,12 @@ pub fn run_fallback_sim(matches: &ArgMatches) -> Result<(), String> {
181181
// Add nodes to the network.
182182
for _ in 0..node_count {
183183
network
184-
.add_beacon_node(beacon_config.clone(), mock_execution_config.clone(), false)
184+
.add_beacon_node(
185+
beacon_config.clone(),
186+
mock_execution_config.clone(),
187+
false,
188+
false,
189+
)
185190
.await?;
186191
}
187192

testing/simulator/src/local_network.rs

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,7 @@ impl<E: EthSpec> LocalNetwork<E> {
195195
&self,
196196
mut beacon_config: ClientConfig,
197197
mock_execution_config: MockExecutionConfig,
198+
is_supernode: bool,
198199
) -> Result<(LocalBeaconNode<E>, LocalExecutionNode<E>), String> {
199200
beacon_config.network.set_ipv4_listening_address(
200201
std::net::Ipv4Addr::UNSPECIFIED,
@@ -206,6 +207,7 @@ impl<E: EthSpec> LocalNetwork<E> {
206207
beacon_config.network.enr_udp4_port = Some(BOOTNODE_PORT.try_into().expect("non zero"));
207208
beacon_config.network.enr_tcp4_port = Some(BOOTNODE_PORT.try_into().expect("non zero"));
208209
beacon_config.network.discv5_config.table_filter = |_| true;
210+
beacon_config.network.subscribe_all_data_column_subnets = is_supernode;
209211

210212
let execution_node = LocalExecutionNode::new(
211213
self.context.service_context("boot_node_el".into()),
@@ -233,6 +235,7 @@ impl<E: EthSpec> LocalNetwork<E> {
233235
mut beacon_config: ClientConfig,
234236
mut mock_execution_config: MockExecutionConfig,
235237
is_proposer: bool,
238+
is_supernode: bool,
236239
) -> Result<(LocalBeaconNode<E>, LocalExecutionNode<E>), String> {
237240
let count = (self.beacon_node_count() + self.proposer_node_count()) as u16;
238241

@@ -249,6 +252,7 @@ impl<E: EthSpec> LocalNetwork<E> {
249252
beacon_config.network.enr_tcp4_port = Some(libp2p_tcp_port.try_into().unwrap());
250253
beacon_config.network.discv5_config.table_filter = |_| true;
251254
beacon_config.network.proposer_only = is_proposer;
255+
beacon_config.network.subscribe_all_data_column_subnets = is_supernode;
252256

253257
mock_execution_config.server_config.listen_port = EXECUTION_PORT + count;
254258

@@ -282,6 +286,7 @@ impl<E: EthSpec> LocalNetwork<E> {
282286
mut beacon_config: ClientConfig,
283287
mock_execution_config: MockExecutionConfig,
284288
is_proposer: bool,
289+
is_supernode: bool,
285290
) -> Result<(), String> {
286291
let first_bn_exists: bool;
287292
{
@@ -301,11 +306,16 @@ impl<E: EthSpec> LocalNetwork<E> {
301306
}
302307
let (beacon_node, execution_node) = if first_bn_exists {
303308
// Network already exists. We construct a new node.
304-
self.construct_beacon_node(beacon_config, mock_execution_config, is_proposer)
305-
.await?
309+
self.construct_beacon_node(
310+
beacon_config,
311+
mock_execution_config,
312+
is_proposer,
313+
is_supernode,
314+
)
315+
.await?
306316
} else {
307317
// Network does not exist. We construct a boot node.
308-
self.construct_boot_node(beacon_config, mock_execution_config)
318+
self.construct_boot_node(beacon_config, mock_execution_config, is_supernode)
309319
.await?
310320
};
311321
// Add nodes to the network.
@@ -330,7 +340,7 @@ impl<E: EthSpec> LocalNetwork<E> {
330340
) -> Result<(), String> {
331341
epoch_delay(Epoch::new(wait_until_epoch), slot_duration, slots_per_epoch).await;
332342

333-
self.add_beacon_node(beacon_config, mock_execution_config, false)
343+
self.add_beacon_node(beacon_config, mock_execution_config, false, false)
334344
.await?;
335345

336346
Ok(())

0 commit comments

Comments
 (0)