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

Serve API to return poet registrations state #6266

Open
wants to merge 67 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 56 commits
Commits
Show all changes
67 commits
Select commit Hold shift + click to select a range
726b49d
check registrations by poet address
ConvallariaMaj Jul 2, 2024
3f68831
Merge branch 'refs/heads/develop' into fix/issue-5563
ConvallariaMaj Jul 9, 2024
5bba175
added:
ConvallariaMaj Jul 10, 2024
8080ed0
fixed:
ConvallariaMaj Jul 11, 2024
7a371a2
fix lint
ConvallariaMaj Jul 11, 2024
89696b1
fix lint2
ConvallariaMaj Jul 11, 2024
189aa4c
- added new test
ConvallariaMaj Jul 14, 2024
97aed33
Merge branch 'refs/heads/develop' into fix/issue-5563
ConvallariaMaj Jul 14, 2024
66ea05e
make linter happy
ConvallariaMaj Jul 15, 2024
f6f2277
fixed review issues
ConvallariaMaj Jul 18, 2024
3313ff9
refactoring:
ConvallariaMaj Jul 23, 2024
dee9103
refactoring:
ConvallariaMaj Jul 23, 2024
4cbafdd
new api
ConvallariaMaj Jul 23, 2024
9a5bad8
refactor tests
ConvallariaMaj Jul 23, 2024
9ffb962
refactored tests
ConvallariaMaj Jul 23, 2024
c4bb081
fix text and make linter happy
ConvallariaMaj Jul 24, 2024
696e3e3
Merge branch 'refs/heads/develop' into issue-332
ConvallariaMaj Jul 28, 2024
ace0460
Merge branch 'refs/heads/fix/issue-5563' into issue-332
ConvallariaMaj Jul 28, 2024
aeb5939
fixed smeshing identities poet servises return
ConvallariaMaj Jul 28, 2024
dcda554
Merge branch 'refs/heads/develop' into issue-332
ConvallariaMaj Aug 12, 2024
d304a1e
fix merge
ConvallariaMaj Aug 12, 2024
0ebdb79
identity states
ConvallariaMaj Aug 13, 2024
69cfb29
simplifying
ConvallariaMaj Aug 14, 2024
4b12ecb
fixing tests
ConvallariaMaj Aug 18, 2024
2c29b49
Merge branch 'refs/heads/develop' into issue-332
ConvallariaMaj Aug 18, 2024
cadaedc
fixing tests2
ConvallariaMaj Aug 18, 2024
aa2c4bd
mocks + fixed warning
ConvallariaMaj Aug 18, 2024
6593496
refactoring + tests fixing
ConvallariaMaj Aug 18, 2024
e00049f
cleaning up
ConvallariaMaj Aug 19, 2024
2826b51
cleaning up2
ConvallariaMaj Aug 19, 2024
bb8fc04
cleaning up3
ConvallariaMaj Aug 20, 2024
0eacbbe
Merge branch 'refs/heads/develop' into issue-332
ConvallariaMaj Aug 20, 2024
d7f7f7d
Merge branch 'refs/heads/develop' into issue-332
ConvallariaMaj Aug 20, 2024
40e3e4b
minor review issue
ConvallariaMaj Aug 20, 2024
0a3e5ca
fix review issues
ConvallariaMaj Aug 25, 2024
34d118b
Merge branch 'refs/heads/develop' into issue-332
ConvallariaMaj Aug 25, 2024
b412dfb
Merge branch 'refs/heads/develop' into issue-332
ConvallariaMaj Aug 26, 2024
66a53c6
regenerate mocks
ConvallariaMaj Aug 26, 2024
9e64d1d
Merge branch 'refs/heads/develop' into issue-332
ConvallariaMaj Aug 29, 2024
a7b2200
fix review issues
ConvallariaMaj Sep 4, 2024
d29238d
fix e2e tests
ConvallariaMaj Sep 4, 2024
f0e13d7
fix e2e tests2
ConvallariaMaj Sep 4, 2024
ef2a856
fix e2e tests3
ConvallariaMaj Sep 5, 2024
bc36bb2
fix db tests
ConvallariaMaj Sep 5, 2024
98aaed4
fix tests
ConvallariaMaj Sep 17, 2024
101bd67
Merge branch 'refs/heads/develop' into issue-332
ConvallariaMaj Sep 17, 2024
2a4392a
fix imports
ConvallariaMaj Sep 18, 2024
b2a3121
Merge branch 'develop' into issue-332
poszu Sep 27, 2024
de52ea0
Merge remote-tracking branch 'origin/develop' into issue-332
fasmat Oct 1, 2024
e73e05e
Update API dependency
fasmat Oct 1, 2024
d10d8f0
Fix failing tests
fasmat Oct 1, 2024
6d6a4fe
Merge remote-tracking branch 'origin/develop' into issue-332
fasmat Oct 2, 2024
2c41327
Review feedback
fasmat Oct 2, 2024
5bb7775
Review feedback
fasmat Oct 2, 2024
e91db30
Update api dependency
fasmat Oct 2, 2024
0400110
Review feedback
fasmat Oct 2, 2024
fd24c4d
Merge remote-tracking branch 'origin/develop' into issue-332
fasmat Oct 9, 2024
dfedf1c
Fix broken dependency
fasmat Oct 9, 2024
c74260a
Merge remote-tracking branch 'origin/develop' into issue-332
fasmat Oct 11, 2024
bdb8e52
Merge remote-tracking branch 'origin/develop' into issue-332
fasmat Oct 15, 2024
198fd04
Merge remote-tracking branch 'origin/develop' into issue-332
fasmat Oct 21, 2024
905a669
make generate
fasmat Oct 21, 2024
2b76480
Merge remote-tracking branch 'origin/develop' into issue-332
fasmat Oct 26, 2024
dca792e
Fix failing test
fasmat Oct 27, 2024
729d95d
Update api dependency
fasmat Nov 5, 2024
5b06560
Merge remote-tracking branch 'origin/develop' into issue-332
fasmat Nov 5, 2024
0299474
Merge remote-tracking branch 'origin/develop' into issue-332
fasmat Nov 6, 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
53 changes: 48 additions & 5 deletions activation/activation.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,12 @@

