Skip to content
This repository has been archived by the owner on Jun 6, 2024. It is now read-only.

Update to v0.9.43 #92

Merged
merged 8 commits into from
Jun 27, 2023
Merged
Show file tree
Hide file tree
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
3,504 changes: 2,035 additions & 1,469 deletions Cargo.lock

Large diffs are not rendered by default.

32 changes: 16 additions & 16 deletions nimbus-consensus/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,24 @@ edition = "2021"
version = "0.9.0"
[dependencies]
# Substrate deps
sc-client-api = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.40" }
sc-consensus = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.40" }
sc-consensus-manual-seal = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.40" }
sp-api = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.40" }
sp-application-crypto = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.40" }
sp-block-builder = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.40" }
sp-blockchain = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.40" }
sp-consensus = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.40" }
sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.40" }
sp-inherents = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.40" }
sp-keystore = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.40" }
sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.40" }
substrate-prometheus-endpoint = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.40" }
sc-client-api = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.43" }
sc-consensus = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.43" }
sc-consensus-manual-seal = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.43" }
sp-api = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.43" }
sp-application-crypto = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.43" }
sp-block-builder = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.43" }
sp-blockchain = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.43" }
sp-consensus = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.43" }
sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.43" }
sp-inherents = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.43" }
sp-keystore = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.43" }
sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.43" }
substrate-prometheus-endpoint = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.43" }

