Repository navigation
fix(contracts): split large lib.rs and centralize TTL (#1324 #1323 #1322 #1325) - #1412
Merged
Hexstar-labs merged 2 commits intoOct 21, 2026
Merged
Conversation
… centralize TTL constants (BrainTease#1323) - Split large lib.rs files into types, storage, and logic modules per contract (BrainTease#1324) - Extracted inline test modules into separate test files (contract_tests.rs) - Moved types, storage keys, and event constants into types.rs modules - Split analytics and governance impl into query/legacy modules with thin wrappers - Moved types/storage from buyback, credential_metadata, grants, certificate, badges, nft, token, registry, token into types.rs - Centralized TTL constants in shared/constants.rs (BrainTease#1323) - Replaced hardcoded TTL values with shared constants across contracts - Added STORAGE_TTL_THRESHOLD and STORAGE_TTL_EXTEND_TO to shared - Added test snapshots untracking (BrainTease#1325) - Added test_snapshots/ to .gitignore - Removed tracked snapshot files from index - Added market batched reads and gas test scaffolding (BrainTease#1322) - Added batched read helpers in market/storage.rs Closes BrainTease#1324 BrainTease#1323 BrainTease#1322 BrainTease#1325
Praizfotos
had a problem deploying
to
preview-pr-1412
October 21, 2026 14:40 — with
GitHub Actions
Failure
This was referenced Oct 21, 2026
|
@Praizfotos Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
- use RangeInclusive::contains instead of manual range comparisons - convert constant assertions to const assertions - silence unused admin variables in upgrade tests
Praizfotos
had a problem deploying
to
preview-pr-1412
October 21, 2026 15:02 — with
GitHub Actions
Failure
This branch had an error being deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR Description
This PR closes the following issues:
Changes
#1324 — Split large contract
lib.rsinto moduleslib.rs(537 → 378 lines). Types moved tocontracts/analytics/src/types.rs, read-only queries tocontracts/analytics/src/queries.rs, inline tests tocontracts/analytics/src/contract_tests.rs.lib.rs(624 → 381 lines). Types moved tocontracts/governance/src/types.rs, upgrade-target validation tocontracts/governance/src/validation_helpers.rs, legacy proposal/upgrade logic tocontracts/governance/src/legacy.rs.queries.rsandlegacy.rsexpose plain functions; the#[contractimpl]blocks inlib.rskeep thin delegating wrappers so the contract ABI is unchanged.mod testsblock into a separatecontract_tests.rsfile.types.rsmodule and re-exported them fromlib.rs.lib.rsin the workspace is now under 400 lines.#1323 — Centralize TTL and storage constants
STORAGE_TTL_THRESHOLDandSTORAGE_TTL_EXTEND_TOtocontracts/shared/src/constants.rs.MAX_ENTRY_TTL,MIN_PERSISTENT_ENTRY_TTL, andMIN_TEMP_ENTRY_TTLto the shared constants module.analytics,grants,governance,registry,buyback, andcredential_metadatawith the shared constants.contracts/shared/src/constants.rs.#1325 — Untrack
test_snapshotsand ignore themcontracts/*/test_snapshots/to.gitignore.git rm --cached -r contracts/*/test_snapshots.#1322 — Batch storage reads in the market contract
contracts/market/src/storage.rswithread_products_batch,read_purchases_batch, andread_escrows_batch.Other improvements
registrynow uses the sharedSTORAGE_TTL_THRESHOLDconstant instead of a hardcoded100in the pause path.level_ordin the registry are public so other modules can reuse them.paginateimport from the analyticslib.rs.validation_helpers.rsand is shared by the legacy upgrade path.Verification
lib.rsfiles in the workspace are under 400 lines — satisfies the [Contracts] #67 Split large contract lib.rs into modules #1324 acceptance criterion.contracts/shared/src/constants.rs— satisfies the [Contracts] #66 Centralize TTL and storage constants #1323 acceptance criterion.Closes #1324
Closes #1323
Closes #1322
Closes #1325