Skip to content
Closed
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
274 changes: 137 additions & 137 deletions Cargo.lock

Large diffs are not rendered by default.

22 changes: 12 additions & 10 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
[workspace]
members = [
"client/consensus/nimbus-consensus",
"precompiles/*",
"pallets/*",
"primitives/*",
"template/node",
"template/runtime",
"template/pallets/template",
"client/consensus/nimbus-consensus",
"precompiles/*",
"pallets/*",
"primitives/*",
"template/node",
"template/runtime",
"template/pallets/template",
]
resolver = "2"

Expand All @@ -26,12 +26,14 @@ async-trait = { version = "0.1.42" }
environmental = { version = "1.1.2", default-features = false }
hex = { version = "0.4.3", default-features = false }
impl-trait-for-tuples = "0.2.1"
parity-scale-codec = { version = "3.0.0", default-features = false, features = [ "derive" ] }
futures = { version = "0.3.24", features = [ "compat" ] }
parity-scale-codec = { version = "3.0.0", default-features = false, features = [
"derive",
] }
futures = { version = "0.3.31", features = ["compat"] }
log = { version = "0.4.22", default-features = false }
parking_lot = "0.12"
scale-info = { version = "2.11.2", default-features = false, features = [
"derive",
"derive",
] }
schnorrkel = { version = "0.11.4", default-features = false }
serde = { version = "1.0.195", default-features = false }
Expand Down
51 changes: 46 additions & 5 deletions client/consensus/nimbus-consensus/src/collators/lookahead.rs
Original file line number Diff line number Diff line change
Expand Up @@ -146,10 +146,18 @@ where
}
};

// React to each new relmy block
// React to each new relay block
while let Some(relay_parent_header) = import_notifications.next().await {
let relay_parent = relay_parent_header.hash();

tracing::trace!(
target: crate::LOG_TARGET,
?relay_parent,
relay_parent_number = ?relay_parent_header.number(),
?params.para_id,
"Notified of a new relay block",
);

// TODO: Currently we use just the first core here, but for elastic scaling
// we iterate and build on all of the cores returned.
// More info: https://github.com/paritytech/polkadot-sdk/issues/1829
Expand Down Expand Up @@ -201,7 +209,15 @@ where
&relay_parent_header,
params.relay_chain_slot_duration,
) {
None => continue,
None => {
tracing::trace!(
target: crate::LOG_TARGET,
relay_parent = ?relay_parent_header,
relay_chain_slot_duration = ?params.relay_chain_slot_duration,
"Fail to get the relay slot for this relay block!"
);
continue;
}
Some((relay_slot, relay_timestamp)) => {
let our_slot = if let Some(slot_duration) = params.slot_duration {
Slot::from_timestamp(relay_timestamp, slot_duration)
Expand Down Expand Up @@ -299,6 +315,7 @@ where

tracing::debug!(
target: crate::LOG_TARGET,
?slot_now,
?relay_parent,
unincluded_segment_len = initial_parent.depth + n_built,
"Slot claimed. Building"
Expand Down Expand Up @@ -442,10 +459,34 @@ where
// collator against chains which have not yet upgraded their runtime.
if parent.hash() != included_block {
match runtime_api.can_build_upon(parent.hash(), included_block, slot) {
Ok(true) => Some(nimbus_id),
Ok(false) => None,
Ok(true) => {
tracing::trace!(
target: crate::LOG_TARGET,
parent_number = ?parent.number(),
parent_hash = ?parent.hash(),
relay_parent_number = ?relay_parent.number(),
relay_parent_hash = ?relay_parent.hash(),
?included_block,
?slot,
"Runtime api UnincludedSegmentApi::can_build_upon return TRUE",
);
Some(nimbus_id)
}
Ok(false) => {
tracing::debug!(
target: crate::LOG_TARGET,
parent_number = ?parent.number(),
parent_hash = ?parent.hash(),
relay_parent_number = ?relay_parent.number(),
relay_parent_hash = ?relay_parent.hash(),
?included_block,
?slot,
"Runtime api UnincludedSegmentApi::can_build_upon return FALSE",
);
None
}
Err(err) => {
tracing::error!(
tracing::warn!(
target: crate::LOG_TARGET,
?err,
?parent,
Expand Down
3 changes: 0 additions & 3 deletions pallets/async-backing/src/consensus_hook.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,6 @@ use frame_support::pallet_prelude::*;
use sp_consensus_slots::Slot;
use sp_std::{marker::PhantomData, num::NonZeroU32};

#[cfg(tests)]
type RelayChainStateProof = crate::mock::FakeRelayChainStateProof;

/// A consensus hook for a fixed block processing velocity and unincluded segment capacity.
///
/// Relay chain slot duration must be provided in milliseconds.
Expand Down
1 change: 1 addition & 0 deletions pallets/async-backing/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ parameter_types! {
}

impl frame_system::Config for Test {
type ExtensionsWeightInfo = ();
type BaseCallFilter = frame_support::traits::Everything;
type BlockWeights = ();
type BlockLength = ();
Expand Down
7 changes: 5 additions & 2 deletions pallets/author-inherent/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,16 @@

#![cfg_attr(not(feature = "std"), no_std)]

extern crate alloc;

use alloc::string::String;
use frame_support::traits::{FindAuthor, Get};
use nimbus_primitives::{
AccountLookup, CanAuthor, NimbusId, SlotBeacon, INHERENT_IDENTIFIER, NIMBUS_ENGINE_ID,
};
use parity_scale_codec::{Decode, Encode, FullCodec};
use sp_inherents::{InherentIdentifier, IsFatalError};
use sp_runtime::{ConsensusEngineId, RuntimeString};
use sp_runtime::ConsensusEngineId;

pub use crate::weights::WeightInfo;
pub use exec::BlockExecutor;
Expand Down Expand Up @@ -232,7 +235,7 @@ pub mod pallet {
#[derive(Encode)]
#[cfg_attr(feature = "std", derive(Debug, Decode))]
pub enum InherentError {
Other(RuntimeString),
Other(String),
}

impl IsFatalError for InherentError {
Expand Down
1 change: 1 addition & 0 deletions pallets/author-inherent/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ parameter_types! {
}

impl frame_system::Config for Test {
type ExtensionsWeightInfo = ();
type BaseCallFilter = frame_support::traits::Everything;
type BlockWeights = ();
type BlockLength = ();
Expand Down
2 changes: 2 additions & 0 deletions pallets/author-mapping/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ parameter_types! {
pub const AvailableBlockRatio: Perbill = Perbill::one();
}
impl frame_system::Config for Runtime {
type ExtensionsWeightInfo = ();
type BaseCallFilter = Everything;
type DbWeight = ();
type RuntimeOrigin = RuntimeOrigin;
Expand Down Expand Up @@ -121,6 +122,7 @@ impl pallet_balances::Config for Runtime {
type FreezeIdentifier = ();
type MaxFreezes = ();
type RuntimeFreezeReason = ();
type DoneSlashHandler = ();
}

parameter_types! {
Expand Down
1 change: 1 addition & 0 deletions pallets/author-slot-filter/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ parameter_types! {
}

impl frame_system::Config for Test {
type ExtensionsWeightInfo = ();
type BaseCallFilter = frame_support::traits::Everything;
type BlockWeights = ();
type BlockLength = ();
Expand Down
2 changes: 2 additions & 0 deletions pallets/emergency-para-xcm/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ parameter_types! {
pub type AccountId = u64;

impl frame_system::Config for Test {
type ExtensionsWeightInfo = ();
type BaseCallFilter = frame_support::traits::Everything;
type BlockWeights = ();
type BlockLength = ();
Expand Down Expand Up @@ -97,6 +98,7 @@ impl cumulus_pallet_parachain_system::Config for Test {
type CheckAssociatedRelayNumber = EmergencyParaXcm;
type WeightInfo = ();
type ConsensusHook = cumulus_pallet_parachain_system::ExpectParentIncluded;
type SelectCore = cumulus_pallet_parachain_system::DefaultCoreSelector<Test>;
}

parameter_types! {
Expand Down
2 changes: 2 additions & 0 deletions pallets/foreign-asset-creator/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ parameter_types! {
pub const BlockHashCount: u32 = 250;
}
impl frame_system::Config for Test {
type ExtensionsWeightInfo = ();
type BaseCallFilter = Everything;
type BlockWeights = ();
type BlockLength = ();
Expand Down Expand Up @@ -97,6 +98,7 @@ impl pallet_balances::Config for Test {
type RuntimeFreezeReason = ();
type FreezeIdentifier = ();
type MaxFreezes = ();
type DoneSlashHandler = ();
}

parameter_types! {
Expand Down
1 change: 1 addition & 0 deletions pallets/maintenance-mode/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ parameter_types! {
pub const SS58Prefix: u8 = 42;
}
impl frame_system::Config for Test {
type ExtensionsWeightInfo = ();
type BaseCallFilter = MaintenanceMode;
type DbWeight = ();
type RuntimeOrigin = RuntimeOrigin;
Expand Down
2 changes: 2 additions & 0 deletions pallets/migrations/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ parameter_types! {
pub const SS58Prefix: u8 = 42;
}
impl frame_system::Config for Runtime {
type ExtensionsWeightInfo = ();
type BaseCallFilter = Everything;
type DbWeight = RocksDbWeight;
type RuntimeOrigin = RuntimeOrigin;
Expand Down Expand Up @@ -104,6 +105,7 @@ impl pallet_balances::Config for Runtime {
type FreezeIdentifier = ();
type MaxFreezes = ();
type RuntimeFreezeReason = ();
type DoneSlashHandler = ();
}

parameter_types! {
Expand Down
2 changes: 2 additions & 0 deletions pallets/randomness/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ parameter_types! {
pub const SS58Prefix: u8 = 42;
}
impl frame_system::Config for Test {
type ExtensionsWeightInfo = ();
type BaseCallFilter = Everything;
type DbWeight = ();
type RuntimeOrigin = RuntimeOrigin;
Expand Down Expand Up @@ -99,6 +100,7 @@ impl pallet_balances::Config for Test {
type FreezeIdentifier = ();
type MaxFreezes = ();
type RuntimeFreezeReason = ();
type DoneSlashHandler = ();
}

parameter_types! {
Expand Down
2 changes: 2 additions & 0 deletions pallets/relay-storage-roots/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ parameter_types! {
pub const SS58Prefix: u8 = 42;
}
impl frame_system::Config for Test {
type ExtensionsWeightInfo = ();
type BaseCallFilter = Everything;
type DbWeight = ();
type RuntimeOrigin = RuntimeOrigin;
Expand Down Expand Up @@ -98,6 +99,7 @@ impl pallet_balances::Config for Test {
type FreezeIdentifier = ();
type MaxFreezes = ();
type RuntimeFreezeReason = ();
type DoneSlashHandler = ();
}

pub struct PersistedValidationDataGetter;
Expand Down
9 changes: 9 additions & 0 deletions precompiles/assets-erc20/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@ mod mock;
#[cfg(test)]
mod tests;

/// System account size in bytes = Pallet_Name_Hash (16) + Storage_name_hash (16) +
/// Blake2_128Concat (16) + AccountId (20) + AccountInfo (4 + 12 + AccountData (4* 16)) = 148
pub const SYSTEM_ACCOUNT_SIZE: u64 = 148;

/// Solidity selector of the Transfer log, which is the Keccak of the Log signature.
pub const SELECTOR_LOG_TRANSFER: [u8; 32] = keccak256!("Transfer(address,address,uint256)");

Expand Down Expand Up @@ -257,6 +261,7 @@ where
id: asset_id.clone().into(),
delegate: Runtime::Lookup::unlookup(spender.clone()),
},
0,
)?;
}
// Dispatch call (if enough gas).
Expand All @@ -268,6 +273,7 @@ where
delegate: Runtime::Lookup::unlookup(spender),
amount,
},
0,
)?;

Ok(())
Expand Down Expand Up @@ -299,6 +305,7 @@ where
target: Runtime::Lookup::unlookup(to),
amount: value,
},
SYSTEM_ACCOUNT_SIZE,
)?;
}

Expand Down Expand Up @@ -346,6 +353,7 @@ where
destination: Runtime::Lookup::unlookup(to),
amount: value,
},
SYSTEM_ACCOUNT_SIZE,
)?;
} else {
// Dispatch call (if enough gas).
Expand All @@ -357,6 +365,7 @@ where
target: Runtime::Lookup::unlookup(to),
amount: value,
},
SYSTEM_ACCOUNT_SIZE,
)?;
}
}
Expand Down
4 changes: 3 additions & 1 deletion precompiles/assets-erc20/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ parameter_types! {
}

impl frame_system::Config for Runtime {
type ExtensionsWeightInfo = ();
type BaseCallFilter = Everything;
type DbWeight = ();
type RuntimeOrigin = RuntimeOrigin;
Expand Down Expand Up @@ -143,6 +144,7 @@ impl pallet_balances::Config for Runtime {
type FreezeIdentifier = ();
type MaxFreezes = ();
type RuntimeFreezeReason = ();
type DoneSlashHandler = ();
}

pub type Precompiles<R> = PrecompileSetBuilder<
Expand Down Expand Up @@ -189,7 +191,7 @@ impl pallet_evm::Config for Runtime {
type FindAuthor = ();
type OnCreate = ();
type GasLimitPovSizeRatio = GasLimitPovSizeRatio;
type SuicideQuickClearLimit = ConstU32<0>;
type GasLimitStorageGrowthRatio = ();
type Timestamp = Timestamp;
type WeightInfo = pallet_evm::weights::SubstrateWeight<Runtime>;
}
Expand Down
Loading
Loading