Skip to content
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

change constructor MCMS #536

Merged
merged 1 commit into from
Oct 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions contracts/src/mcms.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -284,12 +284,10 @@ mod ManyChainMultiSig {
}

#[constructor]
fn constructor(ref self: ContractState) {
let caller = starknet::info::get_caller_address();
self.ownable.initializer(caller);
fn constructor(ref self: ContractState, owner: ContractAddress) {
self.ownable.initializer(owner);
}


#[abi(embed_v0)]
impl ManyChainMultiSigImpl of super::IManyChainMultiSig<ContractState> {
fn set_root(
Expand Down
13 changes: 9 additions & 4 deletions contracts/src/tests/test_mcms/test_set_config.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -464,11 +464,13 @@ fn test_set_config_success_dont_clear_root() {

// mock the contract state
let test_address = test_address();
start_cheat_caller_address(test_address, contract_address_const::<777>());

let owner = contract_address_const::<1231231111>();
start_cheat_caller_address(test_address, owner);

// test internal function state
let mut state = contract_state_for_testing();
ManyChainMultiSig::constructor(ref state);
ManyChainMultiSig::constructor(ref state, owner);
state
.set_config(
signer_addresses.span(),
Expand Down Expand Up @@ -540,11 +542,14 @@ fn test_set_config_success_and_clear_root() {
// mock the contract state
let test_address = test_address();
let mock_chain_id = 990;
start_cheat_caller_address(test_address, contract_address_const::<777>());

let owner = contract_address_const::<1231231111>();
start_cheat_caller_address(test_address, owner);
start_cheat_chain_id(test_address, mock_chain_id);

let mut state = contract_state_for_testing();
ManyChainMultiSig::constructor(ref state);

ManyChainMultiSig::constructor(ref state, owner);

// initialize s_expiring_root_and_op_count & s_root_metadata
state
Expand Down
5 changes: 4 additions & 1 deletion contracts/src/tests/test_mcms/utils.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,10 @@ fn set_root_args(
fn setup_mcms_deploy() -> (
ContractAddress, IManyChainMultiSigDispatcher, IManyChainMultiSigSafeDispatcher
) {
let calldata = array![];
let owner = contract_address_const::<213123123>();
start_cheat_caller_address_global(owner);

let calldata = array![owner.into()];

let (mcms_address, _) = declare("ManyChainMultiSig").unwrap().deploy(@calldata).unwrap();

Expand Down
Loading