Skip to content

Commit

Permalink
fix: format code
Browse files Browse the repository at this point in the history
  • Loading branch information
JordyRo1 committed Jul 4, 2024
1 parent 8f44ccc commit 6317c2d
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 27 deletions.
2 changes: 1 addition & 1 deletion contracts/src/tests/isms/test_aggregation.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ use hyperlane_starknet::tests::setup::{
DESTINATION_DOMAIN, build_messageid_metadata, VALID_OWNER, VALID_RECIPIENT, setup_noop_ism,
MODULES, CONTRACT_MODULES
};
use hyperlane_starknet::utils::utils::U256TryIntoContractAddress;

use openzeppelin::access::ownable::OwnableComponent;
use openzeppelin::access::ownable::interface::{IOwnableDispatcher, IOwnableDispatcherTrait};
use snforge_std::{start_prank, CheatTarget};
use hyperlane_starknet::utils::utils::U256TryIntoContractAddress;
use starknet::ContractAddress;

#[test]
Expand Down
5 changes: 2 additions & 3 deletions contracts/src/tests/isms/test_default_ism.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,9 @@ use hyperlane_starknet::tests::setup::{
setup_trusted_relayer_ism, setup_noop_ism, setup_pausable_ism, mock_setup, DESTINATION_DOMAIN,
OWNER, LOCAL_DOMAIN, DESTINATION_MAILBOX
};
use hyperlane_starknet::utils::utils::U256TryIntoContractAddress;
use openzeppelin::access::ownable::interface::{IOwnableDispatcher, IOwnableDispatcherTrait};
use snforge_std::{start_prank, CheatTarget};
use hyperlane_starknet::utils::utils::U256TryIntoContractAddress;



