-
Notifications
You must be signed in to change notification settings - Fork 834
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
When on PoS the head can be only be updated by ForkchoiceUpdate #3994
Conversation
d34b222
to
5c2fc61
Compare
6785b1f
to
a939dd2
Compare
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.
Question about HEAD_ADVANCED event types, but this looks great.
@@ -236,6 +237,35 @@ protected Hash calculateRootHash( | |||
return Hash.wrap(rootHash); | |||
} | |||
|
|||
@Override | |||
public void remember(final BlockHeader blockHeader) { |
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.
cool name
public void remember(final BlockHeader blockHeader) { | ||
checkArgument(blockHeader != null, "Block header must not be null"); | ||
|
||
final BonsaiWorldStateUpdater localUpdater = updater.copy(); |
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.
This should be of interest to @gezero
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.
The copy method will disappear, I will see this as fail of build when I will try to merge.
@@ -34,4 +34,15 @@ public interface MutableWorldState extends WorldState, MutableWorldView { | |||
* `null` should be passed in. | |||
*/ | |||
void persist(BlockHeader blockHeader); | |||
|
|||
/** | |||
* Remember accumulated changes to underlying storage for future use, without making this the |
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.
👍
updateCacheForNewCanonicalHead(block, td); | ||
final BlockAddedEvent blockAddedEvent; | ||
if (storeOnly) { | ||
blockAddedEvent = handleStoreOnly(blockWithReceipts); |
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.
Does this mean that if/when we "rewind" to this future block in forkchoiceUpdated that we are not going to fire a an event of type HEAD_ADVANCED
anymore?
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.
good catch! Indeed this need to be reviewed
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.
@garyschulte please check now, this commit
Introduce forwardToBlock
It moves head to the block sent by a previous newPayload, and triggers
the advanced head event that will also update the Bonsai world state.
a939dd2
to
b02de74
Compare
…Block When executing a newPayload or build a new block, we do not need to move the chain head and update the world state, since this will be done by a following forkchoice update call, but we still need to validate the block and doing so we can also prepare everything for the future call, so we do not need to re-execute everything, but only update the pointers, so that the response to the forkchoice update call is quick. Signed-off-by: Fabio Di Fabio <[email protected]>
… nothing Signed-off-by: Fabio Di Fabio <[email protected]>
Signed-off-by: Fabio Di Fabio <[email protected]>
Signed-off-by: Fabio Di Fabio <[email protected]>
It moves head to the block sent by a previous newPayload, and triggers the advanced head event that will also update the Bonsai world state. Signed-off-by: Fabio Di Fabio <[email protected]>
b02de74
to
964d2d9
Compare
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.
LGTM 👍
Thanks @garyschulte for the review, I am closing this, since it is now part of this one #4013, that contains also other changes to avoid persisting state when preparing new payloads. |
When executing a newPayload or build a new block, we do not need to move
the chain head and update the world state, since this will be done by a
following forkchoice update call, but we still need to validate the block
and doing so we can also prepare everything for the future call, so we do
not need to re-execute everything, but only update the pointers, so that the
response to the forkchoice update call is quick.
Moreover on block proposal do only a validation of the block without storing or remembering nothing, to avoid saving data that could be stale, for example the empty block that is always proposed, is useless if another better block is produced later.
Signed-off-by: Fabio Di Fabio [email protected]
PR description
Fixed Issue(s)
fixes #3957
Documentation
doc-change-required
label to this PR ifupdates are required.
Changelog