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

[Feature] StateMinerFaults RPC. #3726

Merged
merged 11 commits into from
Nov 23, 2023
Merged

[Feature] StateMinerFaults RPC. #3726

merged 11 commits into from
Nov 23, 2023

Conversation

ruseinov
Copy link
Contributor

@ruseinov ruseinov commented Nov 21, 2023

Summary of changes

Changes introduced in this pull request:

  • Introduces StateMinerFaults server and client support, Lotus-compatible.

Reference issue to close (if applicable)

Work on #3639

Other information and links

Tested with: forest-tool api compare --filter MinerFaults --lotus /dns/127.0.0.1/tcp/1234/http snapshot-latest

Change checklist

  • I have performed a self-review of my own code,
  • I have made corresponding changes to the documentation,
  • I have added tests that prove my fix is effective or that my feature works (if possible),
  • I have made sure the CHANGELOG is up-to-date. All user-facing changes should be reflected in this document.

@ruseinov ruseinov marked this pull request as ready for review November 22, 2023 20:44
@ruseinov ruseinov requested a review from a team as a code owner November 22, 2023 20:44
@ruseinov ruseinov requested review from LesnyRumcajs and elmattic and removed request for a team November 22, 2023 20:44
@LesnyRumcajs
Copy link
Member

I don't understand.

Introduces StateMinerFaults server and client support, Lotus-compatible.

Tested with forest-tool api compare --filter MinerFaults --lotus /dns/api.calibration.node.glif.io/tcp/443/https snapshot-latest, for some reason Lotus mostly returns internal server error, but the forest json is valid.
Needs to be retested with an up-to-date Lotus node.

How do we know it's Lotus-compatible?

@ruseinov
Copy link
Contributor Author

I don't understand.

Introduces StateMinerFaults server and client support, Lotus-compatible.

Tested with forest-tool api compare --filter MinerFaults --lotus /dns/api.calibration.node.glif.io/tcp/443/https snapshot-latest, for some reason Lotus mostly returns internal server error, but the forest json is valid.
Needs to be retested with an up-to-date Lotus node.

How do we know it's Lotus-compatible?

tested locally, it's compatible.

elmattic
elmattic previously approved these changes Nov 23, 2023
Comment on lines +190 to +193
data.state_manager
.miner_faults(&address, &ts)
.map_err(|e| e.into())
.map(|r| r.into())
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: maybe make it more explicit what types we're converting into.

Suggested change
data.state_manager
.miner_faults(&address, &ts)
.map_err(|e| e.into())
.map(|r| r.into())
Ok(LotusJson(data.state_manager.miner_faults(&address, &ts)?))

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It lines up with the other endpoints, I see no reason to be explicit here, while being implicit in other methods.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Also, we'll still need to do map_err.

Copy link
Contributor

Choose a reason for hiding this comment

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

Why do we need map_err?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah, we don't, if we use the ?. I've basically used the same approach I did for the StateMinerPower, which was used in state_market_balance.

I'd say that it would be nice to go with the same approach for all the methods. I've just taken a look and we're pretty much 50/50. In my opinion the best course of action here is to let everybody go with their own flow and once we've finished the RPC compatibility routine - just do a small refactoring to make them look the same.

Cargo.toml Outdated
fil_actor_system_state = "7.0.0-rc.5"
fil_actor_verifreg_state = "7.0.0-rc.5"
fil_actors_shared = "7.0.0-rc.5"
fil_actor_account_state = "7.0.0"
Copy link
Contributor

Choose a reason for hiding this comment

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

This will probably clash with #3739

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It might, we'll have several PRs depeding on this version bump.

lemmih
lemmih previously approved these changes Nov 23, 2023
@ruseinov ruseinov dismissed stale reviews from elmattic and lemmih November 23, 2023 12:25

re-review


let mut faults = Vec::new();

state.for_each_deadline(&self.chain_config.policy, self.blockstore(), |_, part| {
Copy link
Contributor

@elmattic elmattic Nov 23, 2023

Choose a reason for hiding this comment

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

I prefer a more explicit name here, like partition.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's not partition. It's State.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah, you are referring to part?

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes I'm referring to part.

Copy link
Contributor

Choose a reason for hiding this comment

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

Looks like part should be deadline and dl should be partition.


let mut faults = Vec::new();

state.for_each_deadline(&self.chain_config.policy, self.blockstore(), |_, part| {
Copy link
Contributor

Choose a reason for hiding this comment

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

Looks like part should be deadline and dl should be partition.

@ruseinov
Copy link
Contributor Author

Looks like part should be deadline and dl should be partition.

Good catch! Fixed.

@ruseinov ruseinov added this pull request to the merge queue Nov 23, 2023
Merged via the queue into main with commit e14ff65 Nov 23, 2023
27 checks passed
@ruseinov ruseinov deleted the ru/feature/state-miner-faults branch November 23, 2023 14:07
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.

None yet

4 participants