Skip to content

Commit

Permalink
test set_config not owner
Browse files Browse the repository at this point in the history
  • Loading branch information
augustbleeds committed Sep 16, 2024
1 parent a0bb873 commit f4a1646
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 1 deletion.
1 change: 0 additions & 1 deletion contracts/src/mcms.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -453,7 +453,6 @@ mod ManyChainMultiSig {
);
}

// todo: test not onlyOwner
fn set_config(
ref self: ContractState,
signer_addresses: Span<EthAddress>,
Expand Down
31 changes: 31 additions & 0 deletions contracts/src/tests/test_mcms/test_set_config.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,37 @@ fn setup() -> (ContractAddress, IManyChainMultiSigDispatcher, IManyChainMultiSig
)
}

#[test]
#[feature("safe_dispatcher")]
fn test_not_owner() {
let (_, _, mcms_safe) = setup();

let signer_addresses = array![];
let signer_groups = array![];
let group_quorums = array![];
let group_parents = array![];
let clear_root = false;

// so that caller is not owner
start_cheat_caller_address_global(contract_address_const::<123123>());

let result = mcms_safe
.set_config(
signer_addresses.span(),
signer_groups.span(),
group_quorums.span(),
group_parents.span(),
clear_root
);

match result {
Result::Ok(_) => panic!("expect 'Caller is not the owner'"),
Result::Err(panic_data) => {
assert(*panic_data.at(0) == 'Caller is not the owner', *panic_data.at(0));
}
}
}

#[test]
#[feature("safe_dispatcher")]
fn test_set_config_out_of_bound_signers() {
Expand Down

0 comments on commit f4a1646

Please sign in to comment.