posAtxFinder positioningAtxFinder

// states of each known identity
// post states of each known identity
postStates PostStates

// identity states of each known identity
identitiesStates IdentityStates

// smeshingMutex protects methods like `StartSmeshing` and `StopSmeshing` from concurrent execution
// since they (can) modify the fields below.
smeshingMutex sync.Mutex
Expand Down Expand Up @@ -172,6 +175,12 @@
}
}

func WithIdentityStates(is IdentityStates) BuilderOption {
return func(b *Builder) {
b.identitiesStates = is
}
}

func BuilderAtxVersions(v AtxVersions) BuilderOption {
return func(h *Builder) {
h.versions = append([]atxVersion{{0, types.AtxV1}}, v.asSlice()...)
Expand Down Expand Up @@ -206,6 +215,7 @@
poetRetryInterval: defaultPoetRetryInterval,
postValidityDelay: 12 * time.Hour,
postStates: NewPostStates(log),
identitiesStates: NewIdentityStateStorage(),
versions: []atxVersion{{0, types.AtxV1}},
}
for _, opt := range opts {
Expand Down Expand Up @@ -239,7 +249,7 @@
return b.stop != nil
}

// PostState returns the current state of the post service for each registered smesher.
// PostStates returns the current state of the post service for each registered smesher.
func (b *Builder) PostStates() map[types.IdentityDescriptor]types.PostState {
states := b.postStates.Get()
res := make(map[types.IdentityDescriptor]types.PostState, len(states))
Expand All @@ -253,6 +263,20 @@
return res
}

// IdentityStates returns the current state of the identity for each smesher.
func (b *Builder) IdentityStates() map[types.IdentityDescriptor]IdentityState {
states := b.identitiesStates.All()
res := make(map[types.IdentityDescriptor]IdentityState, len(states))
b.smeshingMutex.Lock()
defer b.smeshingMutex.Unlock()
for id, state := range states {
if sig, exists := b.signers[id]; exists {
res[sig] = state

Check warning on line 274 in activation/activation.go

View check run for this annotation

Codecov / codecov/patch

activation/activation.go#L267-L274

Added lines #L267 - L274 were not covered by tests
}
}
return res

Check warning on line 277 in activation/activation.go

View check run for this annotation

Codecov / codecov/patch

activation/activation.go#L277

Added line #L277 was not covered by tests
}
Comment on lines +267 to +278
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about not adding this to the ATX Builder? The builder doesn't need this at all. AFAIR, it's only used in the grpc service, which could do read directly from the "identities state", wdyt?

We don't support unregistering, so the GRPC service could just return all the state of all IDs.


// StartSmeshing is the main entry point of the atx builder. It runs the main
// loop of the builder in a new go-routine and shouldn't be called more than
// once without calling StopSmeshing in between. If the post data is incomplete
Expand Down Expand Up @@ -340,7 +364,7 @@
}
}

