diff --git a/mod/node-core/pkg/components/state_processor.go b/mod/node-core/pkg/components/state_processor.go index a09dbdf587..44914afe56 100644 --- a/mod/node-core/pkg/components/state_processor.go +++ b/mod/node-core/pkg/components/state_processor.go @@ -48,7 +48,6 @@ func ProvideStateProcessor( *BeaconBlockBody, *BeaconBlockHeader, BeaconState, - *BlobSidecars, *transition.Context, *Deposit, *types.Eth1Data, diff --git a/mod/state-transition/pkg/core/state_processor.go b/mod/state-transition/pkg/core/state_processor.go index 0c4f6bad36..bca2bbd9c6 100644 --- a/mod/state-transition/pkg/core/state_processor.go +++ b/mod/state-transition/pkg/core/state_processor.go @@ -48,7 +48,6 @@ type StateProcessor[ ExecutionPayloadHeaderT, ForkT, ValidatorT, WithdrawalT, ], - BlobSidecarsT BlobSidecars, ContextT Context, DepositT Deposit[ForkDataT, WithdrawalCredentialsT], Eth1DataT interface { @@ -97,7 +96,6 @@ func NewStateProcessor[ BeaconBlockHeaderT, Eth1DataT, ExecutionPayloadHeaderT, ForkT, ValidatorT, WithdrawalT, ], - BlobSidecarsT BlobSidecars, ContextT Context, DepositT Deposit[ForkDataT, WithdrawalCredentialsT], Eth1DataT interface { @@ -123,13 +121,13 @@ func NewStateProcessor[ signer crypto.BLSSigner, ) *StateProcessor[ BeaconBlockT, BeaconBlockBodyT, BeaconBlockHeaderT, - BeaconStateT, BlobSidecarsT, ContextT, + BeaconStateT, ContextT, DepositT, Eth1DataT, ExecutionPayloadT, ExecutionPayloadHeaderT, ForkT, ForkDataT, ValidatorT, WithdrawalT, WithdrawalCredentialsT, ] { return &StateProcessor[ BeaconBlockT, BeaconBlockBodyT, BeaconBlockHeaderT, - BeaconStateT, BlobSidecarsT, ContextT, + BeaconStateT, ContextT, DepositT, Eth1DataT, ExecutionPayloadT, ExecutionPayloadHeaderT, ForkT, ForkDataT, ValidatorT, WithdrawalT, WithdrawalCredentialsT, @@ -144,9 +142,9 @@ func NewStateProcessor[ // Transition is the main function for processing a state transition. func (sp *StateProcessor[ BeaconBlockT, BeaconBlockBodyT, BeaconBlockHeaderT, - BeaconStateT, BlobSidecarsT, ContextT, - DepositT, Eth1DataT, ExecutionPayloadT, ExecutionPayloadHeaderT, - ForkT, ForkDataT, ValidatorT, WithdrawalT, WithdrawalCredentialsT, + BeaconStateT, ContextT, DepositT, Eth1DataT, + ExecutionPayloadT, ExecutionPayloadHeaderT, ForkT, + ForkDataT, ValidatorT, WithdrawalT, WithdrawalCredentialsT, ]) Transition( ctx ContextT, st BeaconStateT, @@ -174,7 +172,7 @@ func (sp *StateProcessor[ } func (sp *StateProcessor[ - _, _, _, BeaconStateT, _, _, _, _, _, _, _, _, _, _, _, + _, _, _, BeaconStateT, _, _, _, _, _, _, _, _, _, _, ]) ProcessSlots( st BeaconStateT, slot math.U64, ) (transition.ValidatorUpdates, error) { @@ -219,7 +217,7 @@ func (sp *StateProcessor[ // processSlot is run when a slot is missed. func (sp *StateProcessor[ - _, _, _, BeaconStateT, _, _, _, _, _, _, _, _, _, _, _, + _, _, _, BeaconStateT, _, _, _, _, _, _, _, _, _, _, ]) processSlot( st BeaconStateT, ) error { @@ -276,7 +274,7 @@ func (sp *StateProcessor[ // ProcessBlock processes the block, it optionally verifies the // state root. func (sp *StateProcessor[ - BeaconBlockT, _, _, BeaconStateT, _, ContextT, _, _, _, _, _, _, _, _, _, + BeaconBlockT, _, _, BeaconStateT, ContextT, _, _, _, _, _, _, _, _, _, ]) ProcessBlock( ctx ContextT, st BeaconStateT, @@ -344,7 +342,7 @@ func (sp *StateProcessor[ // processEpoch processes the epoch and ensures it matches the local state. func (sp *StateProcessor[ - _, _, _, BeaconStateT, _, _, _, _, _, _, _, _, _, _, _, + _, _, _, BeaconStateT, _, _, _, _, _, _, _, _, _, _, ]) processEpoch( st BeaconStateT, ) (transition.ValidatorUpdates, error) { @@ -362,7 +360,7 @@ func (sp *StateProcessor[ // state. func (sp *StateProcessor[ BeaconBlockT, _, BeaconBlockHeaderT, BeaconStateT, - _, _, _, _, _, _, _, _, ValidatorT, _, _, + _, _, _, _, _, _, _, ValidatorT, _, _, ]) processBlockHeader( st BeaconStateT, blk BeaconBlockT, @@ -448,7 +446,7 @@ func (sp *StateProcessor[ // //nolint:lll func (sp *StateProcessor[ - _, _, _, BeaconStateT, _, _, _, _, _, _, _, _, _, _, _, + _, _, _, BeaconStateT, _, _, _, _, _, _, _, _, _, _, ]) getAttestationDeltas( st BeaconStateT, ) ([]math.Gwei, []math.Gwei, error) { @@ -466,7 +464,7 @@ func (sp *StateProcessor[ // //nolint:lll func (sp *StateProcessor[ - _, _, _, BeaconStateT, _, _, _, _, _, _, _, _, _, _, _, + _, _, _, BeaconStateT, _, _, _, _, _, _, _, _, _, _, ]) processRewardsAndPenalties( st BeaconStateT, ) error { diff --git a/mod/state-transition/pkg/core/state_processor_committee.go b/mod/state-transition/pkg/core/state_processor_committee.go index a64ab39504..7d84872fa3 100644 --- a/mod/state-transition/pkg/core/state_processor_committee.go +++ b/mod/state-transition/pkg/core/state_processor_committee.go @@ -27,7 +27,7 @@ import ( // processSyncCommitteeUpdates processes the sync committee updates. func (sp *StateProcessor[ - _, _, _, BeaconStateT, _, _, _, _, _, _, _, _, ValidatorT, _, _, + _, _, _, BeaconStateT, _, _, _, _, _, _, _, ValidatorT, _, _, ]) processSyncCommitteeUpdates( st BeaconStateT, ) (transition.ValidatorUpdates, error) { diff --git a/mod/state-transition/pkg/core/state_processor_genesis.go b/mod/state-transition/pkg/core/state_processor_genesis.go index 0b18f96890..f278918010 100644 --- a/mod/state-transition/pkg/core/state_processor_genesis.go +++ b/mod/state-transition/pkg/core/state_processor_genesis.go @@ -34,7 +34,7 @@ import ( // //nolint:gocognit,funlen // todo fix. func (sp *StateProcessor[ - _, BeaconBlockBodyT, BeaconBlockHeaderT, BeaconStateT, _, _, DepositT, + _, BeaconBlockBodyT, BeaconBlockHeaderT, BeaconStateT, _, DepositT, Eth1DataT, _, ExecutionPayloadHeaderT, ForkT, _, ValidatorT, _, _, ]) InitializePreminedBeaconStateFromEth1( st BeaconStateT, diff --git a/mod/state-transition/pkg/core/state_processor_payload.go b/mod/state-transition/pkg/core/state_processor_payload.go index 1833fe3615..1212aa5ad9 100644 --- a/mod/state-transition/pkg/core/state_processor_payload.go +++ b/mod/state-transition/pkg/core/state_processor_payload.go @@ -31,7 +31,7 @@ import ( // processExecutionPayload processes the execution payload and ensures it // matches the local state. func (sp *StateProcessor[ - BeaconBlockT, _, _, BeaconStateT, _, ContextT, + BeaconBlockT, _, _, BeaconStateT, ContextT, _, _, _, ExecutionPayloadHeaderT, _, _, _, _, _, ]) processExecutionPayload( ctx ContextT, @@ -76,7 +76,7 @@ func (sp *StateProcessor[ // and the execution engine. func (sp *StateProcessor[ BeaconBlockT, _, _, BeaconStateT, - _, _, _, _, _, _, _, _, _, _, _, + _, _, _, _, _, _, _, _, _, _, ]) validateExecutionPayload( ctx context.Context, st BeaconStateT, diff --git a/mod/state-transition/pkg/core/state_processor_randao.go b/mod/state-transition/pkg/core/state_processor_randao.go index ef40bd0a61..2140b14333 100644 --- a/mod/state-transition/pkg/core/state_processor_randao.go +++ b/mod/state-transition/pkg/core/state_processor_randao.go @@ -33,7 +33,7 @@ import ( // ensures it matches the local state. func (sp *StateProcessor[ BeaconBlockT, _, _, BeaconStateT, - _, _, _, _, _, _, _, ForkDataT, _, _, _, + _, _, _, _, _, _, ForkDataT, _, _, _, ]) processRandaoReveal( st BeaconStateT, blk BeaconBlockT, @@ -105,7 +105,7 @@ func (sp *StateProcessor[ // //nolint:lll func (sp *StateProcessor[ - _, _, _, BeaconStateT, _, _, _, _, _, _, _, _, _, _, _, + _, _, _, BeaconStateT, _, _, _, _, _, _, _, _, _, _, ]) processRandaoMixesReset( st BeaconStateT, ) error { @@ -129,7 +129,7 @@ func (sp *StateProcessor[ // buildRandaoMix as defined in the Ethereum 2.0 specification. func (sp *StateProcessor[ - _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, + _, _, _, _, _, _, _, _, _, _, _, _, _, _, ]) buildRandaoMix( mix common.Bytes32, reveal crypto.BLSSignature, diff --git a/mod/state-transition/pkg/core/state_processor_slashing.go b/mod/state-transition/pkg/core/state_processor_slashing.go index 5df24f40e4..c3212856d1 100644 --- a/mod/state-transition/pkg/core/state_processor_slashing.go +++ b/mod/state-transition/pkg/core/state_processor_slashing.go @@ -29,7 +29,7 @@ import ( // //nolint:lll func (sp *StateProcessor[ - _, _, _, BeaconStateT, _, _, _, _, _, _, _, _, _, _, _, + _, _, _, BeaconStateT, _, _, _, _, _, _, _, _, _, _, ]) processSlashingsReset( st BeaconStateT, ) error { @@ -48,7 +48,7 @@ func (sp *StateProcessor[ // //nolint:lll,unused // will be used later func (sp *StateProcessor[ - _, _, _, BeaconStateT, _, _, _, _, _, _, _, _, _, _, _, + _, _, _, BeaconStateT, _, _, _, _, _, _, _, _, _, _, ]) processProposerSlashing( _ BeaconStateT, // ps ProposerSlashing, @@ -61,7 +61,7 @@ func (sp *StateProcessor[ // //nolint:lll,unused // will be used later func (sp *StateProcessor[ - _, _, _, BeaconStateT, _, _, _, _, _, _, _, _, _, _, _, + _, _, _, BeaconStateT, _, _, _, _, _, _, _, _, _, _, ]) processAttesterSlashing( _ BeaconStateT, // as AttesterSlashing, @@ -77,7 +77,7 @@ func (sp *StateProcessor[ // //nolint:lll,unused // will be used later func (sp *StateProcessor[ - _, _, _, BeaconStateT, _, _, _, _, _, _, _, _, _, _, _, + _, _, _, BeaconStateT, _, _, _, _, _, _, _, _, _, _, ]) processSlashings( st BeaconStateT, ) error { @@ -130,7 +130,7 @@ func (sp *StateProcessor[ // //nolint:unused // will be used later func (sp *StateProcessor[ - _, _, _, BeaconStateT, _, _, _, _, _, _, _, _, ValidatorT, _, _, + _, _, _, BeaconStateT, _, _, _, _, _, _, _, ValidatorT, _, _, ]) processSlash( st BeaconStateT, val ValidatorT, diff --git a/mod/state-transition/pkg/core/state_processor_staking.go b/mod/state-transition/pkg/core/state_processor_staking.go index da137e17ca..ea2b287b24 100644 --- a/mod/state-transition/pkg/core/state_processor_staking.go +++ b/mod/state-transition/pkg/core/state_processor_staking.go @@ -31,7 +31,7 @@ import ( // processOperations processes the operations and ensures they match the // local state. func (sp *StateProcessor[ - BeaconBlockT, _, _, BeaconStateT, _, _, _, _, _, _, _, _, _, _, _, + BeaconBlockT, _, _, BeaconStateT, _, _, _, _, _, _, _, _, _, _, ]) processOperations( st BeaconStateT, blk BeaconBlockT, @@ -62,7 +62,7 @@ func (sp *StateProcessor[ // processDeposits processes the deposits and ensures they match the // local state. func (sp *StateProcessor[ - _, _, _, BeaconStateT, _, _, DepositT, _, _, _, _, _, _, _, _, + _, _, _, BeaconStateT, _, DepositT, _, _, _, _, _, _, _, _, ]) processDeposits( st BeaconStateT, deposits []DepositT, @@ -78,7 +78,7 @@ func (sp *StateProcessor[ // processDeposit processes the deposit and ensures it matches the local state. func (sp *StateProcessor[ - _, _, _, BeaconStateT, _, _, DepositT, _, _, _, _, _, _, _, _, + _, _, _, BeaconStateT, _, DepositT, _, _, _, _, _, _, _, _, ]) processDeposit( st BeaconStateT, dep DepositT, @@ -110,7 +110,7 @@ func (sp *StateProcessor[ // applyDeposit processes the deposit and ensures it matches the local state. func (sp *StateProcessor[ - _, _, _, BeaconStateT, _, _, DepositT, _, _, _, _, _, ValidatorT, _, _, + _, _, _, BeaconStateT, _, DepositT, _, _, _, _, _, ValidatorT, _, _, ]) applyDeposit( st BeaconStateT, dep DepositT, @@ -137,7 +137,7 @@ func (sp *StateProcessor[ // createValidator creates a validator if the deposit is valid. func (sp *StateProcessor[ - _, _, _, BeaconStateT, _, _, DepositT, _, _, _, _, ForkDataT, _, _, _, + _, _, _, BeaconStateT, _, DepositT, _, _, _, _, ForkDataT, _, _, _, ]) createValidator( st BeaconStateT, dep DepositT, @@ -188,7 +188,7 @@ func (sp *StateProcessor[ // addValidatorToRegistry adds a validator to the registry. func (sp *StateProcessor[ - _, _, _, BeaconStateT, _, _, DepositT, _, _, _, _, _, ValidatorT, _, _, + _, _, _, BeaconStateT, _, DepositT, _, _, _, _, _, ValidatorT, _, _, ]) addValidatorToRegistry( st BeaconStateT, dep DepositT, @@ -219,7 +219,7 @@ func (sp *StateProcessor[ // //nolint:lll func (sp *StateProcessor[ - _, BeaconBlockBodyT, _, BeaconStateT, _, _, _, _, _, _, _, _, _, _, _, + _, BeaconBlockBodyT, _, BeaconStateT, _, _, _, _, _, _, _, _, _, _, ]) processWithdrawals( st BeaconStateT, body BeaconBlockBodyT, diff --git a/mod/state-transition/pkg/core/types.go b/mod/state-transition/pkg/core/types.go index e94a5ed40a..c29a657aff 100644 --- a/mod/state-transition/pkg/core/types.go +++ b/mod/state-transition/pkg/core/types.go @@ -33,21 +33,6 @@ import ( "github.com/berachain/beacon-kit/mod/primitives/pkg/ssz/merkleizer" ) -// The 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 { - // IsDataAvailable ensures that all blobs referenced in the block are - // securely stored before it returns without an error. - IsDataAvailable( - context.Context, math.Slot, BeaconBlockBodyT, - ) bool - - // Persist makes sure that the sidecar remains accessible for data - // availability checks throughout the beacon node's operation. - Persist(math.Slot, BlobSidecarsT) error -} - // BeaconBlock represents a generic interface for a beacon block. type BeaconBlock[ DepositT any, @@ -82,9 +67,7 @@ type BeaconBlockBody[ ExecutionPayloadT ExecutionPayload[ ExecutionPayloadT, ExecutionPayloadHeaderT, WithdrawalT, ], - ExecutionPayloadHeaderT interface { - GetBlockHash() gethprimitives.ExecutionHash - }, + ExecutionPayloadHeaderT ExecutionPayloadHeader, WithdrawalT any, ] interface { constraints.EmptyWithVersion[BeaconBlockBodyT] @@ -100,11 +83,6 @@ type BeaconBlockBody[ GetBlobKzgCommitments() eip4844.KZGCommitments[gethprimitives.ExecutionHash] } -// BlobSidecars is the interface for blobs sidecars. -type BlobSidecars interface { - Len() int -} - // Context defines an interface for managing state transition context. type Context interface { context.Context @@ -122,9 +100,6 @@ type Context interface { // GetSkipValidateResult returns whether to validate the result of the state // transition. GetSkipValidateResult() bool - - // Unwrap returns the underlying golang standard library context. - Unwrap() context.Context } // Deposit is the interface for a deposit. @@ -134,12 +109,8 @@ type Deposit[ ] interface { // GetAmount returns the amount of the deposit. GetAmount() math.Gwei - // GetIndex returns the index of the deposit. - GetIndex() uint64 // GetPubkey returns the public key of the validator. GetPubkey() crypto.BLSPubkey - // GetSignature returns the signature of the deposit. - GetSignature() crypto.BLSSignature // GetWithdrawalCredentials returns the withdrawal credentials. GetWithdrawalCredentials() WithdrawlCredentialsT // VerifySignature verifies the deposit and creates a validator. @@ -181,21 +152,7 @@ type ExecutionPayload[ } type ExecutionPayloadHeader interface { - GetParentHash() gethprimitives.ExecutionHash GetBlockHash() gethprimitives.ExecutionHash - GetPrevRandao() common.Bytes32 - GetFeeRecipient() gethprimitives.ExecutionAddress - GetStateRoot() common.Bytes32 - GetReceiptsRoot() common.Root - GetLogsBloom() []byte - GetNumber() math.U64 - GetGasLimit() math.U64 - GetTimestamp() math.U64 - GetGasUsed() math.U64 - GetExtraData() []byte - GetBaseFeePerGas() math.U256L - GetBlobGasUsed() math.U64 - GetExcessBlobGas() math.U64 } // ExecutionEngine is the interface for the execution engine.