Repository navigation
Conversation
🦋 Changeset detectedLatest commit: 149c221 The changes in this PR will be included in the next version bump. This PR includes changesets to release 9 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
This branch has not been 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.
Summary
client.acp.checkAccesschecks the issuer copy of a share (typesharing, no handle) for expiry withACPUtils.isExpired(acp), which uses the local clock. The ACL rejects an ACP whenacp.expiration < block.timestamp(Permissioned.sol:164), and every other path ofcheckAccessasks the chain. #417 moved the client's own expiry checks (get-or-create reuse,importSharedAndSign) to the latest block, and this one was not part of it.Impact
With a chain clock ahead of the local one (a Hardhat test after
time.increase), an issuer's share that the ACL already treats as expired is reportedvalid. The reverse also happens: when the local clock is ahead of the chain, a share that is still usable on chain is reportedexpired.Fix
The handle-less sharing branch passes the latest block timestamp to
ACPUtils.isExpiredthroughgetLatestBlockTimestamp, the same helper #417 uses for the defaults. This adds onegetBlockrequest to that branch. The revocation check and the on-chain branch are unchanged.The existing test was named "reports expiry locally" and noted the check needs no RPC. I read #388 and #417 and found no reason given for keeping this check on the local clock (the wall-clock exception in #417 is about React display code). If the local-clock check here is intended, I'm happy to close this.
Test plan
core/test/acps.test.ts: the two existingcheckAccesssharing tests now use a stubbed latest block; added one test with the chain 2 hours ahead (expectsexpired) and one with the local clock 2 hours ahead (expectsvalid)core/acps.tsmakes only the two new tests fail (expected 'valid' to be 'expired',expected 'expired' to be 'valid'); restored → passvitest run --project nodeinpackages/sdk: 628 passed, 22 skipped;lint,check:types; prettier on the changed files@cofhe/sdk: patch)Competitor check
Searched
checkAccess,isExpired,latest block,block timestamp,ACP expiration,local clock: no open PR or issue covers this. #498 touches ACP expiry in@cofhe/reacthooks only.Note
Medium Risk
Changes when issuer-side shares are reported valid vs expired, which can affect UI and client logic before on-chain use; behavior now matches ACL rules rather than introducing new permissions.
Overview
client.acp.checkAccessfor an issuer’ssharingACP (no handle) now treats expiry like the on-chain ACL: it comparesacp.expirationto the latest block timestamp viagetLatestBlockTimestamp, instead of the local clock.That closes a skew bug—e.g. after Hardhat
time.increase, a share the ACL already rejects could still lookvalid, or the opposite when the wall clock runs ahead of the chain. The handle-less branch adds onegetBlock; revocation and othercheckAccesspaths are unchanged.Tests stub the chain clock and add cases for chain-ahead vs local-ahead expiry; a patch changeset documents the fix for
@cofhe/sdk.Reviewed by Cursor Bugbot for commit 149c221. Bugbot is set up for automated code reviews on this repo. Configure here.