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

dealpublisher: Fully validate deals before publishing #7234

Merged
merged 2 commits into from
Sep 6, 2021

Conversation

magik6k
Copy link
Contributor

@magik6k magik6k commented Aug 31, 2021

Should fix #7206

@magik6k magik6k requested a review from a team as a code owner August 31, 2021 11:57
@magik6k magik6k changed the title dealpublisher: Fully validate deals xbefore publishing dealpublisher: Fully validate deals before publishing Aug 31, 2021
@magik6k magik6k force-pushed the feat/dealpub-validation branch from a12fdf3 to 6c6c5e3 Compare August 31, 2021 11:58
@magik6k
Copy link
Contributor Author

magik6k commented Aug 31, 2021

This validation seems to be pretty fast, on my mainnet miner:

2021-08-31T14:02:02.435+0200    INFO    storageadapter  storageadapter/dealpublisher.go:370     validating deal {"took": 0.015638289, "proposal": "bafy..."}

@codecov
Copy link

codecov bot commented Aug 31, 2021

Codecov Report

Merging #7234 (42135ec) into master (212400b) will increase coverage by 0.01%.
The diff coverage is 65.51%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #7234      +/-   ##
==========================================
+ Coverage   39.09%   39.10%   +0.01%     
==========================================
  Files         614      614              
  Lines       64895    64923      +28     
==========================================
+ Hits        25369    25391      +22     
- Misses      35127    35132       +5     
- Partials     4399     4400       +1     
Impacted Files Coverage Δ
markets/storageadapter/dealpublisher.go 81.46% <65.51%> (-2.72%) ⬇️
markets/loggers/loggers.go 89.28% <0.00%> (-10.72%) ⬇️
extern/sector-storage/manager_calltracker.go 57.70% <0.00%> (-4.85%) ⬇️
chain/stmgr/call.go 67.87% <0.00%> (-3.64%) ⬇️
itests/kit/blockminer.go 93.65% <0.00%> (-1.59%) ⬇️
chain/vm/vm.go 59.47% <0.00%> (-1.12%) ⬇️
chain/messagepool/selection.go 80.12% <0.00%> (-0.41%) ⬇️
chain/store/store.go 63.49% <0.00%> (-0.18%) ⬇️
storage/wdpost_sched.go 77.22% <0.00%> (ø)
chain/sync_manager.go 67.70% <0.00%> (+0.31%) ⬆️
... and 7 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 212400b...42135ec. Read the comment docs.

Copy link
Contributor

@arajasek arajasek left a comment

Choose a reason for hiding this comment

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

Should do the thing, test would be good to see

@@ -315,6 +318,13 @@ func (p *DealPublisher) publishReady(ready []*pendingDeal) {
// validateDeal checks that the deal proposal start epoch hasn't already
Copy link
Contributor

Choose a reason for hiding this comment

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

update comment (it's doing more now)

Copy link
Contributor

Choose a reason for hiding this comment

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

@magik6k can we add tests like @arajasek suggested before we take things further?

Copy link
Contributor

Choose a reason for hiding this comment

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

FYI - @BigLep

Copy link
Member

Choose a reason for hiding this comment

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

Thanks for adding the test and holding the standard for ourselves and others.

Copy link
Contributor

@ZenGround0 ZenGround0 left a comment

Choose a reason for hiding this comment

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

LGTM

It would be ideal if this also had an integration test setting up a batch of two deals one failing because of client insufficent funds and asserting that only the good deal made it through. Idk how difficult that is to do though.

@magik6k magik6k force-pushed the feat/dealpub-validation branch from dc78e04 to 62a2f25 Compare August 31, 2021 17:46
@magik6k
Copy link
Contributor Author

magik6k commented Sep 1, 2021

The test still isn't exactly non-flaky, after a bunch of runs it hit:

https://app.circleci.com/pipelines/github/filecoin-project/lotus/17038/workflows/3663f40c-6018-47d2-a4fa-fc496585241a/jobs/255358/tests#failed-test-0

2021-08-31T18:00:09.321Z	INFO	markets	loggers/loggers.go:15	storage client event	{"name": "ClientEventFailed", "proposal CID": "bafyreibhep3h5wcixnm6lgixl5zfuv7dkwpbhnuw5urfucjdylzeyz5qyy", "state": "StorageDealError", "message": "unexpected deal status while waiting for data request: 11 (StorageDealFailing). Provider message: deal rejected: node error fetching verified data cap: data cap missing -- client not verified"}
    deals_publish_test.go:296: didn't expect this now

https://app.circleci.com/pipelines/github/filecoin-project/lotus/17035/workflows/293293f6-a104-4af8-a347-e9b326a3e3a4/jobs/255010/tests#failed-test-0

    deals_publish_test.go:303: 
        	Error Trace:	deals_publish_test.go:303
        	Error:      	Not equal: 
        	            	expected: 2
        	            	actual  : 1
        	Test:       	TestPublishNonVerifClient

@jennijuju jennijuju added P1 P1: Must be resolved and removed P1 P1: Must be resolved labels Sep 1, 2021
@magik6k magik6k force-pushed the feat/dealpub-validation branch from 62a2f25 to 22ce0ec Compare September 2, 2021 21:06
@magik6k magik6k force-pushed the feat/dealpub-validation branch 3 times, most recently from d55f551 to 8093f52 Compare September 3, 2021 17:12
@magik6k magik6k force-pushed the feat/dealpub-validation branch from 8093f52 to 42135ec Compare September 3, 2021 17:40
@BlocksOnAChain
Copy link
Contributor

@magik6k - I don’t know if it’s directly related to the tests we added for DealPublisher, but I see we are experiencing some flaky tests for this in our CI: https://app.circleci.com/insights/github/filecoin-project/lotus/workflows/ci/tests?branch=master&reporting-window=last-30-days.
Maybe we can take a look?
FYI: @jennijuju

@BlocksOnAChain BlocksOnAChain linked an issue Sep 6, 2021 that may be closed by this pull request
@BlocksOnAChain
Copy link
Contributor

Also @Stebalien created an issue with has logs related to this: #7252

@jennijuju jennijuju added this to the v1.11.3 milestone Sep 6, 2021
@jennijuju
Copy link
Member

@magik6k - I don’t know if it’s directly related to the tests we added for DealPublisher, but I see we are experiencing some flaky tests for this in our CI: https://app.circleci.com/insights/github/filecoin-project/lotus/workflows/ci/tests?branch=master&reporting-window=last-30-days.
Maybe we can take a look?
FYI: @jennijuju

The last commit should resolve it.

@jennijuju jennijuju merged commit 52cb19c into master Sep 6, 2021
@jennijuju jennijuju deleted the feat/dealpub-validation branch September 6, 2021 17:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
6 participants