-
Notifications
You must be signed in to change notification settings - Fork 323
feat: account cairo1 helpers class upgrade #1105
Conversation
7b664cc
to
80a0c47
Compare
@@ -136,8 +140,27 @@ func __execute__{ | |||
let latest_class = AccountContract.get_latest_class(); |
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.
update the get_latest_class
to get_latest_classes
and return latest account class and latest helper class.
let pedersen_ptr = cast([ap - 1], HashBuiltin*); | ||
let range_check_ptr = [ap - 2]; | ||
let syscall_ptr = cast([ap - 3], felt*); |
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.
write in the order of the branches, ie ap-3
, ap-2
, ap-1
tests/end_to_end/test_account.py
Outdated
@@ -38,50 +72,57 @@ async def test_should_upgrade_outdated_account_on_transfer( | |||
new_account, | |||
other, | |||
class_hashes, | |||
cleanup, |
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.
use @pytest.mark.usefixture("cleanup")
instead of requesting it as an (unused) argument.
you can also define the fixture with @pytest.fixture(autouse=True)
if you want it to be used for all the tests
tests/end_to_end/test_account.py
Outdated
) | ||
|
||
|
||
async def assert_transfer_success(erc20_token, new_account, other): |
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.
maybe use the Counter.inc()
instead as this is not really minimal to illustrate the fact that the original tx is well processed even though we actually upgrade the classe
let (kakarot_address) = Ownable_owner.read(); | ||
let (this_cairo1helpers_class) = Account_cairo1_helpers_class_hash.read(); | ||
|
||
if (latest_cairo1helpers_class != this_cairo1helpers_class) { |
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.
what if we change the helper but not the account class? I think that they need to be in separate branches, and that overall the function can be simplified like
let (account_class, helpers_class) = AccountContract.get_latest_classes();
let (this_helpers_class) = Account_helpers_class_hash.read();
if (helpers_class != this_cairo1helpers_class) {
// Note this could be done in any cases but would cost a useless write
Account_cairo1_helpers_class_hash.write(latest_cairo1helpers_class);
}
// Do the call with the latest account class, possibly same class, works in all the cases
let (response_len, response) = IAccount.library_call___execute__(
class_hash=latest_account_class,
call_array_len=call_array_len,
call_array=call_array,
calldata_len=calldata_len,
calldata=calldata,
);
we don't need to actually store the implementation if we always call kakarot to actually check what is the implementation.
* add txpool_inspect * fix comment * fix clippy
Time spent on this PR: 0.5d
Pull request type
Please check the type of change your PR introduces:
What is the current behavior?
First step for #1095
What is the new behavior?
This change is