Skip to content

version_discovery_interfaces returns method symbols that do not exist: consumers querying "ver_info" and "mig_state" will fail against the real contract #516

Description

@usmanimamu17-create

---ISSUE---

Problem

version_discovery_interfaces (src/version_negotiation.rs) is documented as returning "a standard set of expected backend interface symbols that downstream contracts should expose for version discovery":

pub fn version_discovery_interfaces(env: &Env) -> Vec<Symbol> {
    let mut ifaces = Vec::new(env);
    ifaces.push_back(symbol_short!("ver_info"));
    ifaces.push_back(symbol_short!("mig_state"));
    ifaces.push_back(symbol_short!("is_paused"));
    ifaces
}

The actual contract methods are get_version_info, get_migration_state, and is_pausedver_info and mig_state do not exist as methods anywhere in the crate.

Consequences:

  • A consumer following the discovery protocol will invoke nonexistent functions: the documented use ("downstream contracts should expose for version discovery") tells peers to implement/query ver_info; calling ver_info on this contract fails at the host boundary, so the discovery protocol is unusable as specced.
  • The helper gives false guidance to the multi-contract ecosystem: version_negotiation.rs's whole purpose is a standard protocol for peers; the discovery list is the one part of the protocol that names concrete entry points, and half of them are wrong.
  • No test catches the mismatch: the tests assert the symbols are returned and distinct, but never assert that the symbols correspond to real methods.

Root cause

The discovery symbols were chosen as short aliases and never reconciled with the actual method names; the module was merged unwired (companion issue) so the mismatch went unexercised.

Why this is architecturally hard

  1. The fix options: (a) return the real method names (get_version_info, get_migration_state, is_paused — but these exceed symbol_short's 9-char limit, so the function would need full Symbol::new values), or (b) document that the aliases are protocol-level names peers must map — which contradicts "expected backend interface symbols".
  2. The module is unwired (companion issue); fixing the list before wiring means deciding whether the discovery protocol is a real contract or aspirational documentation.
  3. Any change should add a test asserting each returned symbol resolves to an actual method on the contract surface (the descriptor-completeness companion issue's machinery would catch this class).

Acceptance criteria

  • Every symbol returned by version_discovery_interfaces corresponds to a real, callable method (or the function is removed/re-scoped).
  • A test links the discovery list to the actual method surface.
  • The version-negotiation docs describe the discovery protocol accurately.

Out of scope

Wiring the negotiation protocol into the contract (companion issue) and the coordination harness scope (companion issue).

Getting started

just test

Good first files to read: apexchainx_calculator/src/version_negotiation.rs (version_discovery_interfaces), apexchainx_calculator/src/lib.rs (method names).

Activity

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

Metadata

Metadata

Assignees

Labels

GrantFox OSSIssue tracked in GrantFox OSSMaybe RewardedIssue may be eligible for a GrantFox rewardStellar WaveIssues in the Stellar wave programThird CampaignCampaign: Third Campaignarea/apiImported campaign issue labelpriority/highImported campaign issue label

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions