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

fix: Mainnet halts at block 100 #372

Merged
merged 1 commit into from
Dec 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
19 changes: 0 additions & 19 deletions primitives/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,8 @@ pub mod time {
/// slot_duration()`.
///
/// Change this to adjust the block time.
#[cfg(not(feature = "integration-tests"))]
pub const SECONDS_PER_BLOCK: Moment = 6;

#[allow(clippy::identity_op)]
#[cfg(feature = "integration-tests")]
pub const SECONDS_PER_BLOCK: Moment = 3;

pub const MILLISECS_PER_BLOCK: Moment = SECONDS_PER_BLOCK * 1000;
pub const SLOT_DURATION: Moment = MILLISECS_PER_BLOCK;

Expand Down Expand Up @@ -142,20 +137,6 @@ pub mod fee {
}
}

/// The number of blocks in one session
#[allow(clippy::identity_op)]
#[cfg(feature = "integration-tests")]
pub const SESSION_PERIOD_BLOCKS: BlockNumber = 20 * crate::time::MINUTES;

#[cfg(not(feature = "integration-tests"))]
pub const SESSION_PERIOD_BLOCKS: BlockNumber = 6 * crate::time::HOURS;

#[cfg(not(feature = "integration-tests"))]
pub const UNSIGNED_PROPOSAL_EXPIRY: BlockNumber = SESSION_PERIOD_BLOCKS / 4;

#[cfg(feature = "integration-tests")]
pub const UNSIGNED_PROPOSAL_EXPIRY: BlockNumber = SESSION_PERIOD_BLOCKS;

/// We assume that ~10% of the block weight is consumed by `on_initialize` handlers. This is
/// used to limit the maximal weight of a single extrinsic.
pub const AVERAGE_ON_INITIALIZE_RATIO: Perbill = Perbill::from_percent(10);
Expand Down
21 changes: 9 additions & 12 deletions runtime/mainnet/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ pub use sp_runtime::{MultiAddress, Perbill, Percent, Permill};
pub use tangle_primitives::{
currency::*, fee::*, time::*, AccountId, AccountIndex, Address, Balance, BlockNumber, Hash,
Header, Index, Moment, Signature, AVERAGE_ON_INITIALIZE_RATIO, MAXIMUM_BLOCK_WEIGHT,
NORMAL_DISPATCH_RATIO, SESSION_PERIOD_BLOCKS, UNSIGNED_PROPOSAL_EXPIRY,
NORMAL_DISPATCH_RATIO,
};

use pallet_airdrop_claims::TestWeightInfo;
Expand Down Expand Up @@ -368,21 +368,18 @@ impl pallet_authorship::Config for Runtime {
type FindAuthor = pallet_session::FindAccountFromAuthorIndex<Self, Babe>;
}

parameter_types! {
pub const Period: BlockNumber = SESSION_PERIOD_BLOCKS;
pub const Offset: BlockNumber = 0;
}
use crate::opaque::SessionKeys;

impl pallet_session::Config for Runtime {
type RuntimeEvent = RuntimeEvent;
type ValidatorId = <Self as frame_system::Config>::AccountId;
type ValidatorIdOf = pallet_staking::StashOf<Self>;
type ShouldEndSession = pallet_session::PeriodicSessions<Period, Offset>;
type NextSessionRotation = pallet_session::PeriodicSessions<Period, Offset>;
type SessionManager = Staking;
type SessionHandler = <opaque::SessionKeys as OpaqueKeys>::KeyTypeIdProviders;
type Keys = opaque::SessionKeys;
type WeightInfo = pallet_session::weights::SubstrateWeight<Runtime>;
type ShouldEndSession = Babe;
type NextSessionRotation = Babe;
type SessionManager = pallet_session::historical::NoteHistoricalRoot<Self, Staking>;
type SessionHandler = <SessionKeys as OpaqueKeys>::KeyTypeIdProviders;
type Keys = SessionKeys;
type WeightInfo = ();
}

impl pallet_session::historical::Config for Runtime {
Expand Down Expand Up @@ -949,7 +946,7 @@ parameter_types! {
impl pallet_im_online::Config for Runtime {
type AuthorityId = ImOnlineId;
type RuntimeEvent = RuntimeEvent;
type NextSessionRotation = pallet_session::PeriodicSessions<Period, Offset>;
type NextSessionRotation = Babe;
type ValidatorSet = Historical;
type ReportUnresponsiveness = ();
type UnsignedPriority = ImOnlineUnsignedPriority;
Expand Down
20 changes: 8 additions & 12 deletions runtime/testnet/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,6 @@ pub use tangle_primitives::{
verifier::{arkworks::ArkworksVerifierGroth16Bn254, circom::CircomVerifierGroth16Bn254},
AccountId, AccountIndex, Address, BabeId, Balance, BlockNumber, Hash, Header, Index, Moment,
Signature, AVERAGE_ON_INITIALIZE_RATIO, MAXIMUM_BLOCK_WEIGHT, NORMAL_DISPATCH_RATIO,
SESSION_PERIOD_BLOCKS, UNSIGNED_PROPOSAL_EXPIRY,
};

use pallet_airdrop_claims::TestWeightInfo;
Expand Down Expand Up @@ -379,21 +378,18 @@ impl pallet_authorship::Config for Runtime {
type FindAuthor = pallet_session::FindAccountFromAuthorIndex<Self, Babe>;
}

parameter_types! {
pub const Period: BlockNumber = SESSION_PERIOD_BLOCKS;
pub const Offset: BlockNumber = 0;
}
use crate::opaque::SessionKeys;

impl pallet_session::Config for Runtime {
type RuntimeEvent = RuntimeEvent;
type ValidatorId = <Self as frame_system::Config>::AccountId;
type ValidatorIdOf = pallet_staking::StashOf<Self>;
type ShouldEndSession = pallet_session::PeriodicSessions<Period, Offset>;
type NextSessionRotation = pallet_session::PeriodicSessions<Period, Offset>;
type SessionManager = Staking;
type SessionHandler = <opaque::SessionKeys as OpaqueKeys>::KeyTypeIdProviders;
type Keys = opaque::SessionKeys;
type WeightInfo = pallet_session::weights::SubstrateWeight<Runtime>;
type ShouldEndSession = Babe;
type NextSessionRotation = Babe;
type SessionManager = pallet_session::historical::NoteHistoricalRoot<Self, Staking>;
type SessionHandler = <SessionKeys as OpaqueKeys>::KeyTypeIdProviders;
type Keys = SessionKeys;
type WeightInfo = ();
}

impl pallet_session::historical::Config for Runtime {
Expand Down Expand Up @@ -960,7 +956,7 @@ parameter_types! {
impl pallet_im_online::Config for Runtime {
type AuthorityId = ImOnlineId;
type RuntimeEvent = RuntimeEvent;
type NextSessionRotation = pallet_session::PeriodicSessions<Period, Offset>;
type NextSessionRotation = Babe;
type ValidatorSet = Historical;
type ReportUnresponsiveness = ();
type UnsignedPriority = ImOnlineUnsignedPriority;
Expand Down
Loading