Skip to content

Commit

Permalink
unnecesary upgrade check
Browse files Browse the repository at this point in the history
  • Loading branch information
ermvrs committed Dec 15, 2024
1 parent cba19b6 commit 1060660
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/accounts/base.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ pub mod RosettaAccount {
use starknet::{
ContractAddress, EthAddress, ClassHash, get_contract_address, get_caller_address, get_tx_info
};
use starknet::syscalls::{call_contract_syscall, replace_class_syscall};
use starknet::syscalls::{call_contract_syscall, replace_class_syscall, get_class_hash_at_syscall};
use starknet::storage::{StoragePointerReadAccess, StoragePointerWriteAccess};
use rosettacontracts::accounts::utils::{is_valid_eth_signature, RosettanetSignature, RosettanetCall, RosettanetMulticall, prepare_multicall_context, validate_target_function, generate_tx_hash};
use crate::rosettanet::{IRosettanetDispatcher, IRosettanetDispatcherTrait};
Expand Down Expand Up @@ -83,6 +83,8 @@ pub mod RosettaAccount {
return self.execute_multicall(context);
} else if(selector == UPGRADE_SELECTOR) {
let latest_hash: ClassHash = IRosettanetDispatcher { contract_address: self.registry.read() }.latest_class();
let current_hash: ClassHash = get_class_hash_at_syscall(get_contract_address()).unwrap();
assert(current_hash != latest_hash, 'no new upgrades');
replace_class_syscall(latest_hash).unwrap();
return array![array![latest_hash.into()].span()];
} else {
Expand Down

0 comments on commit 1060660

Please sign in to comment.