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

Added support for PoA key rotation #2086

Merged
merged 7 commits into from
Aug 15, 2024
Merged

Added support for PoA key rotation #2086

merged 7 commits into from
Aug 15, 2024

Conversation

xgreenx
Copy link
Collaborator

@xgreenx xgreenx commented Aug 15, 2024

Closes #1901
Closes #1919

The ConsensusConfig now contains one more variant, PoAV2, that also overrides the PoA at specific block heights. It means that starting this block the node expects blocks signed by another PoA key.

Along with that, I've added additional features to automate the migration of the state so it is compatible with the new chain configuration:

  • During start-up, the fuel-core binary checks if there are any changes in the chain config. If they are, the binary re-inserts the new Conesnsus::Genesis type in the SealedBlockConsensus table. Now we can do Updated the chain config's name chain-configuration#1.
  • The fuel-core to react to signing_key_overrides. If the blocks at the corresponding overwritten block height have different signers, the fuel-core rollbacks to the height before overriding occurs.

Side changes:

  • Renamed the methods of the FuelService to be more explicit on the logic.
  • Moved business logic from FuelService::Task to FuelService.

Checklist

  • New behavior is reflected in tests

Before requesting review

  • I have reviewed the code myself

@xgreenx xgreenx requested a review from a team August 15, 2024 10:36
@xgreenx xgreenx self-assigned this Aug 15, 2024
# Conflicts:
#	bin/fuel-core/chainspec/local-testnet/state_transition_bytecode.wasm
crates/chain-config/src/config/consensus.rs Outdated Show resolved Hide resolved
crates/fuel-core/src/combined_database.rs Show resolved Hide resolved
crates/fuel-core/src/service.rs Outdated Show resolved Hide resolved
crates/fuel-core/src/service.rs Outdated Show resolved Hide resolved
Dentosal
Dentosal previously approved these changes Aug 15, 2024
let on_chain_view = combined_database.on_chain().latest_view()?;

for override_height in poa.get_all_overrides().keys() {
let block_header = on_chain_view
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Handle overrides fro mthe future

@xgreenx xgreenx requested review from Dentosal and a team August 15, 2024 17:15
@xgreenx xgreenx merged commit a2d8d2d into master Aug 15, 2024
34 checks passed
@xgreenx xgreenx deleted the feature/poa-key-rotation branch August 15, 2024 21:05
@xgreenx xgreenx mentioned this pull request Aug 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants