Skip to content

Commit

Permalink
compiles!
Browse files Browse the repository at this point in the history
  • Loading branch information
augustbleeds committed Sep 27, 2024
1 parent 3c6737f commit 7d95f7f
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 25 deletions.
2 changes: 1 addition & 1 deletion contracts/Scarb.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ alexandria_encoding = { git = "https://github.com/keep-starknet-strange/alexandr
snforge_std = { git = "https://github.com/foundry-rs/starknet-foundry.git", tag = "v0.28.0" }

[dev-dependencies]
alexandria_math = { git = "https://github.com/keep-starknet-strange/alexandria.git", rev = "bcdca70afdf59c9976148e95cebad5cf63d75a7f" }
alexandria_math = { git = "https://github.com/keep-starknet-strange/alexandria.git", rev = "e1b080577aaa6889116fc8be5dde72b2fd21e397" }

[lib]

Expand Down
7 changes: 2 additions & 5 deletions contracts/src/tests/test_mcms/test_set_config.cairo
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
use core::array::{SpanTrait, ArrayTrait};
use core::starknet::storage::{StoragePointerReadAccess, StoragePointerWriteAccess};
use starknet::{
ContractAddress, EthAddress, Felt252TryIntoEthAddress, EthAddressIntoFelt252,
EthAddressZeroable, contract_address_const
};
use chainlink::mcms::{
ExpiringRootAndOpCount, RootMetadata, Config, Signer, ManyChainMultiSig,
ManyChainMultiSig::{
InternalFunctionsTrait, contract_state_for_testing, s_signersContractMemberStateTrait,
s_expiring_root_and_op_countContractMemberStateTrait,
s_root_metadataContractMemberStateTrait
},
ManyChainMultiSig::{NewRoot, InternalFunctionsTrait, contract_state_for_testing},
IManyChainMultiSigDispatcher, IManyChainMultiSigDispatcherTrait,
IManyChainMultiSigSafeDispatcher, IManyChainMultiSigSafeDispatcherTrait, IManyChainMultiSig,
ManyChainMultiSig::{MAX_NUM_SIGNERS},
Expand Down
15 changes: 6 additions & 9 deletions contracts/src/tests/test_mcms/test_set_root.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,7 @@ use starknet::{
use chainlink::mcms::{
recover_eth_ecdsa, hash_pair, hash_op, hash_metadata, ExpiringRootAndOpCount, RootMetadata,
Config, Signer, eip_191_message_hash, ManyChainMultiSig, Op,
ManyChainMultiSig::{
NewRoot, InternalFunctionsTrait, contract_state_for_testing,
s_signersContractMemberStateTrait, s_expiring_root_and_op_countContractMemberStateTrait,
s_root_metadataContractMemberStateTrait
},
ManyChainMultiSig::{NewRoot, InternalFunctionsTrait, contract_state_for_testing},
IManyChainMultiSigDispatcher, IManyChainMultiSigDispatcherTrait,
IManyChainMultiSigSafeDispatcher, IManyChainMultiSigSafeDispatcherTrait, IManyChainMultiSig,
ManyChainMultiSig::{MAX_NUM_SIGNERS},
Expand All @@ -30,9 +26,10 @@ use chainlink::tests::test_mcms::utils::{
};

use snforge_std::{
declare, ContractClassTrait, start_cheat_caller_address_global, start_cheat_caller_address,
stop_cheat_caller_address, stop_cheat_caller_address_global, start_cheat_chain_id_global,
spy_events, EventSpyAssertionsTrait, // Add for assertions on the EventSpy
declare, ContractClassTrait, DeclareResultTrait, start_cheat_caller_address_global,
start_cheat_caller_address, stop_cheat_caller_address, stop_cheat_caller_address_global,
start_cheat_chain_id_global, spy_events,
EventSpyAssertionsTrait, // Add for assertions on the EventSpy
test_address, // the contract being tested,
start_cheat_chain_id,
cheatcodes::{events::{EventSpy}}, start_cheat_block_timestamp_global,
Expand Down Expand Up @@ -80,7 +77,7 @@ fn setup_mcms_deploy_set_config_and_set_root_WRONG_MULTISIG() -> (
);

let calldata = ArrayTrait::new();
let mock_target_contract = declare("MockMultisigTarget").unwrap();
let mock_target_contract = declare("MockMultisigTarget").unwrap().contract_class();
let (target_address, _) = mock_target_contract.deploy(@calldata).unwrap();

// mock chain id & timestamp
Expand Down
21 changes: 11 additions & 10 deletions contracts/src/tests/test_mcms/utils.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ use alexandria_encoding::sol_abi::encode::SolAbiEncodeTrait;
use alexandria_math::u512_arithmetics;
use core::math::{u256_mul_mod_n, u256_div_mod_n};
use core::zeroable::{IsZeroResult, NonZero, zero_based};
use core::starknet::storage::{StoragePointerReadAccess, StoragePointerWriteAccess};
use alexandria_math::u512_arithmetics::{u512_add, u512_sub, U512Intou256X2,};

use starknet::{
Expand All @@ -19,19 +20,15 @@ use starknet::{
use chainlink::mcms::{
recover_eth_ecdsa, hash_pair, hash_op, hash_metadata, ExpiringRootAndOpCount, RootMetadata,
Config, Signer, eip_191_message_hash, ManyChainMultiSig, Op,
ManyChainMultiSig::{
NewRoot, InternalFunctionsTrait, contract_state_for_testing,
s_signersContractMemberStateTrait, s_expiring_root_and_op_countContractMemberStateTrait,
s_root_metadataContractMemberStateTrait
},
ManyChainMultiSig::{NewRoot, InternalFunctionsTrait, contract_state_for_testing},
IManyChainMultiSigDispatcher, IManyChainMultiSigDispatcherTrait,
IManyChainMultiSigSafeDispatcher, IManyChainMultiSigSafeDispatcherTrait, IManyChainMultiSig,
ManyChainMultiSig::{MAX_NUM_SIGNERS},
};
use snforge_std::{
declare, ContractClassTrait, start_cheat_caller_address_global, start_cheat_caller_address,
stop_cheat_caller_address, stop_cheat_caller_address_global, spy_events,
EventSpyAssertionsTrait, // Add for assertions on the EventSpy
declare, ContractClassTrait, DeclareResultTrait, start_cheat_caller_address_global,
start_cheat_caller_address, stop_cheat_caller_address, stop_cheat_caller_address_global,
spy_events, EventSpyAssertionsTrait, // Add for assertions on the EventSpy
test_address, // the contract being tested,
start_cheat_chain_id, start_cheat_chain_id_global,
start_cheat_block_timestamp_global, cheatcodes::{events::{EventSpy}}
Expand Down Expand Up @@ -300,7 +297,11 @@ fn setup_mcms_deploy() -> (
) {
let calldata = array![];

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

(
mcms_address,
Expand Down Expand Up @@ -399,7 +400,7 @@ fn setup_mcms_deploy_set_config_and_set_root() -> (
);

let calldata = ArrayTrait::new();
let mock_target_contract = declare("MockMultisigTarget").unwrap();
let mock_target_contract = declare("MockMultisigTarget").unwrap().contract_class();
let (target_address, _) = mock_target_contract.deploy(@calldata).unwrap();

let (root, valid_until, metadata, metadata_proof, signatures, ops, ops_proof) = set_root_args(
Expand Down

0 comments on commit 7d95f7f

Please sign in to comment.