-
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
Custom JSON serialization of TipSetKey for array-of-CIDs #756
base: main
Are you sure you want to change the base?
Conversation
It is a bit annoying on the Go side in Lotus that this will round-trip just fine but we still end up with a non-standard |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #756 +/- ##
==========================================
- Coverage 69.68% 69.56% -0.12%
==========================================
Files 74 74
Lines 7494 7551 +57
==========================================
+ Hits 5222 5253 +31
- Misses 1863 1884 +21
- Partials 409 414 +5
|
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.
Thanks for this PR; the keys look much more readable.
I don't believe this would introduce breaking changes anywhere. I'm specifically thinking about the observer data already collected.
@Kubuxu can you think of any?
I would only be worried about end-users, but given that things are not active yet, the impact would be negligible. |
I'd definitely do this. I'd also:
|
OK, a few edits and some more additions to get the fully desired output from Lotus. Here's what the current output is for {
"GPBFTInstance": 43253,
"ECChain": [
{
"Key": [
{ "/": "bafy2bzacedjge4udf4ti5uqqhclqj4nhoolcoeonrysoy226hbdww4fhg2rkk" },
{ "/": "bafy2bzacedv47mijo2ipmsnf3fpqpvoyfjmtfrwp67356kmivjfyugfkwlo2g" },
{ "/": "bafy2bzaceciho5erd6n6mapqwagpa5u34zylf6kdtiajlq2lbjzxugn6c5fse" }
],
"Commitments": "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=",
"Epoch": 2176643,
"PowerTable": { "/": "bafy2bzaceb4gykw257fov6df5mnyjsvpjxkpapzyxmguexwcmwzf72pued5cw" }
}
],
"SupplementalData": {
"Commitments": "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=",
"PowerTable": { "/": "bafy2bzacebf32gcvjz7qy65yz634ekyng5hknegnytda7z6wfm5seoaqebbj4" }
},
"Signers": [ 0, 2, 1, 2, 1, 1 ],
"Signature": "qrzTiqqfeK5ywyt1nY0/7m6/HAEUykw3AYUuTvlsb7nRIZnTX7DueIO3XyKRd4IME0DzLPTnBUkOQ9qA+d//n++NV6rjuznMCHN32ub8DZTC3yVuqeZGWOVAbstBrHbT",
"PowerTableDelta": [
{
"ParticipantID": 138097,
"PowerDelta": "-839889444667392",
"SigningKey": null
}
]
} |
Commitment is standard Go base64-padded encoded btw, not multibase. I'm not sure it makes much sense to multibase it unless it's going to be typed as a multibase in Go too. Which would be fine by me but I think this is baked into the protocol now as 32 plain bytes? |
It is baked as 32 bytes explicitly. |
It's baked into the protocol as 32 bytes, but the protocol doesn't really care about the json representation. But leaving it as-is is also fine. |
@masih would you mind having another look now that I've expanded scope please? |
🤷 is this OK to do here?
Basically: the byte form of a TipSetKey isn't very useful as a consumer of the Lotus API, we don't give it like that anywhere. So a user would have to decoded the base64 bytes, extract the CIDs from it using one of the CID libraries, then re-form it back into the array-of-CIDs dag-json form to post it back to a Lotus API to do anything with it (like calling
ChainGetTipSet
).Before:
After:
(different epoch but you get the idea)
But now I can at least feed that tsk back into lotus:
An alternative would be to not expose
certs.FinalityCertificate
directly in Lotus but to wrap it in a new struct that uses the native LotusTipSetKey
: https://github.com/filecoin-project/lotus/blob/5791b4a9786bc259df2c1cc2775fd9aaf62d25fb/api/api_full.go#L984-L987