feat(ip_registry): resolve #811 #812 #813 #814 - #935
Open
kurehkim334-lang wants to merge 1 commit into
Open
Conversation
…P#813, AtomicIP#814 AtomicIP#811 — OwnershipChallenge expiry: - Add `expires_at` field to OwnershipChallenge struct (types.rs) - Add DEFAULT_CHALLENGE_TTL_SECONDS const (24 h) and ChallengeTtl DataKey - Add admin-only set_challenge_ttl() to configure per-deployment TTL - Reject respond_to_ownership_challenge() calls after TTL elapses - Add expire_challenge() callable by anyone once a challenge has expired - Add ContractError::ChallengeExpired (36) and ChallengeAlreadyAnswered (37) AtomicIP#812 — Merkle root cache invalidation: - Add MerkleRoot(Address) and MerkleRootStale(Address) to lib.rs DataKey - Add get_merkle_root() with lazy recompute when cache is absent or stale - Add private mark_merkle_root_stale() helper - Call mark_merkle_root_stale() in commit_ip, revoke_ip, transfer_ip, rotate_commitment_key so cache is always consistent - Add ContractError::MerkleRootStale (38) AtomicIP#813 — Key-rotation history pagination: - Update get_key_rotation_history(env, ip_id, offset, limit) with offset/limit pagination, capped at 64 entries per call AtomicIP#814 — NotaryPublicKey validation: - Reject all-zero keys in set_notary_public_key() with InvalidNotaryKey - Add ContractError::InvalidNotaryKey (39) Tests: add coverage for all four issues at end of test.rs. Chore: update .gitignore to exclude test snapshots, wasm, coverage, etc.
|
@kurehkim334-lang 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! 🚀 |
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.
Closes #813
Closes #812
Closes #811
Closes #814
Summary
Resolves issues #811, #812, #813, and #814 for the
ip_registrycontract.#811 — Add OwnershipChallenge expiry handling
expires_at: u64field toOwnershipChallengestruct (types.rs)DEFAULT_CHALLENGE_TTL_SECONDS(86400 s = 24 h) constant andChallengeTtlstorage keyissue_ownership_challengecomputesexpires_at = now + ttlusing the admin-configured TTL (or default)respond_to_ownership_challengerejects calls after TTL withChallengeExpired(36) and duplicate responses withChallengeAlreadyAnswered(37)set_challenge_ttl(env, ttl_seconds)to override the defaultexpire_challenge(env, challenge_id)callable by anyone once the challenge has elapsed — removes the record and emits ach_expevent#812 — Add Merkle root cache invalidation/regeneration
MerkleRoot(Address)andMerkleRootStale(Address)variants toDataKeyget_merkle_root(env, owner)— returns cached root if fresh, lazily recomputes and re-caches when stale or absentmark_merkle_root_stale()helper invoked in every mutation that changes an owner's commitment set:commit_ip,revoke_ip,transfer_ip,rotate_commitment_key#813 — Add key-rotation history query with pagination
get_key_rotation_history(env, ip_id, offset, limit)now acceptsoffsetandlimitparametersoffset=0, limit=64for the first page#814 — Validate NotaryPublicKey format on set
set_notary_public_keynow rejects all-zero keys withContractError::InvalidNotaryKey = 39Testing
New tests added at the end of
contracts/ip_registry/src/test.rscovering:expire_challengesucceeds after TTL, panics before TTLcommit_ipandrevoke_ipget_merkle_rootreturns zero root for owner with no IPsFiles changed
contracts/ip_registry/src/types.rsexpires_attoOwnershipChallengecontracts/ip_registry/src/lib.rscontracts/ip_registry/src/test.rs.gitignore