You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Test the version surface and uninitialized-call failures
Description
src/lib.rs exposes two distinct version concepts — version() returning the symbol ROUTER_V2 and get_schema_version() returning the storage schema number — and a class of NotInitialized (#2) failures when admin-gated entrypoints are called before init. The existing suite checks version() once and the happy-path migration, but never asserts that admin entrypoints (pause, set_pair_fee_bps, propose_admin_transfer, migrate_v1_to_v2, etc.) panic with #2 on a fresh, uninitialized contract. This issue adds that coverage.
Write code in:src/lib.rs — no production change expected (open a follow-up if a gap is found).
Write comprehensive tests in:src/lib.rs#[cfg(test)] mod test — the version + NotInitialized suite described above.
Add documentation: note the lifecycle test matrix in README.md or docs/testing.md.
Include NatSpec-style doc comments (///) on any new test helper.
Validate security assumptions: no admin entrypoint succeeds before initialization; the two version concepts are clearly separated.
Test and commit
Test and commit
Run cargo fmt --all -- --check, cargo build, and cargo test.
Cover edge cases and failure paths: uninitialized pause/fee/transfer/migrate, schema-version default, version constant.
Include the full cargo test output and a short security notes section in the PR description (threat model + mitigations).
Example commit message
test: cover version surface and uninitialized-call NotInitialized paths
Guidelines
Minimum 95 percent test coverage for impacted modules.
Clear, reviewer-focused documentation.
Timeframe: 96 hours.
Community & contribution rewards
💬 Join the StableRoute community on Discord for questions, reviews, and faster merges:https://discord.gg/37aCpusvx
⭐ This is a GrantFox OSS / Official Campaign task and may be rewarded. When your PR is merged you'll be prompted to rate the project — if this issue and the maintainers helped you ship, we'd be grateful for a 5-star rating. Clear questions in Discord and tidy, well-tested PRs are the fastest path to a merge and a reward.
Test the version surface and uninitialized-call failures
Description
src/lib.rsexposes two distinct version concepts —version()returning the symbolROUTER_V2andget_schema_version()returning the storage schema number — and a class ofNotInitialized(#2) failures when admin-gated entrypoints are called beforeinit. The existing suite checksversion()once and the happy-path migration, but never asserts that admin entrypoints (pause,set_pair_fee_bps,propose_admin_transfer,migrate_v1_to_v2, etc.) panic with #2 on a fresh, uninitialized contract. This issue adds that coverage.Requirements and context
version()is stable (ROUTER_V2) and independent ofget_schema_version().init-ed, each admin-gated entrypoint panics withNotInitialized(Bump persistent-entry TTL on every router storage read and write to prevent state expiry #2) — use#[should_panic(expected = "Error(Contract, #2)")].get_schema_versionreturns 1 before any init/migration (default fallback).initfor the negative cases (do not reusesetup_initialized).Suggested execution
git checkout -b test/contracts-40-version-uninitialized-testssrc/lib.rs— no production change expected (open a follow-up if a gap is found).src/lib.rs#[cfg(test)] mod test— the version + NotInitialized suite described above.README.mdordocs/testing.md.///) on any new test helper.Test and commit
cargo fmt --all -- --check,cargo build, andcargo test.cargo testoutput and a short security notes section in the PR description (threat model + mitigations).Example commit message
test: cover version surface and uninitialized-call NotInitialized pathsGuidelines
Community & contribution rewards