-
Notifications
You must be signed in to change notification settings - Fork 329
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
Add upgrade_and_call #1148
base: main
Are you sure you want to change the base?
Add upgrade_and_call #1148
Conversation
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.
Looking good Andrew. Left some comments.
|
||
Replaces the contract's class hash with `new_class_hash` and then calls `selector` | ||
from the upgraded context. | ||
|
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 add a note mentioning that should be kept in mind that the call is executed from the upgraded contract itself, and not the calling account, since they may have some implications in the setup.
Also, another note that could be helpful is that with native account abstraction, and multicall being part of SNIP6, this behavior could be achieved by using just upgraded and putting the extra call in the second element of the list of calls. Then the call would be executed from the account itself, and can't be front-runned.
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.
Done!
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.
Good job, Andrew!
I've left a couple of comments
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #1148 +/- ##
==========================================
+ Coverage 88.87% 88.90% +0.03%
==========================================
Files 57 57
Lines 1375 1379 +4
==========================================
+ Hits 1222 1226 +4
Misses 153 153
Continue to review full report in Codecov by Sentry.
|
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.
Left a couple of minor suggestions. Apart from that, I think we are ready to go
} | ||
|
||
#[test] | ||
#[ignore] // REASON: |
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.
Let's not forget to add a reason or un-ignore the test
Co-authored-by: immrsd <[email protected]>
Fixes #694.
This PR proposes to add
upgrade_and_call
to UpgradeableComponent's InternalImpl. This PR also proposes to addIUpgradeAndCall
interface which includes bothupgrade
andupgrade_and_call
.PR Checklist