feat(gnoland): add block_height and chain_id to GnoTxMetadata#5390
feat(gnoland): add block_height and chain_id to GnoTxMetadata#5390moul wants to merge 3 commits into
Conversation
Extend GnoTxMetadata with BlockHeight and ChainID fields to support chain upgrade tx export/import. The genesis replay ContextFn now also applies block height from metadata during genesis tx execution. These fields use omitempty so existing JSONL files remain compatible.
🛠 PR Checks SummaryAll Automated Checks passed. ✅ 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):No automated checks match this pull request. ☑️ Contributor Actions:
☑️ Reviewer Actions:
📚 Resources:Debug
|
Tests serialization/deserialization of TxWithMetadata with all metadata fields (Timestamp, BlockHeight, ChainID) through JSONL and genesis replay. Also verifies backward compatibility with old format lacking new fields.
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
| Timestamp int64 `json:"timestamp"` | ||
| Timestamp int64 `json:"timestamp"` | ||
| BlockHeight int64 `json:"block_height,omitempty"` | ||
| ChainID string `json:"chain_id,omitempty"` |
There was a problem hiding this comment.
Are you planning to use the ChainID field in a future PR? As it stands, it looks like dead code.
I see it’s being populated on the tx-archive side, but I don’t really get the goal there either (looks like it's never read). Maybe your intent is to specify where a TX comes from in each jsonl line? If that's the goal, I’m wondering if just defining it at the file level would be enough, so we don't unnecessarily duplicate the same data on every line of the jsonl.
Either way, it’d be good to add a comment explaining why this field is there.
There was a problem hiding this comment.
The goal is to ensure the exported value is complete for validating signatures and replaying under similar conditions. We aim to use it as soon as it makes sense, but we want to make it available now to ensure completeness.
- Revert premature doc references to gnoland-1 chain ID in gas-fees.md and explore-with-gnoweb.md (hardfork hasn't happened yet) - Remove premature "Note" callout from gnoland-networks.md - Update migrate-from-gnoland1.sh: reflect Scenario A decision (genesis tx-replay with InitialHeight), document blockers (#5411, #5390, Jae's InitialHeight tm2 work), reference issue #5374 for tracking - Update gnoland-1/README.md: reflect correct PR merge status, document Scenario A approach, list migration blockers explicitly
Summary
GnoTxMetadatawithBlockHeight(int64) andChainID(string) fields, both withomitemptyfor backward compatibilityContextFninloadAppStateto also apply block height from metadata during genesis tx executionTestInitChainer_MetadataBlockHeighttest verifying block height is correctly set during genesis replayContext
Part of the chain upgrade (gnoland1 → gnoland-1) tx export/import pipeline. These fields allow preserving the original block height and chain ID when exporting transactions for genesis assembly.
Companion PR: gnolang/tx-archive — backup populates these new fields, plus new
genesis-assemblecommand.Related PRs: #5334, #5368, #5376, #5377
Test plan
TestInitChainer_MetadataBlockHeightpasses — deploys a realm capturingruntime.ChainHeight()at genesis, verifies captured height matches metadataTestInitChainer_MetadataTxsstill passesomitempty— old JSONL files without new fields still deserialize correctlyAI-assisted: code generated with Claude Code