# Cumulus dependencies
cumulus-client-consensus-common = { git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.40" }
cumulus-primitives-core = { git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.40" }
cumulus-primitives-parachain-inherent = { git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.40" }
cumulus-client-consensus-common = { git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.43" }
cumulus-primitives-core = { git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.43" }
cumulus-primitives-parachain-inherent = { git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.43" }

# Nimbus Dependencies
nimbus-primitives = { path = "../nimbus-primitives" }
Expand Down
40 changes: 24 additions & 16 deletions nimbus-consensus/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,13 @@ use parking_lot::Mutex;
use sc_client_api::backend::Backend;
use sc_consensus::{BlockImport, BlockImportParams};
use sp_api::ProvideRuntimeApi;
use sp_application_crypto::{ByteArray, CryptoTypePublicPair};
use sp_application_crypto::ByteArray;
use sp_consensus::{
BlockOrigin, EnableProofRecording, Environment, ProofRecording, Proposal, Proposer,
};
use sp_core::{crypto::CryptoTypeId, sr25519};
use sp_inherents::{CreateInherentDataProviders, InherentData, InherentDataProvider};
use sp_keystore::{SyncCryptoStore, SyncCryptoStorePtr};
use sp_keystore::{Keystore, KeystorePtr};
use sp_runtime::{
traits::{Block as BlockT, Header as HeaderT},
DigestItem,
Expand All @@ -59,7 +60,7 @@ pub struct NimbusConsensus<B: BlockT, PF, BI, BE, ParaClient, CIDP, DP = ()> {
create_inherent_data_providers: Arc<CIDP>,
block_import: Arc<futures::lock::Mutex<ParachainBlockImport<B, BI, BE>>>,
parachain_client: Arc<ParaClient>,
keystore: SyncCryptoStorePtr,
keystore: KeystorePtr,
skip_prediction: bool,
additional_digests_provider: Arc<DP>,
_phantom: PhantomData<B>,
Expand Down Expand Up @@ -170,9 +171,9 @@ where
/// and intend to perform an operation with it regardless of whether it is
/// expected to be eligible. Concretely, this is used in the consensus worker
/// to implement the `skip_prediction` feature.
pub(crate) fn first_available_key(keystore: &dyn SyncCryptoStore) -> Option<CryptoTypePublicPair> {
pub(crate) fn first_available_key(keystore: &dyn Keystore) -> Option<Vec<u8>> {
// Get all the available keys
match SyncCryptoStore::keys(keystore, NIMBUS_KEY_ID) {
match Keystore::keys(keystore, NIMBUS_KEY_ID) {
Ok(available_keys) => {
if available_keys.is_empty() {
warn!(
Expand All @@ -194,16 +195,16 @@ pub(crate) fn first_available_key(keystore: &dyn SyncCryptoStore) -> Option<Cryp
/// This is the standard way of determining which key to author with.
pub(crate) fn first_eligible_key<B: BlockT, C>(
client: Arc<C>,
keystore: &dyn SyncCryptoStore,
keystore: &dyn Keystore,
parent: &B::Header,
slot_number: u32,
) -> Option<CryptoTypePublicPair>
) -> Option<Vec<u8>>
where
C: ProvideRuntimeApi<B>,
C::Api: NimbusApi<B>,
{
// Get all the available keys
let available_keys = SyncCryptoStore::keys(keystore, NIMBUS_KEY_ID).ok()?;
let available_keys = Keystore::keys(keystore, NIMBUS_KEY_ID).ok()?;

// Print a more helpful message than "not eligible" when there are no keys at all.
if available_keys.is_empty() {
Expand All @@ -220,7 +221,7 @@ where
let maybe_key = available_keys.into_iter().find(|type_public_pair| {
// Have to convert to a typed NimbusId to pass to the runtime API. Maybe this is a clue
// That I should be passing Vec<u8> across the wasm boundary?
if let Ok(nimbus_id) = NimbusId::from_slice(&type_public_pair.1) {
if let Ok(nimbus_id) = NimbusId::from_slice(&type_public_pair) {
NimbusApi::can_author(
&*client.runtime_api(),
parent.hash(),
Expand All @@ -247,18 +248,20 @@ where

pub(crate) fn seal_header<B>(
header: &B::Header,
keystore: &dyn SyncCryptoStore,
type_public_pair: &CryptoTypePublicPair,
keystore: &dyn Keystore,
public_pair: &Vec<u8>,
crypto_id: &CryptoTypeId,
) -> DigestItem
where
B: BlockT,
{
let pre_hash = header.hash();

let raw_sig = SyncCryptoStore::sign_with(
let raw_sig = Keystore::sign_with(
&*keystore,
NIMBUS_KEY_ID,
type_public_pair,
*crypto_id,
public_pair,
pre_hash.as_ref(),
)
.expect("Keystore should be able to sign")
Expand Down Expand Up @@ -344,7 +347,7 @@ where
.map_err(|e| error!(target: LOG_TARGET, error = ?e, "Could not create proposer."))
.ok()?;

let nimbus_id = NimbusId::from_slice(&type_public_pair.1)
let nimbus_id = NimbusId::from_slice(&type_public_pair)
.map_err(
|e| error!(target: LOG_TARGET, error = ?e, "Invalid Nimbus ID (wrong length)."),
)
Expand Down Expand Up @@ -388,7 +391,12 @@ where

let (header, extrinsics) = block.clone().deconstruct();

let sig_digest = seal_header::<B>(&header, &*self.keystore, &type_public_pair);
let sig_digest = seal_header::<B>(
&header,
&*self.keystore,
&type_public_pair,
&sr25519::CRYPTO_ID,
);

let mut block_import_params = BlockImportParams::new(BlockOrigin::Own, header.clone());
block_import_params.post_digests.push(sig_digest.clone());
Expand Down Expand Up @@ -446,7 +454,7 @@ pub struct BuildNimbusConsensusParams<PF, BI, BE, ParaClient, CIDP, DP> {
pub block_import: BI,
pub backend: Arc<BE>,
pub parachain_client: Arc<ParaClient>,
pub keystore: SyncCryptoStorePtr,
pub keystore: KeystorePtr,
pub skip_prediction: bool,
pub additional_digests_provider: DP,
}
15 changes: 10 additions & 5 deletions nimbus-consensus/src/manual_seal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,16 @@ use sc_consensus::BlockImportParams;
use sc_consensus_manual_seal::{ConsensusDataProvider, Error};
use sp_api::{BlockT, HeaderT, ProvideRuntimeApi, TransactionFor};
use sp_application_crypto::ByteArray;
use sp_core::sr25519;
use sp_inherents::InherentData;
use sp_keystore::SyncCryptoStorePtr;
use sp_keystore::KeystorePtr;
use sp_runtime::{Digest, DigestItem};
use std::{marker::PhantomData, sync::Arc};

/// Provides nimbus-compatible pre-runtime digests for use with manual seal consensus
pub struct NimbusManualSealConsensusDataProvider<C, DP = (), P = ()> {
/// Shared reference to keystore
pub keystore: SyncCryptoStorePtr,
pub keystore: KeystorePtr,

/// Shared reference to the client
pub client: Arc<C>,
Expand Down Expand Up @@ -77,7 +78,7 @@ where
// If we aren't eligible, return an appropriate error
match maybe_key {
Some(key) => {
let nimbus_id = NimbusId::from_slice(&key.1).map_err(|_| {
let nimbus_id = NimbusId::from_slice(&key).map_err(|_| {
Error::StringError(String::from("invalid nimbus id (wrong length)"))
})?;
let mut logs = vec![CompatibleDigestItem::nimbus_pre_digest(nimbus_id.clone())];
Expand Down Expand Up @@ -121,8 +122,12 @@ where
let nimbus_public = NimbusId::from_slice(&claimed_author)
.map_err(|_| Error::StringError(String::from("invalid nimbus id (wrong length)")))?;

let sig_digest =
crate::seal_header::<B>(&params.header, &*self.keystore, &nimbus_public.into());
let sig_digest = crate::seal_header::<B>(
&params.header,
&*self.keystore,
&nimbus_public.to_raw_vec(),
&sr25519::CRYPTO_ID,
);

params.post_digests.push(sig_digest);

Expand Down
16 changes: 8 additions & 8 deletions nimbus-primitives/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,16 @@ version = "0.9.0"
async-trait = { version = "0.1", optional = true }
parity-scale-codec = { version = "3.0.0", default-features = false, features = [ "derive" ] }

frame-support = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.40" }
frame-system = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.40" }
frame-support = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.43" }
frame-system = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.43" }
scale-info = { version = "2.0.0", default-features = false, features = [ "derive" ] }
sp-api = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.40" }
sp-application-crypto = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.40" }
sp-inherents = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.40" }
sp-runtime = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.40" }
sp-std = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.40" }
sp-api = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.43" }
sp-application-crypto = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.43" }
sp-inherents = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.43" }
sp-runtime = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.43" }
sp-std = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.43" }

frame-benchmarking = { git = "https://github.com/paritytech/substrate", optional = true, default-features = false, branch = "polkadot-v0.9.40" }
frame-benchmarking = { git = "https://github.com/paritytech/substrate", optional = true, default-features = false, branch = "polkadot-v0.9.43" }

[features]
default = [ "std" ]
Expand Down
10 changes: 5 additions & 5 deletions pallets/aura-style-filter/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@ edition = "2021"
version = "0.9.0"

[dependencies]
frame-support = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.40" }
frame-system = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.40" }
frame-support = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.43" }
frame-system = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.43" }
nimbus-primitives = { path = "../../nimbus-primitives", default-features = false }
parity-scale-codec = { version = "3.0.0", default-features = false, features = [ "derive" ] }
scale-info = { version = "2.0.0", default-features = false, features = [ "derive" ] }
serde = { version = "1.0.101", optional = true, features = [ "derive" ] }
sp-core = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.40" }
sp-runtime = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.40" }
sp-std = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.40" }
sp-core = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.43" }
sp-runtime = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.43" }
sp-std = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.43" }

[features]
default = [ "std" ]
Expand Down
22 changes: 11 additions & 11 deletions pallets/author-inherent/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,25 +7,25 @@ license = "GPL-3.0-only"
version = "0.9.0"

[dependencies]
frame-support = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.40" }
frame-system = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.40" }
frame-support = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.43" }
frame-system = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.43" }
log = { version = "0.4.17", default-features = false }
nimbus-primitives = { path = "../../nimbus-primitives", default-features = false }
parity-scale-codec = { version = "3.0.0", default-features = false, features = [ "derive" ] }
scale-info = { version = "2.0.0", default-features = false, features = [ "derive" ] }
sp-api = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.40" }
sp-application-crypto = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.40" }
sp-inherents = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.40" }
sp-runtime = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.40" }
sp-std = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.40" }
sp-api = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.43" }
sp-application-crypto = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.43" }
sp-inherents = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.43" }
sp-runtime = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.43" }
sp-std = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.43" }

# Benchmarks
frame-benchmarking = { git = "https://github.com/paritytech/substrate", optional = true, default-features = false, branch = "polkadot-v0.9.40" }
frame-benchmarking = { git = "https://github.com/paritytech/substrate", optional = true, default-features = false, branch = "polkadot-v0.9.43" }

[dev-dependencies]
frame-support-test = { git = "https://github.com/paritytech/substrate", version = "3.0.0", branch = "polkadot-v0.9.40" }
sp-core = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.40" }
sp-io = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.40" }
frame-support-test = { git = "https://github.com/paritytech/substrate", version = "3.0.0", branch = "polkadot-v0.9.43" }
sp-core = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.43" }
sp-io = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.43" }

[features]
default = [ "std" ]
Expand Down
16 changes: 8 additions & 8 deletions pallets/author-slot-filter/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,23 @@ edition = "2021"
version = "0.9.0"

[dependencies]
frame-support = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.40" }
frame-system = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.40" }
frame-support = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.43" }
frame-system = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.43" }
log = { version = "0.4.17", default-features = false }
nimbus-primitives = { path = "../../nimbus-primitives", default-features = false }
parity-scale-codec = { version = "3.0.0", default-features = false, features = [ "derive" ] }
scale-info = { version = "2.0.0", default-features = false, features = [ "derive" ] }
serde = { version = "1.0.101", default-features = false, features = [ "derive" ] }
sp-core = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.40" }
sp-runtime = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.40" }
sp-std = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.40" }
sp-core = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.43" }
sp-runtime = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.43" }
sp-std = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.43" }

# Benchmarks
frame-benchmarking = { git = "https://github.com/paritytech/substrate", optional = true, default-features = false, branch = "polkadot-v0.9.40" }
frame-benchmarking = { git = "https://github.com/paritytech/substrate", optional = true, default-features = false, branch = "polkadot-v0.9.43" }

[dev-dependencies]
frame-support-test = { git = "https://github.com/paritytech/substrate", version = "3.0.0", branch = "polkadot-v0.9.40" }
sp-io = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.40" }
frame-support-test = { git = "https://github.com/paritytech/substrate", version = "3.0.0", branch = "polkadot-v0.9.43" }
sp-io = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.43" }

[features]
default = [ "std" ]
Expand Down
1 change: 1 addition & 0 deletions pallets/author-slot-filter/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ mod mock;
#[cfg(test)]
mod tests;

#[allow(deprecated)]
Agusrodri marked this conversation as resolved.
Show resolved Hide resolved
#[pallet]
pub mod pallet {

Expand Down
Loading