-
Notifications
You must be signed in to change notification settings - Fork 0
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
Nonce as Non-Replayable Submission Token #209
Nonce as Non-Replayable Submission Token #209
Conversation
2a9db50
to
67a2f63
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm, one suggestion on your missing revert that may or may not help
|
||
assertEq(counter.number(), 1); | ||
|
||
// Not sure why this revert isn't showing up-- it's reverting, nonetheless. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know this is crazy but is it because you didn't do new bytes[](0)
(inline in the call to execute on 264) above the expectRevert
?
I mean... the constructor execution succeeds, so I wonder if the expect revert accidentally targets this nested call.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nah, doesn't make it work. Though that change is probably for the better for clarity, so I moved that construction to a var above anyway, thanks.
dacc7de
to
c28c310
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. Good change that improves consistency
c28c310
to
6037dc0
Compare
Previously in `QuarkNonceManager`, we used `submissionToken=EXHAUSTED` for non-replayable submissions and `submissionToken=nonce` for the first play of replayable submissions. Overall, this behavior was inconsistent (though otherwise fine) and generally unobservable. With the addition of `getActiveSubmissionToken`, this behavior became obervable and showed its inconsistencies. This patch changes the defined behavior making it where we submit `submissionToken=nonce` for the first play or a single-use or replayable quark operation, but still retain the behavior that `submissions[nonce]=EXHAUSTED` for non-replayables. This ends up as a reduction in the overall code complexity. The only true behavior this changes is that we must (and should) ban `nonce=bytes32(0)` (and for the sake of consistency also `nonce=bytes32(uint_max)`). This is because we would be submitting with `submissionToken=FREE` for that nonce and overall it isn't worth the risk of allowing that (since it wouldn't, but _could_ lead to unlimited replays if other code isn't implemented correctly). Overall, I think this change is a net benefit in reduction of code complexity and better understandability from the end-user's perspective. Patches: * Add a test where we check what values a user can submit for submission tokens * Addressed some #205 comments
6037dc0
to
4c11215
Compare
Previously in
QuarkNonceManager
, we usedsubmissionToken=EXHAUSTED
for non-replayable submissions andsubmissionToken=nonce
for the first play of replayable submissions. Overall, this behavior was inconsistent (though otherwise fine) and generally unobservable. With the addition ofgetActiveSubmissionToken
, this behavior became obervable and showed its inconsistencies. This patch changes the defined behavior making it where we submitsubmissionToken=nonce
for the first play or a single-use or replayable quark operation, but still retain the behavior thatsubmissions[nonce]=EXHAUSTED
for non-replayables. This ends up as a reduction in the overall code complexity.The only true behavior this changes is that we must (and should) ban
nonce=bytes32(0)
(and for the sake of consistency alsononce=bytes32(uint_max)
). This is because we would be submitting withsubmissionToken=FREE
for that nonce and overall it isn't worth the risk of allowing that (since it wouldn't, but could lead to unlimited replays if other code isn't implemented correctly).Overall, I think this change is a net benefit in reduction of code complexity and better understandability from the end-user's perspective.