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

feat(rpc): implement Filecoin.StateSectorExpiration #4339

Merged
merged 5 commits into from
May 29, 2024

Conversation

hanabi1224
Copy link
Contributor

@hanabi1224 hanabi1224 commented May 16, 2024

Summary of changes

Changes introduced in this pull request:

  • Implement RPC method implement Filecoin.StateSectorExpiration
  • API compare tests
  • Treat a test as a success when the error messages from forest and lotus are identical
     Running `target/quick/forest-tool api compare /home/me/fr/snapshots/calibnet/forest_snapshot_calibnet_2024-05-16_height_1617230.forest.car.zst --filter StateSectorExpiration`
| RPC Method                          | Forest                               | Lotus                                |
|-------------------------------------|--------------------------------------|--------------------------------------|
| Filecoin.StateSectorExpiration (10) | Rejected("failed to find sector 0")  | Rejected("failed to find sector 0")  |
| Filecoin.StateSectorExpiration (20) | Rejected("failed to find sector 1")  | Rejected("failed to find sector 1")  |
| Filecoin.StateSectorExpiration (3)  | Rejected("failed to find sector 2")  | Rejected("failed to find sector 2")  |
| Filecoin.StateSectorExpiration (10) | Rejected("failed to find sector 3")  | Rejected("failed to find sector 3")  |
| Filecoin.StateSectorExpiration      | Rejected("failed to find sector 32") | Rejected("failed to find sector 32") |
| Filecoin.StateSectorExpiration      | Rejected("failed to find sector 33") | Rejected("failed to find sector 33") |
| Filecoin.StateSectorExpiration      | Rejected("failed to find sector 35") | Rejected("failed to find sector 35") |
| Filecoin.StateSectorExpiration (10) | Rejected("failed to find sector 4")  | Rejected("failed to find sector 4")  |
| Filecoin.StateSectorExpiration (94) | Valid                                | Valid                                |

Reference issue to close (if applicable)

Closes #4334

Other information and links

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.

@hanabi1224 hanabi1224 marked this pull request as ready for review May 16, 2024 14:35
@hanabi1224 hanabi1224 requested a review from a team as a code owner May 16, 2024 14:35
@hanabi1224 hanabi1224 requested review from ruseinov and LesnyRumcajs and removed request for a team May 16, 2024 14:35
Copy link
Contributor

@ruseinov ruseinov left a comment

Choose a reason for hiding this comment

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

looks good to me. The handler code is a bit convoluted due to a bunch of nesting, but thankfully not a lot of lines, so I don't think there's real need for any kind of refactoring.

let success = match (&forest_status, &lotus_status) {
(TestSummary::Valid, TestSummary::Valid)
| (TestSummary::Timeout, TestSummary::Timeout) => true,
(TestSummary::Rejected(ref reason_forest), TestSummary::Rejected(ref reason_lotus))
Copy link
Member

Choose a reason for hiding this comment

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

This will make the tests pass even if both inputs to Forest and Lotus are accidentally malformed, no? Do you think it'd be safer to explicitly declare tests that should (could) fail and only allow them to do so?

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.

@hanabi1224 hanabi1224 added this pull request to the merge queue May 29, 2024
Merged via the queue into main with commit 0eaaba9 May 29, 2024
27 checks passed
@hanabi1224 hanabi1224 deleted the hm/StateSectorExpiration branch May 29, 2024 07:39
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.

StateSectorExpiration
3 participants