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

refactor(validator): Forkchoice update logic should be more consolidated #1373

Merged
merged 41 commits into from
Jun 7, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
b1cf54c
bet
itsdevbear Jun 7, 2024
df7f945
bet
itsdevbear Jun 7, 2024
b8cf2b1
bet
itsdevbear Jun 7, 2024
8909581
x
itsdevbear Jun 7, 2024
28852da
bet
itsdevbear Jun 7, 2024
482c587
x
itsdevbear Jun 7, 2024
a48b72d
Merge branch 'main' into blockchain-builder
itsdevbear Jun 7, 2024
b077766
bet
itsdevbear Jun 7, 2024
3405f45
maybe improve flakes?
itsdevbear Jun 7, 2024
a543a58
Merge branch 'main' into blockchain-builder
itsdevbear Jun 7, 2024
d72329f
change e2e full node test
itsdevbear Jun 7, 2024
623228a
bet
itsdevbear Jun 7, 2024
eed86a6
timeouts?
itsdevbear Jun 7, 2024
52ebf1c
bet
itsdevbear Jun 7, 2024
4615cdd
bet
itsdevbear Jun 7, 2024
6055c4a
bet
itsdevbear Jun 7, 2024
30d388e
bet
itsdevbear Jun 7, 2024
a27306f
bet
itsdevbear Jun 7, 2024
aa5a4e1
bet
itsdevbear Jun 7, 2024
a368d37
bet
itsdevbear Jun 7, 2024
a589431
bet
itsdevbear Jun 7, 2024
a2b0d34
bet
itsdevbear Jun 7, 2024
33b6041
bet
itsdevbear Jun 7, 2024
00e45c5
bet
itsdevbear Jun 7, 2024
e78babe
bet
itsdevbear Jun 7, 2024
e273451
x
itsdevbear Jun 7, 2024
5785e59
bet
itsdevbear Jun 7, 2024
d5aa9af
bet
itsdevbear Jun 7, 2024
ec3d347
bet
itsdevbear Jun 7, 2024
41930e1
bet
itsdevbear Jun 7, 2024
874e879
bet
itsdevbear Jun 7, 2024
62a1d7d
bet
itsdevbear Jun 7, 2024
339f6a9
bet
itsdevbear Jun 7, 2024
4f13471
bet
itsdevbear Jun 7, 2024
ad4cc6a
bet
itsdevbear Jun 7, 2024
ced48b5
bet
itsdevbear Jun 7, 2024
6a422cb
bet
itsdevbear Jun 7, 2024
3eed75d
Merge branch 'main' into blockchain-builder
itsdevbear Jun 7, 2024
1609f1d
bet
itsdevbear Jun 7, 2024
a6d46ce
bet
itsdevbear Jun 7, 2024
7340c79
Merge branch 'main' into blockchain-builder
itsdevbear Jun 7, 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
Prev Previous commit
Next Next commit
x
  • Loading branch information
