Skip to content

Commit f6cff4f

Browse files
committed
wip/fix no room in segment
1 parent 5791f30 commit f6cff4f

File tree

1 file changed

+12
-69
lines changed
  • crates/anvil-polkadot/src/substrate_node/service

1 file changed

+12
-69
lines changed

crates/anvil-polkadot/src/substrate_node/service/mod.rs

Lines changed: 12 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -288,27 +288,19 @@ fn create_manual_seal_inherent_data_providers(
288288

289289
let para_id = client.runtime_api().parachain_id(current_para_head.hash()).unwrap();
290290

291-
292-
print!("paraID: {}", para_id);
293-
294-
// // NOTE: Our runtime API doesnt seem to have collect_collation_info available
295-
// let should_send_go_ahead = client
296-
// .runtime_api()
297-
// .collect_collation_info(block, &current_para_head)
298-
// .map(|info| info.new_validation_code.is_some())
299-
// .unwrap_or_default();
300-
301291
// The API version is relevant here because the constraints in the runtime changed
302292
// in https://github.com/paritytech/polkadot-sdk/pull/6825. In general, the logic
303293
// here assumes that we are using the aura-ext consensushook in the parachain
304294
// runtime.
305295
// Note: Taken from https://github.com/paritytech/polkadot-sdk/issues/7341, but unsure fi needed or not
306-
let requires_relay_progress = client
307-
.runtime_api()
308-
.has_api_with::<dyn AuraUnincludedSegmentApi<Block>, _>(block, |version| version > 1)
309-
.ok()
310-
.unwrap_or_default();
311-
let current_para_block_head =
296+
// let requires_relay_progress = client
297+
// .runtime_api()
298+
// .has_api_with::<dyn AuraUnincludedSegmentApi<Block>, _>(block, |version| version > 1)
299+
// .ok()
300+
// .unwrap_or_default();
301+
302+
303+
let current_para_block_head =
312304
Some(polkadot_primitives::HeadData(current_para_head.hash().as_bytes().to_vec()));
313305

314306
let current_block_number =
@@ -324,22 +316,12 @@ fn create_manual_seal_inherent_data_providers(
324316
para_id,
325317
current_para_block_head,
326318
relay_offset: time as u32,
327-
relay_blocks_per_para_block: requires_relay_progress.then(|| 1).unwrap_or_default(),
328-
//relay_blocks_per_para_block: 1,
329-
para_blocks_per_relay_epoch: 1,
330-
// upgrade_go_ahead: should_send_go_ahead.then(|| {
331-
// //log::info!("Detected pending validation code, sending go-ahead signal.");
332-
// UpgradeGoAhead::GoAhead
333-
// }),
319+
// relay_blocks_per_para_block: requires_relay_progress.then(|| 1).unwrap_or_default(),
320+
relay_blocks_per_para_block: 1,
321+
para_blocks_per_relay_epoch: 10,
334322
..Default::default()
335323
};
336324

337-
// let timestamp_provider = sp_timestamp::InherentDataProvider::new(
338-
// (slot_duration.as_millis() * current_block_number as u64).into(),
339-
// );
340-
341-
// MockTimestampInherentDataProvider::advance_timestamp(RELAY_CHAIN_SLOT_DURATION_MILLIS);
342-
343325
futures::future::ready(Ok((MockTimestampInherentDataProvider, mocked_parachain)))
344326
}
345327
}
@@ -475,53 +457,14 @@ pub fn new(
475457
None,
476458
);
477459

478-
// let create_inherent_data_providers = {
479-
// move |_, ()| {
480-
// let next_timestamp = time_manager.next_timestamp();
481-
// async move { Ok(sp_timestamp::InherentDataProvider::new(next_timestamp.into())) }
482-
// }
483-
// };
484-
485460
let slot_duration= sc_consensus_aura::SlotDuration::from_millis(6000);
486-
// let slot_duration = client.runtime_api().slot_duration();
461+
//let slot_duration = client.runtime_api().slot_duration();
487462

488-
// Polkadot-sdk doesnt seem to use the latest changes here, so this function isnt available yet. Can use `new()` instead but our client
489-
// doesnt implement all the needed traits
490463
let aura_digest_provider = AuraConsensusDataProvider::new_with_slot_duration(slot_duration);
491464
// let aura_digest_provider = AuraConsensusDataProvider::new(client);
492465

493-
494-
// let para_id = Id::new(anvil_config.get_chain_id().try_into().unwrap());
495-
496-
// might actually work okay with this chain id??
497-
//let para_id = Id::new(420420421);
498-
// let para_id = client.runtime_api().parachain_id();
499-
500-
// anvil_config.set_chain_id(Some(420420421 as u64));
501-
// let id = config;
502-
// print!("paraID 1: {:#?}", id);
503-
// print!("paraID: {}", para_id);
504-
505-
506-
// Connect to your node
507-
// let api = OnlineClient::<PolkadotConfig>::from_url(anvil_config.eth_rpc_url).await?;
508-
509-
// // Runtime API name
510-
// let api_name = "ParachainInfo_parachainId";
511-
512-
// // Call with no parameters
513-
// let para_id: u32 = api
514-
// .rpc()
515-
// .call_runtime_api(api_name, None, ())
516-
// .await?;
517-
518-
// println!("Parachain ID: {}", para_id);
519-
// Ok(())
520-
521-
522466
let create_inherent_data_providers = create_manual_seal_inherent_data_providers(
523467
client.clone(),
524-
525468
anvil_config.clone(),
526469
);
527470

0 commit comments

Comments
 (0)