Skip to content

feat(ip_registry): resolve #811 #812 #813 #814 - #935

Open
kurehkim334-lang wants to merge 1 commit into
AtomicIP:mainfrom
kurehkim334-lang:feature/issues-811-812-813-814
Open

feat(ip_registry): resolve #811 #812 #813 #814#935
kurehkim334-lang wants to merge 1 commit into
AtomicIP:mainfrom
kurehkim334-lang:feature/issues-811-812-813-814

Conversation

@kurehkim334-lang

@kurehkim334-lang kurehkim334-lang commented Aug 26, 2026

Copy link
Copy Markdown

Closes #813


Closes #812


Closes #811


Closes #814


Summary

Resolves issues #811, #812, #813, and #814 for the ip_registry contract.


#811 — Add OwnershipChallenge expiry handling

  • Added expires_at: u64 field to OwnershipChallenge struct (types.rs)
  • Added DEFAULT_CHALLENGE_TTL_SECONDS (86400 s = 24 h) constant and ChallengeTtl storage key
  • issue_ownership_challenge computes expires_at = now + ttl using the admin-configured TTL (or default)
  • respond_to_ownership_challenge rejects calls after TTL with ChallengeExpired (36) and duplicate responses with ChallengeAlreadyAnswered (37)
  • New admin-only set_challenge_ttl(env, ttl_seconds) to override the default
  • New expire_challenge(env, challenge_id) callable by anyone once the challenge has elapsed — removes the record and emits a ch_exp event

#812 — Add Merkle root cache invalidation/regeneration

  • Added MerkleRoot(Address) and MerkleRootStale(Address) variants to DataKey
  • New get_merkle_root(env, owner) — returns cached root if fresh, lazily recomputes and re-caches when stale or absent
  • Private mark_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 accepts offset and limit parameters
  • Capped at 64 entries per call to bound compute cost; pass offset=0, limit=64 for the first page

#814 — Validate NotaryPublicKey format on set

  • set_notary_public_key now rejects all-zero keys with ContractError::InvalidNotaryKey = 39
  • An all-zero 32-byte key is indistinguishable from "not set" and would silently break all future notarization checks

Testing

New tests added at the end of contracts/ip_registry/src/test.rs covering:

  • Challenge expiry after TTL
  • expire_challenge succeeds after TTL, panics before TTL
  • Duplicate response rejection
  • Merkle root changes after commit_ip and revoke_ip
  • get_merkle_root returns zero root for owner with no IPs
  • Key rotation history: zero, one, and many rotations with pagination
  • Valid notary key accepted; zero key rejected

Files changed

File Change
contracts/ip_registry/src/types.rs Added expires_at to OwnershipChallenge
contracts/ip_registry/src/lib.rs All new functions, error variants, DataKey variants
contracts/ip_registry/src/test.rs Updated client trait + new tests
.gitignore Added test snapshots, WASM, coverage, node_modules, etc.

…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.
@drips-wave

drips-wave Bot commented Aug 26, 2026

Copy link
Copy Markdown

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

Learn more about application limits

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant