-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Manual CC & Snapdeals onboarding (No NI-Porep) #12049
Conversation
itests/kit/node_unmanaged.go
Outdated
@@ -9,12 +17,15 @@ import ( | |||
"github.com/libp2p/go-libp2p/core/peer" | |||
) | |||
|
|||
const sectorSize = abi.SectorSize(2 << 10) // 2KiB |
There was a problem hiding this comment.
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:
Lines 284 to 286 in 6302607
// 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.
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed this.
itests/kit/node_opts.go
Outdated
@@ -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 { |
There was a problem hiding this comment.
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,
lotus/itests/kit/ensemble_opts.go
Line 38 in 6302607
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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)
674ff96
to
2c1738a
Compare
All checks have completed ❌ Failed Check / Check (lint-all) (pull_request) |
@rvagg This is ready for a review. We can merge this and I can then continue work on top of this. |
itests/kit/node_unmanaged.go
Outdated
|
||
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()) |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
itests/kit/node_unmanaged.go
Outdated
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()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ditto log line
There was a problem hiding this comment.
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
// 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) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
MinerB
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.
return sectorNumber, respCh | ||
} | ||
|
||
func (tm *TestUnmanagedMiner) wdPostLoop(ctx context.Context, sectorNumber abi.SectorNumber, respCh chan WindowPostResp, withMockProofs bool) { |
There was a problem hiding this comment.
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".
There was a problem hiding this comment.
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?
39fb5cb
to
ad651df
Compare
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:
<PR type>: <area>: <change being made>
fix: mempool: Introduce a cache for valid signatures
PR type
: fix, feat, build, chore, ci, docs, perf, refactor, revert, style, testarea
, e.g. api, chain, state, market, mempool, multisig, networking, paych, proving, sealing, wallet, deps