Skip to content

Commit c57b032

Browse files
authored
Multisig: Do not export any functionality (#967)
1 parent e5e1318 commit c57b032

File tree

2 files changed

+13
-74
lines changed

2 files changed

+13
-74
lines changed

actors/multisig/src/lib.rs

Lines changed: 10 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -44,15 +44,6 @@ pub enum Method {
4444
ChangeNumApprovalsThreshold = 8,
4545
LockBalance = 9,
4646
// Method numbers derived from FRC-0042 standards
47-
ProposeExported = frc42_dispatch::method_hash!("Propose"),
48-
ApproveExported = frc42_dispatch::method_hash!("Approve"),
49-
CancelExported = frc42_dispatch::method_hash!("Cancel"),
50-
AddSignerExported = frc42_dispatch::method_hash!("AddSigner"),
51-
RemoveSignerExported = frc42_dispatch::method_hash!("RemoveSigner"),
52-
SwapSignerExported = frc42_dispatch::method_hash!("SwapSigner"),
53-
ChangeNumApprovalsThresholdExported =
54-
frc42_dispatch::method_hash!("ChangeNumApprovalsThreshold"),
55-
LockBalanceExported = frc42_dispatch::method_hash!("LockBalance"),
5647
UniversalReceiverHook = frc42_dispatch::method_hash!("Receive"),
5748
}
5849

@@ -562,23 +553,15 @@ pub fn compute_proposal_hash(txn: &Transaction, sys: &dyn Primitives) -> anyhow:
562553
impl ActorCode for Actor {
563554
type Methods = Method;
564555
actor_dispatch! {
565-
Constructor => constructor,
566-
Propose => propose,
567-
ProposeExported => propose,
568-
Approve => approve,
569-
ApproveExported => approve,
570-
Cancel => cancel,
571-
CancelExported => cancel,
572-
AddSigner => add_signer,
573-
AddSignerExported => add_signer,
574-
RemoveSigner => remove_signer,
575-
RemoveSignerExported => remove_signer,
576-
SwapSigner => swap_signer,
577-
SwapSignerExported => swap_signer,
578-
ChangeNumApprovalsThreshold => change_num_approvals_threshold,
579-
ChangeNumApprovalsThresholdExported => change_num_approvals_threshold,
556+
Constructor => constructor,
557+
Propose => propose,
558+
Approve => approve,
559+
Cancel => cancel,
560+
AddSigner => add_signer,
561+
RemoveSigner => remove_signer,
562+
SwapSigner => swap_signer,
563+
ChangeNumApprovalsThreshold => change_num_approvals_threshold,
580564
LockBalance => lock_balance,
581-
LockBalanceExported => lock_balance,
582-
UniversalReceiverHook => universal_receiver_hook,
583-
}
565+
UniversalReceiverHook => universal_receiver_hook,
566+
}
584567
}

actors/multisig/tests/multisig_actor_test.rs

Lines changed: 3 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use fil_actor_multisig::testing::check_state_invariants;
22
use fil_actor_multisig::{
3-
compute_proposal_hash, Actor as MultisigActor, ConstructorParams, Method, ProposeParams,
4-
ProposeReturn, State, Transaction, TxnID, TxnIDParams, SIGNERS_MAX,
3+
compute_proposal_hash, Actor as MultisigActor, ConstructorParams, Method, ProposeReturn, State,
4+
Transaction, TxnID, TxnIDParams, SIGNERS_MAX,
55
};
66
use fil_actors_runtime::cbor::serialize;
77
use fil_actors_runtime::runtime::Runtime;
@@ -123,7 +123,7 @@ mod constructor_tests {
123123
RawBytes::default(),
124124
rt.call::<MultisigActor>(
125125
Method::Constructor as u64,
126-
IpldBlock::serialize_cbor(&params).unwrap()
126+
IpldBlock::serialize_cbor(&params).unwrap(),
127127
)
128128
.unwrap()
129129
);
@@ -748,50 +748,6 @@ fn test_fail_propose_from_non_signer() {
748748
check_state(&rt);
749749
}
750750

751-
#[test]
752-
fn test_propose_restricted_correctly() {
753-
let msig = Address::new_id(1000);
754-
let mut rt = construct_runtime(msig);
755-
let h = util::ActorHarness::new();
756-
757-
let anne = Address::new_id(101);
758-
// We will treat Bob as having code CID b"102"
759-
let bob = Address::new_id(102);
760-
let chuck = Address::new_id(103);
761-
let no_unlock_duration = 0;
762-
let start_epoch = 0;
763-
let signers = vec![anne, bob];
764-
765-
let send_value = TokenAmount::from_atto(10u8);
766-
h.construct_and_verify(&mut rt, 2, no_unlock_duration, start_epoch, signers);
767-
768-
// set caller to not-builtin
769-
rt.set_caller(make_identity_cid(b"102"), Address::new_id(102));
770-
let propose_params = IpldBlock::serialize_cbor(&ProposeParams {
771-
to: chuck,
772-
value: send_value,
773-
method: METHOD_SEND,
774-
params: RawBytes::default(),
775-
})
776-
.unwrap();
777-
778-
// cannot call the unexported method num
779-
780-
expect_abort_contains_message(
781-
ExitCode::USR_FORBIDDEN,
782-
"must be built-in",
783-
rt.call::<MultisigActor>(Method::Propose as u64, propose_params.clone()),
784-
);
785-
786-
rt.verify();
787-
788-
// can call the exported method num
789-
rt.expect_validate_caller_any();
790-
rt.call::<MultisigActor>(Method::ProposeExported as u64, propose_params).unwrap();
791-
792-
rt.verify();
793-
}
794-
795751
// AddSigner
796752
#[test]
797753
fn test_add_signer() {

0 commit comments

Comments
 (0)