-
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
markets: OnDealExpiredOrSlashed - get deal by proposal instead of deal ID #5431
Conversation
} | ||
|
||
prop := market.DealProposal(proposal) | ||
res, err := mgr.demAPI.GetCurrentDealInfo(ctx, head.Key().Bytes(), &prop, publishCid) |
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.
Technically we can reorg after getting this info
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.
We can, but in order to fix that we would need to change the way the state change API works.
I suggest we merge this improvement first and then tackle the state change API changes.
@dirkmc What's up with this PR? |
I think it was just waiting for approval - if we want to get this in let me know and I'll rebase |
@dirkmc we opened it for review - could you please resolve the conflict? |
99c8c5e
to
9696ea6
Compare
@jennijuju I've resolved the conflict now, please review when ready |
still waiting filecoin-project/go-fil-markets#476 and will be reviewed by the ignite team soon. |
9696ea6
to
a1baea7
Compare
Here's a start for a test. Unfortunately the sector start and end are set too far out in the future (epoch 23k), so it takes a long while to run. What worried me is that despite the expiry epoch elapsing, the deal did not appear to be set as "expired" on the client side. I might have a bug in my test, or there's another problem here. Abstaining from merging until we get to the bottom of this.
func TestDealExpiry(t *testing.T) {
kit.QuietMiningLogs()
// reset minimum deal duration to 0, so we can make very short-lived deals.
// NOTE: this will need updating with every new specs-actors version.
market2.DealMinDuration = 0
market3.DealMinDuration = 0
market4.DealMinDuration = 0
market5.DealMinDuration = 0
ctx := context.Background()
var (
client kit.TestFullNode
miner1 kit.TestMiner
)
ens := kit.NewEnsemble(t, kit.MockProofs())
ens.FullNode(&client)
ens.Miner(&miner1, &client, kit.WithAllSubsystems())
bm := ens.Start().InterconnectAll().BeginMining(50 * time.Millisecond)
dh := kit.NewDealHarness(t, &client, &miner1, &miner1)
client.WaitTillChain(ctx, kit.HeightAtLeast(5))
_, _, _ = dh.MakeOnlineDeal(ctx, kit.MakeFullDealParams{
Rseed: 0,
FastRet: true,
StartEpoch: 0,
MinBlocksDuration: 50,
})
go func() {
ch, _ := client.ChainNotify(ctx)
for range ch {
bm[0].InjectNulls(10)
}
}()
for {
// sectors, err := miner.SectorsList(ctx)
// require.NoError(t, err)
minerDeals, err := miner1.DealsList(ctx)
require.NoError(t, err)
for _, d := range minerDeals {
spew.Dump(d)
}
ts, err := client.ChainHead(ctx)
require.NoError(t, err)
fmt.Println(ts.Height())
deals, err := client.ClientListDeals(ctx)
require.NoError(t, err)
fmt.Println(storagemarket.DealStates[deals[0].State])
time.Sleep(1 * time.Second)
fmt.Printf("%+v\n", deals[0])
}
} |
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.
See comment above.
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.
We would benefit from two more tests to verify:
- behaviour on miner-initiated sector termination
- behaviour on protocol-initiated sector termination (aka. slashing)
But happy merging this as-is, as it's already strictly better than what we have in master. @dirkmc should we open issues to track the remaining tests?
Created issues to track
|
78b9929
to
77a1977
Compare
Codecov Report
@@ Coverage Diff @@
## master #5431 +/- ##
==========================================
+ Coverage 39.04% 39.09% +0.04%
==========================================
Files 607 608 +1
Lines 64565 64542 -23
==========================================
+ Hits 25212 25230 +18
+ Misses 34963 34929 -34
+ Partials 4390 4383 -7
Continue to review full report at Codecov.
|
Fixes #5414
Depends on #5309 filecoin-project/go-fil-markets#476
Also move common code for OnDealExpiredOrSlashed from storage adapter client and provider into one place.