Skip to content

test(registry): re-register a contract after deregister and check the index #6

Description

@0dillon

Summary

deregister removes an entry by swap-remove: the last index slot is moved into the freed one and
the count drops. There is a test for removing the middle of three entries, but none for registering
again afterwards. That is the path where a stale Slot or Index key would surface, and it is the
normal path for a contract that fixes a bad manifest.

Acceptance Criteria

  • A test registers three contracts, deregisters the middle one, then registers a fourth.
  • It asserts count is correct at each step.
  • It asserts page returns every live entry exactly once, with no gaps and no duplicates.
  • It asserts the re-registered contract is reachable through get.
  • A contract that deregisters and then re-registers itself is covered, since that is the
    manifest-correction path.

Tech Stack

Rust (edition 2021, toolchain 1.93.0 pinned in rust-toolchain.toml), soroban-sdk 27.0.4,
target wasm32v1-none. Build with stellar contract build, never cargo build. Tests are
#[cfg(test)] modules on Env::default(); run them with cargo test --all.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions