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

FIP-0084: Remove ProveCommit and dependencies #1540

Merged
merged 24 commits into from
May 29, 2024
Merged

Conversation

ZenGround0
Copy link
Contributor

@ZenGround0 ZenGround0 commented May 19, 2024

Closes #1277

@ZenGround0 ZenGround0 marked this pull request as ready for review May 19, 2024 06:39
@ZenGround0 ZenGround0 requested a review from anorth May 23, 2024 01:39
actors/miner/src/types.rs Show resolved Hide resolved
actors/miner/tests/util.rs Show resolved Hide resolved
}

#[test]
fn invalid_proof_rejected() {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@anorth I'm more sure about the other tests but could you confirm that we are not throwing away any valuable test coverage here for prove_commit3?

Copy link
Member

Choose a reason for hiding this comment

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

With existing tests in prove_commit2_failures_test.rs plus #1547 I think we're good.

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.

This is looking pretty good, a nice cleanup.

It seems there's some technical debt left behind in the tests. I think you're right to avoid doing it in this PR, but I would appreciate you documenting what needs to be done in an issue and ideally following up to do some of it.

actors/miner/src/types.rs Show resolved Hide resolved
actors/miner/tests/util.rs Outdated Show resolved Hide resolved
@@ -207,7 +208,7 @@ impl Default for ExpectInvocation {
exit_code: ExitCode::OK,
return_value: None,
subinvocs: None,
events: vec![],
events: None,
Copy link
Member

Choose a reason for hiding this comment

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

How about making the default Some(vec[]) so that opting out is explicit?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't see why events should break this symmetry compared to subinvocs for example. Developing new events -> testing new development -> writing explicit checks for event expectations. The default should not expose this complexity. If I'm wrong about this then I think by symmetry we've gotten it wrong for all the other optional fields.

Copy link
Member

Choose a reason for hiding this comment

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

I think we have it "wrong" for all the other optional fields, but the optionals are pragmatic. I think we can do better. I'll file an issue about it. Your call what to do here for now, but if it's only a small addition, I'd add the events.

Copy link
Member

Choose a reason for hiding this comment

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

actors/miner/tests/util.rs Show resolved Hide resolved
actors/miner/tests/util.rs Outdated Show resolved Hide resolved
actors/miner/tests/util.rs Outdated Show resolved Hide resolved
actors/miner/tests/util.rs Show resolved Hide resolved
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.

For improving our continuity, I think someone else (not steb) should also review this PR.

@@ -207,7 +208,7 @@ impl Default for ExpectInvocation {
exit_code: ExitCode::OK,
return_value: None,
subinvocs: None,
events: vec![],
events: None,
Copy link
Member

Choose a reason for hiding this comment

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

I think we have it "wrong" for all the other optional fields, but the optionals are pragmatic. I think we can do better. I'll file an issue about it. Your call what to do here for now, but if it's only a small addition, I'd add the events.

actors/miner/src/types.rs Show resolved Hide resolved
}

#[test]
fn invalid_proof_rejected() {
Copy link
Member

Choose a reason for hiding this comment

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

With existing tests in prove_commit2_failures_test.rs plus #1547 I think we're good.

Comment on lines +3356 to +3357
// To ensure passed in configuration is internally consistent check that cfg deals are a subset
// of precommitted deal ids
Copy link
Member

Choose a reason for hiding this comment

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

Can you explain why it's a subset, and why below we can safely get(i) of configured_deals? So it's a subset, but strictly has a copy of the deals referenced in the prefix of deal_ids. Why?

Copy link
Member

Choose a reason for hiding this comment

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

or ... is it simply that we want to take configured_deals and assign them a deal_id so we pluck them out in order, and then fill the rest up with defaults?

Copy link
Member

Choose a reason for hiding this comment

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

I guess I'm struggling to see why there's additional deal_ids involved here, what are the test cases that involve a different number of deal_ids vs what's in the config?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

or ... is it simply that we want to take configured_deals and assign them a deal_id so we pluck them out in order, and then fill the rest up with defaults?

Yes this is it.

I guess I'm struggling to see why there's additional deal_ids involved here

Yeah you and me both 😄
I don't know if there are any tests that configure more deal ids than deal specs in ProveCommitCfgs but I doubt they're there. However the two configs are completely logically separate so it is technically possible and I wanted to handle just in case.

I could alternatively look into failing the test if the configs don't have the same number of deals but if I hit any failure cases I'd want to just cleanup the mess with #1545.

@@ -79,6 +78,7 @@ pub struct State {
/// Claimed power for each miner.
pub claims: Cid, // Map, HAMT[address]Claim

// Deprecated as of FIP 0084
pub proof_validation_batch: Option<Cid>,
Copy link
Member

Choose a reason for hiding this comment

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

do we expect this to be empty after the upgrade? is there a period where some may get stuck in here across the upgrade epoch boundary, or are they run within the same epoch?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good question. They are always pulled out in the same epoch so there shouldn't be any trouble. I should double check cron logic in case null blocks mess with this.

) -> ProofsByAddress {
if state.proof_validation_batch.is_none() {
return ProofsByAddress::default();
fn check_proofs_invariants(state: &State, acc: &MessageAccumulator) {
Copy link
Member

Choose a reason for hiding this comment

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

what makes use of check_state_invariants() across the actors? Is this called by some external tool? I know about the regular go-state-types ones that are run via lotus, but are these run anywhere with any regularity? Or can they be run manually across real 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.

These are only ever run in actors tests unfortunately. There used to be one set which was used both in actors tests and live tests of mainnet state. Ever since we moved to rust actors we've been maintaining twice the code to get the same value. We've never taken the time to figure out a reasonable solution.

I think it might be slightly less crazy to figure out how to run rust functions on a golang blockstore and then wire this into the lotus-shed command that checks invariants. Since the FVM must be doing this anyway it can't require completely new code.

Copy link
Member

Choose a reason for hiding this comment

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

The integration tests will check invariants across actors.

Yes it's huge technical debt that there are two versions of this. I consider the ones that are developed alongside the actors and run in the tests to be the canonical. The Lotus team, however, consider the version in go-state-types, which runs against mainnet state, to be canonical. I agree with @ZenGround0's suggested path. This isn't captured in an issue anywhere AFAIK, perhaps since it's not quite clear in which repo it belongs.

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 fine to me, from my level of knowledge; a few questions and comments inline but nothing blocking

#1548 (comment) is a comment relating to this PR; I'm mildly uncomfortable introducing an Option for events, even if that does make it on par with some other validation properties there. It would be better if it was much lower effort to add events by executing, eyeballing and backfilling.

It does seem like a large ask to add events here though, a lot of work's gone into this, well done @ZenGround0

@ZenGround0
Copy link
Contributor Author

It would be better if it was much lower effort to add events by executing, eyeballing and backfilling.

I'm the odd one out on this (@anorth said the same) so it's likely I'm thinking about it wrong. However I feel worse about executing, eyeballing and backfilling if I'm understanding that approach right. To me it seems that approach encourages using the tests to learn about the system since you would see how the tests fail and then make them match the implementation. But to me this feels backwards. Instead I would rather engineers make changes to the system, predict the new behavior with a test, check that their assumptions are correct. This forces people to check their model of what should be happening against the system.

I get that we reduce coverage of the exact exec trace this way, but we make the development of precise and good tests easier. I guess I would rather have tests that don't break when the system changes in a way that is irrelevant for the intent of the test. Especially when the trade off is that good tests with precise intents are easier to write. I would rather that lazy people write weak quiet tests (just set everything to None) than slightly stronger noisy tests (blindly copy whatever the system is doing without thinking about whether its relevant to the test).

This is all a remnant of me being scarred by experiences (aka go-filecoin 🙃 ) where tests were so coupled to implementations that it became very hard to make simple changes and roughly impossible to make big changes. In reality that's probably never going to happen here so I wouldn't block a PR that changed events back to required. I think having #1548 alongside integration tests is probably a good tradeoff.

@ZenGround0 ZenGround0 enabled auto-merge May 29, 2024 05:37
@ZenGround0 ZenGround0 added this pull request to the merge queue May 29, 2024
Merged via the queue into master with commit ea7c454 May 29, 2024
14 checks passed
@ZenGround0 ZenGround0 deleted the feat/fip-0084 branch May 29, 2024 14:24
rvagg added a commit that referenced this pull request Jun 18, 2024
rvagg added a commit that referenced this pull request Jun 18, 2024
removed in #1540
but still needed to activate preseals
rvagg added a commit that referenced this pull request Jun 18, 2024
github-merge-queue bot pushed a commit that referenced this pull request Jun 19, 2024
rvagg added a commit that referenced this pull request Jun 19, 2024
removed in #1540
but still needed to activate preseals
rvagg added a commit that referenced this pull request Jun 19, 2024
removed in #1540
but still needed to activate preseals
rvagg added a commit that referenced this pull request Jun 24, 2024
removed in #1540
but still needed to activate preseals
github-merge-queue bot pushed a commit that referenced this pull request Jun 24, 2024
* fix: restore ConfirmSectorProofsValid

removed in #1540
but still needed to activate preseals

* changes as per review

* make rustfmt

---------

Co-authored-by: aarshkshah1992 <[email protected]>
ZenGround0 added a commit that referenced this pull request Jun 25, 2024
* Remove ProveCommit and dependencies

* Remove gas param

* Fixup power tests

* Remove deprecated harness methods and redirect to prove commit3

* Use new harness names

* Remove tests exercising deprecated behavior of prove commit

* fmt

* Get tests running locally

* Cleanup

* Fix many miner tests

* Fix the fix

* More linter and fmt fixes

* fmt

* clippy

* Fix power tests

* Fix itests and miner power dependent tests

* fmt

* Remove and cleanup prove_commit tests

* All tests passing

* Clippy

* Review Response

* Finish review response

* Remove low value test method

* Update prefactor tests to correct names

---------

Co-authored-by: zenground0 <[email protected]>
ZenGround0 pushed a commit that referenced this pull request Jun 25, 2024
ZenGround0 pushed a commit that referenced this pull request Jun 25, 2024
* fix: restore ConfirmSectorProofsValid

removed in #1540
but still needed to activate preseals

* changes as per review

* make rustfmt

---------

Co-authored-by: aarshkshah1992 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Status: ✅ Done
Development

Successfully merging this pull request may close these issues.

Remove deal/sector activation from cron
3 participants