itsdevbear committed Jun 7, 2024
commit 8909581255464b96bdb9b226edd6c6781ad11da8
2 changes: 1 addition & 1 deletion mod/execution/pkg/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -302,10 +302,10 @@ func (s *EngineClient[ExecutionPayloadT]) jwtRefreshLoop(
) {
s.logger.Info("starting JWT refresh loop 🔄")
ticker := time.NewTicker(s.cfg.RPCJWTRefreshInterval)
defer ticker.Stop()
for {
select {
case <-ctx.Done():
ticker.Stop()
return
case <-ticker.C:
s.statusErrMu.Lock()
Expand Down
2 changes: 1 addition & 1 deletion mod/node-core/pkg/app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ func (app *BeaconApp) setupBeaconModule() {
ABCIValidatorMiddleware().
ProcessProposalHandler,
)
app.SetPreBlocker(beaconModule.ABCIBlockchainMiddleware().PreBlock)
app.SetPreBlocker(beaconModule.ABCIFinalizeBlockMiddleware().PreBlock)

// TODO: this needs to be made un-hood.
if err := beaconModule.StartServices(
Expand Down
4 changes: 2 additions & 2 deletions mod/runtime/pkg/runtime/abci.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ func (r BeaconKitRuntime[
ctx context.Context,
bz json.RawMessage,
) ([]appmodulev2.ValidatorUpdate, error) {
return r.abciBlockchainMiddleware.InitGenesis(ctx, bz)
return r.abciFinalizeBlockMiddleware.InitGenesis(ctx, bz)
}

// EndBlock returns the validator set updates from the beacon state.
Expand All @@ -47,5 +47,5 @@ func (r BeaconKitRuntime[
]) EndBlock(
ctx context.Context,
) ([]appmodulev2.ValidatorUpdate, error) {
return r.abciBlockchainMiddleware.EndBlock(ctx)
return r.abciFinalizeBlockMiddleware.EndBlock(ctx)
}
18 changes: 9 additions & 9 deletions mod/runtime/pkg/runtime/middleware/finalize.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,10 @@ import (
"github.com/sourcegraph/conc/iter"
)

// BlockchainMiddleware is a struct that encapsulates the necessary
// FinalizeBlockMiddleware is a struct that encapsulates the necessary
// components to handle
// the proposal processes.
type BlockchainMiddleware[
type FinalizeBlockMiddleware[
BeaconBlockT interface {
ssz.Marshallable
NewFromSSZ([]byte, uint32) (BeaconBlockT, error)
Expand All @@ -60,8 +60,8 @@ type BlockchainMiddleware[
valUpdates []*transition.ValidatorUpdate
}

// NewBlockchainMiddleware creates a new instance of the Handler struct.
func NewBlockchainMiddleware[
// NewFinalizeBlockMiddleware creates a new instance of the Handler struct.
func NewFinalizeBlockMiddleware[
BeaconBlockT interface {
ssz.Marshallable
NewFromSSZ([]byte, uint32) (BeaconBlockT, error)
Expand All @@ -71,21 +71,21 @@ func NewBlockchainMiddleware[
chainSpec primitives.ChainSpec,
chainService BlockchainService[BeaconBlockT, BlobSidecarsT],
telemetrySink TelemetrySink,
) *BlockchainMiddleware[BeaconBlockT, BeaconStateT, BlobSidecarsT] {
) *FinalizeBlockMiddleware[BeaconBlockT, BeaconStateT, BlobSidecarsT] {
// This is just for nilaway, TODO: remove later.
if chainService == nil {
panic("chain service is nil")
}

return &BlockchainMiddleware[BeaconBlockT, BeaconStateT, BlobSidecarsT]{
return &FinalizeBlockMiddleware[BeaconBlockT, BeaconStateT, BlobSidecarsT]{
chainSpec: chainSpec,
chainService: chainService,
metrics: newFinalizeMiddlewareMetrics(telemetrySink),
}
}

// InitGenesis is called by the base app to initialize the state of the.
func (h *BlockchainMiddleware[
func (h *FinalizeBlockMiddleware[
BeaconBlockT, BeaconStateT, BlobSidecarsT,
]) InitGenesis(
ctx context.Context,
Expand All @@ -112,7 +112,7 @@ func (h *BlockchainMiddleware[
// PreBlock is called by the base app before the block is finalized. It
// is responsible for aggregating oracle data from each validator and writing
// the oracle data to the store.
func (h *BlockchainMiddleware[
func (h *FinalizeBlockMiddleware[
BeaconBlockT, BeaconStateT, BlobSidecarsT,
]) PreBlock(
ctx sdk.Context, req *cometabci.FinalizeBlockRequest,
Expand Down Expand Up @@ -142,7 +142,7 @@ func (h *BlockchainMiddleware[
}

// EndBlock returns the validator set updates from the beacon state.
func (h BlockchainMiddleware[
func (h FinalizeBlockMiddleware[
BeaconBlockT, BeaconStateT, BlobSidecarsT,
]) EndBlock(
context.Context,
Expand Down
12 changes: 6 additions & 6 deletions mod/runtime/pkg/runtime/runtime.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,9 @@ type BeaconKitRuntime[
storageBackend StorageBackendT
// chainSpec defines the chain specifications for the BeaconKitRuntime.
chainSpec primitives.ChainSpec
// abciBlockchainMiddleware handles ABCI interactions for the
// abciFinalizeBlockMiddleware handles ABCI interactions for the
// BeaconKitRuntime.
abciBlockchainMiddleware *middleware.BlockchainMiddleware[
abciFinalizeBlockMiddleware *middleware.FinalizeBlockMiddleware[
BeaconBlockT, BeaconStateT, BlobSidecarsT,
]
// abciValidatorMiddleware is responsible for forward ABCI requests to the
Expand Down Expand Up @@ -167,8 +167,8 @@ func NewBeaconKitRuntime[
AvailabilityStoreT, BeaconBlockT, BeaconBlockBodyT, BeaconStateT,
BlobSidecarsT, DepositStoreT, StorageBackendT,
]{
abciBlockchainMiddleware: middleware.
NewBlockchainMiddleware[
abciFinalizeBlockMiddleware: middleware.
NewFinalizeBlockMiddleware[
BeaconBlockT, BeaconStateT, BlobSidecarsT,
](
chainSpec,
Expand Down Expand Up @@ -204,10 +204,10 @@ func (r *BeaconKitRuntime[
func (r *BeaconKitRuntime[
AvailabilityStoreT, BeaconBlockT, BeaconBlockBodyT, BeaconStateT,
BlobSidecarsT, DepositStoreT, StorageBackendT,
]) ABCIBlockchainMiddleware() *middleware.BlockchainMiddleware[
]) ABCIFinalizeBlockMiddleware() *middleware.FinalizeBlockMiddleware[
BeaconBlockT, BeaconStateT, BlobSidecarsT,
] {
return r.abciBlockchainMiddleware
return r.abciFinalizeBlockMiddleware
}

// ABCIValidatorMiddleware returns the ABCI validator middleware.
Expand Down
Loading