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] - Add "until" field to PoetWaitRound, PoetWaitProof, AtxPublished events #5425

Closed
wants to merge 1 commit 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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions activation/activation.go
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,7 @@ func (b *Builder) buildNIPostChallenge(ctx context.Context) (*types.NIPostChalle
zap.Uint32("current epoch", current.Uint32()),
zap.Duration("wait", time.Until(wait)),
)
events.EmitPoetWaitRound(current, current+1, time.Until(wait))
events.EmitPoetWaitRound(current, current+1, wait)
select {
case <-ctx.Done():
return nil, ctx.Err()
Expand Down Expand Up @@ -504,7 +504,7 @@ func (b *Builder) PublishActivationTx(ctx context.Context) error {
events.EmitAtxPublished(
atx.PublishEpoch, atx.TargetEpoch(),
atx.ID(),
time.Until(b.layerClock.LayerToTime(atx.TargetEpoch().FirstLayer())),
b.layerClock.LayerToTime(atx.TargetEpoch().FirstLayer()),
)
return nil
}
Expand Down
2 changes: 1 addition & 1 deletion activation/nipost.go
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ func (nb *NIPostBuilder) BuildNIPost(
)
}

events.EmitPoetWaitProof(challenge.PublishEpoch, challenge.TargetEpoch(), time.Until(poetRoundEnd))
events.EmitPoetWaitProof(challenge.PublishEpoch, challenge.TargetEpoch(), poetRoundEnd)
poetProofRef, membership, err = nb.getBestProof(ctx, challenge.Hash(), challenge.PublishEpoch)
if err != nil {
return nil, &PoetSvcUnstableError{msg: "getBestProof failed", source: err}
Expand Down
15 changes: 9 additions & 6 deletions events/events.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ func EmitInitComplete() {
)
}

func EmitPoetWaitRound(current, publish types.EpochID, wait time.Duration) {
func EmitPoetWaitRound(current, publish types.EpochID, wait time.Time) {
const help = "Node is waiting for PoET registration window in current epoch to open. " +
"After this it will submit challenge and wait until PoET round ends in publish epoch."
emitUserEvent(
Expand All @@ -79,7 +79,8 @@ func EmitPoetWaitRound(current, publish types.EpochID, wait time.Duration) {
&pb.Event_PoetWaitRound{PoetWaitRound: &pb.EventPoetWaitRound{
Current: current.Uint32(),
Publish: publish.Uint32(),
Wait: durationpb.New(wait),
Wait: durationpb.New(time.Until(wait)),
Until: timestamppb.New(wait),
}},
)
}
Expand All @@ -90,7 +91,7 @@ type EventPoetWaitEnd struct {
Wait time.Duration `json:"wait"`
}

func EmitPoetWaitProof(publish, target types.EpochID, wait time.Duration) {
func EmitPoetWaitProof(publish, target types.EpochID, wait time.Time) {
const help = "Node is waiting for PoET to complete. " +
"After it's complete, the node will fetch the PoET proof, generate a PoST proof, " +
"and finally publish an ATX to establish eligibility for rewards in the target epoch."
Expand All @@ -101,7 +102,8 @@ func EmitPoetWaitProof(publish, target types.EpochID, wait time.Duration) {
PoetWaitProof: &pb.EventPoetWaitProof{
Publish: publish.Uint32(),
Target: target.Uint32(),
Wait: durationpb.New(wait),
Wait: durationpb.New(time.Until(wait)),
Until: timestamppb.New(wait),
},
},
)
Expand Down Expand Up @@ -164,7 +166,7 @@ func EmitInvalidPostProof() {
func EmitAtxPublished(
current, target types.EpochID,
id types.ATXID,
wait time.Duration,
wait time.Time,
) {
const help = "Node published activation for the current epoch. " +
"It now needs to wait until the target epoch when it will be eligible for rewards."
Expand All @@ -176,7 +178,8 @@ func EmitAtxPublished(
Current: current.Uint32(),
Target: target.Uint32(),
Id: id[:],
Wait: durationpb.New(wait),
Wait: durationpb.New(time.Until(wait)),
Until: timestamppb.New(wait),
},
},
)
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ require (
github.com/quic-go/quic-go v0.41.0
github.com/santhosh-tekuri/jsonschema/v5 v5.3.1
github.com/seehuhn/mt19937 v1.0.0
github.com/spacemeshos/api/release/go v1.25.0
github.com/spacemeshos/api/release/go v1.26.0
github.com/spacemeshos/economics v0.1.2
github.com/spacemeshos/fixed v0.1.1
github.com/spacemeshos/go-scale v1.1.12
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -616,8 +616,8 @@ github.com/sourcegraph/annotate v0.0.0-20160123013949-f4cad6c6324d/go.mod h1:Udh
github.com/sourcegraph/conc v0.3.0 h1:OQTbbt6P72L20UqAkXXuLOj79LfEanQ+YQFNpLA9ySo=
github.com/sourcegraph/conc v0.3.0/go.mod h1:Sdozi7LEKbFPqYX2/J+iBAM6HpqSLTASQIKqDmF7Mt0=
github.com/sourcegraph/syntaxhighlight v0.0.0-20170531221838-bd320f5d308e/go.mod h1:HuIsMU8RRBOtsCgI77wP899iHVBQpCmg4ErYMZB+2IA=
github.com/spacemeshos/api/release/go v1.25.0 h1:HqIykavooxUxZySiN7yiILRX+Kx6WxM1NF6w72PNmMc=
github.com/spacemeshos/api/release/go v1.25.0/go.mod h1:Ffvt8Zl5K6k0In0OF7PUJ2JoxrW8zBRXKF1kG0abigg=
github.com/spacemeshos/api/release/go v1.26.0 h1:wop4OoID/2o8BEwNP/wypCIy//CDTnv14perIZo0WOU=
github.com/spacemeshos/api/release/go v1.26.0/go.mod h1:cQXfRiIRPc8c6bh9+VAK/GwD0zYCu7jKcos/cPaDYcI=
github.com/spacemeshos/economics v0.1.2 h1:kw8cE5SMa/7svHOGorCd2w8ef1y8iP0p47/2VDOK8Ns=
github.com/spacemeshos/economics v0.1.2/go.mod h1:ngeWn5E/jy9dJP1MHyuk3ehF8NBMTYhchqVDhAHUUNk=
github.com/spacemeshos/fixed v0.1.1 h1:N1y4SUpq1EV+IdJrWJwUCt1oBFzeru/VKVcBsvPc2Fk=
Expand Down