// SmesherID returns the ID of the smesher that created this activation.
// SmesherIDs returns the ID of the smesher that created this activation.
func (b *Builder) SmesherIDs() []types.NodeID {
b.smeshingMutex.Lock()
defer b.smeshingMutex.Unlock()
Expand Down Expand Up @@ -442,6 +466,14 @@
}
eg.Wait()

if err := b.identitiesStates.Set(sig.NodeID(), IdentityStateWaitForATXSyncing); err != nil {
b.logger.Warn("failed to switch identity state",
zap.Stringer("smesherID", sig.NodeID()),
zap.Error(err),
)
return

Check warning on line 474 in activation/activation.go

View check run for this annotation

Codecov / codecov/patch

activation/activation.go#L470-L474

Added lines #L470 - L474 were not covered by tests
}

for {
err := b.PublishActivationTx(ctx, sig)
if err == nil {
Expand Down Expand Up @@ -510,14 +542,22 @@

func (b *Builder) BuildNIPostChallenge(ctx context.Context, nodeID types.NodeID) (*types.NIPostChallenge, error) {
logger := b.logger.With(log.ZShortStringer("smesherID", nodeID))

select {
case <-ctx.Done():
return nil, ctx.Err()
case <-b.syncer.RegisterForATXSynced():
}

currentEpochId := b.layerClock.CurrentLayer().GetEpoch()

if err := b.identitiesStates.Set(nodeID, IdentityStateWaitForPoetRoundStart); err != nil {
b.logger.Warn("failed to switch identity state",
zap.Stringer("smesherID", nodeID),
zap.Error(err),
)
return nil, err

Check warning on line 558 in activation/activation.go

View check run for this annotation

Codecov / codecov/patch

activation/activation.go#L554-L558

Added lines #L554 - L558 were not covered by tests
}

// Try to get existing challenge
existingChallenge, err := b.getExistingChallenge(logger, currentEpochId, nodeID)
if err != nil {
Expand Down Expand Up @@ -733,6 +773,7 @@
targetEpoch := challenge.PublishEpoch.Add(1)
ctx, cancel := context.WithDeadline(ctx, b.layerClock.LayerToTime(targetEpoch.FirstLayer()))
defer cancel()

atx, err := b.createAtx(ctx, sig, challenge)
if err != nil {
return fmt.Errorf("create ATX: %w", err)
Expand Down Expand Up @@ -803,8 +844,9 @@
sig *signing.EdSigner,
challenge *types.NIPostChallenge,
) (builtAtx, error) {
version := b.version(challenge.PublishEpoch)
var challengeHash types.Hash32

version := b.version(challenge.PublishEpoch)
switch version {
case types.AtxV1:
challengeHash = wire.NIPostChallengeToWireV1(challenge).Hash()
Expand All @@ -814,6 +856,7 @@
return nil, fmt.Errorf("unknown ATX version: %v", version)
}
b.logger.Info("building ATX", zap.Stringer("smesherID", sig.NodeID()), zap.Stringer("version", version))

nipostState, err := b.nipostBuilder.BuildNIPost(ctx, sig, challengeHash, challenge)
if err != nil {
return nil, fmt.Errorf("build NIPost: %w", err)
Expand Down
78 changes: 69 additions & 9 deletions activation/activation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -176,14 +176,17 @@ func publishAtx(
NumUnits: DefaultPostSetupOpts().NumUnits,
LabelsPerUnit: DefaultPostConfig().LabelsPerUnit,
}, nil).AnyTimes()

tab.mnipost.EXPECT().BuildNIPost(gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any()).DoAndReturn(
func(_ context.Context, _ *signing.EdSigner, _ types.Hash32, _ *types.NIPostChallenge,
) (*nipost.NIPostState, error) {
*currLayer = currLayer.Add(buildNIPostLayerDuration)
return newNIPostWithPoet(tb, types.RandomHash().Bytes()), nil
})

ch := make(chan struct{})
close(ch)

tab.mclock.EXPECT().AwaitLayer(publishEpoch.FirstLayer()).DoAndReturn(
func(got types.LayerID) <-chan struct{} {
// advance to publish layer
Expand Down Expand Up @@ -349,7 +352,14 @@ func TestBuilder_StopSmeshing_failsWhenNotStarted(t *testing.T) {
}

func TestBuilder_PublishActivationTx_HappyFlow(t *testing.T) {
tab := newTestBuilder(t, 1, WithPoetConfig(PoetConfig{PhaseShift: layerDuration}))
ctrl := gomock.NewController(t)
idStates := NewMockIdentityStates(ctrl)
idStates.EXPECT().Set(gomock.Any(), gomock.Any()).Return(nil).AnyTimes()

tab := newTestBuilder(t, 1,
WithPoetConfig(PoetConfig{PhaseShift: layerDuration}),
WithIdentityStates(idStates))

Comment on lines -351 to +361
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the point of adding the "identitystates` in these tests? It doesn't verify anything additionally (compared to the original test) but it complicates the tests.

sig := maps.Values(tab.signers)[0]

posEpoch := postGenesisEpoch
Expand Down Expand Up @@ -434,7 +444,13 @@ func TestBuilder_Loop_WaitsOnStaleChallenge(t *testing.T) {
}

func TestBuilder_PublishActivationTx_FaultyNet(t *testing.T) {
tab := newTestBuilder(t, 1, WithPoetConfig(PoetConfig{PhaseShift: layerDuration * 4}))
ctrl := gomock.NewController(t)
idStates := NewMockIdentityStates(ctrl)
idStates.EXPECT().Set(gomock.Any(), gomock.Any()).Return(nil).AnyTimes()

tab := newTestBuilder(t, 1,
WithPoetConfig(PoetConfig{PhaseShift: layerDuration * 4}),
WithIdentityStates(idStates))
sig := maps.Values(tab.signers)[0]

posEpoch := postGenesisEpoch
Expand Down Expand Up @@ -509,7 +525,14 @@ func TestBuilder_PublishActivationTx_UsesExistingChallengeOnLatePublish(t *testi
poetCfg := PoetConfig{
PhaseShift: layerDuration * 4,
}
tab := newTestBuilder(t, 1, WithPoetConfig(poetCfg))

ctrl := gomock.NewController(t)
idStates := NewMockIdentityStates(ctrl)
idStates.EXPECT().Set(gomock.Any(), gomock.Any()).Return(nil).AnyTimes()

tab := newTestBuilder(t, 1,
WithPoetConfig(poetCfg),
WithIdentityStates(idStates))
sig := maps.Values(tab.signers)[0]

currLayer := (postGenesisEpoch + 1).FirstLayer().Add(5) // late for poet round start
Expand Down Expand Up @@ -585,7 +608,13 @@ func TestBuilder_PublishActivationTx_UsesExistingChallengeOnLatePublish(t *testi
}

func TestBuilder_PublishActivationTx_RebuildNIPostWhenTargetEpochPassed(t *testing.T) {
tab := newTestBuilder(t, 1, WithPoetConfig(PoetConfig{PhaseShift: layerDuration * 4}))
ctrl := gomock.NewController(t)
idStates := NewMockIdentityStates(ctrl)
idStates.EXPECT().Set(gomock.Any(), gomock.Any()).Return(nil).AnyTimes()

tab := newTestBuilder(t, 1,
WithPoetConfig(PoetConfig{PhaseShift: layerDuration * 4}),
WithIdentityStates(idStates))
sig := maps.Values(tab.signers)[0]

posEpoch := types.EpochID(2)
Expand Down Expand Up @@ -670,7 +699,13 @@ func TestBuilder_PublishActivationTx_RebuildNIPostWhenTargetEpochPassed(t *testi
}

func TestBuilder_PublishActivationTx_NoPrevATX(t *testing.T) {
tab := newTestBuilder(t, 1, WithPoetConfig(PoetConfig{PhaseShift: layerDuration * 4}))
ctrl := gomock.NewController(t)
idStates := NewMockIdentityStates(ctrl)
idStates.EXPECT().Set(gomock.Any(), gomock.Any()).Return(nil).AnyTimes()

tab := newTestBuilder(t, 1,
WithPoetConfig(PoetConfig{PhaseShift: layerDuration * 4}),
WithIdentityStates(idStates))
sig := maps.Values(tab.signers)[0]

posEpoch := postGenesisEpoch
Expand Down Expand Up @@ -784,7 +819,14 @@ func TestBuilder_PublishActivationTx_PrevATXWithoutPrevATX(t *testing.T) {
r := require.New(t)

// Arrange
tab := newTestBuilder(t, 1, WithPoetConfig(PoetConfig{PhaseShift: layerDuration * 4}))
ctrl := gomock.NewController(t)
idStates := NewMockIdentityStates(ctrl)
idStates.EXPECT().Set(gomock.Any(), gomock.Any()).Return(nil).AnyTimes()

tab := newTestBuilder(t, 1,
WithPoetConfig(PoetConfig{PhaseShift: layerDuration * 4}),
WithIdentityStates(idStates),
)
sig := maps.Values(tab.signers)[0]

otherSigner, err := signing.NewEdSigner()
Expand Down Expand Up @@ -878,7 +920,14 @@ func TestBuilder_PublishActivationTx_TargetsEpochBasedOnPosAtx(t *testing.T) {
r := require.New(t)

// Arrange
tab := newTestBuilder(t, 1, WithPoetConfig(PoetConfig{PhaseShift: layerDuration * 4}))
ctrl := gomock.NewController(t)
idStates := NewMockIdentityStates(ctrl)
idStates.EXPECT().Set(gomock.Any(), gomock.Any()).Return(nil).AnyTimes()

tab := newTestBuilder(t, 1,
WithPoetConfig(PoetConfig{PhaseShift: layerDuration * 4}),
WithIdentityStates(idStates))

sig := maps.Values(tab.signers)[0]

otherSigner, err := signing.NewEdSigner()
Expand Down Expand Up @@ -975,7 +1024,14 @@ func TestBuilder_PublishActivationTx_TargetsEpochBasedOnPosAtx(t *testing.T) {
}

func TestBuilder_PublishActivationTx_FailsWhenNIPostBuilderFails(t *testing.T) {
tab := newTestBuilder(t, 1, WithPoetConfig(PoetConfig{PhaseShift: layerDuration * 4}))
ctrl := gomock.NewController(t)
idStates := NewMockIdentityStates(ctrl)
idStates.EXPECT().Set(gomock.Any(), gomock.Any()).Return(nil).AnyTimes()

tab := newTestBuilder(t, 1,
WithPoetConfig(PoetConfig{PhaseShift: layerDuration * 4}),
WithIdentityStates(idStates))

sig := maps.Values(tab.signers)[0]

posEpoch := postGenesisEpoch
Expand Down Expand Up @@ -1279,10 +1335,14 @@ func TestWaitPositioningAtx(t *testing.T) {
{"round started", 0, 0, 3},
} {
t.Run(tc.desc, func(t *testing.T) {
ctrl := gomock.NewController(t)
idStates := NewMockIdentityStates(ctrl)
idStates.EXPECT().Set(gomock.Any(), gomock.Any()).Return(nil).AnyTimes()

tab := newTestBuilder(t, 1, WithPoetConfig(PoetConfig{
PhaseShift: tc.shift,
GracePeriod: tc.grace,
}))
}), WithIdentityStates(idStates))
sig := maps.Values(tab.signers)[0]

tab.mclock.EXPECT().CurrentLayer().Return(types.LayerID(0)).AnyTimes()
Expand Down
10 changes: 10 additions & 0 deletions activation/builder_v2_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,13 @@ import (
)

func TestBuilder_BuildsInitialAtxV2(t *testing.T) {
ctrl := gomock.NewController(t)
idStates := NewMockIdentityStates(ctrl)
idStates.EXPECT().Set(gomock.Any(), gomock.Any()).Return(nil).AnyTimes()

tab := newTestBuilder(t, 1,
WithPoetConfig(PoetConfig{PhaseShift: layerDuration}),
WithIdentityStates(idStates),
Comment on lines +21 to +27
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ditto

Suggested change
ctrl := gomock.NewController(t)
idStates := NewMockIdentityStates(ctrl)
idStates.EXPECT().Set(gomock.Any(), gomock.Any()).Return(nil).AnyTimes()
tab := newTestBuilder(t, 1,
WithPoetConfig(PoetConfig{PhaseShift: layerDuration}),
WithIdentityStates(idStates),
tab := newTestBuilder(t, 1,
WithPoetConfig(PoetConfig{PhaseShift: layerDuration}),

BuilderAtxVersions(AtxVersions{1: types.AtxV2}))

tab.SetCoinbase(types.Address{1, 2, 3, 4})
Expand Down Expand Up @@ -72,8 +77,13 @@ func TestBuilder_BuildsInitialAtxV2(t *testing.T) {
}

func TestBuilder_SwitchesToBuildV2(t *testing.T) {
ctrl := gomock.NewController(t)
idStates := NewMockIdentityStates(ctrl)
idStates.EXPECT().Set(gomock.Any(), gomock.Any()).Return(nil).AnyTimes()

tab := newTestBuilder(t, 1,
WithPoetConfig(PoetConfig{PhaseShift: layerDuration}),
WithIdentityStates(idStates),
BuilderAtxVersions(AtxVersions{4: types.AtxV2}))
sig := maps.Values(tab.signers)[0]

Expand Down
6 changes: 5 additions & 1 deletion activation/e2e/activation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,8 @@ func Test_BuilderWithMultipleClients(t *testing.T) {
verifier,
)

idStates := activation.NewIdentityStateStorage()

nb, err := activation.NewNIPostBuilder(
localDB,
svc,
Expand All @@ -150,6 +152,7 @@ func Test_BuilderWithMultipleClients(t *testing.T) {
clock,
validator,
activation.WithPoetServices(client),
activation.NipostbuilderWithIdentityStates(idStates),
)
require.NoError(t, err)

Expand Down Expand Up @@ -202,6 +205,7 @@ func Test_BuilderWithMultipleClients(t *testing.T) {
activation.WithPoetConfig(poetCfg),
activation.WithValidator(validator),
activation.WithPoets(client),
activation.WithIdentityStates(idStates),
)
for _, sig := range signers {
tab.Register(sig)
Expand All @@ -225,7 +229,7 @@ func Test_BuilderWithMultipleClients(t *testing.T) {
err := validator.VRFNonce(
sig.NodeID(),
commitment,
uint64(*atx.VRFNonce),
*atx.VRFNonce,
atx.NIPost.PostMetadata.LabelsPerUnit,
atx.NumUnits,
)
Expand Down
10 changes: 10 additions & 0 deletions activation/e2e/atx_merge_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,8 @@ func Test_MarryAndMerge(t *testing.T) {
require.NoError(t, err)
t.Cleanup(clock.Close)

idStates := activation.NewIdentityStateStorage()

nb, err := activation.NewNIPostBuilder(
localDB,
svc,
Expand All @@ -267,6 +269,7 @@ func Test_MarryAndMerge(t *testing.T) {
clock,
validator,
activation.WithPoetServices(poetSvc),
activation.NipostbuilderWithIdentityStates(idStates),
)
require.NoError(t, err)

Expand Down Expand Up @@ -311,6 +314,13 @@ func Test_MarryAndMerge(t *testing.T) {
InitialPost: post,
}
challenge := wire.NIPostChallengeToWireV2(postChallenge).Hash()

err = idStates.Set(signer.NodeID(), activation.IdentityStateWaitForATXSyncing)
require.NoError(t, err)

err = idStates.Set(signer.NodeID(), activation.IdentityStateWaitForPoetRoundStart)
require.NoError(t, err)

nipost, err := nb.BuildNIPost(context.Background(), signer, challenge, postChallenge)
if err != nil {
return err
Expand Down
Loading
Loading