fix(cert-var): certify the initial value and relax the freshness check - #1489
Merged
Merged
Conversation
Certified data starts empty, so a get before the first set failed verification. The 5-second freshness window failed on small client clock skew; it now matches the 5 minutes Certificate.create allows. Also replaces a dead sdk.dfinity.org spec link.
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Add coverage verifying the initial value is certified immediately after deployment.
Get a fresh assessment by requesting another Copilot review.
Review effort: Lite
Findings: 1
Open (1)
What changed in this PR
Updates the Motoko cert-var example to certify its initial value and allow the SDK’s five-minute freshness window.
Changes:
- Certifies the initial value during installation.
- Relaxes freshness validation from five seconds to five minutes.
- Updates documentation and the interface specification link.
| File | Summary |
|---|---|
motoko/cert-var/README.md |
Documents the five-minute freshness window. |
motoko/cert-var/frontend/index.html |
Updates freshness validation and the specification link. |
motoko/cert-var/backend/main.mo |
Certifies the initial value; a pre-mutation regression test is requested. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
lwshang
approved these changes
Sep 28, 2026
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.

Two fixes to the Motoko
cert-varexample.getbefore the firstsetreturnedvalue = 0with an emptycertified_data, and the frontend's check 4 failed. The actor now certifies its initial value at install (CD.set(blobOfNat32(value))in the actor body). Verified on a fresh local install:certified_data = 00000000. After an upgrade, the certified value still matches.Certificate.create()itself enforces by default (maxAgeInMinutes). The README says so too.The spec link in the frontend comment pointed to the retired
sdk.dfinity.org; it now links the certified data section of the interface spec.mops checkpasses,test.shpasses 4/4, and the frontend shows "Success: Fully certified query response." in a browser.