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

Polkadot v1.6.0 upgrade #413

Merged
merged 49 commits into from
Feb 22, 2024
Merged
Show file tree
Hide file tree
Changes from 13 commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
9ab7d7c
Simple template compiles
fgamundi Feb 9, 2024
3ef4d8f
Simple template cleanup
fgamundi Feb 9, 2024
d8c9bcd
Simple template chainspec
fgamundi Feb 9, 2024
ac5fea8
Complete build green
fgamundi Feb 13, 2024
35cf56c
fmt
fgamundi Feb 13, 2024
e2c616b
Fix deps
fgamundi Feb 14, 2024
0f3297b
Tests builds
fgamundi Feb 15, 2024
fc012bb
impl GenesisBuilder
fgamundi Feb 15, 2024
07b1d11
Updated polkadot-sdk commit
fgamundi Feb 16, 2024
e32171e
Missing deps
fgamundi Feb 16, 2024
766140f
Unit tests ok!
fgamundi Feb 16, 2024
8b1003f
bring serde regardless of std feature
girazoki Feb 16, 2024
fea9133
api-augment
fgamundi Feb 16, 2024
0ee0a6e
Fix container chain chain spec using set_storage
tmpolaczyk Feb 16, 2024
bbcbecc
Merge branch 'master' into fg/polkadot-v1.6.0
fgamundi Feb 16, 2024
36274a4
Merge branch 'master' into fg/polkadot-v1.6.0
fgamundi Feb 16, 2024
d9e272a
Fix frontier node and identity tests
fgamundi Feb 16, 2024
9125148
Fix xcm tests for message queue
fgamundi Feb 16, 2024
1121930
use build_storage from emulated_integration_tests
girazoki Feb 16, 2024
98ec012
Merge branch 'master' into fg/polkadot-v1.6.0
fgamundi Feb 19, 2024
d027f6c
fmt
fgamundi Feb 19, 2024
e44ca0f
Update moonkit ref
fgamundi Feb 19, 2024
1b75b68
try-runtime builds
fgamundi Feb 19, 2024
ce7ae5c
Ts lint
fgamundi Feb 19, 2024
30fd8cd
toml maid
fgamundi Feb 19, 2024
f35ea5d
merge
girazoki Feb 20, 2024
fdc1a26
fix runtime-benchmarks compilation
girazoki Feb 19, 2024
8e3ece1
try-runtime to pallet-balances
girazoki Feb 20, 2024
e1ea242
XcmpQueue migrations
fgamundi Feb 20, 2024
33f74cd
Migrations
fgamundi Feb 20, 2024
e4c461f
try-runtime
fgamundi Feb 20, 2024
e59d5cb
zepter
fgamundi Feb 20, 2024
a66e937
toml-maid
fgamundi Feb 20, 2024
4dfe83e
Review
fgamundi Feb 20, 2024
bb99085
Merge remote-tracking branch 'origin/master' into fg/polkadot-v1.6.0
fgamundi Feb 20, 2024
d5f17a5
try runtime subcommand
fgamundi Feb 20, 2024
e6ba443
MessageQueueServiceWeight to 25%
fgamundi Feb 20, 2024
b60d095
Unused import
fgamundi Feb 20, 2024
017af80
Fix clippy
fgamundi Feb 20, 2024
9e058e4
increase sleep time for first block in parathread
girazoki Feb 21, 2024
c2fe33c
be a bit more mindful about times in parachains
girazoki Feb 21, 2024
98fd437
increment even more timeout
girazoki Feb 21, 2024
4b534dc
Formatting and API augment
fgamundi Feb 21, 2024
34f4c04
Update forks refs
fgamundi Feb 22, 2024
c538141
Merge branch 'master' into fg/polkadot-v1.6.0
fgamundi Feb 22, 2024
2e91399
Increase grcov version in coverage
fgamundi Feb 22, 2024
e412943
Remove ignores from coverage
fgamundi Feb 22, 2024
917d08a
Remove ignores from coverage
fgamundi Feb 22, 2024
996d4a8
Revert coverage changes
fgamundi Feb 22, 2024
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
2,565 changes: 1,547 additions & 1,018 deletions Cargo.lock

