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

Manual CC & Snapdeals onboarding (No NI-Porep) #12049

Closed

Conversation

aarshkshah1992
Copy link
Contributor

Related Issues

This PR aims to refactor #12017 by creating a generic testkit manual miner that can be used to onboard CC sectors and Snap deal sectors. It does not have any of the NI-PoRep tests introduced in #12045.

Proposed Changes

Additional Info

Checklist

Before you mark the PR ready for review, please make sure that:

  • Commits have a clear commit message.
  • PR title is in the form of of <PR type>: <area>: <change being made>
    • example: fix: mempool: Introduce a cache for valid signatures
    • PR type: fix, feat, build, chore, ci, docs, perf, refactor, revert, style, test
    • area, e.g. api, chain, state, market, mempool, multisig, networking, paych, proving, sealing, wallet, deps
  • If the PR affects users (e.g., new feature, bug fix, system requirements change), update the CHANGELOG.md and add details to the UNRELEASED section.
  • New features have usage guidelines and / or documentation updates in
  • Tests exist for new functionality or change in behavior
  • CI is green

@aarshkshah1992 aarshkshah1992 changed the base branch from master to rvagg/manual_cc_itest May 27, 2024 17:32
@@ -9,12 +17,15 @@ import (
"github.com/libp2p/go-libp2p/core/peer"
)

const sectorSize = abi.SectorSize(2 << 10) // 2KiB
Copy link
Member

Choose a reason for hiding this comment

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

There's already a sectorSize in the test kit, I just couldn't figure out a way to feed that back, I wanted to ask the kit "what sector size am I using?" but I think 2k just gets hard-wired everywhere in itests now, which is a little unfortunate. Maybe we should make a SectorSize() method on the miner so we can: use the 2k default that the test kit uses, have a SectorSize() option, and also have a SectorSize() method on the miner so we can work with it.

But also this brought up another, adjacent, issue when I was looking at it, we have this line:

// Will use 2KiB sectors by default (default value of sectorSize).
proofType, err := miner.SealProofTypeFromSectorSize(options.sectorSize, n.genesis.version, false)
require.NoError(n.t, err)

But we also have kit.TestSpt and I'm adding kit.TestSptNi, so hard-wired seal proof types; I don't think they should be hard-wired but maybe we add new methods SealProofType() and SealProofTypeNi() to get them instead of these constants.

Copy link
Member

Choose a reason for hiding this comment

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

this still needs to go, it's in the opts, we should only have it once

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 this.

@@ -82,6 +84,13 @@ type OptBuilder func(activeNodes []*TestFullNode) node.Option
// NodeOpt is a functional option for test nodes.
type NodeOpt func(opts *nodeOpts) error

