Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.
This repository was 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

@Sophia-Gold

Description

@Sophia-Gold

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.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions