Skip to content

Commit ab2c1c6

Browse files
committed
address comments
1 parent 3b42f07 commit ab2c1c6

2 files changed

Lines changed: 17 additions & 34 deletions

File tree

crates/contract/src/api/foreign_chain_support.rs

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,8 @@ impl MpcContract {
2121
/// set); panics in [`NotInitialized`](ProtocolContractState::NotInitialized) or when the caller is not a participant. Entries for
2222
/// accounts that are no longer participants are pruned after resharing by
2323
/// [`Self::clean_foreign_chain_data`].
24-
#[deprecated(
25-
note = "superseded by register_foreign_chains_config; feeds only the legacy get_supported_foreign_chains view (https://github.com/near/mpc/issues/3434)"
26-
)]
24+
#[deprecated(note = "TODO(#3630): drop this. This is superseded by
25+
register_foreign_chains_config, and feeds only the legacy get_supported_foreign_chains")]
2726
#[handle_result]
2827
pub fn register_foreign_chain_support(
2928
&mut self,
@@ -114,7 +113,7 @@ impl MpcContract {
114113
}
115114

116115
#[deprecated(
117-
note = "https://github.com/near/mpc/issues/3079. Nodes register via register_foreign_chains_config instead"
116+
note = "TODO(#3630): drop this. Nodes register via register_foreign_chains_config instead"
118117
)]
119118
#[expect(deprecated)]
120119
#[handle_result]
@@ -243,7 +242,7 @@ impl MpcContract {
243242
}
244243

245244
#[deprecated(
246-
note = "superseded by get_available_foreign_chains, which gates verify_foreign_transaction (https://github.com/near/mpc/issues/3434)"
245+
note = "TODO(#3630): drop this. It's superseded by get_available_foreign_chains, which gates verify_foreign_transaction"
247246
)]
248247
pub fn get_supported_foreign_chains(&self) -> dtos::SupportedForeignChains {
249248
let active_participant_account_ids = self
@@ -289,9 +288,7 @@ impl MpcContract {
289288
.into()
290289
}
291290

292-
#[deprecated(
293-
note = "superseded by get_foreign_chains_configs (https://github.com/near/mpc/issues/3434)"
294-
)]
291+
#[deprecated(note = "TODO(#3630): drop this, it's deprecated.")]
295292
pub fn get_foreign_chain_support_by_node(&self) -> dtos::ForeignChainSupportByNode {
296293
self.node_foreign_chain_support.to_dto()
297294
}

crates/contract/tests/sandbox/common.rs

Lines changed: 12 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ use crate::sandbox::utils::{
88
},
99
shared_key_utils::{DomainKey, make_key_for_domain},
1010
sign_utils::{PendingSignRequest, make_and_submit_requests},
11-
transactions::CallMpcContract,
11+
transactions::{CallMpcContract, execute_async_handle_calls},
1212
};
1313
use digest::Digest;
1414
use dtos::ProtocolContractState;
@@ -676,38 +676,24 @@ pub async fn make_foreign_chain_available(
676676
"need at least {threshold} accounts to whitelist a chain, got {}",
677677
accounts.len()
678678
);
679-
let votes = accounts.iter().take(threshold).map(|account| {
679+
execute_async_handle_calls(&accounts[..threshold], contract, |handle| {
680680
let batch = batch.clone();
681-
async move {
682-
let result = account
683-
.call_mpc(contract.id())
684-
.vote_update_foreign_chain_providers(batch)
685-
.await
686-
.unwrap()
687-
.into_result();
688-
assert!(result.is_ok(), "whitelist vote should succeed: {result:?}");
689-
}
690-
});
691-
futures::future::join_all(votes).await;
681+
async move { handle.vote_update_foreign_chain_providers(batch).await }
682+
})
683+
.await
684+
.expect("whitelist vote should succeed");
692685

693-
let foreign_chains_config: dtos::ForeignChainsConfig = BTreeSet::from([chain]).into();
694-
let registrations = accounts.iter().map(|account| {
686+
execute_async_handle_calls(accounts, contract, |handle| {
687+
let foreign_chains_config: dtos::ForeignChainsConfig = BTreeSet::from([chain]).into();
695688
let foreign_chains_config = foreign_chains_config.clone();
696689
async move {
697-
let result = account
698-
.call_mpc(contract.id())
690+
handle
699691
.register_foreign_chains_config(foreign_chains_config)
700692
.await
701-
.unwrap()
702-
.into_result();
703-
assert!(
704-
result.is_ok(),
705-
"{} should succeed: {result:?}",
706-
method_names::REGISTER_FOREIGN_CHAINS_CONFIG
707-
);
708693
}
709-
});
710-
futures::future::join_all(registrations).await;
694+
})
695+
.await
696+
.expect("foreign chains config registration should succeed");
711697
}
712698

713699
/// Poll the contract until a pending foreign-tx request appears (or panic after timeout).

0 commit comments

Comments
 (0)