diff --git a/activation/nipost.go b/activation/nipost.go index 556643a641..399e07c9e5 100644 --- a/activation/nipost.go +++ b/activation/nipost.go @@ -406,16 +406,16 @@ func (nb *NIPostBuilder) submitPoetChallenges( } } - misconfiguredRegistrations := make(map[string]nipost.PoETRegistration) + misconfiguredRegistrations := make(map[string]struct{}) for addr := range registrationsMap { - if reg, ok := existingRegistrationsMap[addr]; !ok { - misconfiguredRegistrations[addr] = reg + if _, ok := existingRegistrationsMap[addr]; !ok { + misconfiguredRegistrations[addr] = struct{}{} } } if len(misconfiguredRegistrations) != 0 { nb.logger.Warn( - "Invalid PoET registrations found. Local state contains PoETs not in node config", + "Found existing registrations for poets not listed in the config. Will not fetch proof from them.", zap.Strings("registrations_addresses", maps.Keys(misconfiguredRegistrations)), log.ZShortStringer("smesherID", nodeID), ) @@ -441,7 +441,8 @@ func (nb *NIPostBuilder) submitPoetChallenges( case len(existingRegistrations) == 0: // no existing registration for given poets set nb.logger.Panic( - "Invalid PoET registrations found. Local state only contains PoETs not in node config", + "None of the poets listed in the config matches the existing registrations. "+ + "Verify your config and local database state.", zap.Strings("registrations", maps.Keys(registrationsMap)), zap.Strings("configured_poets", maps.Keys(nb.poetProvers)), log.ZShortStringer("smesherID", nodeID), diff --git a/activation/nipost_test.go b/activation/nipost_test.go index be8c9ae0c4..cc368c9c44 100644 --- a/activation/nipost_test.go +++ b/activation/nipost_test.go @@ -1077,6 +1077,7 @@ func TestNIPoSTBuilder_PoETConfigChange(t *testing.T) { require.NoError(t, err) logger := zaptest.NewLogger(t) + nb, err := NewNIPostBuilder( db, nil, diff --git a/activation/poet.go b/activation/poet.go index ea0e3dc35f..f7b8a3cc31 100644 --- a/activation/poet.go +++ b/activation/poet.go @@ -155,10 +155,8 @@ func NewHTTPPoetClient(server types.PoetServer, cfg PoetConfig, opts ...PoetClie resp, err := poetClient.info(context.Background()) if err != nil { - return nil, err - } - - if resp.PhaseShift.AsDuration() != cfg.PhaseShift { + poetClient.logger.Error("getting info about poet service configuration", zap.Error(err)) + } else if resp.PhaseShift.AsDuration() != cfg.PhaseShift { poetClient.logger.Warn("getting info about poet service configuration", zap.Duration("server: phase shift", resp.PhaseShift.AsDuration()), zap.Duration("config: cycle gap", cfg.PhaseShift), @@ -497,7 +495,6 @@ func (c *poetService) reauthorize( ctx context.Context, id types.NodeID, challenge []byte, - logger *zap.Logger, ) (*PoetAuth, error) { if c.certifier != nil { if _, pubkey, err := c.getCertifierInfo(ctx); err == nil { @@ -538,7 +535,7 @@ func (c *poetService) Submit( return round, nil case errors.Is(err, ErrUnauthorized): logger.Warn("failed to submit challenge as unauthorized - authorizing again", zap.Error(err)) - auth, err := c.reauthorize(ctx, nodeID, challenge, logger) + auth, err := c.reauthorize(ctx, nodeID, challenge) if err != nil { return nil, fmt.Errorf("authorizing: %w", err) }