Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/develop' into migrate-systest-gr…
Browse files Browse the repository at this point in the history
…pc-version
  • Loading branch information
fasmat committed Feb 6, 2025
2 parents fb57a52 + 106070f commit 33bbfe4
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 15 deletions.
21 changes: 8 additions & 13 deletions activation/activation.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,6 @@ type Builder struct {
layerClock layerClock
syncer syncer
logger *zap.Logger
parentCtx context.Context
poets []PoetService
poetCfg PoetConfig
poetRetryInterval time.Duration
Expand Down Expand Up @@ -139,14 +138,6 @@ func WithPoetRetryInterval(interval time.Duration) BuilderOption {
}
}

// WithContext modifies parent context for background job.
func WithContext(ctx context.Context) BuilderOption {
return func(b *Builder) {
// TODO(mafa): fix this
b.parentCtx = ctx // nolint:fatcontext
}
}

// WithPoetConfig sets the poet config.
func WithPoetConfig(c PoetConfig) BuilderOption {
return func(b *Builder) {
Expand Down Expand Up @@ -192,7 +183,6 @@ func NewBuilder(
opts ...BuilderOption,
) *Builder {
b := &Builder{
parentCtx: context.Background(),
signers: make(map[types.NodeID]*signing.EdSigner),
conf: conf,
db: db,
Expand Down Expand Up @@ -228,7 +218,13 @@ func (b *Builder) Register(sig *signing.EdSigner) {
b.postStates.Set(sig.NodeID(), types.PostStateIdle)

if b.stop != nil {
b.startID(b.parentCtx, sig)
ctx, stop := context.WithCancel(context.Background())
prevStop := b.stop
b.stop = func() {
prevStop()
stop()
}
b.startID(ctx, sig)
}
}

Expand Down Expand Up @@ -268,9 +264,8 @@ func (b *Builder) StartSmeshing(coinbase types.Address) error {
}

b.coinbaseAccount = coinbase
ctx, stop := context.WithCancel(b.parentCtx)
ctx, stop := context.WithCancel(context.Background())
b.stop = stop

for _, sig := range b.signers {
b.startID(ctx, sig)
}
Expand Down
5 changes: 4 additions & 1 deletion activation/poet.go
Original file line number Diff line number Diff line change
Expand Up @@ -462,7 +462,10 @@ func NewPoetServiceWithClient(
opt(service)
}

err := service.verifyPhaseShiftConfiguration(context.Background())
ctx, cancel := context.WithTimeout(context.Background(), time.Second*30)
defer cancel()

err := service.verifyPhaseShiftConfiguration(ctx)
switch {
case errors.Is(err, errIncompatiblePhaseShift):
logger.Fatal("failed to create poet service", zap.String("poet", client.Address()))
Expand Down
1 change: 0 additions & 1 deletion node/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -1126,7 +1126,6 @@ func (app *App) initServices(ctx context.Context) error {
app.clock,
syncer,
app.addLogger(ATXBuilderLogger, lg).Zap(),
activation.WithContext(ctx),
activation.WithPoetConfig(app.Config.POET),
// TODO(dshulyak) makes no sense. how we ended using it?
activation.WithPoetRetryInterval(app.Config.HARE3.PreroundDelay),
Expand Down

0 comments on commit 33bbfe4

Please sign in to comment.