-
Notifications
You must be signed in to change notification settings - Fork 80
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: allow all unrestricted method numbers on accounts #1086
Conversation
The approach looks good to me, thank you! I think the macros look good, but I'm honestly not especially sure. |
d0f2072
to
18b95d5
Compare
The best way to review macros is to try expanding them. E.g.: fn invoke_method<RT>(
rt: &mut RT,
method: MethodNum,
args: Option<fvm_ipld_encoding::ipld_block::IpldBlock>,
) -> Result<Option<fvm_ipld_encoding::ipld_block::IpldBlock>, ActorError>
where
RT: Runtime,
RT::Blockstore: Clone,
{
restrict_internal_api(rt, method)?;
match FromPrimitive::from_u64(method) {
Some(Self::Methods::Constructor) => {
$crate::dispatch(rt, Self::constructor, &args)
}
Some(Self::Methods::AuthenticateMessageExported) => {
$crate::dispatch(rt, Self::authenticate_message, &args)
}
None => Self::fallback(rt, method, args),
None => Err($crate::ActorError::unhandled_message({
let res = $crate::fmt::format(std::fmt::Arguments::new_v1(
&[],
&[std::fmt::ArgumentV1::new(&(method), std::fmt::Display::fmt)],
));
res
})),
}
} |
18b95d5
to
fc736c3
Compare
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.
I think something weird happened to the PR and I can't see any macro changes. The raw
macro thing isn't on master.
- I think this should accept all unimplemented methods. I don't think FRC-0042 should be privileged here. We left a large range below that because there could be good call for other schemes.
- I don't think we should use the macros in these actors. The additional conceptual complexity and indirection isn't worth it. It would be better to be blindingly obvious how it works.
What if we need to add new methods in this low method range? |
Yeah, I'm not sure I like this idea -- we likely need some bound here, and I think the FRC-0042 range makes sense. I'm comfortable with that level of "privileging" FRC-0042. |
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.
This LGTM.
Ok on the FRC-0042 thing: filecoin-project/FIPs#592 (reply in thread) |
This patch implements a "raw" fallback for both account types that simply accepts all methods greater than or equal to the min FRC0042 number.
Alternative to #1081
Fixes filecoin-project/ref-fvm#1518