Skip to content

Commit

Permalink
nits
Browse files Browse the repository at this point in the history
  • Loading branch information
abi87 committed Oct 25, 2024
1 parent 1899f55 commit 1335b7d
Show file tree
Hide file tree
Showing 8 changed files with 28 additions and 14 deletions.
3 changes: 3 additions & 0 deletions mod/beacon/blockchain/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@ type AvailabilityStore[BeaconBlockBodyT any] interface {
type ConsensusBlock[BeaconBlockT any] interface {
GetBeaconBlock() BeaconBlockT

// GetNextPayloadTimestamp returns the timestamp proposed by
// consensus for the next payload to be proposed. It is also
// used to bound current payload upon validation
GetNextPayloadTimestamp() math.U64
}

Expand Down
5 changes: 3 additions & 2 deletions mod/beacon/validator/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -190,8 +190,9 @@ type SlotData[AttestationDataT, SlashingInfoT any] interface {
GetAttestationData() []AttestationDataT
// GetSlashingInfo returns the slashing info of the incoming slot.
GetSlashingInfo() []SlashingInfoT
// GetNextPayloadTimestamp returns the consensus proposed timestamp
// for the next execution payload
// GetNextPayloadTimestamp returns the timestamp proposed by
// consensus for the next payload to be proposed. It is also
// used to bound current payload upon validation
GetNextPayloadTimestamp() math.U64
}

Expand Down
6 changes: 5 additions & 1 deletion mod/consensus/pkg/cometbft/service/middleware/middleware.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ type ABCIMiddleware[
// chainSpec is the chain specification.
chainSpec common.ChainSpec
// minimum delay among blocks, useful to set a strictly increasing
// execution payload timestamp
// execution payload timestamp.
minPayloadDelay time.Duration
// dispatcher is the central dispatcher to
dispatcher types.EventDispatcher
Expand Down Expand Up @@ -80,6 +80,10 @@ func NewABCIMiddleware[
) *ABCIMiddleware[
BeaconBlockT, BlobSidecarsT, GenesisT, SlotDataT,
] {
// We may build execution payload optimistically, i.e. build execution
// payload for next block while current block is being verified and not yet
// finalized. Hence we need a minPayloadDelay that guarantees that:
// curr
minPayloadDelay := min(
cmtCfg.Consensus.TimeoutPropose,
cmtCfg.Consensus.TimeoutPrevote,
Expand Down
6 changes: 3 additions & 3 deletions mod/consensus/pkg/types/consensus_block.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,6 @@ import (
type ConsensusBlock[BeaconBlockT any] struct {
blk BeaconBlockT

// nextPayloadTimestamp is the timestamp proposed by consensus
// for the next payload to be proposed.
// TODO: consider validating that it is strictly bounded and increasing
nextPayloadTimestamp math.U64
}

Expand All @@ -51,6 +48,9 @@ func (b *ConsensusBlock[BeaconBlockT]) GetBeaconBlock() BeaconBlockT {
return b.blk
}

// GetNextPayloadTimestamp returns the timestamp proposed by consensus
// for the next payload to be proposed. It is also used to bound
// current payload upon validation.
func (b *ConsensusBlock[_]) GetNextPayloadTimestamp() math.U64 {
return b.nextPayloadTimestamp
}
6 changes: 3 additions & 3 deletions mod/consensus/pkg/types/slot_data.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ type SlotData[AttestationDataT, SlashingInfoT any] struct {
attestationData []AttestationDataT
// slashingInfo is the slashing info of the incoming slot.
slashingInfo []SlashingInfoT
// nextPayloadTimestamp is the timestamp proposed by consensus
// for the next payload to be proposed.
// TODO: consider validating that it is strictly bounded and increasing
// nextPayloadTimestamp is the timestamp proposed by
// consensus for the next payload to be proposed. It is also
// used to bound current payload upon validation
nextPayloadTimestamp math.U64
}

Expand Down
3 changes: 3 additions & 0 deletions mod/node-core/pkg/components/interfaces.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,9 @@ type (
ConsensusBlock[BeaconBlockT any] interface {
GetBeaconBlock() BeaconBlockT

// GetNextPayloadTimestamp returns the timestamp proposed by
// consensus for the next payload to be proposed. It is also
// used to bound current payload upon validation
GetNextPayloadTimestamp() math.U64
}

Expand Down
8 changes: 5 additions & 3 deletions mod/primitives/pkg/transition/context.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,9 @@ type Context struct {
// SkipValidateResult indicates whether to validate the result of
// the state transition.
SkipValidateResult bool
// NextPayloadTimestamp is consensus proposed timestamp for the
// next payload to be built
// NextPayloadTimestamp is the timestamp proposed by
// consensus for the next payload to be proposed. It is also
// used to bound current payload upon validation
NextPayloadTimestamp math.U64
}

Expand Down Expand Up @@ -73,7 +74,8 @@ func (c *Context) GetSkipValidateResult() bool {
}

// GetNextPayloadTimestamp returns the timestamp proposed by consensus
// for the next payload to be built.
// for the next payload to be proposed. It is also used to bound
// current payload upon validation.
func (c *Context) GetNextPayloadTimestamp() math.U64 {
return c.NextPayloadTimestamp
}
Expand Down
5 changes: 3 additions & 2 deletions mod/state-transition/pkg/core/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,9 @@ type Context interface {
// GetSkipValidateResult returns whether to validate the result of the state
// transition.
GetSkipValidateResult() bool
// GetNextPayloadTimestamp returns the consensus proposed timestamp
// for the next payload to be built.
// GetNextPayloadTimestamp returns the timestamp proposed by
// consensus for the next payload to be proposed. It is also
// used to bound current payload upon validation
GetNextPayloadTimestamp() math.U64
}

Expand Down

0 comments on commit 1335b7d

Please sign in to comment.