Skip to content

Normalize stellar-cli version rendering in stellar version and cliver meta #2535

@leighmcculloch

Description

@leighmcculloch

What problem does your feature solve?

The stellar-cli version is rendered inconsistently depending on how the CLI was installed. The same 26.0.0 release ends up as three different strings in the cliver meta of a built contract — and in the stellar version output — depending on the install method. This was raised in #2525 (comment).

Today, cliver (and stellar version) renders as {pkg}#{git} where {git} is whatever crate_git_revision produces at build time. That depends on the install path:

Homebrew (built from a crates.io tarball with no git context):

cliver: 26.0.0#

Cargo crates.io install (commit hash recorded in the package metadata):

cliver: 26.0.0#60f7458e7ecffddf2f2d91dc6d0d2db4fab03ecc

Cargo git install (built from a git checkout — git describe output):

cliver: 26.0.0#v20.0.0-836-gfe07b3678833e07c43235a6caaeccff81e146856

Three different strings for the same release makes downstream tooling (verifiers, registries, indexers) unable to reliably parse, compare, or validate the field, and makes verify's "expected vs. running" mismatch detection fragile.

What would you like to see?

Normalize the rendering of the stellar-cli version so it is always emitted in exactly one form, regardless of how the CLI was installed:

26.0.0#60f7458e7ecffddf2f2d91dc6d0d2db4fab03ecc

That is: {semver}#{full-40-char-commit-sha}.

This normalization should apply to both:

  1. The stellar version command output
  2. The cliver meta embedded into wasm during contract build

Once normalized, the format becomes a stable contract that:

What alternatives are there?

  • Document the three formats and have downstream tooling parse all of them. Cheaper short-term but pushes complexity onto every consumer of cliver forever, and leaves verify mismatch detection brittle which is already creating problems.
  • Drop the commit sha entirely and embed only {semver}. Simpler, but loses the ability to identify exactly which commit a build came from — important for security-relevant verification of contract builds.
  • Keep the semver-only format for release builds and only embed the sha for unreleased / dev builds. A middle ground, but produces two formats again.

Metadata

Metadata

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions