Skip to content

Closes: #941 Feat/template versioning strictly increasing version test - #1247

Closed
Chaampion1-1 wants to merge 4 commits into
Stellopay:mainfrom
Chaampion1-1:feature/template-versioning-strictly-increasing-version-test
Closed

Closes: #941 Feat/template versioning strictly increasing version test#1247
Chaampion1-1 wants to merge 4 commits into
Stellopay:mainfrom
Chaampion1-1:feature/template-versioning-strictly-increasing-version-test

Conversation

@Chaampion1-1

Copy link
Copy Markdown

Description

This PR enforces that each newly published version number for a template strictly increases over the previous latest_version ($version > latest_version$) in publish_template_version within onchain/contracts/template_versioning/src/lib.rs.# Related Issue

Fixes # 941

Solution Approach

  1. Updated publish_template_version to accept an explicit target version: u32 parameter.
  2. Implemented the strictly-increasing version validation guard if version == 0 || version <= latest returning VersioningError::InvalidData.
  3. Added NatSpec-style doc comments detailing security invariants, parameters, return values, and error conditions.
  4. Added comprehensive unit tests in test_versioning.rs verifying that duplicate/lower versions return InvalidData and sequential version increments ($1 \to 2 \to 3$) succeed.
  5. Updated integration test invocations in test_template_versioning_payroll_integration.rs.
  6. Documented the invariant, API table updates, error codes, and test coverage in docs/template-versioning.md.

Checklist

  • I have tested the changes locally
  • I have added/updated documentation as needed
  • I have reviewed the code and ensured it follows the project guidelines
  • I have added necessary tests (unit/integration)
  • My changes generate no new warnings/errors
  • I have checked for code formatting issues

Screenshots/Recordings

image image

@Chaampion1-1
Chaampion1-1 force-pushed the feature/template-versioning-strictly-increasing-version-test branch from 60e035a to 32fe3d8 Compare August 1, 2026 07:07
@Chaampion1-1
Chaampion1-1 force-pushed the feature/template-versioning-strictly-increasing-version-test branch from f1ea979 to 0dc00e0 Compare August 3, 2026 18:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants