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

Replace fetching control addresses with IsControllingAddress #816

Closed
anorth opened this issue Nov 8, 2022 · 4 comments · Fixed by #948
Closed

Replace fetching control addresses with IsControllingAddress #816

anorth opened this issue Nov 8, 2022 · 4 comments · Fixed by #948
Assignees
Labels
good first issue Good for newcomers P1

Comments

@anorth
Copy link
Member

anorth commented Nov 8, 2022

A few other actors fetch the control addresses from the miner, then perform the ritual of resolving and comparing an address against them. Replace them with calls to the new IsControllingAddress method. Remove the existing accessor if possible.

@anorth anorth added the good first issue Good for newcomers label Nov 8, 2022
@anorth anorth moved this to 📋 Backlog in Network v18 Nov 8, 2022
@anorth anorth moved this from 📋 Backlog to 🔖 Ready in Network v18 Nov 13, 2022
@jennijuju jennijuju added the P1 label Nov 25, 2022
@jennijuju jennijuju moved this from 🔖 Ready to 📋 Backlog in Network v18 Nov 28, 2022
@jennijuju jennijuju assigned jennijuju and unassigned jennijuju Dec 7, 2022
@jennijuju jennijuju moved this from 📋 Backlog to 🏗 In progress in Network v18 Dec 7, 2022
@jennijuju
Copy link
Member

@sudo-shashank will work on this!

@sudo-shashank
Copy link
Contributor

@anorth where can I find more context on new IsControllingAddress?

@jennijuju
Copy link
Member

fn is_controlling_address(
rt: &mut impl Runtime,
params: IsControllingAddressParam,
) -> Result<IsControllingAddressReturn, ActorError> {
rt.validate_immediate_caller_accept_any()?;
let input = match rt.resolve_address(&params.address) {
Some(a) => Address::new_id(a),
None => return Ok(IsControllingAddressReturn { is_controlling: false }),
};
let state: State = rt.state()?;
let info = get_miner_info(rt.store(), &state)?;
let is_controlling = info
.control_addresses
.iter()
.chain(&[info.worker, info.owner])
.into_iter()
.any(|a| *a == input);
Ok(IsControllingAddressReturn { is_controlling })
}

@jennijuju
Copy link
Member

your PR should be targeting next branch as well!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers P1
Projects
No open projects
Status: Done
Development

Successfully merging a pull request may close this issue.

3 participants