-
Notifications
You must be signed in to change notification settings - Fork 47
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
chore: add small Peggy contract refactors #131
base: master
Are you sure you want to change the base?
Conversation
WalkthroughThe changes in the Changes
Poem
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
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.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
📒 Files selected for processing (1)
- solidity/contracts/Peggy.sol (2 hunks)
🧰 Additional context used
🔇 Additional comments (1)
solidity/contracts/Peggy.sol (1)
379-380
: Excellent refactoring for stack depth reduction and improved readability.The introduction of the
currentBatchNonce
local variable is a good optimization. It reduces repeated access to the state variablestate_lastBatchNonces[_tokenContract]
, which can save gas. Additionally, it improves code readability by giving a clear name to the value being used in the subsequent checks.The updated batch nonce checks using this new variable maintain the same logic while being consistent with the refactoring. This change doesn't alter the behavior of the function but makes it more efficient and easier to understand.
Also applies to: 383-383, 389-389
_batchNonce < | ||
state_lastBatchNonces[_tokenContract] + | ||
MAX_NONCE_JUMP_LIMIT, | ||
_batchNonce < currentBatchNonce + MAX_NONCE_JUMP_LIMIT, |
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.
is the comment correct?
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.
yes, why would it be wrong?
Summary by CodeRabbit
New Features
Bug Fixes
Refactor
submitBatch
function to improve readability and maintainability.