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 all 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,811 changes: 1,695 additions & 1,116 deletions Cargo.lock

Large diffs are not rendered by default.

335 changes: 169 additions & 166 deletions Cargo.toml

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion client/consensus/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ 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-parachain-inherent = { workspace = true }
cumulus-primitives-core = { workspace = true }
cumulus-primitives-parachain-inherent = { workspace = true }
cumulus-relay-chain-interface = { workspace = true }

# Polkadot
Expand Down
19 changes: 13 additions & 6 deletions client/consensus/src/collators.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ use {
cumulus_client_collator::service::ServiceInterface as CollatorServiceInterface,
cumulus_client_consensus_common::ParachainCandidate,
cumulus_client_consensus_proposer::ProposerInterface,
cumulus_client_parachain_inherent::{ParachainInherentData, ParachainInherentDataProvider},
cumulus_primitives_core::{
relay_chain::Hash as PHash, DigestItem, ParachainBlockData, PersistedValidationData,
},
cumulus_primitives_parachain_inherent::ParachainInherentData,
cumulus_relay_chain_interface::RelayChainInterface,
futures::prelude::*,
nimbus_primitives::{CompatibleDigestItem as NimbusCompatibleDigestItem, NIMBUS_KEY_ID},
Expand Down Expand Up @@ -113,7 +113,7 @@ where
parent_hash: Block::Hash,
_timestamp: impl Into<Option<Timestamp>>,
) -> Result<(ParachainInherentData, InherentData), Box<dyn Error + Send + Sync + 'static>> {
let paras_inherent_data = ParachainInherentData::create_at(
let paras_inherent_data = ParachainInherentDataProvider::create_at(
relay_parent,
&self.relay_client,
validation_data,
Expand Down Expand Up @@ -158,12 +158,14 @@ where
inherent_data: (ParachainInherentData, InherentData),
proposal_duration: Duration,
max_pov_size: usize,
) -> Result<(Collation, ParachainBlockData<Block>, Block::Hash), Box<dyn Error + Send + 'static>>
{
) -> Result<
Option<(Collation, ParachainBlockData<Block>, Block::Hash)>,
Box<dyn Error + Send + 'static>,
> {
let mut digest = additional_pre_digest.into().unwrap_or_default();
digest.append(&mut slot_claim.pre_digest);

let proposal = self
let maybe_proposal = self
.proposer
.propose(
&parent_header,
Expand All @@ -176,6 +178,11 @@ where
.await
.map_err(|e| Box::new(e) as Box<dyn Error + Send>)?;

let proposal = match maybe_proposal {
None => return Ok(None),
Some(p) => p,
};

let sealed_importable = seal_tanssi::<_, P>(
proposal.block,
proposal.storage_changes,
Expand Down Expand Up @@ -223,7 +230,7 @@ where
);
}

Ok((collation, block_data, post_hash))
Ok(Some((collation, block_data, post_hash)))
} else {
Err(
Box::<dyn Error + Send + Sync>::from("Unable to produce collation")
Expand Down
18 changes: 12 additions & 6 deletions client/consensus/src/collators/basic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ where
.await
);

let (collation, _, post_hash) = try_request!(
let maybe_collation = try_request!(
collator
.collate(
&parent_header,
Expand All @@ -241,11 +241,17 @@ where
.await
);

let result_sender = Some(collator.collator_service().announce_with_barrier(post_hash));
request.complete(Some(CollationResult {
collation,
result_sender,
}));
if let Some((collation, _, post_hash)) = maybe_collation {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Damn it, I hate that they keep changing this part of the code

let result_sender =
Some(collator.collator_service().announce_with_barrier(post_hash));
request.complete(Some(CollationResult {
collation,
result_sender,
}));
} else {
request.complete(None);
tracing::debug!(target: crate::LOG_TARGET, "No block proposal");
}
}
}
}
5 changes: 0 additions & 5 deletions client/consensus/src/consensus_orchestrator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,6 @@ use {
sp_runtime::traits::Block as BlockT,
};

pub use {
sc_consensus_aura::{slot_duration, AuraVerifier, BuildAuraWorkerParams, SlotProportion},
sc_consensus_slots::InherentDataProviderExt,
};

#[async_trait::async_trait]
pub trait RetrieveAuthoritiesFromOrchestrator<Block: BlockT, ExtraArgs, A>: Send + Sync {
/// Create the inherent data providers at the given `parent` block using the given `extra_args`.
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
12 changes: 10 additions & 2 deletions client/consensus/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ use {
polkadot_primitives::{
Hash as PHash, OccupiedCoreAssumption, PersistedValidationData, ValidatorId,
},
sc_block_builder::BlockBuilderProvider,
sc_block_builder::BlockBuilderBuilder,
sc_client_api::HeaderBackend,
sc_consensus::{BoxJustificationImport, ForkChoiceStrategy},
sc_keystore::LocalKeystore,
Expand Down Expand Up @@ -373,7 +373,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();
let (_relay_parent_storage_root, proof) =
RelayStateSproofBuilder::default().into_state_root_and_proof();

Expand Down Expand Up @@ -636,6 +643,7 @@ async fn collate_returns_correct_block() {
)
.await
.unwrap()
.unwrap()
.1;

// The returned block should be imported and we should be able to get its header by now.
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;
11 changes: 7 additions & 4 deletions client/node-common/src/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -549,10 +549,13 @@ 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'."
);
if collator {
if let Err(err) = SUBSTRATE_REFERENCE_HARDWARE.check_hardware(&hwbench) {
log::warn!(
"⚠️ The hardware does not meet the minimal requirements {} for role 'Authority'.",
err
);
}
}

if let Some(ref mut telemetry) = telemetry {
Expand Down
4 changes: 3 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, features = [ "arbitrary_precision" ] }
url = { workspace = true }

# Local
Expand Down Expand Up @@ -88,9 +89,9 @@ cumulus-client-cli = { workspace = true }
cumulus-client-consensus-aura = { workspace = true }
cumulus-client-consensus-common = { workspace = true }
cumulus-client-network = { workspace = true }
cumulus-client-parachain-inherent = { workspace = true }
cumulus-client-service = { workspace = true }
cumulus-primitives-core = { workspace = true }
cumulus-primitives-parachain-inherent = { workspace = true }
cumulus-relay-chain-interface = { workspace = true }
cumulus-test-relay-sproof-builder = { workspace = true }

Expand All @@ -113,6 +114,7 @@ substrate-build-script-utils = { workspace = true }
default = []
runtime-benchmarks = [
"container-chain-template-frontier-runtime/runtime-benchmarks",
"cumulus-primitives-core/runtime-benchmarks",
"frame-benchmarking-cli/runtime-benchmarks",
"frame-benchmarking/runtime-benchmarks",
"nimbus-primitives/runtime-benchmarks",
Expand Down
Loading
Loading