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

[Merged by Bors] - post: update to latest version with inflight verification #4716

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 8 additions & 1 deletion activation/post.go
Original file line number Diff line number Diff line change
Expand Up @@ -317,20 +317,27 @@
)
events.EmitInitStart(mgr.id, mgr.commitmentAtxId)
err = mgr.init.Initialize(ctx)
events.EmitInitComplete(err != nil)

mgr.mu.Lock()
defer mgr.mu.Unlock()
var errLabelMismatch initialization.ErrReferenceLabelMismatch
switch {
case errors.Is(err, context.Canceled):
mgr.logger.Info("post setup session was stopped")
mgr.state = PostSetupStateStopped
return err
case errors.As(err, &errLabelMismatch):
mgr.logger.With().Error("post setup session failed due to an issue with the initialization provider", log.Err(errLabelMismatch))
mgr.state = PostSetupStateError
events.EmitInitFailure(mgr.id, mgr.commitmentAtxId, errLabelMismatch)
return nil

Check warning on line 333 in activation/post.go

View check run for this annotation

Codecov / codecov/patch

activation/post.go#L329-L333

Added lines #L329 - L333 were not covered by tests
fasmat marked this conversation as resolved.
Show resolved Hide resolved
case err != nil:
mgr.logger.With().Error("post setup session failed", log.Err(err))
mgr.state = PostSetupStateError
events.EmitInitFailure(mgr.id, mgr.commitmentAtxId, err)

Check warning on line 337 in activation/post.go

View check run for this annotation

Codecov / codecov/patch

activation/post.go#L337

Added line #L337 was not covered by tests
return err
}
events.EmitInitComplete()

mgr.logger.With().Info("post setup completed",
log.String("node_id", mgr.id.String()),
Expand Down
19 changes: 17 additions & 2 deletions events/events.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,26 @@
)
}

func EmitInitComplete(failure bool) {
func EmitInitFailure(smesher types.NodeID, commitment types.ATXID, err error) {
const help = "Node failed post data initialization."
emitUserEvent(
help,
true,
&pb.Event_InitFailed{
InitFailed: &pb.EventInitFailed{
Smesher: smesher[:],
Commitment: commitment[:],
Error: err.Error(),
},
},
)

Check warning on line 58 in events/events.go

View check run for this annotation

Codecov / codecov/patch

events/events.go#L46-L58

Added lines #L46 - L58 were not covered by tests
}

func EmitInitComplete() {
const help = "Node completed post data initialization."
emitUserEvent(
help,
failure,
false,
&pb.Event_InitComplete{
InitComplete: &pb.EventInitComplete{},
},
Expand Down
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,13 @@ require (
github.com/pyroscope-io/pyroscope v0.37.2
github.com/santhosh-tekuri/jsonschema/v5 v5.3.0
github.com/seehuhn/mt19937 v1.0.0
github.com/spacemeshos/api/release/go v1.16.0
github.com/spacemeshos/api/release/go v1.17.0
github.com/spacemeshos/economics v0.1.0
github.com/spacemeshos/fixed v0.1.0
github.com/spacemeshos/go-scale v1.1.10
github.com/spacemeshos/merkle-tree v0.2.2
github.com/spacemeshos/poet v0.8.6
github.com/spacemeshos/post v0.8.7
github.com/spacemeshos/post v0.8.8
github.com/spf13/afero v1.9.5
github.com/spf13/cobra v1.7.0
github.com/spf13/pflag v1.0.5
Expand Down
8 changes: 4 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -594,8 +594,8 @@ github.com/sirupsen/logrus v1.7.0/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic
github.com/sirupsen/logrus v1.8.1 h1:dJKuHgqk1NNQlqoA6BTlM1Wf9DOH3NBjQyu0h9+AZZE=
github.com/sourcegraph/annotate v0.0.0-20160123013949-f4cad6c6324d/go.mod h1:UdhH50NIW0fCiwBSr0co2m7BnFLdv4fQTgdqdJTHFeE=
github.com/sourcegraph/syntaxhighlight v0.0.0-20170531221838-bd320f5d308e/go.mod h1:HuIsMU8RRBOtsCgI77wP899iHVBQpCmg4ErYMZB+2IA=
github.com/spacemeshos/api/release/go v1.16.0 h1:DcRjnD+UBU4nx5TljxcPairHlI/wrbFX2VPUmWTarTs=
github.com/spacemeshos/api/release/go v1.16.0/go.mod h1:aSK7c2PUsle+EpC9VPAsPnsjKWDbo+NzT7kZgmzIZeM=
github.com/spacemeshos/api/release/go v1.17.0 h1:GZT2foJ619pYLYbNGWkat8QSFJnH1u2eOWw8AwSlz/g=
github.com/spacemeshos/api/release/go v1.17.0/go.mod h1:aSK7c2PUsle+EpC9VPAsPnsjKWDbo+NzT7kZgmzIZeM=
github.com/spacemeshos/economics v0.1.0 h1:PJAKbhBKqbbdCYTB29pkmc8sYqK3pKUAiuAvQxuSJEg=
github.com/spacemeshos/economics v0.1.0/go.mod h1:Bz0wRDwCOUP1A6w3cPW6iuUBGME8Tz48sIriYiohsBg=
github.com/spacemeshos/fixed v0.1.0 h1:20KIGvxLlAsuidQrvuwwHe6PrvqeTKzbJIsScbmnUPQ=
Expand All @@ -606,8 +606,8 @@ github.com/spacemeshos/merkle-tree v0.2.2 h1:+zF+17CwVebq9UzShunUBXv16rEVKIJHh2C
github.com/spacemeshos/merkle-tree v0.2.2/go.mod h1:0Q/z4S5Kt9qz/c3qWa7hKA1yT7n7odyysbPIUTRu/xo=
github.com/spacemeshos/poet v0.8.6 h1:jMQ9HkJeCRqUMRTIk0HEP/5kvVdAH+OAkzOKQ0XlhJU=
github.com/spacemeshos/poet v0.8.6/go.mod h1:Ut/aR/1Sks6/I/+GDFLqCinXW6OIIS8z9uL/zjFTTP8=
github.com/spacemeshos/post v0.8.7 h1:aqzAQ6FrPJhm6pgLtisFWKV5E6I3+LVnlbEJ+CDdzPM=
github.com/spacemeshos/post v0.8.7/go.mod h1:LDj6XQht1ZvTZurBJ+LZNf17t92qIQymWgU2sY6V2Zs=
github.com/spacemeshos/post v0.8.8 h1:bGKq7XDTJIPcX/oPP1KZ51p0JmLA7rIElJoqRSiBVv8=
github.com/spacemeshos/post v0.8.8/go.mod h1:LDj6XQht1ZvTZurBJ+LZNf17t92qIQymWgU2sY6V2Zs=
github.com/spacemeshos/sha256-simd v0.1.0 h1:G7Mfu5RYdQiuE+wu4ZyJ7I0TI74uqLhFnKblEnSpjYI=
github.com/spacemeshos/sha256-simd v0.1.0/go.mod h1:O8CClVIilId7RtuCMV2+YzMj6qjVn75JsxOxaE8vcfM=
github.com/spaolacci/murmur3 v1.1.0 h1:7c1g84S4BPRrfL5Xrdp6fOJ206sU9y293DDHaoy0bLI=
Expand Down