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] - Implement malfeasance2 info method for GRPC API #6566

Closed
wants to merge 11 commits into from
Prev Previous commit
Review feedback
  • Loading branch information
fasmat committed Jan 3, 2025
commit d18381bf8c2bc7e91b4ef0c08e8ddb88c0d2027e
2 changes: 1 addition & 1 deletion activation/handler_v1.go
Original file line number Diff line number Diff line change
Expand Up @@ -631,27 +631,27 @@
return types.BytesToHash(atx.NIPost.PostMetadata.Challenge), maps.Keys(filtered)
}

// Obtain the atxSignature of the given ATX.
// Obtain the signature of the given ATX.
func atxSignature(ctx context.Context, db sql.Executor, id types.ATXID) (types.EdSignature, error) {
var blob sql.Blob
v, err := atxs.LoadBlob(ctx, db, id.Bytes(), &blob)
if err != nil {
return types.EmptyEdSignature, err
}

Check warning on line 640 in activation/handler_v1.go

View check run for this annotation

Codecov / codecov/patch

activation/handler_v1.go#L639-L640

Added lines #L639 - L640 were not covered by tests

if len(blob.Bytes) == 0 {
// An empty blob indicates a golden ATX (after a checkpoint-recovery).
return types.EmptyEdSignature, fmt.Errorf("can't get signature for a golden (checkpointed) ATX: %s", id)
}

Check warning on line 645 in activation/handler_v1.go

View check run for this annotation

Codecov / codecov/patch

activation/handler_v1.go#L643-L645

Added lines #L643 - L645 were not covered by tests

switch v {
case types.AtxV1:
var atx wire.ActivationTxV1
if err := codec.Decode(blob.Bytes, &atx); err != nil {
return types.EmptyEdSignature, fmt.Errorf("decoding atx v1: %w", err)
}

Check warning on line 652 in activation/handler_v1.go

View check run for this annotation

Codecov / codecov/patch

activation/handler_v1.go#L651-L652

Added lines #L651 - L652 were not covered by tests
return atx.Signature, nil
default: // only needed for V1 ATXs
return types.EmptyEdSignature, fmt.Errorf("unsupported ATX version: %v", v)

Check warning on line 655 in activation/handler_v1.go

View check run for this annotation

Codecov / codecov/patch

activation/handler_v1.go#L654-L655

Added lines #L654 - L655 were not covered by tests
}
}
2 changes: 1 addition & 1 deletion hare3/hare.go
Original file line number Diff line number Diff line change
Expand Up @@ -472,7 +472,7 @@ func (h *Hare) run(session *session) error {
if err := h.onOutput(session, current, out); err != nil {
return err
}
// we are logginng stats 1 network delay after new iteration start
// we are logging stats 1 network delay after new iteration start
// so that we can receive notify messages from previous iteration
if session.proto.Round == softlock && h.config.LogStats {
h.log.Debug("stats", zap.Uint32("lid", session.lid.Uint32()), zap.Inline(session.proto.Stats()))
Expand Down
2 changes: 1 addition & 1 deletion hare4/hare.go
Original file line number Diff line number Diff line change
Expand Up @@ -684,7 +684,7 @@ func (h *Hare) run(session *session) error {
if err := h.onOutput(session, current, out); err != nil {
return err
}
// we are logginng stats 1 network delay after new iteration start
// we are logging stats 1 network delay after new iteration start
// so that we can receive notify messages from previous iteration
if session.proto.Round == softlock && h.config.LogStats {
h.log.Info("stats", zap.Uint32("lid", session.lid.Uint32()), zap.Inline(session.proto.Stats()))
Expand Down
4 changes: 2 additions & 2 deletions sql/malfeasance/malfeasance.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,8 @@
return err
}

// Proof returns the malfeasance proof for the given node ID. Returns sql.ErrNotFound if no proof for the given node ID
// exists. To return a proof for a marriage set use MarriageProof instead.
// NodeIDProof returns the malfeasance proof and its domain for the given node ID. Returns sql.ErrNotFound if no proof
// for the given node ID exists. To return a proof for a marriage set use MarriageProof instead.
func NodeIDProof(db sql.Executor, nodeID types.NodeID) ([]byte, int, error) {
var (
proof []byte
Expand All @@ -116,8 +116,8 @@
return false
})
if err != nil {
return nil, 0, fmt.Errorf("proof %v: %w", nodeID, err)
}

Check warning on line 120 in sql/malfeasance/malfeasance.go

View check run for this annotation

Codecov / codecov/patch

sql/malfeasance/malfeasance.go#L119-L120

Added lines #L119 - L120 were not covered by tests
if rows == 0 {
return nil, 0, sql.ErrNotFound
}
Expand All @@ -144,8 +144,8 @@
return false
})
if err != nil {
return nil, 0, fmt.Errorf("marriage proof %v: %w", marriageID, err)
}

Check warning on line 148 in sql/malfeasance/malfeasance.go

View check run for this annotation

Codecov / codecov/patch

sql/malfeasance/malfeasance.go#L147-L148

Added lines #L147 - L148 were not covered by tests
if rows == 0 {
return nil, 0, sql.ErrNotFound
}
Expand Down
Loading