Skip to content

Split the interface version into protocol and pre-release-version (curr)#212

Merged
leighmcculloch merged 1 commit intocurrfrom
leighmcculloch-patch-1
Sep 1, 2024
Merged

Split the interface version into protocol and pre-release-version (curr)#212
leighmcculloch merged 1 commit intocurrfrom
leighmcculloch-patch-1

Conversation

@leighmcculloch
Copy link
Member

@leighmcculloch leighmcculloch commented Aug 31, 2024

What

Split the 64bit interface version field in the env meta into two separate fields for the data it contains.

Why

The interface version is a 64bit value that contains two 32 bit values, the protocol version and the prerelease version.

In formal releases the prerelease version is always zero.

Because the values are joined together in the 64bit value it renders are a confusing large number that developers don’t understand. Humans can’t see a large integer and know that it actually means “protocol 21”.

While there has been some attempt to render the larger number as its components in developer tooling like the CLI, developers end up looking at the code decoded in other formats based off the xdr structure, such as the json equivalent, and seeing the large integers still.

There was discussion in the following thread about splitting the components into their own env meta key value pairs, and in hindsight that’s how we should have implemented it in the first place:

However, we can get 80% of the benefit by changing the xdr structure to interpret the existing bytes as two distinct fields. It’ll be backwards compatible.

Visible difference in developer tooling:

Before:

$ wasm-cs contract.wasm read contractenvmetav0 --format binary \
    | stellar-xdr decode --type ScEnvMetaEntry --input stream --output json-formatted
{
  "sc_env_meta_kind_interface_version": 94489280512
}

After:

$ wasm-cs contract.wasm read contractenvmetav0 --format binary \
    | stellar-xdr decode --type ScEnvMetaEntry --input stream --output json-formatted
{
  "sc_env_meta_kind_interface_version": {
    "protocol": 22,
    "pre_release": 0
  }
}

@leighmcculloch leighmcculloch changed the title Split the interface version into protocol and pre-release-version Split the interface version into protocol and pre-release-version (curr) Sep 1, 2024
@leighmcculloch leighmcculloch merged commit 2a23ba5 into curr Sep 1, 2024
@leighmcculloch leighmcculloch deleted the leighmcculloch-patch-1 branch September 1, 2024 23:35
github-merge-queue bot pushed a commit to stellar/rs-soroban-env that referenced this pull request Sep 3, 2024
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

Comments