Summary
Three pub helpers in campaign/src/storage.rs are defined but never called from any contract entrypoint and never referenced again outside their own definition:
pub fn bump_all_persistent(env: &Env, milestone_count: u32)
pub fn get_contract_status(env: &Env) -> Option<u32>
pub fn set_contract_status(env: &Env, status: u32)
DataKey::ContractStatus exists only to back helpers (2) and (3) — it has no other consumers.
Location
campaign/src/storage.rs:
- Lines 312–327 —
get_contract_status / set_contract_status and the DataKey::ContractStatus references.
- Lines 377–399 —
bump_all_persistent; the doc-comment on line 377 explicitly references a bump_storage admin function ("Call this from a bump_storage admin function to prevent archival during long-running campaigns") — no such function exists on CampaignContract in lib.rs.
A cross-repo search confirms there are no callers:
$ grep -rn 'set_contract_status\|get_contract_status' --include='*.rs' .
./src/storage.rs:312:pub fn get_contract_status(env: &Env) -> Option<u32> {
./src/storage.rs:322:pub fn set_contract_status(env: &Env, status: u32) {
Impact
- Maintenance surface: future readers of
storage.rs will assume these helpers are part of a feature that isn't actually wired up, leading to speculative refactors and tests against hypothetical behaviour.
- API drift risk:
pub fn exposure means downstream integrators or static analysers will pick them up as part of the contract surface even though they are unreachable from any contract method.
- Dead-code warnings: clippy with
-D warnings (which is what CI runs — see .github/workflows/ci.yml job clippy) currently does not flag these because pub items default to "considered used" at the crate level. Adding #![deny(dead_code)] (or auditing for true dead code, e.g. with cargo udeps) would expose them.
Fix
Two reasonable options:
Option A — Delete the helpers (preferred if there is no plan to wire them up):
- Remove
get_contract_status, set_contract_status, and the DataKey::ContractStatus variant from types.rs (or keep the variant if it is reserved for future use).
- Remove
bump_all_persistent (and its milestone-iteration loop in storage.rs).
- Update the doc comment that references a non-existent
bump_storage admin function.
Option B — Wire them up: Add a bump_storage admin method on CampaignContract that calls storage::bump_all_persistent(env, ...), gated by creator.require_auth() and a freeze-aware check. Either remove or document the intended call sites for get_contract_status / set_contract_status so the ContractStatus key has a real consumer.
Severity
[LOW] — pure dead-code / dead-API surface; no behaviour change required to fix. Pick Option A or B as a follow-up so the contract surface and the on-disk storage keyset stay in sync.
Summary
Three
pubhelpers incampaign/src/storage.rsare defined but never called from any contract entrypoint and never referenced again outside their own definition:pub fn bump_all_persistent(env: &Env, milestone_count: u32)pub fn get_contract_status(env: &Env) -> Option<u32>pub fn set_contract_status(env: &Env, status: u32)DataKey::ContractStatusexists only to back helpers (2) and (3) — it has no other consumers.Location
campaign/src/storage.rs:get_contract_status/set_contract_statusand theDataKey::ContractStatusreferences.bump_all_persistent; the doc-comment on line 377 explicitly references abump_storageadmin function ("Call this from abump_storageadmin function to prevent archival during long-running campaigns") — no such function exists onCampaignContractinlib.rs.A cross-repo search confirms there are no callers:
Impact
storage.rswill assume these helpers are part of a feature that isn't actually wired up, leading to speculative refactors and tests against hypothetical behaviour.pub fnexposure means downstream integrators or static analysers will pick them up as part of the contract surface even though they are unreachable from any contract method.-D warnings(which is what CI runs — see.github/workflows/ci.ymljobclippy) currently does not flag these becausepubitems default to "considered used" at the crate level. Adding# would expose them.Fix
Two reasonable options:
Option A — Delete the helpers (preferred if there is no plan to wire them up):
get_contract_status,set_contract_status, and theDataKey::ContractStatusvariant fromtypes.rs(or keep the variant if it is reserved for future use).bump_all_persistent(and its milestone-iteration loop instorage.rs).bump_storageadmin function.Option B — Wire them up: Add a
bump_storageadmin method onCampaignContractthat callsstorage::bump_all_persistent(env, ...), gated bycreator.require_auth()and a freeze-aware check. Either remove or document the intended call sites forget_contract_status/set_contract_statusso theContractStatuskey has a real consumer.Severity
[LOW]— pure dead-code / dead-API surface; no behaviour change required to fix. Pick Option A or B as a follow-up so the contract surface and the on-disk storage keyset stay in sync.