difftreelog
Merge pull request #1012 from UniqueNetwork/feature/lookahead-leftovers
in: master
Fix lookahead collator build
11 files changed
Cargo.lockdiffbeforeafterboth--- a/Cargo.lock
+++ b/Cargo.lock
@@ -6450,6 +6450,7 @@
"cumulus-pallet-parachain-system",
"cumulus-pallet-xcm",
"cumulus-pallet-xcmp-queue",
+ "cumulus-primitives-aura",
"cumulus-primitives-core",
"cumulus-primitives-timestamp",
"cumulus-primitives-utility",
@@ -8109,12 +8110,14 @@
"pallet-evm-coder-substrate",
"pallet-nonfungible",
"pallet-refungible",
+ "pallet-structure",
"parity-scale-codec",
"scale-info",
"sp-core",
"sp-io",
"sp-runtime",
"sp-std",
+ "up-common",
"up-data-structs",
]
@@ -14732,6 +14735,7 @@
"cumulus-client-consensus-proposer",
"cumulus-client-network",
"cumulus-client-service",
+ "cumulus-primitives-aura",
"cumulus-primitives-core",
"cumulus-primitives-parachain-inherent",
"cumulus-relay-chain-inprocess-interface",
Cargo.tomldiffbeforeafterboth1[workspace]2default-members = ['client/*', 'node/*', 'runtime/opal']3members = [4 'client/*',5 'crates/*',6 'node/*',7 'pallets/*',8 'primitives/*',9 'runtime/opal',10 'runtime/quartz',11 'runtime/tests',12 'runtime/unique',13]14package.version = "1.1.0"15resolver = "2"1617[profile.release]18# Runtime requires unwinding19panic = "unwind"2021[profile.production]22codegen-units = 123inherits = "release"24lto = true25opt-level = 32627[profile.integration-tests]28debug-assertions = true29inherits = "release"3031[workspace.dependencies]32# Unique33app-promotion-rpc = { path = "primitives/app_promotion_rpc", default-features = false }34evm-coder = { version = "0.4.2", default-features = false, features = ['bondrewd'] }35pallet-app-promotion = { path = "pallets/app-promotion", default-features = false }36pallet-balances-adapter = { default-features = false, path = "pallets/balances-adapter" }37pallet-charge-transaction = { package = "pallet-template-transaction-payment", default-features = false, git = "https://github.com/uniquenetwork/pallet-sponsoring", branch = "polkadot-v1.1.0" }38pallet-collator-selection = { default-features = false, path = "pallets/collator-selection" }39pallet-common = { default-features = false, path = "pallets/common" }40pallet-configuration = { default-features = false, path = "pallets/configuration" }41pallet-evm-coder-substrate = { default-features = false, path = "pallets/evm-coder-substrate" }42pallet-evm-contract-helpers = { path = "pallets/evm-contract-helpers", default-features = false }43pallet-evm-migration = { path = "pallets/evm-migration", default-features = false }44pallet-evm-transaction-payment = { path = "pallets/evm-transaction-payment", default-features = false }45pallet-foreign-assets = { default-features = false, path = "pallets/foreign-assets" }46pallet-fungible = { default-features = false, path = "pallets/fungible" }47pallet-gov-origins = { default-features = false, path = "pallets/gov-origins" }48pallet-identity = { default-features = false, path = "pallets/identity" }49pallet-inflation = { path = "pallets/inflation", default-features = false }50pallet-maintenance = { default-features = false, path = "pallets/maintenance" }51pallet-nonfungible = { default-features = false, path = "pallets/nonfungible" }52pallet-refungible = { default-features = false, path = "pallets/refungible" }53pallet-structure = { default-features = false, path = "pallets/structure" }54pallet-test-utils = { default-features = false, path = "test-pallets/utils" }55pallet-unique = { path = "pallets/unique", default-features = false }56precompile-utils-macro = { path = "runtime/common/ethereum/precompiles/utils/macro" }57struct-versioning = { path = "crates/struct-versioning" }58uc-rpc = { path = "client/rpc" }59unique-rpc = { path = "node/rpc" }60up-common = { path = "primitives/common", default-features = false }61up-data-structs = { path = "primitives/data-structs", default-features = false }62up-pov-estimate-rpc = { path = "primitives/pov-estimate-rpc", default-features = false }63up-rpc = { path = "primitives/rpc", default-features = false }64up-sponsorship = { default-features = false, git = "https://github.com/uniquenetwork/pallet-sponsoring", branch = "polkadot-v1.1.0" }6566# Unique: Runtimes67opal-runtime = { path = "runtime/opal" }68quartz-runtime = { path = "runtime/quartz" }69unique-runtime = { path = "runtime/unique" }7071# Frontier (Unique patches over the Parity version)72fc-api = { default-features = false, git = "https://github.com/uniquenetwork/unique-frontier", branch = "unique-polkadot-v1.1.0" }73fc-consensus = { git = "https://github.com/uniquenetwork/unique-frontier", branch = "unique-polkadot-v1.1.0" }74fc-db = { default-features = false, git = "https://github.com/uniquenetwork/unique-frontier", branch = "unique-polkadot-v1.1.0" }75fc-mapping-sync = { git = "https://github.com/uniquenetwork/unique-frontier", branch = "unique-polkadot-v1.1.0" }76fc-rpc = { default-features = false, git = "https://github.com/uniquenetwork/unique-frontier", branch = "unique-polkadot-v1.1.0" }77fc-rpc-core = { default-features = false, git = "https://github.com/uniquenetwork/unique-frontier", branch = "unique-polkadot-v1.1.0" }78fp-evm = { default-features = false, git = "https://github.com/uniquenetwork/unique-frontier", branch = "unique-polkadot-v1.1.0" }79fp-rpc = { default-features = false, git = "https://github.com/uniquenetwork/unique-frontier", branch = "unique-polkadot-v1.1.0" }80fp-self-contained = { default-features = false, features = [81 "serde",82], git = "https://github.com/uniquenetwork/unique-frontier", branch = "unique-polkadot-v1.1.0" }83fp-storage = { default-features = false, git = "https://github.com/uniquenetwork/unique-frontier", branch = "unique-polkadot-v1.1.0" }84pallet-base-fee = { default-features = false, git = "https://github.com/uniquenetwork/unique-frontier", branch = "unique-polkadot-v1.1.0" }85pallet-ethereum = { default-features = false, git = "https://github.com/uniquenetwork/unique-frontier", branch = "unique-polkadot-v1.1.0" }86pallet-evm = { default-features = false, git = "https://github.com/uniquenetwork/unique-frontier", branch = "unique-polkadot-v1.1.0" }87pallet-evm-precompile-simple = { default-features = false, git = "https://github.com/uniquenetwork/unique-frontier", branch = "unique-polkadot-v1.1.0" }8889# Parity90codec = { default-features = false, features = ['derive'], package = 'parity-scale-codec', version = "3.6.5" }91cumulus-client-cli = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0" }92cumulus-client-collator = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0" }93cumulus-client-consensus-aura = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0" }94cumulus-client-consensus-common = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0" }95cumulus-client-consensus-proposer = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0" }96cumulus-client-network = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0" }97cumulus-client-service = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0" }98cumulus-pallet-aura-ext = { default-features = false, git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0" }99cumulus-pallet-dmp-queue = { default-features = false, git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0" }100cumulus-pallet-parachain-system = { default-features = false, git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0" }101cumulus-pallet-xcm = { default-features = false, git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0" }102cumulus-pallet-xcmp-queue = { default-features = false, git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0" }103cumulus-primitives-core = { default-features = false, git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0" }104cumulus-primitives-parachain-inherent = { default-features = false, git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0" }105cumulus-primitives-timestamp = { default-features = false, git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0" }106cumulus-primitives-utility = { default-features = false, git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0" }107cumulus-relay-chain-inprocess-interface = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0" }108cumulus-relay-chain-interface = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0" }109cumulus-relay-chain-minimal-node = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0" }110frame-executive = { default-features = false, git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0" }111frame-support = { default-features = false, git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0" }112frame-system = { default-features = false, git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0" }113frame-system-rpc-runtime-api = { default-features = false, git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0" }114pallet-aura = { default-features = false, git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0" }115pallet-authorship = { default-features = false, git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0" }116pallet-balances = { default-features = false, git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0" }117pallet-collective = { default-features = false, git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0" }118pallet-democracy = { default-features = false, git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0" }119pallet-membership = { default-features = false, git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0" }120pallet-preimage = { default-features = false, git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0" }121pallet-ranked-collective = { default-features = false, git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0" }122pallet-referenda = { default-features = false, git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0" }123pallet-scheduler = { default-features = false, git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0" }124pallet-session = { default-features = false, git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0" }125pallet-state-trie-migration = { default-features = false, git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0" }126pallet-sudo = { default-features = false, git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0" }127pallet-timestamp = { default-features = false, git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0" }128pallet-transaction-payment = { default-features = false, git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0" }129pallet-transaction-payment-rpc = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0" }130pallet-transaction-payment-rpc-runtime-api = { default-features = false, git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0" }131pallet-treasury = { default-features = false, git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0" }132pallet-utility = { default-features = false, git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0" }133pallet-xcm = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0", default-features = false }134parachain-info = { default-features = false, git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0" }135parity-scale-codec = { version = "3.6.5", features = ["derive"], default-features = false }136polkadot-cli = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0" }137polkadot-parachain-primitives = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0", default-features = false }138polkadot-primitives = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0" }139polkadot-service = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0" }140sc-basic-authorship = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0" }141sc-chain-spec = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0" }142sc-cli = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0" }143sc-client-api = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0" }144sc-consensus = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0" }145sc-consensus-manual-seal = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0" }146sc-executor = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0" }147sc-network = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0" }148sc-network-sync = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0" }149sc-rpc = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0" }150sc-rpc-api = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0" }151sc-service = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0" }152sc-sysinfo = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0" }153sc-telemetry = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0" }154sc-tracing = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0" }155sc-transaction-pool = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0" }156scale-info = { version = "2.9.0", default-features = false, features = ["derive"] }157sp-api = { default-features = false, git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0" }158sp-arithmetic = { default-features = false, git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0" }159sp-block-builder = { default-features = false, git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0" }160sp-blockchain = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0" }161sp-consensus-aura = { default-features = false, git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0" }162sp-core = { default-features = false, git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0" }163sp-externalities = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0" }164sp-inherents = { default-features = false, git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0" }165sp-io = { default-features = false, git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0" }166sp-keystore = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0" }167sp-offchain = { default-features = false, git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0" }168sp-runtime = { default-features = false, git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0" }169sp-session = { default-features = false, git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0" }170sp-staking = { default-features = false, git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0" }171sp-state-machine = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0" }172sp-std = { default-features = false, git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0" }173sp-storage = { default-features = false, git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0" }174sp-timestamp = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0" }175sp-tracing = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0" }176sp-transaction-pool = { default-features = false, git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0" }177sp-trie = { default-features = false, git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0" }178sp-version = { default-features = false, git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0" }179sp-weights = { default-features = false, git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0" }180staging-xcm = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0", default-features = false }181staging-xcm-builder = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0", default-features = false }182staging-xcm-executor = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0", default-features = false }183substrate-frame-rpc-system = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0" }184substrate-prometheus-endpoint = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0" }185186# Parity: Build utils187substrate-build-script-utils = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0" }188substrate-wasm-builder = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0" }189190# Parity: Benchmarking191frame-benchmarking = { default-features = false, git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0" }192frame-benchmarking-cli = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0" }193frame-system-benchmarking = { default-features = false, git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0" }194195# Parity: Try Runtime196frame-try-runtime = { default-features = false, git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0" }197try-runtime-cli = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0" }198199# ORML200orml-tokens = { default-features = false, git = "https://github.com/moonbeam-foundation/open-runtime-module-library", branch = "upgrade-to-polkadot-v1.1.0" }201orml-traits = { default-features = false, git = "https://github.com/moonbeam-foundation/open-runtime-module-library", branch = "upgrade-to-polkadot-v1.1.0" }202orml-vesting = { default-features = false, git = "https://github.com/moonbeam-foundation/open-runtime-module-library", branch = "upgrade-to-polkadot-v1.1.0" }203orml-xcm-support = { default-features = false, git = "https://github.com/moonbeam-foundation/open-runtime-module-library", branch = "upgrade-to-polkadot-v1.1.0" }204orml-xtokens = { default-features = false, git = "https://github.com/moonbeam-foundation/open-runtime-module-library", branch = "upgrade-to-polkadot-v1.1.0" }205206# Other207derivative = { version = "2.2.0", features = ["use_core"] }208ethereum = { version = "0.14.0", default-features = false }209evm-core = { git = "https://github.com/rust-blockchain/evm", rev = "b7b82c7e1fc57b7449d6dfa6826600de37cc1e65", default-features = false }210hex-literal = "0.4.1"211impl-trait-for-tuples = "0.2.2"212jsonrpsee = { version = "0.16.3", features = ["macros", "server"] }213log = { version = "0.4.20", default-features = false }214num_enum = { version = "0.7.0", default-features = false }215serde = { default-features = false, features = ['derive'], version = "1.0.188" }216smallvec = "1.11.1"node/cli/Cargo.tomldiffbeforeafterboth--- a/node/cli/Cargo.toml
+++ b/node/cli/Cargo.toml
@@ -36,6 +36,7 @@
cumulus-client-consensus-proposer = { workspace = true }
cumulus-client-network = { workspace = true }
cumulus-client-service = { workspace = true }
+cumulus-primitives-aura = { workspace = true }
cumulus-primitives-core = { workspace = true }
cumulus-primitives-parachain-inherent = { features = ["std"], workspace = true }
cumulus-relay-chain-inprocess-interface = { workspace = true }
@@ -113,7 +114,9 @@
'quartz-runtime?/gov-test-timings',
'unique-runtime?/gov-test-timings',
]
-lookahead = []
+lookahead = [
+ 'opal-runtime/lookahead'
+]
pov-estimate = [
'opal-runtime/pov-estimate',
'quartz-runtime?/pov-estimate',
node/cli/src/command.rsdiffbeforeafterboth--- a/node/cli/src/command.rs
+++ b/node/cli/src/command.rs
@@ -396,6 +396,8 @@
}
}
#[cfg(feature = "try-runtime")]
+ // embedded try-runtime cli will be removed soon.
+ #[allow(deprecated)]
Some(Subcommand::TryRuntime(cmd)) => {
use std::{future::Future, pin::Pin};
node/cli/src/service.rsdiffbeforeafterboth--- a/node/cli/src/service.rs
+++ b/node/cli/src/service.rs
@@ -221,6 +221,14 @@
{
}
);
+#[cfg(not(feature = "lookahead"))]
+ez_bounds!(
+ pub trait LookaheadApiDep {}
+);
+#[cfg(feature = "lookahead")]
+ez_bounds!(
+ pub trait LookaheadApiDep: cumulus_primitives_aura::AuraUnincludedSegmentApi<Block> {}
+);
/// Starts a `ServiceBuilder` for a full service.
///
@@ -358,6 +366,7 @@
+ Sync
+ 'static,
RuntimeApi::RuntimeApi: RuntimeApiDep<Runtime> + 'static,
+ RuntimeApi::RuntimeApi: LookaheadApiDep,
Runtime: RuntimeInstance,
ExecutorDispatch: NativeExecutionDispatch + 'static,
{
@@ -687,6 +696,8 @@
announce_block: Arc<dyn Fn(Hash, Option<Vec<u8>>) + Send + Sync>,
}
+// Clones ignored for optional lookahead collator
+#[allow(clippy::redundant_clone)]
pub fn start_consensus<ExecutorDispatch, RuntimeApi, Runtime>(
client: Arc<FullClient<RuntimeApi, ExecutorDispatch>>,
transaction_pool: Arc<
@@ -701,6 +712,7 @@
+ Sync
+ 'static,
RuntimeApi::RuntimeApi: RuntimeApiDep<Runtime> + 'static,
+ RuntimeApi::RuntimeApi: LookaheadApiDep,
Runtime: RuntimeInstance,
{
let StartConsensusParameters {
@@ -735,12 +747,12 @@
client.clone(),
);
- let block_import = ParachainBlockImport::new(client.clone(), backend);
+ let block_import = ParachainBlockImport::new(client.clone(), backend.clone());
let params = BuildAuraConsensusParams {
create_inherent_data_providers: move |_, ()| async move { Ok(()) },
block_import,
- para_client: client,
+ para_client: client.clone(),
#[cfg(feature = "lookahead")]
para_backend: backend,
para_id,
@@ -751,10 +763,19 @@
proposer,
collator_service,
// With async-baking, we allowed to be both slower (longer authoring) and faster (multiple para blocks per relay block)
+ #[cfg(not(feature = "lookahead"))]
authoring_duration: Duration::from_millis(500),
+ #[cfg(feature = "lookahead")]
+ authoring_duration: Duration::from_millis(1500),
overseer_handle,
#[cfg(feature = "lookahead")]
- code_hash_provider: || {},
+ code_hash_provider: move |block_hash| {
+ client
+ .code_at(block_hash)
+ .ok()
+ .map(cumulus_primitives_core::relay_chain::ValidationCode)
+ .map(|c| c.hash())
+ },
collator_key,
relay_chain_slot_duration,
};
@@ -762,7 +783,10 @@
task_manager.spawn_essential_handle().spawn(
"aura",
None,
+ #[cfg(not(feature = "lookahead"))]
run_aura::<_, AuraAuthorityPair, _, _, _, _, _, _, _>(params),
+ #[cfg(feature = "lookahead")]
+ run_aura::<_, AuraAuthorityPair, _, _, _, _, _, _, _, _, _>(params),
);
Ok(())
}
pallets/inflation/src/lib.rsdiffbeforeafterboth--- a/pallets/inflation/src/lib.rs
+++ b/pallets/inflation/src/lib.rs
@@ -70,8 +70,10 @@
+ Mutate<Self::AccountId>;
type TreasuryAccountId: Get<Self::AccountId>;
- // The block number provider
- type BlockNumberProvider: BlockNumberProvider<BlockNumber = BlockNumberFor<Self>>;
+ // The block number provider, which should be callable from `on_initialize` hook.
+ type OnInitializeBlockNumberProvider: BlockNumberProvider<
+ BlockNumber = BlockNumberFor<Self>,
+ >;
/// Number of blocks that pass between treasury balance updates due to inflation
#[pallet::constant]
@@ -118,7 +120,7 @@
};
let block_interval: u32 = T::InflationBlockInterval::get().try_into().unwrap_or(0);
- let current_relay_block = T::BlockNumberProvider::current_block_number();
+ let current_relay_block = T::OnInitializeBlockNumberProvider::current_block_number();
let next_inflation: BlockNumberFor<T> = <NextInflationBlock<T>>::get();
add_weight(1, 0, Weight::from_parts(5_000_000, 0));
primitives/common/src/constants.rsdiffbeforeafterboth--- a/primitives/common/src/constants.rs
+++ b/primitives/common/src/constants.rs
@@ -23,7 +23,10 @@
use crate::types::{Balance, BlockNumber};
+#[cfg(not(feature = "lookahead"))]
pub const MILLISECS_PER_BLOCK: u64 = 12000;
+#[cfg(feature = "lookahead")]
+pub const MILLISECS_PER_BLOCK: u64 = 3000;
pub const MILLISECS_PER_RELAY_BLOCK: u64 = 6000;
pub const SLOT_DURATION: u64 = MILLISECS_PER_BLOCK;
runtime/common/config/pallets/mod.rsdiffbeforeafterboth--- a/runtime/common/config/pallets/mod.rs
+++ b/runtime/common/config/pallets/mod.rs
@@ -21,7 +21,7 @@
traits::{ConstU32, ConstU64, Currency},
};
use sp_arithmetic::Perbill;
-use sp_runtime::traits::AccountIdConversion;
+use sp_runtime::traits::{AccountIdConversion, BlockNumberProvider};
use up_common::{
constants::*,
types::{AccountId, Balance, BlockNumber},
@@ -105,12 +105,34 @@
pub const InflationBlockInterval: BlockNumber = 100; // every time per how many blocks inflation is applied
}
+/// Pallet-inflation needs block number in on_initialize, where there is no `validation_data` exists yet
+pub struct OnInitializeBlockNumberProvider;
+impl BlockNumberProvider for OnInitializeBlockNumberProvider {
+ type BlockNumber = BlockNumber;
+
+ fn current_block_number() -> Self::BlockNumber {
+ use hex_literal::hex;
+ use parity_scale_codec::Decode;
+ use sp_io::storage;
+ // TODO: Replace with the following code after https://github.com/paritytech/polkadot-sdk/commit/3ea497b5a0fdda252f9c5a3c257cfaf8685f02fd lands
+ // <cumulus_pallet_parachain_system::Pallet<Runtime>>::last_relay_block_number()
+
+ // ParachainSystem.LastRelayChainBlockNumber
+ let Some(encoded) = storage::get(&hex!("45323df7cc47150b3930e2666b0aa313a2bca190d36bd834cc73a38fc213ecbd")) else {
+ // First parachain block
+ return Default::default()
+ };
+ BlockNumber::decode(&mut encoded.as_ref())
+ .expect("typeof(RelayBlockNumber) == typeof(BlockNumber) == u32; qed")
+ }
+}
+
/// Used for the pallet inflation
impl pallet_inflation::Config for Runtime {
type Currency = Balances;
type TreasuryAccountId = TreasuryAccountId;
type InflationBlockInterval = InflationBlockInterval;
- type BlockNumberProvider = RelayChainBlockNumberProvider<Runtime>;
+ type OnInitializeBlockNumberProvider = OnInitializeBlockNumberProvider;
}
impl pallet_unique::Config for Runtime {
runtime/common/config/parachain.rsdiffbeforeafterboth--- a/runtime/common/config/parachain.rs
+++ b/runtime/common/config/parachain.rs
@@ -38,9 +38,29 @@
type ReservedDmpWeight = ReservedDmpWeight;
type ReservedXcmpWeight = ReservedXcmpWeight;
type XcmpMessageHandler = XcmpQueue;
+ #[cfg(not(feature = "lookahead"))]
type CheckAssociatedRelayNumber = cumulus_pallet_parachain_system::RelayNumberStrictlyIncreases;
+ #[cfg(feature = "lookahead")]
+ type CheckAssociatedRelayNumber =
+ cumulus_pallet_parachain_system::RelayNumberMonotonicallyIncreases;
}
impl parachain_info::Config for Runtime {}
impl cumulus_pallet_aura_ext::Config for Runtime {}
+
+/// Maximum number of blocks simultaneously accepted by the Runtime, not yet included
+/// into the relay chain.
+#[cfg(feature = "lookahead")]
+const UNINCLUDED_SEGMENT_CAPACITY: u32 = 3;
+/// How many parachain blocks are processed by the relay chain per parent. Limits the
+/// number of blocks authored per slot.
+#[cfg(feature = "lookahead")]
+const BLOCK_PROCESSING_VELOCITY: u32 = 2;
+#[cfg(feature = "lookahead")]
+pub type ConsensusHook = cumulus_pallet_aura_ext::FixedVelocityConsensusHook<
+ Runtime,
+ { MILLISECS_PER_RELAY_BLOCK as u32 },
+ BLOCK_PROCESSING_VELOCITY,
+ UNINCLUDED_SEGMENT_CAPACITY,
+>;
runtime/common/runtime_apis.rsdiffbeforeafterboth--- a/runtime/common/runtime_apis.rs
+++ b/runtime/common/runtime_apis.rs
@@ -679,6 +679,16 @@
}
}
+ #[cfg(feature = "lookahead")]
+ impl cumulus_primitives_aura::AuraUnincludedSegmentApi<Block> for Runtime {
+ fn can_build_upon(
+ included_hash: <Block as BlockT>::Hash,
+ slot: cumulus_primitives_aura::Slot,
+ ) -> bool {
+ $crate::config::parachain::ConsensusHook::can_build_upon(included_hash, slot)
+ }
+ }
+
/// Should never be used, yet still required because of https://github.com/paritytech/polkadot-sdk/issues/27
/// Not allowed to panic, because rpc may be called using native runtime, thus causing thread panic.
impl fp_rpc::ConvertTransactionRuntimeApi<Block> for Runtime {
runtime/opal/Cargo.tomldiffbeforeafterboth--- a/runtime/opal/Cargo.toml
+++ b/runtime/opal/Cargo.toml
@@ -69,6 +69,7 @@
'cumulus-pallet-parachain-system/std',
'cumulus-pallet-xcm/std',
'cumulus-pallet-xcmp-queue/std',
+ 'cumulus-primitives-aura/std',
'cumulus-primitives-core/std',
'cumulus-primitives-utility/std',
'frame-executive/std',
@@ -230,6 +231,7 @@
preimage = []
refungible = []
session-test-timings = []
+lookahead = []
################################################################################
# local dependencies
@@ -240,6 +242,7 @@
cumulus-pallet-parachain-system = { workspace = true }
cumulus-pallet-xcm = { workspace = true }
cumulus-pallet-xcmp-queue = { workspace = true }
+cumulus-primitives-aura = { workspace = true }
cumulus-primitives-core = { workspace = true }
cumulus-primitives-timestamp = { workspace = true }
cumulus-primitives-utility = { workspace = true }