-
Notifications
You must be signed in to change notification settings - Fork 7
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
Make ECChain opaque [][]byte in GBPFT #149
Conversation
What if we just agreed on opaque byte slices and let the client deal with all the serialization and deserialization? This package doesn't actually care about the structure of the data, correct? I.e.: type ECChain [][]byte |
It might care about power table in there |
Is there a specific reason for not removing the redundant data from phases other than QUALITY? That seems like a more optimal solution IMHO. |
IMO, it shouldn't. |
Right, the protocol code never inspects the CID, and doesn't generally have access to the corresponding (non-finalised, or non-lookback) table. So @Stebalien 's suggestion is pretty good – I will try it out.
We can still do that. I'm not not doing that, if you know what I mean. But it's a much larger change. We can try that after this, if we think it's worthwhile. |
Thank you, yes I think it is worth it. |
@Stebalien @Kubuxu @masih I've implemented this now. Please see updated PR description and re-review. |
…set ID. Changes the TipsetID type to be [][]byte, removing an additional serialization and making it unusable as a map key.
// - a commitment to the resulting power table, | ||
// - a commitment to additional derived values. | ||
// However, GossipPBFT doesn't need to know anything about that structure. | ||
type TipSet = []byte |
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 am curious: why type alias instead of type definition?
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.
cbor-gen was unable to generate correct (compiling) code for [][]byte. A type definition would have been slightly better, but this isn't a yak I'm prepared to shave.
|
||
func (t TipSetID) Bytes() []byte { | ||
return []byte(t.value) | ||
} |
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.
nice 👍
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.
SGTM
This patch implements the changes described in filecoin-project/FIPs#1004. Unfortunately, go-f3 now needs to be aware of the internal structure of `TipSet` objects as it sends them over the wire in one format, but signs another. This effectively reverts #149. Specific changes: 1. On the wire (and in finality certificates), `TipSet` objects are now directly cbor-marshaled within the payload instead of first being marshaled to byte strings. 2. Instead of directly covering the entire tipset list with the payload signature: 1. `TipSet` objects are "marshaled for signing" per the FIP change proposed above. 2. These marshaled tipset objects are stuffed into a merkle tree. 3. The merkle tree root is signed (along with the payload's other fields), again according the proposed changes. fixes #166
This patch implements the changes described in filecoin-project/FIPs#1004. Unfortunately, go-f3 now needs to be aware of the internal structure of `TipSet` objects as it sends them over the wire in one format, but signs another. This effectively reverts #149. Specific changes: 1. On the wire (and in finality certificates), `TipSet` objects are now directly cbor-marshaled within the payload instead of first being marshaled to byte strings. 2. Instead of directly covering the entire tipset list with the payload signature: 1. `TipSet` objects are "marshaled for signing" per the FIP change proposed above. 2. These marshaled tipset objects are stuffed into a merkle tree. 3. The merkle tree root is signed (along with the payload's other fields), again according the proposed changes. fixes #166
This patch implements the changes described in filecoin-project/FIPs#1004. Unfortunately, go-f3 now needs to be aware of the internal structure of `TipSet` objects as it sends them over the wire in one format, but signs another. This effectively reverts #149. Specific changes: 1. On the wire (and in finality certificates), `TipSet` objects are now directly cbor-marshaled within the payload instead of first being marshaled to byte strings. 2. Instead of directly covering the entire tipset list with the payload signature: 1. `TipSet` objects are "marshaled for signing" per the FIP change proposed above. 2. These marshaled tipset objects are stuffed into a merkle tree. 3. The merkle tree root is signed (along with the payload's other fields), again according the proposed changes. fixes #166
This patch implements the changes described in filecoin-project/FIPs#1004. Unfortunately, go-f3 now needs to be aware of the internal structure of `TipSet` objects as it sends them over the wire in one format, but signs another. This effectively reverts #149. Specific changes: 1. On the wire (and in finality certificates), `TipSet` objects are now directly cbor-marshaled within the payload instead of first being marshaled to byte strings. 2. Instead of directly covering the entire tipset list with the payload signature: 1. `TipSet` objects are "marshaled for signing" per the FIP change proposed above. 2. These marshaled tipset objects are stuffed into a merkle tree. 3. The merkle tree root is signed (along with the payload's other fields), again according the proposed changes. fixes #166
This patch implements the changes described in filecoin-project/FIPs#1004. Unfortunately, go-f3 now needs to be aware of the internal structure of `TipSet` objects as it sends them over the wire in one format, but signs another. This effectively reverts #149. Specific changes: 1. On the wire (and in finality certificates), `TipSet` objects are now directly cbor-marshaled within the payload instead of first being marshaled to byte strings. 2. Instead of directly covering the entire tipset list with the payload signature: 1. `TipSet` objects are "marshaled for signing" per the FIP change proposed above. 2. These marshaled tipset objects are stuffed into a merkle tree. 3. The merkle tree root is signed (along with the payload's other fields), again according the proposed changes. fixes #166
* EVM-friendly TipSet and ECChain formats This patch implements the changes described in filecoin-project/FIPs#1004. Unfortunately, go-f3 now needs to be aware of the internal structure of `TipSet` objects as it sends them over the wire in one format, but signs another. This effectively reverts #149. Specific changes: 1. On the wire (and in finality certificates), `TipSet` objects are now directly cbor-marshaled within the payload instead of first being marshaled to byte strings. 2. Instead of directly covering the entire tipset list with the payload signature: 1. `TipSet` objects are "marshaled for signing" per the FIP change proposed above. 2. These marshaled tipset objects are stuffed into a merkle tree. 3. The merkle tree root is signed (along with the payload's other fields), again according the proposed changes. fixes #166 * test marshal payload for signing * slightly optimize hashing * add a worst-case benchmark for marshalling payloads * address feedback * Fake marshaling for testing * pre-allocate when marshaling tipsets * combine signer/verifier and MarshalPayloadForSignature Into a single Signatures interface. * tipset marshal for signing test * Test bad merkle-tree paths
Removes all internal structure from ECTipset and ECChain, making them entirely opaque. Adds a key type which just stringifies the bytes, ensuring that the entire value is used as a map key. Note that this doesn't yet exactly match the draft FIP (#148).
The internal structure of chain values now needs to be specified elsewhere, but GPBFT will never introspect it.
This also deleted some useful tests for the consistency of chains. When a new type is introduces at the integration layer, those tests should be restored there instead.
Previous PR description below (just introduces the key type) :
This also changes the TipsetID type to be
[][]byte
, removing an additional serialization step and, by design, making it unusable as a map key. Note that this doesn't yet exactly match the draft FIP (#148).Review: please critique this design and suggest alternatives. There is an outstanding problem of generating a unique key for
[][]byte
(for both keying and signing) that will incorporate the slice boundaries. Ideas welcome.Closes #147.