-
Notifications
You must be signed in to change notification settings - Fork 365
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
refactor(batcher): add user state & other code quality refactors #1106
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
uri-99
requested changes
Oct 1, 2024
… checking its size
IAvecilla
approved these changes
Oct 1, 2024
uri-99
approved these changes
Oct 1, 2024
Oppen
reviewed
Oct 1, 2024
Oppen
reviewed
Oct 1, 2024
Oppen
approved these changes
Oct 2, 2024
This was referenced Oct 3, 2024
PatStiles
pushed a commit
that referenced
this pull request
Oct 7, 2024
Co-authored-by: Urix <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR refactors the batcher codebase, hopefully making it more readable.
A
UserState
struct has been created to handle the cached state of each user who sent some proof to the batch, with the information about its nonce, the number of proofs in the batch, and the minimum fee of all the proofs that it has submitted and are currently in the batch.The
handle_message
function has been refactored to be more clear in its steps:Since the batch queue and the user state are updated at the same time, this should get rid of the vulnerability highlited by Least Authority in issue #1081.
Testing
Test that everything works as expected, try sending proofs with both paying and nonpaying addresses. Everything should work as expected.
NOTE: Since there were a lot of changes, it could be useful for reviewing to check the whole
handle_message
function and try to understand each step, which should be clearer now, and validate that it makes sense. Give it special attention since is where the most changes have been done