#[test]
Expand All @@ -38,7 +37,7 @@ fn test_verify_trusted_relayer_ism() {
0x01020304050607080910111213141516,
0x01020304050607080910000000000000
];
let recipient : felt252 = mock_recipient.contract_address.into();
let recipient: felt252 = mock_recipient.contract_address.into();
let message_body = BytesTrait::new(42, array);
let message = Message {
version: HYPERLANE_VERSION,
Expand Down
4 changes: 2 additions & 2 deletions contracts/src/tests/isms/test_merkleroot_multisig.cairo
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use core::option::OptionTrait;
use alexandria_bytes::{Bytes, BytesTrait};
use core::array::ArrayTrait;
use core::array::SpanTrait;
use core::option::OptionTrait;
use hyperlane_starknet::contracts::libs::message::{Message, MessageTrait, HYPERLANE_VERSION};
use hyperlane_starknet::contracts::libs::multisig::merkleroot_ism_metadata::merkleroot_ism_metadata::MerkleRootIsmMetadata;
use hyperlane_starknet::interfaces::IMessageRecipientDispatcherTrait;
Expand All @@ -15,11 +15,11 @@ use hyperlane_starknet::tests::setup::{
get_merkle_message_and_signature, LOCAL_DOMAIN, DESTINATION_DOMAIN, TEST_PROOF,
build_merkle_metadata, VALID_OWNER, VALID_RECIPIENT, build_fake_merkle_metadata
};
use hyperlane_starknet::utils::utils::U256TryIntoContractAddress;
use openzeppelin::access::ownable::OwnableComponent;
use openzeppelin::access::ownable::interface::{IOwnableDispatcher, IOwnableDispatcherTrait};
use snforge_std::cheatcodes::events::EventAssertions;
use snforge_std::{start_prank, CheatTarget};
use hyperlane_starknet::utils::utils::U256TryIntoContractAddress;


#[test]
Expand Down
2 changes: 1 addition & 1 deletion contracts/src/tests/isms/test_messageid_multisig.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ use hyperlane_starknet::tests::setup::{
get_message_and_signature, LOCAL_DOMAIN, DESTINATION_DOMAIN, RECIPIENT_ADDRESS,
build_messageid_metadata, VALID_OWNER, VALID_RECIPIENT, build_fake_messageid_metadata
};
use hyperlane_starknet::utils::utils::U256TryIntoContractAddress;
use openzeppelin::access::ownable::OwnableComponent;
use openzeppelin::access::ownable::interface::{IOwnableDispatcher, IOwnableDispatcherTrait};
use snforge_std::cheatcodes::events::EventAssertions;
use snforge_std::{start_prank, CheatTarget};
use hyperlane_starknet::utils::utils::U256TryIntoContractAddress;


#[test]
Expand Down
30 changes: 17 additions & 13 deletions contracts/src/tests/setup.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -168,14 +168,13 @@ pub fn setup_mailbox(
let mock_ism = setup_mock_ism();
setup_mock_token();
let params: Array<felt252> = array![
domain.into(), OWNER().try_into().unwrap(), mock_ism.contract_address.into(), default_hook.into(), required_hook.into()
domain.into(),
OWNER().try_into().unwrap(),
mock_ism.contract_address.into(),
default_hook.into(),
required_hook.into()
];
mailbox_class
.deploy_at(
@params,
mailbox_address
)
.unwrap();
mailbox_class.deploy_at(@params, mailbox_address).unwrap();
let mut spy = spy_events(SpyOn::One(mailbox_address));
(
IMailboxDispatcher { contract_address: mailbox_address },
Expand Down Expand Up @@ -238,9 +237,10 @@ pub fn setup_merkleroot_multisig_ism(
pub fn setup_mailbox_client() -> IMailboxClientDispatcher {
let (mailbox, _, _, _) = setup_mailbox(MAILBOX(), Option::None, Option::None);
let mailboxclient_class = declare("mailboxclient").unwrap();
let params: Array<felt252> = array![mailbox.contract_address.into(), OWNER().try_into().unwrap()];
let res = mailboxclient_class
.deploy_at(@params, MAILBOX_CLIENT());
let params: Array<felt252> = array![
mailbox.contract_address.into(), OWNER().try_into().unwrap()
];
let res = mailboxclient_class.deploy_at(@params, MAILBOX_CLIENT());
if (res.is_err()) {
panic(res.unwrap_err());
}
Expand Down Expand Up @@ -268,7 +268,9 @@ pub fn setup_domain_routing_ism() -> (
IInterchainSecurityModuleDispatcher, IRoutingIsmDispatcher, IDomainRoutingIsmDispatcher
) {
let domain_routing_ism = declare("domain_routing_ism").unwrap();
let (domain_routing_ism_addr, _) = domain_routing_ism.deploy(@array![OWNER().try_into().unwrap()]).unwrap();
let (domain_routing_ism_addr, _) = domain_routing_ism
.deploy(@array![OWNER().try_into().unwrap()])
.unwrap();
(
IInterchainSecurityModuleDispatcher { contract_address: domain_routing_ism_addr },
IRoutingIsmDispatcher { contract_address: domain_routing_ism_addr },
Expand Down Expand Up @@ -299,7 +301,7 @@ pub fn setup_mock_validator_announce(
pub fn setup_aggregation(modules: Span<felt252>) -> IAggregationDispatcher {
let aggregation_class = declare("aggregation").unwrap();
let mut parameters = Default::default();
let owner : felt252 = OWNER().try_into().unwrap();
let owner: felt252 = OWNER().try_into().unwrap();
Serde::serialize(@owner, ref parameters);
Serde::serialize(@modules, ref parameters);
let (aggregation_addr, _) = aggregation_class.deploy(@parameters).unwrap();
Expand Down Expand Up @@ -549,7 +551,9 @@ pub fn setup_mock_token() -> ERC20ABIDispatcher {
let fee_token_class = declare("mock_fee_token").unwrap();
let (fee_token_addr, _) = fee_token_class
.deploy_at(
@array![INITIAL_SUPPLY.low.into(), INITIAL_SUPPLY.high.into(), OWNER().try_into().unwrap()],
@array![
INITIAL_SUPPLY.low.into(), INITIAL_SUPPLY.high.into(), OWNER().try_into().unwrap()
],
ETH_ADDRESS()
)
.unwrap();
Expand Down
12 changes: 5 additions & 7 deletions contracts/src/tests/test_mailbox.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ use hyperlane_starknet::tests::setup::{
DESTINATION_MAILBOX, setup_protocol_fee, setup_mock_hook, PROTOCOL_FEE, INITIAL_SUPPLY,
setup_mock_fee_hook
};
use openzeppelin::access::ownable::OwnableComponent;
use hyperlane_starknet::utils::utils::U256TryIntoContractAddress;
use openzeppelin::access::ownable::OwnableComponent;
use openzeppelin::access::ownable::interface::{IOwnableDispatcher, IOwnableDispatcherTrait};
use openzeppelin::token::erc20::interface::{ERC20ABI, ERC20ABIDispatcher, ERC20ABIDispatcherTrait};
use snforge_std::cheatcodes::events::EventAssertions;
Expand All @@ -38,7 +38,7 @@ fn test_transfer_ownership() {
start_prank(CheatTarget::One(ownable.contract_address), OWNER().try_into().unwrap());
ownable.transfer_ownership(NEW_OWNER().try_into().unwrap());
stop_prank(CheatTarget::One(ownable.contract_address));
let owner : felt252 = ownable.owner().into();
let owner: felt252 = ownable.owner().into();
assert(owner == NEW_OWNER().try_into().unwrap(), 'Failed transfer ownership');

let expected_event = OwnableComponent::OwnershipTransferred {
Expand Down Expand Up @@ -443,7 +443,7 @@ fn test_process() {
];

let message_body = BytesTrait::new(42, array);
let recipient : felt252 = mock_recipient.contract_address.into();
let recipient: felt252 = mock_recipient.contract_address.into();
let message = Message {
version: HYPERLANE_VERSION,
nonce: 0,
Expand All @@ -457,9 +457,7 @@ fn test_process() {
let metadata = message_body;
mailbox.process(metadata.clone(), message);
let expected_event = mailbox::Event::Process(
mailbox::Process {
origin: LOCAL_DOMAIN, sender: OWNER(), recipient: recipient.into(),
}
mailbox::Process { origin: LOCAL_DOMAIN, sender: OWNER(), recipient: recipient.into(), }
);
let expected_event_id = mailbox::Event::ProcessId(mailbox::ProcessId { id: message_id });

Expand Down Expand Up @@ -494,7 +492,7 @@ fn test_process_fails_if_version_mismatch() {
];

let message_body = BytesTrait::new(42, array);
let recipient : felt252= mock_recipient.contract_address.into();
let recipient: felt252 = mock_recipient.contract_address.into();
let message = Message {
version: HYPERLANE_VERSION + 1,
nonce: 0,
Expand Down

0 comments on commit 6317c2d

Please sign in to comment.