Skip to content

Commit

Permalink
Migrate eth account preset tests (#1060)
Browse files Browse the repository at this point in the history
* feat: update dual_eth_account tests

* feat: update eth_account tests

* refactor: remove unused helpers

* feat: update eth account preset tests

* Update src/tests/account/ethereum/test_eth_account.cairo

Co-authored-by: immrsd <[email protected]>

* Update src/tests/presets/test_eth_account.cairo

Co-authored-by: immrsd <[email protected]>

* feat: apply review updates

---------

Co-authored-by: immrsd <[email protected]>
  • Loading branch information
ericnordelo and immrsd authored Jul 23, 2024
1 parent ba8004c commit 9e091d4
Show file tree
Hide file tree
Showing 4 changed files with 160 additions and 144 deletions.
10 changes: 6 additions & 4 deletions src/tests/account/ethereum/test_eth_account.cairo
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
use core::starknet::SyscallResultTrait;
use openzeppelin::account::EthAccountComponent::{InternalTrait, SRC6CamelOnlyImpl};
use openzeppelin::account::EthAccountComponent::{PublicKeyCamelImpl, PublicKeyImpl};
use openzeppelin::account::EthAccountComponent;
Expand Down Expand Up @@ -236,8 +237,8 @@ fn test_execute_with_version(version: Option<felt252>) {
calls.append(call);

// Handle version for test
if version.is_some() {
cheat_transaction_version_global(version.unwrap());
if let Option::Some(version) = version {
cheat_transaction_version_global(version);
}

// Execute
Expand Down Expand Up @@ -449,10 +450,11 @@ fn test_public_key_setter_and_getter_camel() {
fn test_public_key_setter_different_account_camel() {
let mut state = COMPONENT_STATE();
let key_pair = KEY_PAIR();
let contract_address = test_address();

start_cheat_caller_address(test_address(), CALLER());
start_cheat_caller_address(contract_address, CALLER());

let signature = get_accept_ownership_signature(test_address(), ETH_PUBKEY(), key_pair);
let signature = get_accept_ownership_signature(contract_address, ETH_PUBKEY(), key_pair);
state.setPublicKey(key_pair.public_key, signature);
}

Expand Down
2 changes: 1 addition & 1 deletion src/tests/presets.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
mod test_erc1155;
mod test_erc20;
mod test_erc721;
// mod test_eth_account;
mod test_eth_account;
mod test_universal_deployer;
Loading

0 comments on commit 9e091d4

Please sign in to comment.