Skip to content

feat(maintainable): record how many keys were extended in MaintenanceState #4

Description

@0dillon

Summary

MaintenanceState stores last_maintained and last_keeper
(crates/maintainable/src/types.rs). extend_all returns the number of keys it extended, but that
number is thrown away — a cross-contract reader only sees that something happened.

rent_vault pays a tip based on lk_state(). It currently cannot tell a run that extended every
declared key from one that extended none because they were all above the threshold. Storing the
count gives the vault something to check and gives keepers an auditable record.

This changes a stored #[contracttype], so it needs a decision about existing deployments — the
testnet contracts hold state in the old shape.

Acceptance Criteria

  • MaintenanceState gains a field for the number of keys extended on the last run.
  • __lk_extend_all writes it.
  • The Maintained event carries the same count.
  • A test asserts the count is 0 for a no-op run above the threshold, and the full key count for
    a run below it.
  • The compatibility break is written down: what happens when lk_state() reads an entry
    written by the old layout, and what an adopter has to do about it.

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