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

core/tracker: refactor inclusion checker #2120

Merged
merged 10 commits into from
Apr 24, 2023
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
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
1 change: 1 addition & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ linters:
- maintidx
- maligned
- musttag
- nestif
- nonamedreturns
- paralleltest
- prealloc
Expand Down
11 changes: 8 additions & 3 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -398,9 +398,7 @@ func wireCoreWorkflow(ctx context.Context, life *lifecycle.Manager, conf Config,
feeRecipientFunc := func(pubkey core.PubKey) string {
return feeRecipientAddrByCorePubkey[pubkey]
}

sched.SubscribeSlots(setFeeRecipient(eth2Cl, eth2Pubkeys, feeRecipientFunc))
sched.SubscribeSlots(tracker.NewInclDelayFunc(eth2Cl, sched.GetDutyDefinition))

fetch, err := fetcher.New(eth2Cl, feeRecipientFunc)
if err != nil {
Expand Down Expand Up @@ -462,9 +460,15 @@ func wireCoreWorkflow(ctx context.Context, life *lifecycle.Manager, conf Config,
if err != nil {
return err
}

inclusion, err := tracker.NewInclusion(ctx, eth2Cl)
if err != nil {
return err
}

opts := []core.WireOption{
core.WithTracing(),
core.WithTracking(track),
core.WithTracking(track, inclusion.Submitted),
core.WithAsyncRetry(retryer),
}
core.Wire(sched, fetch, cons, dutyDB, vapi, parSigDB, parSigEx, sigAgg, aggSigDB, broadcaster, opts...)
Expand All @@ -482,6 +486,7 @@ func wireCoreWorkflow(ctx context.Context, life *lifecycle.Manager, conf Config,
life.RegisterStart(lifecycle.AsyncAppCtx, lifecycle.StartP2PConsensus, startCons)
life.RegisterStart(lifecycle.AsyncAppCtx, lifecycle.StartAggSigDB, lifecycle.HookFuncCtx(aggSigDB.Run))
life.RegisterStart(lifecycle.AsyncAppCtx, lifecycle.StartParSigDB, lifecycle.HookFuncCtx(parSigDB.Trim))
life.RegisterStart(lifecycle.AsyncAppCtx, lifecycle.StartTracker, lifecycle.HookFuncCtx(inclusion.Run))
life.RegisterStop(lifecycle.StopScheduler, lifecycle.HookFuncMin(sched.Stop))
life.RegisterStop(lifecycle.StopDutyDB, lifecycle.HookFuncMin(dutyDB.Shutdown))
life.RegisterStop(lifecycle.StopRetryer, lifecycle.HookFuncCtx(retryer.Shutdown))
Expand Down
1 change: 0 additions & 1 deletion app/monitoringapi.go
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,6 @@ func startReadyChecker(ctx context.Context, tcpNode host.Host, eth2Cl eth2wrap.C
}

syncing, syncDistance, err := beaconNodeSyncing(ctx, eth2Cl)
//nolint:nestif
if err != nil {
err = errReadyBeaconNodeDown
readyzGauge.Set(readyzBeaconNodeDown)
Expand Down
1 change: 0 additions & 1 deletion app/privkeylock/privkeylock.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import (
// New creates a private key lock file in path, writing contextStr in it.
// If a private key lock file exists at path New returns an error, a clean-up function otherwise.
func New(path, contextStr string) (func() error, error) {
//nolint:nestif
if _, err := os.Stat(path); err == nil {
readCtxStr, err := os.ReadFile(path)
if err != nil {
Expand Down
2 changes: 0 additions & 2 deletions cluster/definition.go
Original file line number Diff line number Diff line change
Expand Up @@ -167,8 +167,6 @@ func (d Definition) NodeIdx(pID peer.ID) (NodeIdx, error) {
}

// VerifySignatures returns true if all config signatures are fully populated and valid. A verified definition is ready for use in DKG.
//
//nolint:nestif
func (d Definition) VerifySignatures() error {
// Skip signature verification for definition versions earlier than v1.3 since there are no EIP712 signatures before v1.3.0.
if !supportEIP712Sigs(d.Version) && !eip712SigsPresent(d.Operators) {
Expand Down
124 changes: 0 additions & 124 deletions core/tracker/incldelay.go

This file was deleted.

100 changes: 0 additions & 100 deletions core/tracker/incldelay_internal_test.go

This file was deleted.

Loading