-
Notifications
You must be signed in to change notification settings - Fork 0
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
fix: aggregation spec to use height instead of size #66
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -132,7 +132,7 @@ A Storefront principal can invoke a capabilty to offer an aggregate that is read | |
"offer": { "/": "bafy...many-cars" }, /* dag-cbor CID with offer content */ | ||
"piece": { | ||
"link": { "/": "commitment...aggregate-proof" }, | ||
"size": 10102020203013342343 | ||
"height": 4 /* height of the perfect binary tree for the aggregate */ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is "perfect" the right word? "Perfectly balanced" perhaps? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. According to the wikipedia
Which is why I use that term in data-segment lib |
||
} /* commitment proof for aggregate */ | ||
} | ||
}], | ||
|
@@ -141,14 +141,16 @@ A Storefront principal can invoke a capabilty to offer an aggregate that is read | |
} | ||
``` | ||
|
||
Invoking `aggregate/offer` capability submits an aggregate to a broker service for inclusion in one or more Filecoin deals. The `nb.offer` field represents a "Ferry" aggregate offer that is ready for a Filecoin deal. Its value is the DAG-CBOR CID that refers to a "Ferry" offer. It encodes a dag-cbor block with an array of entries representing all the CAR files to include in the aggregated deal. This block MUST be included in the CAR file that transports the invocation. Its format is: | ||
Invoking `aggregate/offer` capability submits an aggregate to a broker service for inclusion in one or more Filecoin deals. The `nb.piece` field represents the proof of the `piece` to be offered for the deal. It contains the proof CID `piece.link` together with the `piece.height` of the perfect binary tree computed for this aggregate. The `height` can be used to derive the leaf count (`2 ** height`), which can then be used to derive the `size` of the piece (`leafCount * Node.Size` where `Node.Size` is 32). | ||
|
||
The `nb.offer` field represents a "Ferry" aggregate offer that is ready for a Filecoin deal. Its value is the DAG-CBOR CID that refers to a "Ferry" offer. It encodes a dag-cbor block with an array of entries representing all the pieces to include in the aggregated deal. This array MUST be sorted in the exact same order as they were used to compute the aggregate piece CID. This block MUST be included in the CAR file that transports the invocation. Its format is: | ||
|
||
```json | ||
/* offers block as PieceInfo type, encoded as DAG-JSON (for readability) */ | ||
/* offers block as an adapted PieceInfo type (with tree `height` instead of `size`), encoded as DAG-JSON (for readability) */ | ||
[ | ||
{ | ||
"link": { "/": "commitment...car0" }, /* COMMP CID */ | ||
"size": 110101, | ||
"height": 110101, /* height of the perfect binary tree for the piece */ | ||
}, | ||
{ | ||
/* ... */ | ||
|
@@ -343,10 +345,13 @@ type AggregateOfferDetail struct { | |
|
||
type Offer [PieceInfo] | ||
|
||
# Adapted from `PieceInfo` type in filecoin | ||
# https://github.com/filecoin-project/go-state-types/blob/1e6cf0d47cdda75383ef036fc2725d1cf51dbde8/abi/piece.go#L47-L50 | ||
# Uses `height` field instead of `size`. `height` field can be used to derive `leafCount` and consequently `size`, while | ||
# allowing the usage of smaller numbers instead of `bigint`. | ||
type PieceInfo { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @Gozala by this change, I am considering to just rename Motivation would be to create a new name instead of relying on There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. IMO it's fine to leave as There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I really don't want to call it a If you want to rename perhaps call it a |
||
# Size in nodes. For BLS12-381 (capacity 254 bits), must be >= 16. (16 * 8 = 128) | ||
size Int | ||
# Height of the perfect binary tree for the piece | ||
height Int | ||
link Link | ||
} | ||
``` | ||
|
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.
should this be
pieceProof
or even justproof
? See rationale on other review commentThere 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.
Please lets not use term
proof
as we'll have inclusion proofs and ucans have their own proofs and it's going to get very confusing. I'm open to different name, but proof is just too confusingThere 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.
Actually can we just call this an
aggregate
instead ? Alternatively we could change it all toThere 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.
Also it's kind of a mistake that
height
/size
is not part of the CID itself.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.
@vasco-santos we should also check with spade team if they even need or care about the pieces here, I suspect they are not.
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 previously went back from
aggregate
topiece
given they by the end of the day are the same. Haveheight
andcid
, and perhaps in the future they could be encoded in the CID as you say.