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
Add upgrade-safe storage layout versioning with assert_storage_layout_compatible called at module entry
Why this matters
DataKey and DataKey2 enums have grown across migrations without a top-level layout version stamp, and AlreadyAtTargetVersion/MigrationDowngradeNotAllowed are defined but never wired into a layout guard. Introduce a StorageLayoutVersion persistent key set during initialize, read on every state-changing entry, and rejected when the on-chain value is newer than the deployed binary expects.
Scope
Implement the requested behavior across src/lib.rs. The solution must preserve existing compatibility, authorization, and production safeguards.
Priority
High
Acceptance criteria
The requested behavior is implemented across src/lib.rs with a clear, reviewable contract.
Security, authorization, validation, and data-integrity requirements in the repository context are enforced and covered by tests.
Failure, retry, timeout, concurrency, and boundary behavior is explicit and produces safe, diagnosable outcomes where applicable.
Regression coverage includes empty, invalid, duplicate, and boundary inputs relevant to this flow.
Existing API, storage, and deployment compatibility is preserved unless a migration is explicitly documented.
Validation
Include focused tests for:
happy paths;
invalid input and authorization boundaries;
concurrency, retries, or failure recovery;
backward compatibility;
relevant integration or contract behavior.
The implementation must pass the repository’s existing build, lint, test, and formatting checks (use cargo test --all where applicable).
Non-goals
Typo-only, formatting-only, or documentation-only changes.
Unrelated refactors or dependency upgrades.
Weakening security, authorization, CI, or production safeguards.
Changing public behavior outside this issue’s scope.
Contributor application
Before implementation, comment with:
relevant experience;
a concise implementation approach;
expected files or modules affected;
an estimate for opening the first PR.
Wait for maintainer assignment before coding.
PR requirements
Use a feature branch and include Closes #.
The PR must:
address every acceptance criterion;
link each criterion to code and tests;
explain security and failure-mode handling;
include meaningful regression coverage;
document compatibility or migration considerations;
pass the repository checks.
Reward-readiness
This is a substantive quality issue. Merge status does not guarantee reward eligibility; final evaluation is determined separately.
Implementation context
Description
DataKey and DataKey2 enums have grown across migrations without a top-level layout version stamp, and AlreadyAtTargetVersion/MigrationDowngradeNotAllowed are defined but never wired into a layout guard. Introduce a StorageLayoutVersion persistent key set during initialize, read on every state-changing entry, and rejected when the on-chain value is newer than the deployed binary expects.
Summary
Add upgrade-safe storage layout versioning with assert_storage_layout_compatible called at module entry
Why this matters
DataKeyandDataKey2enums have grown across migrations without a top-level layout version stamp, andAlreadyAtTargetVersion/MigrationDowngradeNotAllowedare defined but never wired into a layout guard. Introduce aStorageLayoutVersionpersistent key set duringinitialize, read on every state-changing entry, and rejected when the on-chain value is newer than the deployed binary expects.Scope
Implement the requested behavior across src/lib.rs. The solution must preserve existing compatibility, authorization, and production safeguards.
Priority
High
Acceptance criteria
Validation
Include focused tests for:
The implementation must pass the repository’s existing build, lint, test, and formatting checks (use cargo test --all where applicable).
Non-goals
Contributor application
Before implementation, comment with:
Wait for maintainer assignment before coding.
PR requirements
Use a feature branch and include Closes #.
The PR must:
Reward-readiness
This is a substantive quality issue. Merge status does not guarantee reward eligibility; final evaluation is determined separately.
Implementation context
Description
DataKeyandDataKey2enums have grown across migrations without a top-level layout version stamp, andAlreadyAtTargetVersion/MigrationDowngradeNotAllowedare defined but never wired into a layout guard. Introduce aStorageLayoutVersionpersistent key set duringinitialize, read on every state-changing entry, and rejected when the on-chain value is newer than the deployed binary expects.Requirements and context
src/lib.rs(DataKey,DataKey2,initialize,AlreadyAtTargetVersion,MigrationDowngradeNotAllowed)Suggested execution
git checkout -b feat/storage-layout-versioningSTORAGE_LAYOUT_VERSION: u32constant and persistent keyassert_storage_layout_compatiblecalled at top of state-changing methodslayout_von initialize and on migrationsTest and commit
cargo test --allExample commit message
feat: enforce storage layout version on entry to state-changing methodsGuidelines