Skip to content

Commit

Permalink
chore(cleanup): idk what to do so here (#1585)
Browse files Browse the repository at this point in the history
  • Loading branch information
archbear authored Jun 24, 2024
1 parent 8f34513 commit 58d9ba1
Show file tree
Hide file tree
Showing 19 changed files with 92 additions and 218 deletions.
26 changes: 2 additions & 24 deletions mod/beacon/blockchain/payload.go
Original file line number Diff line number Diff line change
Expand Up @@ -158,18 +158,7 @@ func (s *Service[
// handleOptimisticPayloadBuild handles optimistically
// building for the next slot.
func (s *Service[
AvailabilityStoreT,
BeaconBlockT,
BeaconBlockBodyT,
BeaconBlockHeaderT,
BeaconStateT,
BlobSidecarsT,
DepositT,
ExecutionPayloadT,
ExecutionPayloadHeaderT,
GenesisT,
PayloadAttributesT,
_,
_, BeaconBlockT, _, _, BeaconStateT, _, _, _, _, _, _, _,
]) handleOptimisticPayloadBuild(
ctx context.Context,
st BeaconStateT,
Expand All @@ -186,18 +175,7 @@ func (s *Service[

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

// executeStateTransition runs the stf.
func (s *Service[
AvailabilityStoreT,
BeaconBlockT,
BeaconBlockBodyT,
BeaconBlockHeaderT,
BeaconStateT,
BlobSidecarsT,
DepositT,
ExecutionPayloadT,
ExecutionPayloadHeaderT,
GenesisT,
PayloadAttributesT,
_,
_, BeaconBlockT, _, _, BeaconStateT, _, _, _, _, _, _, _,
]) executeStateTransition(
ctx context.Context,
st BeaconStateT,
Expand Down
4 changes: 1 addition & 3 deletions mod/beacon/validator/block_builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,7 @@ import (

// buildBlockAndSidecars builds a new beacon block.
func (s *Service[
BeaconBlockT, BeaconBlockBodyT, BeaconStateT, BlobSidecarsT,
DepositT, DepositStoreT, Eth1DataT, ExecutionPayloadT,
ExecutionPayloadHeaderT, ForkDataT,
BeaconBlockT, _, _, BlobSidecarsT, _, _, _, _, _, _,
]) buildBlockAndSidecars(
ctx context.Context,
requestedSlot math.Slot,
Expand Down
1 change: 0 additions & 1 deletion mod/execution/pkg/deposit/pruner.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ func BuildPruneRangeFn[
DepositT Deposit[DepositT, WithdrawalCredentialsT],
ExecutionPayloadT ExecutionPayload,
WithdrawalCredentialsT any,

](cs common.ChainSpec) func(BlockEventT) (uint64, uint64) {
return func(event BlockEventT) (uint64, uint64) {
deposits := event.Data().GetBody().GetDeposits()
Expand Down
2 changes: 1 addition & 1 deletion mod/execution/pkg/deposit/sync.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ func (s *Service[
case <-ctx.Done():
return
case msg := <-s.feed:
if msg.Type() == events.BeaconBlockFinalized {
if msg.Is(events.BeaconBlockFinalized) {
blockNum := msg.Data().
GetBody().GetExecutionPayload().GetNumber()
s.fetchAndStoreDeposits(ctx, blockNum-s.eth1FollowDistance)
Expand Down
1 change: 1 addition & 0 deletions mod/execution/pkg/deposit/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ type BlockEvent[
ExecutionPayloadT ExecutionPayload,
] interface {
Type() asynctypes.EventID
Is(asynctypes.EventID) bool
Data() BeaconBlockT
}

Expand Down
36 changes: 8 additions & 28 deletions mod/state-transition/pkg/core/state_processor.go
Original file line number Diff line number Diff line change
Expand Up @@ -169,10 +169,7 @@ func (sp *StateProcessor[
}

func (sp *StateProcessor[
BeaconBlockT, BeaconBlockBodyT, BeaconBlockHeaderT,
BeaconStateT, BlobSidecarsT, ContextT,
DepositT, Eth1DataT, ExecutionPayloadT, ExecutionPayloadHeaderT,
ForkT, ForkDataT, ValidatorT, WithdrawalT, WithdrawalCredentialsT,
_, _, _, BeaconStateT, _, _, _, _, _, _, _, _, _, _, _,
]) ProcessSlots(
st BeaconStateT, slot math.U64,
) (transition.ValidatorUpdates, error) {
Expand Down Expand Up @@ -217,10 +214,7 @@ func (sp *StateProcessor[

// processSlot is run when a slot is missed.
func (sp *StateProcessor[
BeaconBlockT, BeaconBlockBodyT, BeaconBlockHeaderT,
BeaconStateT, BlobSidecarsT, ContextT,
DepositT, Eth1DataT, ExecutionPayloadT, ExecutionPayloadHeaderT,
ForkT, ForkDataT, ValidatorT, WithdrawalT, WithdrawalCredentialsT,
_, _, _, BeaconStateT, _, _, _, _, _, _, _, _, _, _, _,
]) processSlot(
st BeaconStateT,
) error {
Expand Down Expand Up @@ -277,10 +271,7 @@ func (sp *StateProcessor[
// ProcessBlock processes the block, it optionally verifies the
// state root.
func (sp *StateProcessor[
BeaconBlockT, BeaconBlockBodyT, BeaconBlockHeaderT,
BeaconStateT, BlobSidecarsT, ContextT,
DepositT, Eth1DataT, ExecutionPayloadT, ExecutionPayloadHeaderT,
ForkT, ForkDataT, ValidatorT, WithdrawalT, WithdrawalCredentialsT,
BeaconBlockT, _, _, BeaconStateT, _, ContextT, _, _, _, _, _, _, _, _, _,
]) ProcessBlock(
ctx ContextT,
st BeaconStateT,
Expand Down Expand Up @@ -348,10 +339,7 @@ func (sp *StateProcessor[

// processEpoch processes the epoch and ensures it matches the local state.
func (sp *StateProcessor[
BeaconBlockT, BeaconBlockBodyT, BeaconBlockHeaderT,
BeaconStateT, BlobSidecarsT, ContextT,
DepositT, Eth1DataT, ExecutionPayloadT, ExecutionPayloadHeaderT,
ForkT, ForkDataT, ValidatorT, WithdrawalT, WithdrawalCredentialsT,
_, _, _, BeaconStateT, _, _, _, _, _, _, _, _, _, _, _,
]) processEpoch(
st BeaconStateT,
) (transition.ValidatorUpdates, error) {
Expand All @@ -368,10 +356,8 @@ func (sp *StateProcessor[
// processBlockHeader processes the header and ensures it matches the local
// state.
func (sp *StateProcessor[
BeaconBlockT, BeaconBlockBodyT, BeaconBlockHeaderT,
BeaconStateT, BlobSidecarsT, ContextT,
DepositT, Eth1DataT, ExecutionPayloadT, ExecutionPayloadHeaderT,
ForkT, ForkDataT, ValidatorT, WithdrawalT, WithdrawalCredentialsT,
BeaconBlockT, _, BeaconBlockHeaderT, BeaconStateT,
_, _, _, _, _, _, _, _, ValidatorT, _, _,
]) processBlockHeader(
st BeaconStateT,
blk BeaconBlockT,
Expand Down Expand Up @@ -457,10 +443,7 @@ func (sp *StateProcessor[
//
//nolint:lll
func (sp *StateProcessor[
BeaconBlockT, BeaconBlockBodyT, BeaconBlockHeaderT,
BeaconStateT, BlobSidecarsT, ContextT,
DepositT, Eth1DataT, ExecutionPayloadT, ExecutionPayloadHeaderT,
ForkT, ForkDataT, ValidatorT, WithdrawalT, WithdrawalCredentialsT,
_, _, _, BeaconStateT, _, _, _, _, _, _, _, _, _, _, _,
]) getAttestationDeltas(
st BeaconStateT,
) ([]math.Gwei, []math.Gwei, error) {
Expand All @@ -478,10 +461,7 @@ func (sp *StateProcessor[
//
//nolint:lll
func (sp *StateProcessor[
BeaconBlockT, BeaconBlockBodyT, BeaconBlockHeaderT,
BeaconStateT, BlobSidecarsT, ContextT,
DepositT, Eth1DataT, ExecutionPayloadT, ExecutionPayloadHeaderT,
ForkT, ForkDataT, ValidatorT, WithdrawalT, WithdrawalCredentialsT,
_, _, _, BeaconStateT, _, _, _, _, _, _, _, _, _, _, _,
]) processRewardsAndPenalties(
st BeaconStateT,
) error {
Expand Down
5 changes: 1 addition & 4 deletions mod/state-transition/pkg/core/state_processor_committee.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,7 @@ import (

// processSyncCommitteeUpdates processes the sync committee updates.
func (sp *StateProcessor[
BeaconBlockT, BeaconBlockBodyT, BeaconBlockHeaderT,
BeaconStateT, BlobSidecarsT, ContextT,
DepositT, Eth1DataT, ExecutionPayloadT, ExecutionPayloadHeaderT,
ForkT, ForkDataT, ValidatorT, WithdrawalT, WithdrawalCredentialsT,
_, _, _, BeaconStateT, _, _, _, _, _, _, _, _, ValidatorT, _, _,
]) processSyncCommitteeUpdates(
st BeaconStateT,
) (transition.ValidatorUpdates, error) {
Expand Down
6 changes: 2 additions & 4 deletions mod/state-transition/pkg/core/state_processor_genesis.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,8 @@ import (
//
//nolint:gocognit,funlen // todo fix.
func (sp *StateProcessor[
BeaconBlockT, BeaconBlockBodyT, BeaconBlockHeaderT,
BeaconStateT, BlobSidecarsT, ContextT,
DepositT, Eth1DataT, ExecutionPayloadT, ExecutionPayloadHeaderT,
ForkT, ForkDataT, ValidatorT, WithdrawalT, WithdrawalCredentialsT,
_, BeaconBlockBodyT, BeaconBlockHeaderT, BeaconStateT, _, _, DepositT,
Eth1DataT, _, ExecutionPayloadHeaderT, ForkT, _, ValidatorT, _, _,
]) InitializePreminedBeaconStateFromEth1(
st BeaconStateT,
deposits []DepositT,
Expand Down
12 changes: 4 additions & 8 deletions mod/state-transition/pkg/core/state_processor_payload.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,8 @@ import (
// processExecutionPayload processes the execution payload and ensures it
// matches the local state.
func (sp *StateProcessor[
BeaconBlockT, BeaconBlockBodyT, BeaconBlockHeaderT,
BeaconStateT, BlobSidecarsT, ContextT,
DepositT, Eth1DataT, ExecutionPayloadT, ExecutionPayloadHeaderT,
ForkT, ForkDataT, ValidatorT, WithdrawalT, WithdrawalCredentialsT,
BeaconBlockT, _, _, BeaconStateT, _, ContextT,
_, _, _, ExecutionPayloadHeaderT, _, _, _, _, _,
]) processExecutionPayload(
ctx ContextT,
st BeaconStateT,
Expand Down Expand Up @@ -75,10 +73,8 @@ func (sp *StateProcessor[
// state
// and the execution engine.
func (sp *StateProcessor[
BeaconBlockT, BeaconBlockBodyT, BeaconBlockHeaderT,
BeaconStateT, BlobSidecarsT, ContextT,
DepositT, Eth1DataT, ExecutionPayloadT, ExecutionPayloadHeaderT,
ForkT, ForkDataT, ValidatorT, WithdrawalT, WithdrawalCredentialsT,
BeaconBlockT, _, _, BeaconStateT,
_, _, _, _, _, _, _, _, _, _, _,
]) validateExecutionPayload(
ctx context.Context,
st BeaconStateT,
Expand Down
16 changes: 4 additions & 12 deletions mod/state-transition/pkg/core/state_processor_randao.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,8 @@ import (
// processRandaoReveal processes the randao reveal and
// ensures it matches the local state.
func (sp *StateProcessor[
BeaconBlockT, BeaconBlockBodyT, BeaconBlockHeaderT,
BeaconStateT, BlobSidecarsT, ContextT,
DepositT, Eth1DataT, ExecutionPayloadT, ExecutionPayloadHeaderT,
ForkT, ForkDataT, ValidatorT, WithdrawalT, WithdrawalCredentialsT,
BeaconBlockT, _, _, BeaconStateT,
_, _, _, _, _, _, _, ForkDataT, _, _, _,
]) processRandaoReveal(
st BeaconStateT,
blk BeaconBlockT,
Expand Down Expand Up @@ -107,10 +105,7 @@ func (sp *StateProcessor[
//
//nolint:lll
func (sp *StateProcessor[
BeaconBlockT, BeaconBlockBodyT, BeaconBlockHeaderT,
BeaconStateT, BlobSidecarsT, ContextT,
DepositT, Eth1DataT, ExecutionPayloadT, ExecutionPayloadHeaderT,
ForkT, ForkDataT, ValidatorT, WithdrawalT, WithdrawalCredentialsT,
_, _, _, BeaconStateT, _, _, _, _, _, _, _, _, _, _, _,
]) processRandaoMixesReset(
st BeaconStateT,
) error {
Expand All @@ -134,10 +129,7 @@ func (sp *StateProcessor[

// buildRandaoMix as defined in the Ethereum 2.0 specification.
func (sp *StateProcessor[
BeaconBlockT, BeaconBlockBodyT, BeaconBlockHeaderT,
BeaconStateT, BlobSidecarsT, ContextT,
DepositT, Eth1DataT, ExecutionPayloadT, ExecutionPayloadHeaderT,
ForkT, ForkDataT, ValidatorT, WithdrawalT, WithdrawalCredentialsT,
_, _, _, _, _, _, _, _, _, _, _, _, _, _, _,
]) buildRandaoMix(
mix common.Bytes32,
reveal crypto.BLSSignature,
Expand Down
25 changes: 5 additions & 20 deletions mod/state-transition/pkg/core/state_processor_slashing.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,7 @@ import (
//
//nolint:lll
func (sp *StateProcessor[
BeaconBlockT, BeaconBlockBodyT, BeaconBlockHeaderT,
BeaconStateT, BlobSidecarsT, ContextT,
DepositT, Eth1DataT, ExecutionPayloadT, ExecutionPayloadHeaderT,
ForkT, ForkDataT, ValidatorT, WithdrawalT, WithdrawalCredentialsT,
_, _, _, BeaconStateT, _, _, _, _, _, _, _, _, _, _, _,
]) processSlashingsReset(
st BeaconStateT,
) error {
Expand All @@ -51,10 +48,7 @@ func (sp *StateProcessor[
//
//nolint:lll,unused // will be used later
func (sp *StateProcessor[
BeaconBlockT, BeaconBlockBodyT, BeaconBlockHeaderT,
BeaconStateT, BlobSidecarsT, ContextT,
DepositT, Eth1DataT, ExecutionPayloadT, ExecutionPayloadHeaderT,
ForkT, ForkDataT, ValidatorT, WithdrawalT, WithdrawalCredentialsT,
_, _, _, BeaconStateT, _, _, _, _, _, _, _, _, _, _, _,
]) processProposerSlashing(
_ BeaconStateT,
// ps ProposerSlashing,
Expand All @@ -67,10 +61,7 @@ func (sp *StateProcessor[
//
//nolint:lll,unused // will be used later
func (sp *StateProcessor[
BeaconBlockT, BeaconBlockBodyT, BeaconBlockHeaderT,
BeaconStateT, BlobSidecarsT, ContextT,
DepositT, Eth1DataT, ExecutionPayloadT, ExecutionPayloadHeaderT,
ForkT, ForkDataT, ValidatorT, WithdrawalT, WithdrawalCredentialsT,
_, _, _, BeaconStateT, _, _, _, _, _, _, _, _, _, _, _,
]) processAttesterSlashing(
_ BeaconStateT,
// as AttesterSlashing,
Expand All @@ -86,10 +77,7 @@ func (sp *StateProcessor[
//
//nolint:lll,unused // will be used later
func (sp *StateProcessor[
BeaconBlockT, BeaconBlockBodyT, BeaconBlockHeaderT,
BeaconStateT, BlobSidecarsT, ContextT,
DepositT, Eth1DataT, ExecutionPayloadT, ExecutionPayloadHeaderT,
ForkT, ForkDataT, ValidatorT, WithdrawalT, WithdrawalCredentialsT,
_, _, _, BeaconStateT, _, _, _, _, _, _, _, _, _, _, _,
]) processSlashings(
st BeaconStateT,
) error {
Expand Down Expand Up @@ -142,10 +130,7 @@ func (sp *StateProcessor[
//
//nolint:unused // will be used later
func (sp *StateProcessor[
BeaconBlockT, BeaconBlockBodyT, BeaconBlockHeaderT,
BeaconStateT, BlobSidecarsT, ContextT,
DepositT, Eth1DataT, ExecutionPayloadT, ExecutionPayloadHeaderT,
ForkT, ForkDataT, ValidatorT, WithdrawalT, WithdrawalCredentialsT,
_, _, _, BeaconStateT, _, _, _, _, _, _, _, _, ValidatorT, _, _,
]) processSlash(
st BeaconStateT,
val ValidatorT,
Expand Down
Loading

0 comments on commit 58d9ba1

Please sign in to comment.