-
Notifications
You must be signed in to change notification settings - Fork 445
docs(genesis): add documentation genesis_txs.jsonl file #5024
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
base: master
Are you sure you want to change the base?
Conversation
🛠 PR Checks Summary🔴 Pending initial approval by a review team member, or review from tech-staff Manual Checks (for Reviewers):
Read More🤖 This bot helps streamline PR reviews by verifying automated checks and providing guidance for contributors and reviewers. ✅ Automated Checks (for Contributors):🟢 Maintainers must be able to edit this pull request (more info) ☑️ Contributor Actions:
☑️ Reviewer Actions:
📚 Resources:Debug
|
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
| "github.com/gnolang/gno/tm2/pkg/std" | ||
| ) | ||
|
|
||
| func createGenesisTxsFile(outputPath string, privKey secp256k1.PrivKeySecp256k1, chainID string) error { |
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.
You can use embedmd to extract the code
Example: https://github.com/gnolang/gno/blob/master/docs/builders/example-minisocial-dapp.md?plain=1
|
|
||
| ### Transaction Structure | ||
|
|
||
| Each line contains a `TxWithMetadata` object: |
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.
nitpick: There's multiple lines in the following example.
It would be better to have like:
The file contains an array of TxWithMetadata object:
|
|
||
| ### Transaction Ordering | ||
|
|
||
| Transactions **must be sorted by timestamp before writing** to ensure deterministic ordering when replaying genesis state. The sorting is not done automatically when reading, you must sort manually using `slices.SortStableFunc` as shown above. |
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 think move this above the example
Davphla
left a comment
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.
Some nitpicks, but LGTM!
I didn't retry the script but it looks correct to me.
Co-authored-by: David <[email protected]>
This PR is made since in the past i created a tool for samourai zenao project to generate txs file from a SQL database state and struggled to find informations about how to generate a genesis_txs.jsonl from scratch.
I thought it was a "unique" case but then a student from the student programs asked how to do the same.
I explained him, but i thought it would be nice to add some documentation on the format and how to create a genesis_txs.jsonl file.
My generator of genesis_txs file for zenao: https://github.com/samouraiworld/zenao/blob/03b5ef5f39e2a2cf987c4eacea6b6f3cd10a0b2a/backend/gzchain/gentxs.go