Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix missing parachain inherent data #802

Closed
wants to merge 19 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -183,6 +183,8 @@ cumulus-pallet-session-benchmarking = { git = "https://github.com/paritytech/pol
cumulus-primitives-core = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.11.0", default-features = false }
cumulus-primitives-timestamp = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.11.0", default-features = false }
cumulus-primitives-utility = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.11.0", default-features = false }
cumulus-primitives-parachain-inherent = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.11.0", default-features = false }
cumulus-test-relay-sproof-builder = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.11.0", default-features = false }
parachain-info = { package = "staging-parachain-info", git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.11.0", default-features = false }
parachains-common = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.11.0", default-features = false }

@@ -191,6 +193,7 @@ cumulus-client-cli = { git = "https://github.com/paritytech/polkadot-sdk", branc
cumulus-client-collator = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.11.0" }
cumulus-client-consensus-aura = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.11.0" }
cumulus-client-consensus-common = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.11.0" }
cumulus-client-consensus-relay-chain = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.11.0" }
cumulus-client-network = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.11.0" }
cumulus-client-consensus-proposer = {git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.11.0"}
cumulus-client-service = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.11.0" }
3 changes: 3 additions & 0 deletions node/Cargo.toml
Original file line number Diff line number Diff line change
@@ -63,8 +63,11 @@ cumulus-client-collator = { workspace = true }
cumulus-client-consensus-aura = { workspace = true }
cumulus-client-consensus-common = { workspace = true }
cumulus-client-consensus-proposer = { workspace = true }
cumulus-client-consensus-relay-chain = { workspace = true }
cumulus-client-service = { workspace = true }
cumulus-primitives-core = { workspace = true }
cumulus-primitives-parachain-inherent = { workspace = true }
cumulus-test-relay-sproof-builder = { workspace = true }
cumulus-relay-chain-interface = { workspace = true }

# Frontier
39 changes: 30 additions & 9 deletions node/src/service.rs
Original file line number Diff line number Diff line change
@@ -32,8 +32,10 @@ use cumulus_client_service::{
BuildNetworkParams, CollatorSybilResistance, DARecoveryProfile, ParachainHostFunctions,
StartRelayChainTasksParams,
};
use cumulus_primitives_core::{relay_chain::CollatorPair, ParaId};
use cumulus_primitives_core::{relay_chain::CollatorPair, ParaId, PersistedValidationData};
use cumulus_primitives_parachain_inherent::ParachainInherentData;
use cumulus_relay_chain_interface::{OverseerHandle, RelayChainInterface};
use cumulus_test_relay_sproof_builder::RelayStateSproofBuilder;

// Substrate Imports
use fc_rpc::{StorageOverride, StorageOverrideHandler};
@@ -50,9 +52,11 @@ use sc_network_sync::SyncingService;
use sc_service::{Configuration, PartialComponents, TFullBackend, TFullClient, TaskManager};
use sc_telemetry::{Telemetry, TelemetryHandle, TelemetryWorker, TelemetryWorkerHandle};
use sc_transaction_pool_api::OffchainTransactionPoolFactory;
use sp_consensus_aura::{Slot, SlotDuration};
use sp_core::U256;
use sp_keystore::KeystorePtr;
use substrate_prometheus_endpoint::Registry;

// Frontier
use crate::eth::{
db_config_dir, new_frontier_partial, spawn_frontier_tasks, BackendType, EthConfiguration,
@@ -344,15 +348,32 @@ async fn start_node_impl(
execute_gas_limit_multiplier: eth_config.execute_gas_limit_multiplier,
forced_parent_hashes: None,
pending_create_inherent_data_providers: move |_, ()| async move {
let current = sp_timestamp::InherentDataProvider::from_system_time();
let next_slot = current.timestamp().as_millis() + slot_duration.as_millis();
let timestamp = sp_timestamp::InherentDataProvider::new(next_slot.into());
let slot = sp_consensus_aura::inherents::InherentDataProvider::from_timestamp_and_slot_duration(
*timestamp,
slot_duration,
// Patch from https://github.com/darwinia-network/darwinia/pull/1608
let timestamp = sp_timestamp::InherentDataProvider::from_system_time();
let relay_chain_slot = Slot::from_timestamp(
timestamp.timestamp(),
SlotDuration::from_millis(6000 as u64), // RELAY_CHAIN_SLOT_DURATION_MILLIS
);
let dynamic_fee = fp_dynamic_fee::InherentDataProvider(U256::from(target_gas_price));
Ok((slot, timestamp, dynamic_fee))

let mut state_proof_builder =
cumulus_test_relay_sproof_builder::RelayStateSproofBuilder::default();
state_proof_builder.para_id = para_id;
state_proof_builder.current_slot = relay_chain_slot;
state_proof_builder.included_para_head = Some(polkadot_primitives::HeadData(vec![]));
let (relay_parent_storage_root, relay_chain_state) =
state_proof_builder.into_state_root_and_proof();
let parachain_inherent_data =
cumulus_primitives_parachain_inherent::ParachainInherentData {
validation_data: cumulus_primitives_core::PersistedValidationData {
relay_parent_number: u32::MAX,
relay_parent_storage_root,
..Default::default()
},
relay_chain_state,
downward_messages: Default::default(),
horizontal_messages: Default::default(),
};
Ok((timestamp, parachain_inherent_data))
},
};

2 changes: 1 addition & 1 deletion zombienet/download_polkadot.sh
Original file line number Diff line number Diff line change
@@ -2,7 +2,7 @@

# Default version and download directory
VERSION=${1:-"v1.11.0"}
DOWNLOAD_DIR=${2:-"./tmp"} # Default is the current directory
DOWNLOAD_DIR=${2:-"./tmp"} # Default is tmp

BASE_URL="https://github.com/paritytech/polkadot-sdk/releases/download/polkadot-$VERSION"