-
Notifications
You must be signed in to change notification settings - Fork 79
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
Use Option<IpldBlock> for all message params #913
Conversation
906b9ee
to
9f57d96
Compare
This is now ready for review. The GH dependencies will be dropped when the FVM PR lands, but I'd like confidence that this is the right direction before landing work in the FVM. |
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.
Thanks for taking this on, but this PR is too large to review. It's doing too many things at once, unnecessarily. I gotta put my foot down somewhere, and I'm doing it here. Please engage me on Slack or similar for discussion about why large PRs are very costly.
I've looked at about a third of this. It looks directionally fine. I can review more of it on a second pass.
A bunch of things that are not just what this PR title says should be broken out to separate PRs, to land ahead of this one.
- Removing use of
Cbor
trait - Upgrading frc46_token with all changes except this IpldBlock change
- Fancy but complex macros to reduce dispatch boilerplate
- Changing
send
to use IpldBlock too
actors/datacap/src/lib.rs
Outdated
@@ -71,14 +72,14 @@ pub struct Actor; | |||
|
|||
impl Actor { | |||
/// Constructor for DataCap Actor | |||
pub fn constructor(rt: &mut impl Runtime, governor: Address) -> Result<(), ActorError> { | |||
pub fn constructor(rt: &mut impl Runtime, params: Address) -> Result<(), ActorError> { |
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 rename reduces clarity and doesn't seem necessary
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.
Sure. I was hoping to have all methods uniformly take a single parameter named params
(or no parameters at all), but I'm not fussed.
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 params
is fine if we've wrapped in a transparent struct, so the struct member then has an informative name.
A further suggestion to make this more manageable is to apply it to only one or two simple actors initially, while figuring out all the supporting code, then do the mechanical application to the rest at the end. |
9f57d96
to
30ac751
Compare
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## master #913 +/- ##
==========================================
+ Coverage 88.84% 89.05% +0.21%
==========================================
Files 92 92
Lines 19584 19320 -264
==========================================
- Hits 17399 17206 -193
+ Misses 2185 2114 -71
|
Lowering to draft until pre-factors have landed and conflicts resolved |
ad37e93
to
f85ce31
Compare
where | ||
RT: Runtime, | ||
{ | ||
// I'm trying to find a fixed template for these blocks so we can macro it. |
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.
Now done!
b8bde98
to
ca85aa8
Compare
Rebased. |
f8b12ef
to
bcd18ff
Compare
Cargo.toml
Outdated
@@ -53,6 +53,7 @@ members = [ | |||
"test_vm", | |||
] | |||
|
|||
[patch.crates-io] |
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: revert
actors/paych/src/lib.rs
Outdated
@@ -159,8 +161,14 @@ impl Actor { | |||
} | |||
|
|||
if let Some(extra) = &sv.extra { | |||
rt.send(&extra.actor, extra.method, extra.data.clone(), TokenAmount::zero()) | |||
.map_err(|e| e.wrap("spend voucher verification failed"))?; | |||
// TODO: Is this the best way to handle this? |
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 comment isn't helpful. Please either explain the design issue, or remove.
actors/verifreg/src/lib.rs
Outdated
@@ -68,12 +69,12 @@ pub struct Actor; | |||
|
|||
impl Actor { | |||
/// Constructor for Registry Actor | |||
pub fn constructor(rt: &mut impl Runtime, root_key: Address) -> Result<(), ActorError> { | |||
pub fn constructor(rt: &mut impl Runtime, params: Address) -> Result<(), ActorError> { |
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: I don't think this rename is helpful
test_vm/src/lib.rs
Outdated
@@ -371,11 +372,7 @@ impl<'bs> VM<'bs> { | |||
|
|||
pub fn get_state<C: Cbor>(&self, addr: Address) -> Option<C> { |
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.
Re-opening #700 until we remove use of Cbor here too
bcd18ff
to
d5d2212
Compare
@@ -2168,3 +2188,60 @@ name = "winapi-x86_64-pc-windows-gnu" | |||
version = "0.4.0" | |||
source = "registry+https://github.com/rust-lang/crates.io-index" | |||
checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" | |||
|
|||
[[package]] | |||
name = "windows-sys" |
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.
Is introducing windows stuff required for this PR? That's unexpected
@@ -117,7 +128,7 @@ fn authenticate_message() { | |||
plaintext: vec![], | |||
result: Ok(()), | |||
}); | |||
assert_eq!(RawBytes::default(), rt.call::<AccountActor>(3, ¶ms).unwrap()); | |||
assert_eq!(RawBytes::default(), rt.call::<AccountActor>(3, params.clone()).unwrap()); |
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 would have thought the None
would carry over to the output of call?
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.
Not yet -- returns will be a separate PR.
actors/market/src/lib.rs
Outdated
@@ -86,7 +87,7 @@ impl Actor { | |||
} | |||
|
|||
/// Deposits the received value into the balance held in escrow. | |||
fn add_balance(rt: &mut impl Runtime, provider_or_client: Address) -> Result<(), ActorError> { | |||
fn add_balance(rt: &mut impl Runtime, params: Address) -> Result<(), ActorError> { |
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: Overall I'm not convinced standardizing params names is the best way. Not a super strong opinion though.
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.
that's the majority opinion, so I'm gonna revert
// TODO: when landing https://github.com/filecoin-project/builtin-actors/pull/518 | ||
// ExtendProofValidity | ||
ExtendCommittmentLegacy, | ||
// handle only legacy sectors |
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.
undo, if you want this above a field it should be above the ExtendCommittmentLegacy field
actors/power/src/lib.rs
Outdated
@@ -289,7 +292,7 @@ impl Actor { | |||
|
|||
fn submit_porep_for_bulk_verify( | |||
rt: &mut impl Runtime, | |||
seal_info: SealVerifyInfo, |
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.
Reiterating: I think it makes sense for methods to define param names that make sense in context
d5d2212
to
2c64ca7
Compare
2c64ca7
to
1571382
Compare
1571382
to
6451460
Compare
#758 (the "params" half)
This is a mostly-manual overhaul of the system to use Option for message params, as driven by filecoin-project/ref-fvm#1199. As part of it, we start using the macros introduced in #947 for the dispatch table for all actors.
Other changes:
ReceiverHook
s of the account & multisig actors now explicitly receiveUniversalReceiverParams
, where previously they accepted anything. They will fail if called with input that isn't validly serializedUniversalReceiverParams
(though the value of theUniversalReceiverParams
itself doesn't matter)Send
.