Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Enable Offchain Equalise #5683

Merged
merged 13 commits into from
Apr 27, 2020
21 changes: 21 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ members = [
"frame/society",
"frame/staking",
"frame/staking/reward-curve",
"frame/staking/fuzzer",
"frame/sudo",
"frame/support",
"frame/support/procedural",
Expand Down
5 changes: 4 additions & 1 deletion bin/node/runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -296,8 +296,9 @@ parameter_types! {
pub const BondingDuration: pallet_staking::EraIndex = 24 * 28;
pub const SlashDeferDuration: pallet_staking::EraIndex = 24 * 7; // 1/4 the bonding duration.
pub const RewardCurve: &'static PiecewiseLinear<'static> = &REWARD_CURVE;
pub const ElectionLookahead: BlockNumber = 25; // 10 minutes per session => 100 block.
pub const ElectionLookahead: BlockNumber = EPOCH_DURATION_IN_BLOCKS / 4;
pub const MaxNominatorRewardedPerValidator: u32 = 64;
pub const MaxIterations: u32 = 5;
}

impl pallet_staking::Trait for Runtime {
Expand All @@ -318,6 +319,8 @@ impl pallet_staking::Trait for Runtime {
type NextNewSession = Session;
type ElectionLookahead = ElectionLookahead;
type Call = Call;
type Randomness = RandomnessCollectiveFlip;
Copy link
Member

Choose a reason for hiding this comment

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

Why not Babe?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ow I didn't know Babe also implements it. What are the differences? I don't think the randomness that Staking needs is in any sense consensus critical.

Copy link
Member

Choose a reason for hiding this comment

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

Babe provides "real" randomness, while the one provided by collective flip is based on the last 80? block hashes.

Copy link
Member

Choose a reason for hiding this comment

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

isn't there a local (non-deterministic) rand() function for offchain workers?

Copy link
Member

Choose a reason for hiding this comment

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

Yeah.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'll switch to that then 👍

type MaxIterations = MaxIterations;
type MaxNominatorRewardedPerValidator = MaxNominatorRewardedPerValidator;
type UnsignedPriority = StakingUnsignedPriority;
}
Expand Down
2 changes: 2 additions & 0 deletions frame/session/benchmarking/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,8 @@ impl pallet_staking::Trait for Test {
type Call = Call;
type MaxNominatorRewardedPerValidator = MaxNominatorRewardedPerValidator;
type UnsignedPriority = UnsignedPriority;
type Randomness = ();
type MaxIterations = ();
}

impl crate::Trait for Test {}
Expand Down
4 changes: 0 additions & 4 deletions frame/staking/fuzz/.gitignore

This file was deleted.

38 changes: 0 additions & 38 deletions frame/staking/fuzz/Cargo.toml

This file was deleted.

130 changes: 0 additions & 130 deletions frame/staking/fuzz/fuzz_targets/submit_solution.rs

This file was deleted.

2 changes: 2 additions & 0 deletions frame/staking/fuzzer/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
hfuzz_target
hfuzz_workspace
Loading