func WithMockProofs() NodeOpt {
Copy link
Member

Choose a reason for hiding this comment

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

there's already one on the ensemble itself,

func MockProofs(e ...bool) EnsembleOpt {

I think we should be able to fetch n.options.mockProofs when we instantiate TestUnmanagedMiner so there's no need for a new option, use what's there, just expose it in the TestUnmanagedMiner struct.

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 have removed tests with mock proofs completely for now. Will add it back as a separate test.

Copy link
Member

Choose a reason for hiding this comment

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

I'm a little concerned about the complete removal of mock tests from this because there's so many places where you need to bypass ffi calls when you are running with mock proofs; I'll trust that you've got that under control but it is harder now the logic has been spread around a bit more.

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 have added back all the mock proof tests (for both cc sectors and sectors with pieces)

itests/kit/node_unmanaged.go Outdated Show resolved Hide resolved
itests/kit/node_unmanaged.go Outdated Show resolved Hide resolved
@aarshkshah1992 aarshkshah1992 force-pushed the feat/refactor-withoit-ni-porep branch from 674ff96 to 2c1738a Compare May 29, 2024 04:09
Copy link

github-actions bot commented May 29, 2024

All checks have completed

❌ Failed Check / Check (lint-all) (pull_request)
⏭️ Skipped Check / Check (gen-check) (pull_request)

@aarshkshah1992 aarshkshah1992 changed the title [WIP] Manual CC & Snapdeals onboarding (No NI-Porep) Manual CC & Snapdeals onboarding (No NI-Porep) May 29, 2024
@aarshkshah1992
Copy link
Contributor Author

@rvagg This is ready for a review. We can merge this and I can then continue work on top of this.


func (tm *TestUnmanagedMiner) AssertNoPower(ctx context.Context) {
p := tm.CurrentPower(ctx)
tm.t.Logf("MinerB RBP: %v, QaP: %v", p.MinerPower.QualityAdjPower.String(), p.MinerPower.RawBytePower.String())
Copy link
Member

Choose a reason for hiding this comment

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

log line has MinerB, could either remove this entirely or replace it with f0 actor address—which would be helpful because you can then correlate it with the order they were instantiated

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 all these log lines.

func (tm *TestUnmanagedMiner) AssertPower(ctx context.Context, raw uint64, qa uint64) {
req := require.New(tm.t)
p := tm.CurrentPower(ctx)
tm.t.Logf("MinerB RBP: %v, QaP: %v", p.MinerPower.QualityAdjPower.String(), p.MinerPower.RawBytePower.String())
Copy link
Member

Choose a reason for hiding this comment

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

ditto log line

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.

// Create cache directory
cacheDirPath := filepath.Join(tm.cacheDir, fmt.Sprintf("%d", sectorNumber))
requirements.NoError(os.Mkdir(cacheDirPath, 0755))
tm.t.Logf("MinerB: Sector %d: created cache directory at %s", sectorNumber, cacheDirPath)
Copy link
Member

Choose a reason for hiding this comment

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

MinerB

Copy link
Member

Choose a reason for hiding this comment

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

2 more in this function

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.

itests/kit/node_unmanaged.go Outdated Show resolved Hide resolved
itests/kit/node_unmanaged.go Outdated Show resolved Hide resolved
itests/kit/node_unmanaged.go Outdated Show resolved Hide resolved
itests/kit/node_unmanaged.go Outdated Show resolved Hide resolved
itests/kit/node_unmanaged.go Outdated Show resolved Hide resolved
return sectorNumber, respCh
}

func (tm *TestUnmanagedMiner) wdPostLoop(ctx context.Context, sectorNumber abi.SectorNumber, respCh chan WindowPostResp, withMockProofs bool) {
Copy link
Member

Choose a reason for hiding this comment

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

this isn't a loop anymore, it just does one post then exits

which is going to be a problem because we're going to have additions (including ni-porep) that will take longer to onboard so existing sectors need to continue to post

which has implications for other changes in here -- the channel has a buffer of 1, but what if we just want to make it continue to post without waiting for a response? I think my original version had a channel for first post because that's the only one we actually care about so we can check power.

It also disputed all posts to make sure it did the right thing on each post. I don't think that's as critical to keep in the loop, but it was a nice feature that you always got an assertion that your post was valid without having to include additional logic. The only catch with that is when you want to assert that a post should not be valid, but that could also just be a boolean "expect valid" (to check each time and expect a failure to dispute) or "submit dispute" (to check each time or not check at all and make it the caller's responsibility).

I was just doing this last week with ni-porep, experimenting with a test case where the post was invalid and making sure the dispute didn't error to make sure that the dispute mechanism was working.

However I'm actually not sure about the value of adding tests for disputing succeeding, because we have itests/wdpost_dispute_test.go already. I don't know that ni-porep adds anything novel that would need to add a new dispute check on windowpost, we'd need to check on that. But I still think it's nice to add a dispute mechanism when we're not using fake proofs, even if we can't flip between "expect valid" and "expect invalid".

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 in these tests you're only needing the single PoSt anyway because you wait and assert power just for that single miner, so if they fail the next post then it shouldn't bother your assertions? So you're probably not going to see flaky failures due to speed differences. Maybe this is OK then and we should expand test coverage by adding new itests rather than expanding this file and having minerC, minerE, etc. Then a single PoSt might be fine for many cases. Possibly not for snapping deals though? That might need some repeated PoSts?

@rvagg
Copy link
Member

rvagg commented Jun 3, 2024

I've gone ahead and squashed this down and included it in #12017 and also rebased that branch on the current #12005 which has master in it, so we don't get too far out on a limb! We can keep iterating from there rather than having these big chains of PRs and commits.

@rvagg rvagg closed this Jun 3, 2024
@rvagg rvagg deleted the feat/refactor-withoit-ni-porep branch June 3, 2024 09:13
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.

2 participants