-
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
Verifreg to use ActorID #936
Conversation
a7b0013
to
6ff37e0
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.
The problem is that AllocationRequest is duplicated in market/src/ext.rs, to avoid circular dependencies. This was hard for you to know, sorry. Update that one too.
actors/verifreg/src/lib.rs
Outdated
let code_cid = | ||
rt.get_actor_code_cid(&id).with_context_code(ExitCode::USR_ILLEGAL_ARGUMENT, || { | ||
format!("no code CID for provider {}", addr) | ||
})?; | ||
let provider_type = rt | ||
.resolve_builtin_actor_type(&code_cid) | ||
.with_context_code(ExitCode::USR_ILLEGAL_ARGUMENT, || { | ||
format!("provider code {} must be built-in miner actor", code_cid) | ||
})?; | ||
if provider_type != Type::Miner { | ||
return Err(actor_error!( | ||
illegal_argument, | ||
"allocation provider {} must be a miner actor, was {:?}", | ||
addr, | ||
provider_type | ||
)); | ||
} | ||
Ok(id) |
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.
We still need the last two checks here. The only one to remove is the address resolution at the top
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.
fixed
f6be7e8
to
c768f94
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.
LGTM after small clean-ups. If you're confident in those changes, go ahead and merge after making them, otherwise feel free to ping me for a final check.
@@ -879,7 +879,7 @@ fn alloc_request_for_deal( | |||
let alloc_expiration = | |||
min(deal.proposal.start_epoch, curr_epoch + policy.maximum_verified_allocation_expiration); | |||
ext::verifreg::AllocationRequest { | |||
provider: deal.proposal.provider, | |||
provider: deal.proposal.provider.id().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.
This is ok, but please add a brief comment to this method noting that the proposal must have ID addresses.
@@ -628,8 +628,6 @@ impl Actor { | |||
let mut new_allocs = Vec::with_capacity(reqs.allocations.len()); | |||
for req in &reqs.allocations { | |||
validate_new_allocation(req, rt.policy(), curr_epoch)?; | |||
// Require the provider for new allocations to be a miner actor. | |||
// This doesn't matter much, but is more ergonomic to fail rather than lock up datacap. |
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.
Please restore the comment too.
actors/verifreg/src/lib.rs
Outdated
let id = rt.resolve_address(addr).with_context_code(ExitCode::USR_ILLEGAL_ARGUMENT, || { | ||
format!("failed to resolve provider address {}", addr) | ||
})?; | ||
fn resolve_miner_id(rt: &mut impl Runtime, id: &ActorID) -> Result<ActorID, 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.
Please rename this to check_miner_id
, since this no longer does resolution.
Change the parameter to ActorID
, not &ActorID
.
Change the return type to Result<(), ActorError>
since the return is just the parameter, and at the call site you can use req.provider
instead of provider_id
.
…ject#936) * Use ActorID in ClaimExtensionRequest * Use ActorID in AllocationRequest * Remove unused fn resolve_miner_id * Fix receive_alloc_requires_miner_actor test * Fix datacap transfer scenario test * Use ActorID in market actor * Fixed resolve_miner_id * Cleanup
Changes:
Closes #869