Skip to content

fix: --cid-base works in all commands and auto-upgrades CIDv0#11239

Open
lidel wants to merge 1 commit intomasterfrom
fix/cid-base-auto-upgrade
Open

fix: --cid-base works in all commands and auto-upgrades CIDv0#11239
lidel wants to merge 1 commit intomasterfrom
fix/cid-base-auto-upgrade

Conversation

@lidel
Copy link
Copy Markdown
Member

@lidel lidel commented Mar 17, 2026

Passing --cid-base=base32 now returns CIDv1 in base32 everywhere, including block, dag stat, and object patch which previously ignored it.

Changes

  • 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

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
@lidel lidel marked this pull request as ready for review March 17, 2026 18:44
@lidel lidel requested a review from a team as a code owner March 17, 2026 18:44
Copy link
Copy Markdown
Contributor

@guillaumemichel guillaumemichel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment on lines +306 to +307
if len(cidStr) > 20 {
cidStr = cidStr[:20]
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why truncate at 20 bytes? An explanation would help

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants