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

Add market state invariants and fix a mistake in tests. #1520

Merged
merged 2 commits into from
Feb 9, 2024

Conversation

anorth
Copy link
Member

@anorth anorth commented Feb 9, 2024

Adds market-internal state invariants between deal stats and provider-sector-deal mapping.

@anorth anorth requested review from magik6k and arajasek February 9, 2024 00:57
// Other deal clean-up is deferred to per-epoch cron.
// Note there may be some deal states that are not removed here,
// despite deletion of this mapping, e.g. for expired but not-yet-settled deals.
// The sector->deal mapping is no longer needed (the deal state has sector number too).
let all_deal_ids = st.pop_sector_deal_ids(
Copy link
Member Author

Choose a reason for hiding this comment

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

This line removes all provider-sector-deal mappings for the sectors, so the deleted code below was a no-op.

&[id0, id1],
);
assert_deal_deleted(&rt, id0, &deal0, sector_number);
assert_deal_deleted(&rt, id1, &deal1, sector_number);
assert_deal_deleted(&rt, id1, &deal2, sector_number);
Copy link
Member Author

Choose a reason for hiding this comment

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

This mistake (id1) was introduced when synchronous deal termination was introduced. The test made a lot more sense before that, and just remains relevant.

Copy link
Member

@rvagg rvagg left a comment

Choose a reason for hiding this comment

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

seems reasonable to me

do we add the same invariant checks from here to go-state-types?

actors/market/src/testing.rs Outdated Show resolved Hide resolved
actors/market/src/testing.rs Outdated Show resolved Hide resolved
@arajasek
Copy link
Contributor

arajasek commented Feb 9, 2024

seems reasonable to me

do we add the same invariant checks from here to go-state-types?

@rvagg Yes (if you felt inspired to do that, that would be awesome!).

Co-authored-by: Rod Vagg <[email protected]>
@Stebalien Stebalien enabled auto-merge February 9, 2024 16:36
@Stebalien Stebalien added this pull request to the merge queue Feb 9, 2024
Merged via the queue into master with commit 78c41b3 Feb 9, 2024
14 checks passed
@Stebalien Stebalien deleted the anorth/market-invariants branch February 9, 2024 16:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: ☑️ Done (Archive)
Development

Successfully merging this pull request may close these issues.

4 participants