-
Notifications
You must be signed in to change notification settings - Fork 84
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
feat: multisig: accept arbitrary public messages #1252
Changes from 10 commits
537c211
8c59b3e
3d22165
7de419c
1a5dc53
261e12f
b4bb679
af27e34
9d99a06
a276308
b52eef6
d8023da
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,11 +4,14 @@ | |
use fvm_actor_utils::receiver::UniversalReceiverParams; | ||
use std::collections::BTreeSet; | ||
|
||
use fil_actors_runtime::FIRST_EXPORTED_METHOD_NUMBER; | ||
use fvm_ipld_blockstore::Blockstore; | ||
use fvm_ipld_encoding::ipld_block::IpldBlock; | ||
use fvm_ipld_encoding::RawBytes; | ||
use fvm_shared::address::Address; | ||
use fvm_shared::econ::TokenAmount; | ||
use fvm_shared::error::ExitCode; | ||
use fvm_shared::MethodNum; | ||
use fvm_shared::{HAMT_BIT_WIDTH, METHOD_CONSTRUCTOR}; | ||
use num_derive::FromPrimitive; | ||
use num_traits::Zero; | ||
|
@@ -445,6 +448,19 @@ impl Actor { | |
rt.validate_immediate_caller_accept_any()?; | ||
Ok(()) | ||
} | ||
|
||
pub fn fallback( | ||
rt: &mut impl Runtime, | ||
method: MethodNum, | ||
_: Option<IpldBlock>, | ||
) -> Result<Option<IpldBlock>, ActorError> { | ||
rt.validate_immediate_caller_accept_any()?; | ||
if method >= FIRST_EXPORTED_METHOD_NUMBER { | ||
Ok(None) | ||
} else { | ||
Err(actor_error!(unhandled_message; "invalid method: {}", method)) | ||
} | ||
} | ||
} | ||
|
||
fn execute_transaction_if_approved( | ||
|
@@ -562,5 +578,6 @@ impl ActorCode for Actor { | |
ChangeNumApprovalsThreshold => change_num_approvals_threshold, | ||
LockBalance => lock_balance, | ||
UniversalReceiverHook => universal_receiver_hook, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We could remove this, since the Universal Receiver Hook's method is in the exported FRC-42 range, so it gets covered by the fallback. But I'd rather keep this explicit branch for clarity. IMO, the account actor should do the same (which it doesn't). There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Suggestion: lets make the change to explicit handling of universal receiver hook to the account actor in this PR |
||
_ => fallback [raw], | ||
ZenGround0 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: the accept range is
>= 2 ^24
(or>= 1 << 24
)