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

fix(consensus, blockchain): set execution payload timestamp based on CometBFT timestamp #2095

Merged
merged 32 commits into from
Nov 6, 2024
Merged
Changes from 1 commit
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
eea8ead
nits
abi87 Oct 23, 2024
49538dc
wip: extended sdk.Context use to middleware
abi87 Oct 23, 2024
b303196
dropped unnecessary types and file
abi87 Oct 23, 2024
847cd52
some more types cleanup
abi87 Oct 23, 2024
020cb11
some more types cleanup
abi87 Oct 23, 2024
92bbfae
added type for BeaconBlock with relevant consensus data
abi87 Oct 23, 2024
69efa86
nits
abi87 Oct 23, 2024
8b87b65
wip: adding consensus data to blocks to be verified
abi87 Oct 23, 2024
be54ae7
wip: added consensus block to blockchain service
abi87 Oct 23, 2024
196f1ec
wip: used consensus block type in blockchain service
abi87 Oct 23, 2024
55126cb
wip: fixed dispatching of consensus blocks
abi87 Oct 23, 2024
ce0d420
wip: rebased next payload timestamp on top of consensus block time
abi87 Oct 23, 2024
49b31a8
wip: rebased next payload timestamp from finalized block on top of co…
abi87 Oct 23, 2024
7975424
nit
abi87 Oct 23, 2024
70bba14
wip: fixed dispatching of finalized beacon blocks
abi87 Oct 23, 2024
0365941
wip: rebased next payload timestamp for building blocks on top of con…
abi87 Oct 23, 2024
da314f1
nits
abi87 Oct 23, 2024
36041e8
fixed consensus time setting
abi87 Oct 23, 2024
13a93ea
improved SlotData encapsulation
abi87 Oct 24, 2024
f13cdf7
Merge branch 'main' into consensus_decorated_events
abi87 Oct 24, 2024
0c6e82a
nit
abi87 Oct 24, 2024
20c881e
dropped minor code duplication
abi87 Oct 24, 2024
6b106b8
fix(blockchain): Further timestamp simplification (#2097)
abi87 Oct 24, 2024
e447c20
fix(state-transition): Validate execution payload timestamp (#2096)
abi87 Oct 24, 2024
cbc89a4
Merge branch 'main' into consensus_decorated_events
abi87 Oct 25, 2024
699df26
fix(consensus, beacon): let consensus tell SuggestedNextPayloadTimest…
abi87 Oct 25, 2024
6c256d4
fixed comment
abi87 Oct 25, 2024
f386d51
nit to appease rabbit + revert faulty change
abi87 Oct 25, 2024
e66ef6c
hardened check
abi87 Oct 25, 2024
0c0b3d5
Merge branch 'main' into consensus_decorated_events
abi87 Oct 31, 2024
8ca08fb
Merge branch 'main' into consensus_decorated_events
abi87 Nov 6, 2024
a8f2e07
Merge branch 'main' into consensus_decorated_events
abi87 Nov 6, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 17 additions & 18 deletions mod/consensus/pkg/cometbft/service/middleware/abci.go
Copy link
Contributor

Choose a reason for hiding this comment

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

right now it looks like SlotData is used exclusively for PrepareProposal and ConsensusBlock is used exclusively for ProcessProposal. Is this always the case? If so, we should probably rename / explain their purposes more specifically

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Correct. Names are not super telling but i would defer the renaming to a future PR to avoid inflating scope

Original file line number Diff line number Diff line change
Expand Up @@ -196,21 +196,17 @@ func (h *ABCIMiddleware[
req *cmtabci.ProcessProposalRequest,
) (*cmtabci.ProcessProposalResponse, error) {
var (
err error
startTime = time.Now()
blk BeaconBlockT
numMsgs int
sidecars BlobSidecarsT
awaitCtx, cancel = context.WithTimeout(ctx, AwaitTimeout)
)
defer cancel()
// flush the channels to ensure that we are not handling old data.
if numMsgs = async.ClearChan(h.subBBVerified); numMsgs > 0 {
if numMsgs := async.ClearChan(h.subBBVerified); numMsgs > 0 {
h.logger.Error(
"WARNING: messages remaining in beacon block verification channel",
"num_msgs", numMsgs)
}
if numMsgs = async.ClearChan(h.subSCVerified); numMsgs > 0 {
if numMsgs := async.ClearChan(h.subSCVerified); numMsgs > 0 {
h.logger.Error(
"WARNING: messages remaining in sidecar verification channel",
"num_msgs", numMsgs)
Expand All @@ -219,32 +215,35 @@ func (h *ABCIMiddleware[
defer h.metrics.measureProcessProposalDuration(startTime)

// Request the beacon block.
if blk, err = encoding.
blk, err := encoding.
UnmarshalBeaconBlockFromABCIRequest[BeaconBlockT](
req, 0, h.chainSpec.ActiveForkVersionForSlot(math.U64(req.Height)),
); err != nil {
req,
BeaconBlockTxIndex,
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

nit: reuse constant

h.chainSpec.ActiveForkVersionForSlot(math.U64(req.Height)),
)
if err != nil {
return h.createProcessProposalResponse(errors.WrapNonFatal(err))
}

// notify that the beacon block has been received.
if err = h.dispatcher.Publish(
async.NewEvent(ctx, async.BeaconBlockReceived, blk),
); err != nil {
blkEvent := async.NewEvent(ctx, async.BeaconBlockReceived, blk)
if err = h.dispatcher.Publish(blkEvent); err != nil {
return h.createProcessProposalResponse(errors.WrapNonFatal(err))
}

// Request the blob sidecars.
if sidecars, err = encoding.
sidecars, err := encoding.
UnmarshalBlobSidecarsFromABCIRequest[BlobSidecarsT](
req, 1,
); err != nil {
req,
BlobSidecarsTxIndex,
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

nit: reuse constant

)
if err != nil {
return h.createProcessProposalResponse(errors.WrapNonFatal(err))
}

// notify that the sidecars have been received.
if err = h.dispatcher.Publish(
async.NewEvent(ctx, async.SidecarsReceived, sidecars),
); err != nil {
blobEvent := async.NewEvent(ctx, async.SidecarsReceived, sidecars)
if err = h.dispatcher.Publish(blobEvent); err != nil {
return h.createProcessProposalResponse(errors.WrapNonFatal(err))
}

Expand Down
Loading