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

add expected blocktime to pallet_async_backing #30

Merged
merged 2 commits into from
Mar 14, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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 changes: 3 additions & 0 deletions pallets/async-backing/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,9 @@ pub mod pallet {

/// A way to get the current parachain slot and verify it's validity against the relay slot.
type GetAndVerifySlot: GetAndVerifySlot;

#[pallet::constant]
type ExpectedBlockTime: Get<Self::Moment>;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Maybe add a comment that this is used by tools like chopsticks, to prevent future developers from accidentally removing it

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

done

}

/// First tuple element is the highest slot that has been seen in the history of this chain.
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 @@ -81,6 +81,7 @@ impl pallet_timestamp::Config for Test {
parameter_types! {
pub const AllowMultipleBlocksPerSlot: bool = true;
pub const SlotDuration: u64 = 12000;
type ExpectedBlockTime = ConstU64<1>;
}

impl async_backing::Config for Test {
Expand Down
5 changes: 5 additions & 0 deletions template/runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -638,9 +638,14 @@ impl pallet_author_slot_filter::Config for Runtime {
type WeightInfo = ();
}

parameter_types! {
pub const ExpectedBlockTime: u64 = MILLISECS_PER_BLOCK;
}

impl pallet_async_backing::Config for Runtime {
type AllowMultipleBlocksPerSlot = ConstBool<false>;
type GetAndVerifySlot = pallet_async_backing::RelaySlot;
type ExpectedBlockTime = ExpectedBlockTime;
}

parameter_types! {
Expand Down
Loading