Large diffs are not rendered by default.

328 changes: 165 additions & 163 deletions Cargo.toml

Large diffs are not rendered by default.

5 changes: 1 addition & 4 deletions client/consensus/src/consensus_orchestrator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,7 @@ use {
time::{Duration, Instant},
},
};
pub use {
sc_consensus_aura::{slot_duration, AuraVerifier, BuildAuraWorkerParams, SlotProportion},
sc_consensus_slots::InherentDataProviderExt,
};
pub use {sc_consensus_aura::SlotProportion, sc_consensus_slots::InherentDataProviderExt};

const LOG_TARGET: &str = "aura::tanssi";

Expand Down
7 changes: 5 additions & 2 deletions client/consensus/src/manual_seal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,16 @@ use {
sc_client_api::{AuxStore, UsageProvider},
sc_consensus::BlockImportParams,
sc_consensus_manual_seal::{ConsensusDataProvider, Error},
sp_api::{HeaderT, ProvideRuntimeApi},
sp_api::ProvideRuntimeApi,
sp_blockchain::{HeaderBackend, HeaderMetadata},
sp_consensus_aura::{digests::CompatibleDigestItem, AuraApi, Slot, SlotDuration},
sp_core::Pair,
sp_inherents::InherentData,
sp_keystore::KeystorePtr,
sp_runtime::{traits::Block as BlockT, Digest, DigestItem},
sp_runtime::{
traits::{Block as BlockT, Header as HeaderT},
Digest, DigestItem,
},
sp_timestamp::TimestampInherentData,
std::{marker::PhantomData, sync::Arc},
tp_consensus::TanssiAuthorityAssignmentApi,
Expand Down
11 changes: 9 additions & 2 deletions client/consensus/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ use {
CompatibleDigestItem, NimbusId, NimbusPair, NIMBUS_ENGINE_ID, NIMBUS_KEY_ID,
},
parking_lot::Mutex,
sc_block_builder::BlockBuilderProvider,
sc_block_builder::BlockBuilderBuilder,
sc_client_api::{BlockchainEvents, HeaderBackend},
sc_consensus::{BoxJustificationImport, ForkChoiceStrategy},
sc_consensus_aura::SlotProportion,
Expand Down Expand Up @@ -212,7 +212,14 @@ impl Proposer<TestBlock> for DummyProposer {
_: Duration,
_: Option<usize>,
) -> Self::Proposal {
let r = self.1.new_block(digests).unwrap().build();
let r = BlockBuilderBuilder::new(&*self.1)
.on_parent_block(self.1.chain_info().best_hash)
.fetch_parent_block_number(&*self.1)
.unwrap()
.with_inherent_digests(digests)
.build()
.unwrap()
.build();

futures::future::ready(r.map(|b| Proposal {
block: b.block,
Expand Down
58 changes: 58 additions & 0 deletions client/node-common/src/command.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
// Copyright (C) Moondance Labs Ltd.
// This file is part of Tanssi.

// Tanssi is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.

// Tanssi is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.

// You should have received a copy of the GNU General Public License
// along with Tanssi. If not, see <http://www.gnu.org/licenses/>.

use parity_scale_codec::Encode;
use sc_chain_spec::ChainSpec;
use sp_runtime::{
traits::{Block as BlockT, Hash as HashT, Header as HeaderT, Zero},
StateVersion,
};

/// Generate the genesis block from a given ChainSpec.
pub fn generate_genesis_block<Block: BlockT>(
chain_spec: &dyn ChainSpec,
genesis_state_version: StateVersion,
) -> Result<Block, String> {
let storage = chain_spec.build_storage()?;

let child_roots = storage.children_default.iter().map(|(sk, child_content)| {
let state_root = <<<Block as BlockT>::Header as HeaderT>::Hashing as HashT>::trie_root(
child_content.data.clone().into_iter().collect(),
genesis_state_version,
);
(sk.clone(), state_root.encode())
});
let state_root = <<<Block as BlockT>::Header as HeaderT>::Hashing as HashT>::trie_root(
storage.top.clone().into_iter().chain(child_roots).collect(),
genesis_state_version,
);

let extrinsics_root = <<<Block as BlockT>::Header as HeaderT>::Hashing as HashT>::trie_root(
Vec::new(),
genesis_state_version,
);

Ok(Block::new(
<<Block as BlockT>::Header as HeaderT>::new(
Zero::zero(),
extrinsics_root,
state_root,
Default::default(),
Default::default(),
),
Default::default(),
))
}
2 changes: 2 additions & 0 deletions client/node-common/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,5 @@
// along with Tanssi. If not, see <http://www.gnu.org/licenses/>.

pub mod service;

pub mod command;
10 changes: 7 additions & 3 deletions client/node-common/src/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -521,10 +521,14 @@ where
// Here you can check whether the hardware meets your chains' requirements. Putting a link
// in there and swapping out the requirements for your own are probably a good idea. The
// requirements for a para-chain are dictated by its relay-chain.
if collator && !SUBSTRATE_REFERENCE_HARDWARE.check_hardware(hwbench) {
log::warn!(
"⚠️ The hardware does not meet the minimal requirements for role 'Authority'."
match SUBSTRATE_REFERENCE_HARDWARE.check_hardware(&hwbench) {
Err(err) if collator => {
tmpolaczyk marked this conversation as resolved.
Show resolved Hide resolved
log::warn!(
"⚠️ The hardware does not meet the minimal requirements {} for role 'Authority'.",
err
);
}
_ => {}
}

if let Some(ref mut telemetry) = telemetry {
Expand Down
3 changes: 2 additions & 1 deletion container-chains/templates/frontier/node/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ jsonrpsee = { workspace = true, features = [ "server" ] }
log = { workspace = true }
parity-scale-codec = { workspace = true }
serde = { workspace = true, features = [ "derive" ] }
serde_json = { workspace = true }
url = { workspace = true }

# Local
Expand Down Expand Up @@ -90,7 +91,7 @@ cumulus-client-consensus-common = { workspace = true }
cumulus-client-network = { workspace = true }
cumulus-client-service = { workspace = true }
cumulus-primitives-core = { workspace = true }
cumulus-primitives-parachain-inherent = { workspace = true }
cumulus-client-parachain-inherent = { workspace = true }
cumulus-relay-chain-interface = { workspace = true }
cumulus-test-relay-sproof-builder = { workspace = true }

Expand Down
88 changes: 36 additions & 52 deletions container-chains/templates/frontier/node/src/chain_spec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,29 +73,25 @@ pub fn development_config(para_id: ParaId, boot_nodes: Vec<String>) -> ChainSpec
})
.collect();

ChainSpec::from_genesis(
// Name
"Development",
// ID
"dev",
ChainType::Development,
move || {
testnet_genesis(
default_funded_accounts.clone(),
para_id,
AccountId::from(hex!("f24FF3a9CF04c71Dbc94D0b566f7A27B94566cac")), // Alith
)
},
boot_nodes,
None,
None,
None,
Some(properties),
ChainSpec::builder(
container_chain_template_frontier_runtime::WASM_BINARY
.expect("WASM binary was not built, please build it!"),
Extensions {
relay_chain: "rococo-local".into(), // You MUST set this to the correct network!
para_id: para_id.into(),
},
)
.with_name("Development")
.with_id("dev")
.with_chain_type(ChainType::Development)
.with_genesis_config(testnet_genesis(
default_funded_accounts.clone(),
para_id,
AccountId::from(hex!("f24FF3a9CF04c71Dbc94D0b566f7A27B94566cac")), // Alith
))
.with_properties(properties)
.with_boot_nodes(boot_nodes)
.build()
}

pub fn local_testnet_config(para_id: ParaId, boot_nodes: Vec<String>) -> ChainSpec {
Expand All @@ -105,7 +101,7 @@ pub fn local_testnet_config(para_id: ParaId, boot_nodes: Vec<String>) -> ChainSp
properties.insert("tokenDecimals".into(), 18.into());
properties.insert("ss58Format".into(), 42.into());
properties.insert("isEthereum".into(), true.into());
let protocol_id = Some(format!("container-chain-{}", para_id));
let protocol_id = format!("container-chain-{}", para_id);

let mut default_funded_accounts = pre_funded_accounts();
default_funded_accounts.sort();
Expand All @@ -118,55 +114,41 @@ pub fn local_testnet_config(para_id: ParaId, boot_nodes: Vec<String>) -> ChainSp
})
.collect();

ChainSpec::from_genesis(
// Name
&format!("Frontier Container {}", para_id),
// ID
&format!("frontier_container_{}", para_id),
ChainType::Local,
move || {
testnet_genesis(
default_funded_accounts.clone(),
para_id,
AccountId::from(hex!("f24FF3a9CF04c71Dbc94D0b566f7A27B94566cac")), // Alith
)
},
// Bootnodes
boot_nodes,
// Telemetry
None,
// Protocol ID
protocol_id.as_deref(),
// Fork ID
None,
// Properties
Some(properties),
// Extensions
ChainSpec::builder(
container_chain_template_frontier_runtime::WASM_BINARY
.expect("WASM binary was not built, please build it!"),
Extensions {
relay_chain: "rococo-local".into(), // You MUST set this to the correct network!
para_id: para_id.into(),
},
)
.with_name(&format!("Frontier Container {}", para_id))
.with_id(&format!("frontier_container_{}", para_id))
.with_chain_type(ChainType::Local)
.with_genesis_config(testnet_genesis(
default_funded_accounts.clone(),
para_id,
AccountId::from(hex!("f24FF3a9CF04c71Dbc94D0b566f7A27B94566cac")), // Alith
))
.with_properties(properties)
.with_protocol_id(&protocol_id)
.with_boot_nodes(boot_nodes)
.build()
}

fn testnet_genesis(
endowed_accounts: Vec<AccountId>,
id: ParaId,
root_key: AccountId,
) -> container_chain_template_frontier_runtime::RuntimeGenesisConfig {
) -> serde_json::Value {
// This is the simplest bytecode to revert without returning any data.
// We will pre-deploy it under all of our precompiles to ensure they can be called from
// within contracts.
// (PUSH1 0x00 PUSH1 0x00 REVERT)
let revert_bytecode = vec![0x60, 0x00, 0x60, 0x00, 0xFD];

container_chain_template_frontier_runtime::RuntimeGenesisConfig {
system: container_chain_template_frontier_runtime::SystemConfig {
code: container_chain_template_frontier_runtime::WASM_BINARY
.expect("WASM binary was not build, please build it!")
.to_vec(),
..Default::default()
},
let g = container_chain_template_frontier_runtime::RuntimeGenesisConfig {
system: Default::default(),
balances: container_chain_template_frontier_runtime::BalancesConfig {
balances: endowed_accounts
.iter()
Expand Down Expand Up @@ -225,7 +207,9 @@ fn testnet_genesis(
// This should initialize it to whatever we have set in the pallet
polkadot_xcm: PolkadotXcmConfig::default(),
tx_pause: Default::default(),
}
};

serde_json::to_value(&g).unwrap()
}

/// Get pre-funded accounts
Expand Down
3 changes: 2 additions & 1 deletion container-chains/templates/frontier/node/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ pub enum Subcommand {
PurgeChain(cumulus_client_cli::PurgeChainCmd),

/// Export the genesis state of the parachain.
ExportGenesisState(cumulus_client_cli::ExportGenesisStateCommand),
#[command(alias = "export-genesis-state")]
ExportGenesisHead(cumulus_client_cli::ExportGenesisHeadCommand),
girazoki marked this conversation as resolved.
Show resolved Hide resolved

/// Export the genesis wasm of the parachain.
ExportGenesisWasm(cumulus_client_cli::ExportGenesisWasmCommand),
Expand Down
6 changes: 3 additions & 3 deletions container-chains/templates/frontier/node/src/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ use {
service::{self, frontier_database_dir, NodeConfig},
},
container_chain_template_frontier_runtime::Block,
cumulus_client_cli::generate_genesis_block,
cumulus_primitives_core::ParaId,
frame_benchmarking_cli::{BenchmarkCmd, SUBSTRATE_REFERENCE_HARDWARE},
log::{info, warn},
node_common::command::generate_genesis_block,
node_common::service::NodeBuilderConfig as _,
parity_scale_codec::Encode,
polkadot_cli::IdentifyVariant,
Expand Down Expand Up @@ -235,11 +235,11 @@ pub fn run() -> Result<()> {
cmd.run(config, polkadot_config)
})
}
Some(Subcommand::ExportGenesisState(cmd)) => {
Some(Subcommand::ExportGenesisHead(cmd)) => {
let runner = cli.create_runner(cmd)?;
runner.sync_run(|mut config| {
let partials = NodeConfig::new_builder(&mut config, None)?;
cmd.run(&*config.chain_spec, &*partials.client)
cmd.run(partials.client)
})
}
Some(Subcommand::ExportGenesisWasm(cmd)) => {
Expand Down
5 changes: 0 additions & 5 deletions container-chains/templates/frontier/node/src/eth.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,6 @@
// You should have received a copy of the GNU General Public License
// along with Tanssi. If not, see <http://www.gnu.org/licenses/>.

// Frontier
pub use {
fc_consensus::FrontierBlockImport,
fc_rpc_core::types::{FeeHistoryCache, FeeHistoryCacheLimit, FilterPool},
};
// Local
use container_chain_template_frontier_runtime::opaque::Block;

Expand Down
2 changes: 1 addition & 1 deletion container-chains/templates/frontier/node/src/rpc/eth.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ use {
// Frontier
use fc_db::Backend as FrontierBackend;
pub use {
fc_rpc::{EthBlockDataCacheTask, EthConfig, OverrideHandle, StorageOverride},
fc_rpc::{EthBlockDataCacheTask, OverrideHandle},
fc_rpc_core::types::{FeeHistoryCache, FeeHistoryCacheLimit, FilterPool},
fc_storage::overrides_handle,
};
Expand Down
6 changes: 3 additions & 3 deletions container-chains/templates/frontier/node/src/rpc/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ pub use sc_rpc::{DenyUnsafe, SubscriptionTaskExecutor};

use {
container_chain_template_frontier_runtime::{opaque::Block, AccountId, Hash, Index},
cumulus_client_parachain_inherent::ParachainInherentData,
cumulus_primitives_core::{ParaId, PersistedValidationData},
cumulus_primitives_parachain_inherent::ParachainInherentData,
cumulus_test_relay_sproof_builder::RelayStateSproofBuilder,
fc_rpc::{EthTask, TxPool},
fc_rpc_core::TxPoolApiServer,
Expand All @@ -45,14 +45,14 @@ use {
sc_service::TaskManager,
sc_transaction_pool::{ChainApi, Pool},
sc_transaction_pool_api::TransactionPool,
sp_api::{CallApiAt, HeaderT, ProvideRuntimeApi},
sp_api::{CallApiAt, ProvideRuntimeApi},
sp_block_builder::BlockBuilder,
sp_blockchain::{
Backend as BlockchainBackend, Error as BlockChainError, HeaderBackend, HeaderMetadata,
},
sp_consensus_aura::SlotDuration,
sp_core::H256,
sp_runtime::traits::{BlakeTwo256, Block as BlockT},
sp_runtime::traits::{BlakeTwo256, Block as BlockT, Header as HeaderT},
std::{sync::Arc, time::Duration},
};
pub struct DefaultEthConfig<C, BE>(std::marker::PhantomData<(C, BE)>);
Expand Down
4 changes: 1 addition & 3 deletions container-chains/templates/frontier/node/src/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,9 @@ use {
container_chain_template_frontier_runtime::{opaque::Block, RuntimeApi},
cumulus_client_cli::CollatorOptions,
cumulus_client_consensus_common::ParachainBlockImport as TParachainBlockImport,
cumulus_client_parachain_inherent::{MockValidationDataInherentDataProvider, MockXcmConfig},
cumulus_client_service::prepare_node_config,
cumulus_primitives_core::{relay_chain::well_known_keys as RelayWellKnownKeys, ParaId},
cumulus_primitives_parachain_inherent::{
MockValidationDataInherentDataProvider, MockXcmConfig,
},
fc_consensus::FrontierBlockImport,
fc_db::DatabaseSource,
fc_rpc_core::types::{FeeHistoryCache, FilterPool},
Expand Down
Loading
Loading