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

Signature aggregation API fixes for small items #393

Merged

Conversation

feuGeneA
Copy link
Contributor

Why this should be merged

Because it fixes #381

How this was tested

With the tests in the code base

feuGeneA added 6 commits July 30, 2024 17:40
before this, it was being rendered as:

INFO [07-29|19:29:09.151] Starting the signature aggregator with config at :%s /home/gene/tmp/signature-aggregator-config.json61842304=<nil> LOG_ERROR="Normalized odd number of arguments by adding nil"
"Starting the signature-aggregator executable" message already exists
elsewhere. This differentiates this log entry from that one.
and other error handling cleanup
@feuGeneA feuGeneA force-pushed the signature-aggregation-api-issue-381 branch from 03c78ac to 079ff03 Compare July 30, 2024 17:42
@feuGeneA feuGeneA marked this pull request as ready for review July 30, 2024 19:44
@feuGeneA feuGeneA requested a review from a team as a code owner July 30, 2024 19:44
} else if *req.QuorumNum >= 0 || *req.QuorumNum > 100 {
logger.Warn("Invalid quorum number", zap.Uint64("quorum-num", *req.QuorumNum))
http.Error(w, "invalid quorum number", http.StatusBadRequest)
} else if req.QuorumNum >= 0 || req.QuorumNum > 100 {
Copy link
Contributor

Choose a reason for hiding this comment

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

This was my initial mistake but this if statement is wrong and will return true for any QuorumNum supplied since any uint is >=0. It was originally meant to be <=0 but this is uint64 so that shouldn't be possible. Additionally since it's defined as 0-100 we should be safe to use uint8 here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

addressed in da09584

} else if *req.QuorumNum >= 0 || *req.QuorumNum > 100 {
logger.Warn("Invalid quorum number", zap.Uint64("quorum-num", *req.QuorumNum))
http.Error(w, "invalid quorum number", http.StatusBadRequest)
} else if req.QuorumNum >= 0 || req.QuorumNum > 100 {
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
} else if req.QuorumNum >= 0 || req.QuorumNum > 100 {
} else if req.QuorumNum <= 0 || req.QuorumNum > 100 {

Copy link
Contributor

Choose a reason for hiding this comment

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

The first portion shouldn't be necessary since it's uint right now either

my suggestion would be

Suggested change
} else if req.QuorumNum >= 0 || req.QuorumNum > 100 {
} else if req.QuorumNum > 100 {

Copy link
Contributor Author

Choose a reason for hiding this comment

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

addressed in da09584

Comment on lines 117 to 119
} else {
quorumNum = *req.QuorumNum
quorumNum = req.QuorumNum
}
Copy link
Contributor

Choose a reason for hiding this comment

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

else isn't needed here if the if returns early

Copy link
Contributor Author

Choose a reason for hiding this comment

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

addressed in addressed in da09584

Comment on lines -43 to +45
QuorumNum *uint64 `json:"quorum-num"`
QuorumNum uint64 `json:"quorum-num"`
Copy link
Contributor

@geoff-vball geoff-vball Jul 30, 2024

Choose a reason for hiding this comment

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

Does the code still default to 67 if omitted now? (I would assume this is if we supplied 0)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes the default is applied in that quorum check if we were discussing elsewhere here.

addresses review comments #393 (comment)
and #393 (comment)

i went ahead and just removed the `>=0` case (which, as discussed, should
really be `<=0`) since we're already checking `==0` in the previous branch, and
since it can't be `<0` since it's an unsigned value.
@feuGeneA feuGeneA requested review from iansuvak and geoff-vball July 30, 2024 21:30
@iansuvak iansuvak merged commit 15045f0 into signature-aggregation-api Jul 31, 2024
7 checks passed
@iansuvak iansuvak deleted the signature-aggregation-api-issue-381 branch July 31, 2024 13:56
@meaghanfitzgerald meaghanfitzgerald added the Warp Signature API API service for serving arbitrary Warp signatures from any VM label Aug 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Warp Signature API API service for serving arbitrary Warp signatures from any VM
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants