Skip to content
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

Merged
merged 9 commits into from
Dec 14, 2022
Merged

Conversation

sudo-shashank
Copy link
Contributor

Changes:

Closes #869

@sudo-shashank sudo-shashank force-pushed the shashank/verifreg-changes-#869 branch from a7b0013 to 6ff37e0 Compare December 12, 2022 07:27
Copy link
Member

@anorth anorth left a 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.

Comment on lines 1024 to 1041
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)
Copy link
Member

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

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

actors/verifreg/src/lib.rs Show resolved Hide resolved
actors/verifreg/tests/verifreg_actor_test.rs Show resolved Hide resolved
@sudo-shashank sudo-shashank force-pushed the shashank/verifreg-changes-#869 branch from f6be7e8 to c768f94 Compare December 13, 2022 10:00
@sudo-shashank sudo-shashank marked this pull request as ready for review December 13, 2022 10:29
@sudo-shashank sudo-shashank requested a review from anorth December 13, 2022 10:29
Copy link
Member

@anorth anorth left a 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(),
Copy link
Member

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.
Copy link
Member

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.

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> {
Copy link
Member

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.

@sudo-shashank sudo-shashank merged commit 686a2f2 into master Dec 14, 2022
@sudo-shashank sudo-shashank deleted the shashank/verifreg-changes-#869 branch December 14, 2022 13:15
shamb0 pushed a commit to shamb0/builtin-actors that referenced this pull request Jan 31, 2023
…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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Change verifreg AllocationRequest to use ActorID
2 participants