Skip to content

Commit

Permalink
Merge branch 'main' into execution-hash
Browse files Browse the repository at this point in the history
  • Loading branch information
itsdevbear authored Aug 7, 2024
2 parents b2242a7 + 1ad255b commit 887397e
Show file tree
Hide file tree
Showing 9 changed files with 31 additions and 113 deletions.
8 changes: 4 additions & 4 deletions mod/beacon/blockchain/execution_engine.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import (

// sendPostBlockFCU sends a forkchoice update to the execution client.
func (s *Service[
_, BeaconBlockT, _, _, BeaconStateT, _, _, _, _, _, _, _,
_, BeaconBlockT, _, _, BeaconStateT, _, _, _, _, _, _,
]) sendPostBlockFCU(
ctx context.Context,
st BeaconStateT,
Expand All @@ -55,7 +55,7 @@ func (s *Service[
// client with attributes.
func (s *Service[
_, BeaconBlockT, _, _, BeaconStateT,
_, _, _, ExecutionPayloadHeaderT, _, _, _,
_, _, ExecutionPayloadHeaderT, _, _, _,
]) sendNextFCUWithAttributes(
ctx context.Context,
st BeaconStateT,
Expand Down Expand Up @@ -92,7 +92,7 @@ func (s *Service[
// sendNextFCUWithoutAttributes sends a forkchoice update to the
// execution client without attributes.
func (s *Service[
_, BeaconBlockT, _, _, _, _, _, _,
_, BeaconBlockT, _, _, _, _, _,
ExecutionPayloadHeaderT, _, PayloadAttributesT, _,
]) sendNextFCUWithoutAttributes(
ctx context.Context,
Expand Down Expand Up @@ -124,7 +124,7 @@ func (s *Service[
//
// TODO: This is hood and needs to be improved.
func (s *Service[
_, BeaconBlockT, _, _, _, _, _, _, _, _, _, _,
_, BeaconBlockT, _, _, _, _, _, _, _, _, _,
]) calculateNextTimestamp(blk BeaconBlockT) uint64 {
//#nosec:G701 // not an issue in practice.
return max(
Expand Down
10 changes: 5 additions & 5 deletions mod/beacon/blockchain/payload.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import (

// forceStartupHead sends a force head FCU to the execution client.
func (s *Service[
_, _, _, _, BeaconStateT, _, _, _, _, _, _, _,
_, _, _, _, BeaconStateT, _, _, _, _, _, _,
]) forceStartupHead(
ctx context.Context,
st BeaconStateT,
Expand Down Expand Up @@ -57,7 +57,7 @@ func (s *Service[
// handleRebuildPayloadForRejectedBlock handles the case where the incoming
// block was rejected and we need to rebuild the payload for the current slot.
func (s *Service[
_, _, _, _, BeaconStateT, _, _, _, _, _, _, _,
_, _, _, _, BeaconStateT, _, _, _, _, _, _,
]) handleRebuildPayloadForRejectedBlock(
ctx context.Context,
st BeaconStateT,
Expand All @@ -80,7 +80,7 @@ func (s *Service[
// rejected the incoming block and it would be unsafe to use any
// information from it.
func (s *Service[
_, _, _, _, BeaconStateT, _, _, _, ExecutionPayloadHeaderT, _, _, _,
_, _, _, _, BeaconStateT, _, _, ExecutionPayloadHeaderT, _, _, _,
]) rebuildPayloadForRejectedBlock(
ctx context.Context,
st BeaconStateT,
Expand Down Expand Up @@ -147,7 +147,7 @@ func (s *Service[
// handleOptimisticPayloadBuild handles optimistically
// building for the next slot.
func (s *Service[
_, BeaconBlockT, _, _, BeaconStateT, _, _, _, _, _, _, _,
_, BeaconBlockT, _, _, BeaconStateT, _, _, _, _, _, _,
]) handleOptimisticPayloadBuild(
ctx context.Context,
st BeaconStateT,
Expand All @@ -164,7 +164,7 @@ func (s *Service[

// optimisticPayloadBuild builds a payload for the next slot.
func (s *Service[
_, BeaconBlockT, _, _, BeaconStateT, _, _, _, _, _, _, _,
_, BeaconBlockT, _, _, BeaconStateT, _, _, _, _, _, _,
]) optimisticPayloadBuild(
ctx context.Context,
st BeaconStateT,
Expand Down
6 changes: 3 additions & 3 deletions mod/beacon/blockchain/process.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ import (
// ProcessGenesisData processes the genesis state and initializes the beacon
// state.
func (s *Service[
_, _, _, _, _, _, _, _, _, GenesisT, _, _,
_, _, _, _, _, _, _, _, GenesisT, _, _,
]) ProcessGenesisData(
ctx context.Context,
genesisData GenesisT,
Expand All @@ -48,7 +48,7 @@ func (s *Service[
// ProcessBeaconBlock receives an incoming beacon block, it first validates
// and then processes the block.
func (s *Service[
_, BeaconBlockT, _, _, _, _, _, _, _, _, _, _,
_, BeaconBlockT, _, _, _, _, _, _, _, _, _,
]) ProcessBeaconBlock(
ctx context.Context,
blk BeaconBlockT,
Expand Down Expand Up @@ -98,7 +98,7 @@ func (s *Service[

// executeStateTransition runs the stf.
func (s *Service[
_, BeaconBlockT, _, _, BeaconStateT, _, _, _, _, _, _, _,
_, BeaconBlockT, _, _, BeaconStateT, _, _, _, _, _, _,
]) executeStateTransition(
ctx context.Context,
st BeaconStateT,
Expand Down
8 changes: 4 additions & 4 deletions mod/beacon/blockchain/receive.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ import (
// ReceiveBlock receives a block and blobs from the
// network and processes them.
func (s *Service[
_, BeaconBlockT, _, _, _, _, _, _, _, _, _, _,
_, BeaconBlockT, _, _, _, _, _, _, _, _, _,
]) ReceiveBlock(
ctx context.Context,
blk BeaconBlockT,
Expand All @@ -43,7 +43,7 @@ func (s *Service[
// VerifyIncomingBlock verifies the state root of an incoming block
// and logs the process.
func (s *Service[
_, BeaconBlockT, _, _, _, _, _, _, _, _, _, _,
_, BeaconBlockT, _, _, _, _, _, _, _, _, _,
]) VerifyIncomingBlock(
ctx context.Context,
blk BeaconBlockT,
Expand Down Expand Up @@ -110,7 +110,7 @@ func (s *Service[

// verifyStateRoot verifies the state root of an incoming block.
func (s *Service[
_, BeaconBlockT, _, _, BeaconStateT, _, _, _, _, _, _, _,
_, BeaconBlockT, _, _, BeaconStateT, _, _, _, _, _, _,
]) verifyStateRoot(
ctx context.Context,
st BeaconStateT,
Expand Down Expand Up @@ -146,7 +146,7 @@ func (s *Service[
// shouldBuildOptimisticPayloads returns true if optimistic
// payload builds are enabled.
func (s *Service[
_, _, _, _, _, _, _, _, _, _, _, _,
_, _, _, _, _, _, _, _, _, _, _,
]) shouldBuildOptimisticPayloads() bool {
return s.optimisticPayloadBuilds && s.lb.Enabled()
}
30 changes: 12 additions & 18 deletions mod/beacon/blockchain/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,13 @@ import (

// Service is the blockchain service.
type Service[
AvailabilityStoreT AvailabilityStore[BeaconBlockBodyT, BlobSidecarsT],
AvailabilityStoreT AvailabilityStore[BeaconBlockBodyT],
BeaconBlockT BeaconBlock[BeaconBlockBodyT, ExecutionPayloadT],
BeaconBlockBodyT BeaconBlockBody[ExecutionPayloadT],
BeaconBlockHeaderT BeaconBlockHeader,
BeaconStateT ReadOnlyBeaconState[
BeaconStateT, BeaconBlockHeaderT, ExecutionPayloadHeaderT,
],
BlobSidecarsT BlobSidecars,
DepositT any,
ExecutionPayloadT ExecutionPayload,
ExecutionPayloadHeaderT ExecutionPayloadHeader,
Expand All @@ -58,7 +57,6 @@ type Service[
AvailabilityStoreT,
BeaconBlockBodyT,
BeaconStateT,
BlobSidecarsT,
]
// logger is used for logging messages in the service.
logger log.Logger[any]
Expand All @@ -73,7 +71,6 @@ type Service[
sp StateProcessor[
BeaconBlockT,
BeaconStateT,
BlobSidecarsT,
*transition.Context,
DepositT,
ExecutionPayloadHeaderT,
Expand All @@ -95,15 +92,14 @@ type Service[

// NewService creates a new validator service.
func NewService[
AvailabilityStoreT AvailabilityStore[BeaconBlockBodyT, BlobSidecarsT],
AvailabilityStoreT AvailabilityStore[BeaconBlockBodyT],
BeaconBlockT BeaconBlock[BeaconBlockBodyT, ExecutionPayloadT],
BeaconBlockBodyT BeaconBlockBody[ExecutionPayloadT],
BeaconBlockHeaderT BeaconBlockHeader,
BeaconStateT ReadOnlyBeaconState[
BeaconStateT, BeaconBlockHeaderT,
ExecutionPayloadHeaderT,
],
BlobSidecarsT BlobSidecars,
DepositT any,
ExecutionPayloadT ExecutionPayload,
ExecutionPayloadHeaderT ExecutionPayloadHeader,
Expand All @@ -119,7 +115,6 @@ func NewService[
AvailabilityStoreT,
BeaconBlockBodyT,
BeaconStateT,
BlobSidecarsT,
],
logger log.Logger[any],
cs common.ChainSpec,
Expand All @@ -128,7 +123,6 @@ func NewService[
sp StateProcessor[
BeaconBlockT,
BeaconStateT,
BlobSidecarsT,
*transition.Context,
DepositT,
ExecutionPayloadHeaderT,
Expand All @@ -141,13 +135,13 @@ func NewService[
optimisticPayloadBuilds bool,
) *Service[
AvailabilityStoreT, BeaconBlockT, BeaconBlockBodyT, BeaconBlockHeaderT,
BeaconStateT, BlobSidecarsT, DepositT, ExecutionPayloadT,
ExecutionPayloadHeaderT, GenesisT, PayloadAttributesT, WithdrawalT,
BeaconStateT, DepositT, ExecutionPayloadT, ExecutionPayloadHeaderT,
GenesisT, PayloadAttributesT, WithdrawalT,
] {
return &Service[
AvailabilityStoreT, BeaconBlockT, BeaconBlockBodyT, BeaconBlockHeaderT,
BeaconStateT, BlobSidecarsT, DepositT, ExecutionPayloadT,
ExecutionPayloadHeaderT, GenesisT, PayloadAttributesT, WithdrawalT,
BeaconStateT, DepositT, ExecutionPayloadT, ExecutionPayloadHeaderT,
GenesisT, PayloadAttributesT, WithdrawalT,
]{
sb: sb,
logger: logger,
Expand All @@ -166,13 +160,13 @@ func NewService[

// Name returns the name of the service.
func (s *Service[
_, _, _, _, _, _, _, _, _, _, _, _,
_, _, _, _, _, _, _, _, _, _, _,
]) Name() string {
return "blockchain"
}

func (s *Service[
_, _, _, _, _, _, _, _, _, _, _, _,
_, _, _, _, _, _, _, _, _, _, _,
]) Start(ctx context.Context) error {
subBlkCh, err := s.blkBroker.Subscribe()
if err != nil {
Expand All @@ -187,7 +181,7 @@ func (s *Service[
}

func (s *Service[
_, BeaconBlockT, _, _, _, _, _, _, _, GenesisT, _, _,
_, BeaconBlockT, _, _, _, _, _, _, GenesisT, _, _,
]) start(
ctx context.Context,
subBlkCh chan *asynctypes.Event[BeaconBlockT],
Expand All @@ -213,7 +207,7 @@ func (s *Service[
}

func (s *Service[
_, _, _, _, _, _, _, _, _, GenesisT, _, _,
_, _, _, _, _, _, _, _, GenesisT, _, _,
]) handleProcessGenesisDataRequest(msg *asynctypes.Event[GenesisT]) {
if msg.Error() != nil {
s.logger.Error("Error processing genesis data", "error", msg.Error())
Expand Down Expand Up @@ -245,7 +239,7 @@ func (s *Service[
}

func (s *Service[
_, BeaconBlockT, _, _, _, _, _, _, _, _, _, _,
_, BeaconBlockT, _, _, _, _, _, _, _, _, _,
]) handleBeaconBlockReceived(
msg *asynctypes.Event[BeaconBlockT],
) {
Expand All @@ -270,7 +264,7 @@ func (s *Service[
}

func (s *Service[
_, BeaconBlockT, _, _, _, _, _, _, _, _, _, _,
_, BeaconBlockT, _, _, _, _, _, _, _, _, _,
]) handleBeaconBlockFinalization(
msg *asynctypes.Event[BeaconBlockT],
) {
Expand Down
8 changes: 3 additions & 5 deletions mod/beacon/blockchain/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ import (
// AvailabilityStore interface is responsible for validating and storing
// sidecars for specific blocks, as well as verifying sidecars that have already
// been stored.
type AvailabilityStore[BeaconBlockBodyT any, BlobSidecarsT any] interface {
type AvailabilityStore[BeaconBlockBodyT any] interface {
// IsDataAvailable ensures that all blobs referenced in the block are
// securely stored before it returns without an error.
IsDataAvailable(
Expand Down Expand Up @@ -179,7 +179,6 @@ type ReadOnlyBeaconState[
type StateProcessor[
BeaconBlockT,
BeaconStateT,
BlobSidecarsT,
ContextT,
DepositT,
ExecutionPayloadHeaderT any,
Expand Down Expand Up @@ -208,10 +207,9 @@ type StateProcessor[
// StorageBackend defines an interface for accessing various storage components
// required by the beacon node.
type StorageBackend[
AvailabilityStoreT AvailabilityStore[BeaconBlockBodyT, BlobSidecarsT],
AvailabilityStoreT AvailabilityStore[BeaconBlockBodyT],
BeaconBlockBodyT,
BeaconStateT,
BlobSidecarsT any,
BeaconStateT any,
] interface {
// AvailabilityStore returns the availability store for the given context.
AvailabilityStore() AvailabilityStoreT
Expand Down
72 changes: 0 additions & 72 deletions mod/beacon/interfaces.go

This file was deleted.

1 change: 0 additions & 1 deletion mod/node-core/pkg/components/chain_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ func ProvideChainService(
*BeaconBlockBody,
*BeaconBlockHeader,
*BeaconState,
*BlobSidecars,
*Deposit,
*ExecutionPayload,
*ExecutionPayloadHeader,
Expand Down
1 change: 0 additions & 1 deletion mod/node-core/pkg/components/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,6 @@ type (
*BeaconBlockBody,
*BeaconBlockHeader,
*BeaconState,
*BlobSidecars,
*Deposit,
*ExecutionPayload,
*ExecutionPayloadHeader,
Expand Down

0 comments on commit 887397e

Please sign in to comment.