Skip to content

Commit

Permalink
Don't rewrite poet config (#4782)
Browse files Browse the repository at this point in the history
## Motivation
The poet config is unnecessarily and wrongly rewritten in node setup code.

## Changes
Don't rewrite poet config at all.
  • Loading branch information
poszu committed Aug 7, 2023
1 parent 8f76eff commit 7c3ef42
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
3 changes: 3 additions & 0 deletions activation/poet.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,9 @@ func withCustomHttpClient(client *http.Client) PoetClientOpts {

// NewHTTPPoetClient returns new instance of HTTPPoetClient connecting to the specified url.
func NewHTTPPoetClient(baseUrl string, cfg PoetConfig, opts ...PoetClientOpts) (*HTTPPoetClient, error) {
// TODO(brozansk): Take a logger and use it instead of global logger
log.With().Info("creating poet client", log.String("url", baseUrl), log.Int("max_retries", cfg.MaxRequestRetries), log.Stringer("retry_delay", cfg.RequestRetryDelay))

client := &retryablehttp.Client{
RetryMax: cfg.MaxRequestRetries,
RetryWaitMin: cfg.RequestRetryDelay,
Expand Down
11 changes: 3 additions & 8 deletions node/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -634,11 +634,6 @@ func (app *App) initServices(ctx context.Context) error {
return fmt.Errorf("failed to create mesh: %w", err)
}

poetCfg := activation.PoetConfig{
PhaseShift: app.Config.POET.PhaseShift,
CycleGap: app.Config.POET.CycleGap,
GracePeriod: app.Config.POET.GracePeriod,
}
fetcherWrapped := &layerFetcher{}
atxHandler := activation.NewHandler(
app.cachedDB,
Expand All @@ -653,7 +648,7 @@ func (app *App) initServices(ctx context.Context) error {
beaconProtocol,
trtl,
app.addLogger(ATXHandlerLogger, lg),
poetCfg,
app.Config.POET,
)

// we can't have an epoch offset which is greater/equal than the number of layers in an epoch
Expand Down Expand Up @@ -802,7 +797,7 @@ func (app *App) initServices(ctx context.Context) error {
app.Config.SMESHING.Opts.DataDir,
app.addLogger(NipostBuilderLogger, lg),
app.edSgn,
poetCfg,
app.Config.POET,
app.clock,
activation.WithNipostValidator(app.validator),
)
Expand Down Expand Up @@ -839,7 +834,7 @@ func (app *App) initServices(ctx context.Context) error {
newSyncer,
app.addLogger("atxBuilder", lg),
activation.WithContext(ctx),
activation.WithPoetConfig(poetCfg),
activation.WithPoetConfig(app.Config.POET),
activation.WithPoetRetryInterval(app.Config.HARE.WakeupDelta),
activation.WithValidator(app.validator),
)
Expand Down

0 comments on commit 7c3ef42

Please sign in to comment.