Repository navigation
Conversation
DealDataRoot is part of the unsigned DealParams, so it is not covered by the client signature, and CBOR decoding leaves it at cid.Undef when the key is omitted. validateDealProposal only checked PieceCID, so such a proposal was accepted and persisted: CidFieldDef serialized cid.Undef as the one-character string "b", which cid.Parse rejects, so every subsequent Provider.Start() failed in ListActive/ListCompleted until the row was deleted by hand. - validateDealProposal: reject an undefined DealDataRoot next to the existing PieceCID guard, before signature verification. - fielddef: make CidFieldDef and CidPtrFieldDef refuse to marshal an undefined CID, so a value that cannot be read back is never written. Tests cover the acceptance rejection and the DB insert failure.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
A deal client could omit the
DealDataRootkey from theDealParamsCBOR map. The field is outside the signedClientDealProposal.Proposaland CBOR decoding tolerates its absence, so the proposal passed validation and was written to the deals DB. The DB layer serializedcid.Undefas the string"b", which cannot be parsed back, and a single such row makes every subsequentProvider.Start()fail inListActive/ListCompleted— i.e. one accepted deal permanently preventsboostdfrom starting until the row is removed manually.Root cause
DealParams.UnmarshalCBORzero-initializes the struct and only assigns keys that are present (generated code).validateDealProposalguardedproposal.PieceCID.Defined()but had no equivalent check forDealDataRoot.CidFieldDef.Marshallonly checked for a nil pointer and otherwise calledString();cid.Undef.String()is"b", andcid.Parse("b")returnscid too short.Because
DealDataRootis unused by the transfer / commP / publish path, the bad value is not noticed until the row is read back.Changes
storagemarket/deal_acceptance.go: reject an undefinedDealDataRootbefore signature verification, mirroring the existingPieceCIDcheck. This is the single acceptance path for libp2p deals (v1.2.0 and v1.2.1), offline deal proposals, contract-monitor deals andBoostDummyDeal.db/fielddef/fielddef.go:CidFieldDef/CidPtrFieldDefnow return an error instead of marshalling an undefined CID. A value that cannot be read back is never written.Tests
TestDealVerification/"deal data root undefined"— proposal is rejected withdeal data root undefined.TestDealsDBRejectsUndefinedCID— inserting a deal withcid.Undeffails withcannot marshal undefined cidand leaves the table untouched.Compatibility
DealDataRoothas existed since the first boost commit and is required by protocol 1.2.0; a zero-valued CID cannot even be marshalled, so omission is the only way to produceUndef.BoostDummyDeal(local admin API) now rejects hand-built params without a root.DealDataRoot = 'b'are not repaired automatically — see below.Upgrade note for affected nodes
A
boostdthat already has a poisoned row still fails to start after upgrading. Stop it and remove the row:If the row had already reached
Publishedor later, the deal exists on chain; verifyChainDealIDbefore deleting, since removing the row also removes boost's local tracking of it.