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

consensus: accept Dusk-signed Emergency Block #3120

Merged
merged 10 commits into from
Dec 20, 2024
Merged

Conversation

fed-franz
Copy link
Contributor

@fed-franz fed-franz commented Dec 5, 2024

Partially implements #1234

New features:
It enables the acceptance of an Emergency Block (EB) with the following properties:
- iteration = u8::MAX
- timestamp > prev_block.timestamp + MIN_EMERGENCY_BLOCK_TIME, where MIN_EMERGENCY_BLOCK_TIME is of MAX_STEP_TIMEOUT x 3 (MAX_ITER_TIMEOUT) times CONSENSUS_MAX_ITER + 1. This value aims at ensure enough time is given to provisioners to produce a block before an Emergency Block can be accepted.
- signed by Dusk (DUSK_CONSENSUS_KEY)

No Attestation is needed to accept an EB.

For what concerns finality, the Emergency Block is consider as being produced at iteration CONSENSUS_MAX_ITER (i.e., the one after the last consensus iteration)

The EB is repropagated upon acceptance (unlike other Block messages)


Refactors:

  • on_block_event: reduces indentation and improves code clarity by splitting attach_att_if_needed into is_block_attested and attach_blk_att
  • execute_checks: change disable_att_check into check_attestation
  • rusk/node: remove duplicate Dusk key loading
  • generate_block: move seed computation and "block generation elapsed-time log" from generate_candidate_message to generate_block; take voters from ru
  • remove iteration check from message deserialization (this also allows to have a standalone definition of CONSENSUS_MAX_ITER, instead of tieing it to MESSAGE_MAX_ITER

@fed-franz fed-franz force-pushed the emergency_block_simple branch from 35b2818 to b484c40 Compare December 5, 2024 10:28
@fed-franz fed-franz marked this pull request as ready for review December 5, 2024 15:14
@fed-franz fed-franz force-pushed the emergency_block_simple branch 3 times, most recently from fa474f3 to 704194e Compare December 10, 2024 11:29
node/src/chain/fsm.rs Outdated Show resolved Hide resolved
node/src/chain/fsm.rs Outdated Show resolved Hide resolved
@fed-franz fed-franz self-assigned this Dec 12, 2024
@fed-franz fed-franz force-pushed the emergency_block_simple branch 3 times, most recently from 4df55b6 to 54b2169 Compare December 16, 2024 12:37
@fed-franz fed-franz added module:consensus Issues related to consensus module module:node Issues related to node module labels Dec 16, 2024
@fed-franz fed-franz force-pushed the emergency_block_simple branch from 54b2169 to 7fb17cf Compare December 19, 2024 15:21
@fed-franz
Copy link
Contributor Author

This PR has been successfully tested:

  • locally, with locally crafted emergency blocks
  • on testnet, with no apparent regressions

herr-seppia
herr-seppia previously approved these changes Dec 20, 2024
Copy link
Member

@herr-seppia herr-seppia left a comment

Choose a reason for hiding this comment

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

LGTM

@fed-franz fed-franz force-pushed the emergency_block_simple branch from 7fb17cf to 092cdd9 Compare December 20, 2024 10:23
@fed-franz fed-franz force-pushed the emergency_block_simple branch from 90f3bdf to 13e4f9e Compare December 20, 2024 14:35
@fed-franz fed-franz force-pushed the emergency_block_simple branch from 69ff441 to dbbad71 Compare December 20, 2024 16:53
@fed-franz fed-franz merged commit c98ad03 into master Dec 20, 2024
16 checks passed
@fed-franz fed-franz deleted the emergency_block_simple branch December 20, 2024 19:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
module:consensus Issues related to consensus module module:node Issues related to node module
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants