Skip to content

ghostkey_lib: armour label comes from std::any::type_name, which is not guaranteed stable across compilers #180

Description

@sanity

ghostkey_lib 0.2 derives the armour label (-----BEGIN ..._V1-----) in Armorable::struct_name() from std::any::type_name::<Self>() (src/armorable.rs). The standard library documents type_name's output as a best-effort description that may change between compiler versions.

Why it matters: Harvest's reputation contract (freenet/harvest#143) requires an owner certificate to be in its canonical armour, byte for byte what re-armouring the parsed certificate gives. That closes a free-text channel on a permanent record. If a toolchain bump changed type_name's output, the canonical armour would change, and certificates armoured by an earlier build would stop verifying.

Harvest pins the current bytes: a native test, plus a rehearsal against the contract WASM on a real node. That catches a change when Harvest rebuilds. It does not stop one happening.

Suggestion: use a fixed label per type (a const LABEL: &str on the trait, defaulting to today's values), so the wire form does not depend on the compiler.

[AI-assisted - Claude]

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions