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

BEEFY: add on-chain mechanism to initialize/reset beefy pallet and client (voter) #14203

Closed
Tracked by #2150
acatangiu opened this issue May 23, 2023 · 1 comment · Fixed by #14217
Closed
Tracked by #2150
Assignees
Labels
J0-enhancement An additional feature request.

Comments

@acatangiu
Copy link
Contributor

BEEFY will be deployed on running chains so relying on GenesisConfig is not enough.

Currently, to initialize it, sudo/governance needs to do multiple synchronized setStorage** calls (setting pallet genesis block and setting initial authority_set_id to GENESIS_AUTHORITY_SET_ID).

This approach doesn't allow us to set a genesis further in the future than current session because the authority-set-id is incremented every session and the client expects active.id() == GENESIS_AUTHORITY_SET_ID for the pallet genesis block; and is somewhat error-prone.

Solution(s)

  1. Relax requirement that initial authority_set_id needs to be GENESIS_AUTHORITY_SET_ID. (easy)
  2. Add explicit reset/init mechanism to pallet-beefy so that it only starts tracking and rotating authority-sets after pallet genesis block. (more involved)

CC @andresilva

@acatangiu acatangiu added the J0-enhancement An additional feature request. label May 23, 2023
@acatangiu acatangiu self-assigned this May 23, 2023
@acatangiu acatangiu added this to BEEFY May 23, 2023
@acatangiu acatangiu moved this to Need for Polkadot 🗒 in BEEFY May 23, 2023
@acatangiu acatangiu moved this from Need for Polkadot 🗒 to Need for Kusama 🗒 in BEEFY May 23, 2023
@acatangiu
Copy link
Contributor Author

I think we should go with 1st option.

BEEFY consensus can be restarted by resetting "genesisBlock" in pallet-beefy, but we don't want to also reset authority set IDs so that they are uniquely identified across the entire chain history regardless of how many times BEEFY consensus has been reset/restarted.
Ergo the client should also accept initial authority_set_id != 0.

acatangiu added a commit that referenced this issue May 25, 2023
BEEFY consensus can be restarted by resetting "genesisBlock" in
pallet-beefy, but we don't want to also reset authority set IDs so
that they are uniquely identified across the entire chain history
regardless of how many times BEEFY consensus has been reset/restarted.

This is why the client now also accepts initial authority_set_id != 0.

BEEFY client now detects pallet-beefy reset/reinit and errors-out and
asks for a restart.
BEEFY client persisted state should be discarded on client restarts
following pallet-beefy reset/reinit.

End result is BEEFY client/voter can now completely reinitialize using
"new" on-chain info following pallet-beefy reset/reinit, discarding old state.

Fixes #14203
Fixes #14204

Signed-off-by: acatangiu <adrian@parity.io>
@github-project-automation github-project-automation bot moved this from Need for Kusama 🗒 to Done ✅ in BEEFY May 25, 2023
coderobe pushed a commit that referenced this issue May 25, 2023
BEEFY consensus can be restarted by resetting "genesisBlock" in
pallet-beefy, but we don't want to also reset authority set IDs so
that they are uniquely identified across the entire chain history
regardless of how many times BEEFY consensus has been reset/restarted.

This is why the client now also accepts initial authority_set_id != 0.

BEEFY client now detects pallet-beefy reset/reinit and errors-out and
asks for a restart.
BEEFY client persisted state should be discarded on client restarts
following pallet-beefy reset/reinit.

End result is BEEFY client/voter can now completely reinitialize using
"new" on-chain info following pallet-beefy reset/reinit, discarding old state.

Fixes #14203
Fixes #14204

Signed-off-by: acatangiu <adrian@parity.io>
Ank4n pushed a commit that referenced this issue Jul 8, 2023
BEEFY consensus can be restarted by resetting "genesisBlock" in
pallet-beefy, but we don't want to also reset authority set IDs so
that they are uniquely identified across the entire chain history
regardless of how many times BEEFY consensus has been reset/restarted.

This is why the client now also accepts initial authority_set_id != 0.

BEEFY client now detects pallet-beefy reset/reinit and errors-out and
asks for a restart.
BEEFY client persisted state should be discarded on client restarts
following pallet-beefy reset/reinit.

End result is BEEFY client/voter can now completely reinitialize using
"new" on-chain info following pallet-beefy reset/reinit, discarding old state.

Fixes #14203
Fixes #14204

Signed-off-by: acatangiu <adrian@parity.io>
nathanwhit pushed a commit to nathanwhit/substrate that referenced this issue Jul 19, 2023
…ch#14217)

BEEFY consensus can be restarted by resetting "genesisBlock" in
pallet-beefy, but we don't want to also reset authority set IDs so
that they are uniquely identified across the entire chain history
regardless of how many times BEEFY consensus has been reset/restarted.

This is why the client now also accepts initial authority_set_id != 0.

BEEFY client now detects pallet-beefy reset/reinit and errors-out and
asks for a restart.
BEEFY client persisted state should be discarded on client restarts
following pallet-beefy reset/reinit.

End result is BEEFY client/voter can now completely reinitialize using
"new" on-chain info following pallet-beefy reset/reinit, discarding old state.

Fixes paritytech#14203
Fixes paritytech#14204

Signed-off-by: acatangiu <adrian@parity.io>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
J0-enhancement An additional feature request.
Projects
No open projects
Status: Done
Development

Successfully merging a pull request may close this issue.

1 participant