fix(cli/rpc): --cid-base works in all commands#11239
Merged
Conversation
Passing --cid-base=base32 now returns CIDv1 in base32 everywhere, including block, dag stat, and object patch which previously ignored it. - cidbase: auto-upgrade CIDv0 when base is not base58btc, deprecate --upgrade-cidv0-in-output, remove GetLowLevelCidEncoder - block stat/put/rm: use GetCidEncoder - dag stat: store CID as pre-encoded string, drop MarshalJSON/UnmarshalJSON - object patch rm-link/add-link: use GetCidEncoder - bitswap: switch to GetCidEncoder
guillaumemichel
approved these changes
Mar 18, 2026
Contributor
guillaumemichel
left a comment
There was a problem hiding this comment.
Looks good overall
What should be the behaviour if both --format=v0 and --cid-base=base32 are supplied? It would be nice to have a test asserting a well-defined behaviour.
Also we could add harness tests to assert flags work as expected with block, dag stat, object patch.
Remove unused DagStat.String() which truncated CIDs. Add CLI tests for --cid-base across block, dag stat, and object patch commands, including the --format=v0 interaction.
… chroot Use GetCidEncoder in commands that were still outputting CIDs via raw .String() calls. - refs local: encode blockstore keys with the requested base - object diff: encode Before/After CIDs in text encoder - pin remote add/ls: pass encoder through toRemotePinOutput - files chroot: encode old/new root CIDs in status message - tests: use base16 to avoid false positives if base32 becomes default
Add harness tests for add, add -Q, pin ls, and dag import. Fix object patch tests broken by upstream UnixFS validation. Use base16 in all tests to avoid false positives.
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.
Passing
--cid-base=base32now returns CIDv1 in base32 everywhere, includingblock,dag stat, andobject patchwhich previously ignored it.Changes
upgrade-cidv0-in-output, removeGetLowLevelCidEncoderGetCidEncoderMarshalJSON/UnmarshalJSONobject patch rm-link/add-link: useGetCidEncoderGetCidEncoder