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

Ensure only the first V + 1 blocks from a given author at a slot are accepted by the runtime #2544

Closed
Tracked by #2476
Sophia-Gold opened this issue May 8, 2023 · 2 comments
Assignees

Comments

@Sophia-Gold
Copy link

Sophia-Gold commented May 8, 2023

From #2476:

What I'm imagining is an extension to the logic of pallet-aura-ext which does these things in on_initialize:

  • Track the slot of the current in a storage item, as well as how many blocks have been authored at that slot. (Slot, u32)
  • if the slot is the same as the previous value of the storage item, the counter is incremented.
  • if the slot is less than the previous value, then panic
  • if the slot is greater than the previous value, then update the storage item to (new_slot, 1).
  • To handle the case where the storage item was not present directly after an upgrade, set the value to (current_slot, 1).

Along with a ConsensusHook implementation like this (living in the pallet-aura-ext crate):

struct FixedVelocityConsensusHook<const N: u32>;
  • If counter > N + 1, panic.
@rphmeier
Copy link
Contributor

rphmeier commented May 10, 2023

We need a second constant C which is the maximum capacity, actually. so struct FixedVelocityConsensusHook<T: pallet_aura::Config, V, C> where both velocity & capacity are clamped to 1

@slumber
Copy link
Contributor

slumber commented May 11, 2023

#2551

@slumber slumber closed this as completed May 11, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants