Skip to content

docs(period): fix #220 specify canonical u64 YYYYMM period format - #624

Open
heqmah wants to merge 1 commit into
zintarh:mainfrom
heqmah:docs/issue-220-period-format-contract
Open

docs(period): fix #220 specify canonical u64 YYYYMM period format#624
heqmah wants to merge 1 commit into
zintarh:mainfrom
heqmah:docs/issue-220-period-format-contract

Conversation

@heqmah

@heqmah heqmah commented Aug 1, 2026

Copy link
Copy Markdown

Closes #220

This Pull Request addes a strict period format contract to the repository documentation and interface definitions.

Context & Problem

Previously, integrations and references had inconsistencies regarding how time periods were represented. Some older scripts/documents referenced arbitrary string symbols such as dec2025, while testing frameworks and core logic used numeric representations (e.g. 202512). This lack of a canonical format caused confusion for external integrations, frontends, indexers, and developers designing transaction payloads.

Solution & Design

We formally document that the period parameter is defined as a u64 (unsigned 64-bit integer) representing calendar months using the strict YYYYMM convention (e.g. 202401 for January 2024, 202512 for December 2025).

The design includes:

  1. Canonical Monthly Format: Specifies the exact numeric representation (YYYYMM), valid year range (2024-2100), and valid month range (01-12).
  2. On-Chain Validation Mechanics: Explains how validation executes in $\mathcal{O}(1)$ time and space complexity using division (period / 100) and modulo (period % 100) arithmetic to save gas compared to string parsing.
  3. Non-Monthly Period Handling: Explicitly details that non-monthly intervals (daily, weekly, quarterly) are not natively supported by the contract validation checks. To support them, integrations must map/bucket these intervals to a valid YYYYMM u64 value before generating cryptographic signatures and calling the contract.

This change ensures a single, unambiguous specification for both on-chain contract logic and off-chain indexer/relayer services.

Changed

  • README.md : Updated the data model definition of period to specify the canonical u64 type, detailed the YYYYMM monthly validation rules, and added a section describing the mapping strategy for non-monthly periods.
  • docs/signing-payload.md : Clarified the u64 cryptographic payload requirements and provided detailed mapping examples for quarterly, weekly, and daily wraps.
  • src/lib.rs : Updated module-level Rust docstrings at the top of the file to formally document the period format contract.

@drips-wave

drips-wave Bot commented Aug 1, 2026

Copy link
Copy Markdown

@heqmah 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! 🚀

Learn more about application limits

@heqmah
heqmah force-pushed the docs/issue-220-period-format-contract branch from 635f61f to 8217aaa Compare August 1, 2026 19:37
@heqmah

heqmah commented Aug 1, 2026

Copy link
Copy Markdown
Author

@zintarh please kindly review

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.

docs: Add period format contract for monthly wraps

1 participant