-
Notifications
You must be signed in to change notification settings - Fork 22
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
Delay handler execution till after state update #1353
base: main
Are you sure you want to change the base?
Conversation
…the state update has been written.
update ([#1352](https://github.com/Concordium/concordium-node/issues/1352)). The fix delays | ||
executing the on-block and on-finalization handlers until after the state update has been | ||
committed. This also should also result in better consistency in the gRPC API (i.e. if a client | ||
is notified that a block has arrived, `GetBlockInfo` should not result in `NOT_FOUND` for thatb |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is notified that a block has arrived, `GetBlockInfo` should not result in `NOT_FOUND` for thatb | |
is notified that a block has arrived, `GetBlockInfo` should not result in `NOT_FOUND` for that |
- Fix a bug that can occasionally result in a crash if `GetBlockInfo` is invoked during a protocol | ||
update ([#1352](https://github.com/Concordium/concordium-node/issues/1352)). The fix delays | ||
executing the on-block and on-finalization handlers until after the state update has been | ||
committed. This also should also result in better consistency in the gRPC API (i.e. if a client |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typo: "This also should also ... "
bufferedSendCatchUpStatus | ||
forM_ finalizedBlocks $ \bp -> do | ||
let height = localToAbsoluteBlockHeight genHeight (SkovV1.blockHeight bp) | ||
let isHomeBaked = case nodeBakerIdMaybe of |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could we factor this out and reuse in skovV1BlockHandler
@td202 are there tests for this? |
Purpose
Closes #1352
This defers the execution of on-block and on-finalization handlers until after the consensus state has been committed. This in particular ensures that in the case of a protocol update, the consensus state is committed before the protocol update occurs (as this is part of the on-finalization handling). Consequently, a
GetBlockInfo
that queries the genesis block of a new consensus (created in the protocol update) will always be able to see the terminal block (which is available once the consensus state is committed).This also ensures that if gRPC clients are notified of block arrivals, queries about those blocks will not fail, which was previously a theoretical possibility.
Changes
SkovT
implementation uses theMonadWriter
aspect to produce a sequence ofHandlerEvent
s rather than directly invoking a handler callback.onBlockHandler
,onFinalizationHandler
andonPendingLiveHandler
are removed from theHandlerContext
, as the events will be used instead. (onPendingLiveHandler
was not used anyway.)HandlerContext
implementation to separate functionsskovV1BlockHandler
andskovV1FinalizeHandler
.liftSkovV1Update
, and are run after updating the state.Checklist
hard-to-understand areas.