feat(fxmigrate): scaffold Exporter CLI for Fabric to Fabric-X state migration#97
Open
sridhar-panigrahi wants to merge 2 commits intohyperledger:mainfrom
Open
Conversation
…ient Signed-off-by: Shridhar Panigrahi <sridharpanigrahi2006@gmail.com>
Signed-off-by: Shridhar Panigrahi <sridharpanigrahi2006@gmail.com>
Author
|
@cendhu — this is the Exporter CLI piece from the RFC. Adds tools/fxmigrate with the snapshot manifest verification, PDC filtering, version conversion, and the 5-phase export flow. Still need to add tests for reader.go (needs a real snapshot fixture) and wire up the --init-from-snapshot path on the committer side, but wanted to get eyes on the structure first. Let me know if anything looks off. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This adds
tools/fxmigrate— the Exporter CLI that handles the export side of the Fabric → Fabric-X migration pipeline from RFC hyperledger/fabric-x-rfcs#5 and epic #21.The tool reads a standard Fabric peer snapshot directory, filters out everything that doesn't belong in Fabric-X (PDC hashes, system chaincodes, implicit org collections), converts Fabric version pairs to Fabric-X scalar integers, and writes a genesis-data file that the committer's
--init-from-snapshotbootstrap mode can ingest.Structure
Follows the same layout as
fxconfig— cobra CLI, internal packages, unit tests:What the export command does
Five phases:
_snapshot_signable_metadata.jsonand verify SHA-256 checksums for all snapshot filespublic_state.datato discover which namespaces are presentFiltering
Per RFC §3.1, excluded from migration:
lscc,_lifecycle,cscc,qscc,escc,vscc$$h$$pattern) and PDC private state ($$p$$pattern)$$)\x00collectionprefix)Version conversion
Fabric stores versions as
(blockNum, txNum)pairs. Converted to Fabric-X scalar BIGINT:(blockNum << 32) | txNumTests
5 unit tests: manifest parsing (happy path, missing file, empty channel name), namespace filtering, key filtering.
Related
Signed-off-by: Shridhar Panigrahi sridharpanigrahi2006@gmail.com