-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
feat: file base genesis source/target #13724
Conversation
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## main #13724 +/- ##
==========================================
+ Coverage 56.25% 56.82% +0.56%
==========================================
Files 667 640 -27
Lines 56576 55047 -1529
==========================================
- Hits 31829 31280 -549
+ Misses 22165 21217 -948
+ Partials 2582 2550 -32
|
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.
lgtm, just few nits! I'd like to still have @aaronc review this as he's the one who described this feature.
Thanks @JayT106 🙏. Looks good so far. Will try to do a more thorough review later today. |
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.
This looks like a great start thank you @JayT106 !
We need to handle the spec correctly which I tried to outline in my comments. Apologies if this wasn't clear before. Let me know if the comments make sense.
d62bb9c
to
7db3988
Compare
not sure how to pass the dependency review with |
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 work and thank you for this change @JayT106! I've added a review, please take a look.
de4e5fc
to
f77db62
Compare
Yep, I don't know either, but we should investigate given that it is starting to block multiple PRs: #13701 (comment) |
submit an issue to tendermint |
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.
Thank you for this change @JayT106 and for your patience! I've sent my second round of review but the highlight here is that:
- No need to create a bytes.Buffer then do buf.ReadFrom(reader), then do buf.Bytes() or buf.String(); there is io.ReadAll(reader) per https://pkg.go.dev/io#ReadAll which will sort things out
- Anytime you find yourself doing .Write([]byte(str)) then later a comparison in which you have to convert bytes to a string just to compare with str, that means you could have rather kept the value of str as a byteslice
Thank you!
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.
This seems like it's going conceptually in the right direction now @JayT106. But I think the logic is not quite correct yet and could be simplified.
Basically when a FileGenesisSource
is created we have three things:
sourceDir
moduleName
- the
RawJSON
that came fromapp_state_bytes
fromRequestInitChain
I don't think we should be trying to open <sourceDir>/genesis.json
, instead the function creating FileGenesisSource
should have already parsed app_state_bytes
from RequestInitChain
and passes the json.RawMessage
for that module into FileGenesisSource
.
Then we try first reading <module>/<field>.json
, then <module>.json
, and finally the json.RawMessage
that got passed into NewFileGenesisSource
Co-authored-by: Aaron Craelius <aaron@regen.network>
Co-authored-by: Aaron Craelius <aaron@regen.network>
@aaronc could we get a review from you on this pr |
I guess with the new collections feature solving the genesis streaming problem, there's less motivation to pursue this PR? Or can this PR work together with collections? @JayT106 |
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.
The genesis API that we ended up adopting in core (and that collections and ORM use) is significantly simpler than the one originally proposed. There is no need to support the Read/WriteMessage
and Read/WriteRawJSON
methods anymore so these can be deleted from this PR. That should make the implementation significantly simpler. Do you intend to move this forward with those changes @JayT106? If not someone on the SDK team can probably push it over the finish line.
I would note that file based genesis is not supported yet in the SDK or collections. So at some point we'll need to pick up the remaining pieces to get it to work (some of which can be pulled from this PR) |
ADR-061 defined the genesis source/target interface as part of the core APIs. This PR implements the file-based genesis source/target suggested by #12808 (comment) and is able to support reworking the genesis import/export in PR #13032 .
Author Checklist
All items are required. Please add a note to the item if the item is not applicable and
please add links to any relevant follow up issues.
I have...
!
to the type prefix if API or client breaking changeCHANGELOG.md
Reviewers Checklist
All items are required. Please add a note if the item is not applicable and please add
your handle next to the items reviewed if you only reviewed selected items.
I have...
!
in the type prefix if API or client breaking change