-
Notifications
You must be signed in to change notification settings - Fork 32
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
MixBytes: add user op max cost setter #58
Conversation
Slither reportTHIS CHECKLIST IS NOT COMPLETE. Use |
0aaf9e1
to
ded38b9
Compare
|
||
uint256 public constant RATE_LIMIT_PERIOD = 1 minutes; | ||
uint256 public constant RATE_LIMIT_THRESHOLD_TOTAL = 50; | ||
|
||
uint256 public userOpMaxCost; |
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 would set the initial value here because sponsor paymaster is already initialized so the initializer is not going to be called
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.
we can't do that when using UUPS...
https://docs.openzeppelin.com/upgrades-plugins/1.x/writing-upgradeable#avoid-initial-values-in-field-declarations
but it's true that the initialize
won't be called again, i think we have 2 options here:
- create a new initialise fn: e.g
initializeV2
which only initializes this variable - or just make sure that we call the
setUserOpMaxCost
and the migration.
thoughts?
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.
also, this is interesting. when upgrading a contract:
- you cannot change the order in which the contract state variables are declared
- you cannot change the type of a variable
- you cannot change the type of a variable
- you cannot introduce a new variable before existing ones
- you cannot remove an existing variable
If you need to introduce a new variable, make sure you always do so at the end:
we may need to re-visit our last changes on the contracts and maybe revert the changes (if there are) and re-deploy? or maybe not? they've been working fine...
we should ideally also make sure that all tests run locally but also on mainnet fork (on the deployed contracts)
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, I have been taking care to follow this. It is what we did at Babylon. Always add at the end
you cannot change the order in which the contract state variables are declared
you cannot change the type of a variable
you cannot introduce a new variable before existing ones
you cannot remove an existing variable
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.
One comment about initialization. Otherwise, lgtm
ba2a561
to
d62f346
Compare
d62f346
to
ebd6fb8
Compare
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## main #58 +/- ##
==========================================
+ Coverage 93.82% 94.34% +0.52%
==========================================
Files 8 8
Lines 437 442 +5
Branches 121 122 +1
==========================================
+ Hits 410 417 +7
Misses 2 2
+ Partials 25 23 -2
|
As per MixBytes recommendation, adds a
userOpMaxCost
setter.Also adds some polishes.