docs: add vc-schema-registry README and inline rustdoc#8
Conversation
Implements the vc-schema-registry Soroban contract and its full documentation as required by issue ACTA-Team#7: - contracts/vc-schema-registry/: complete contract implementation (lib.rs, contract.rs, error.rs, storage.rs, events.rs, test.rs) with /// rustdoc on every public function and //! module-level docs - contracts/vc-schema-registry/README.md: mirrors vc-issuer-registry structure; covers storage layout, SchemaRecord, entry points with auth column, schema ID derivation (sha256 of XDR-encoded triple), versioning & deprecation semantics, error codes, and events tables - Root README.md: adds vc-schema-registry to the contracts table - Cargo.toml: adds vc-schema-registry to workspace members All 17 tests pass; cargo build (workspace) succeeds.
|
@OlaGreat 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! 🚀 |
|
Warning Review limit reached
Next review available in: 58 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughA new Changesvc-schema-registry Soroban contract
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related issues
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (2)
contracts/vc-schema-registry/src/test.rs (1)
42-49: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winUse explicit error matching in failure-path tests.
#[should_panic]and bareis_err()can pass on unrelated failures. Please assert the specific expected error for each case (e.g.,AlreadyInitialized,Unauthorized,SchemaNotFound,NotInitialized) to prevent false positives.Also applies to: 98-107, 175-186, 193-204, 211-219, 238-246, 253-258, 276-280
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@contracts/vc-schema-registry/src/test.rs` around lines 42 - 49, The failure-path tests in test.rs use broad panic/error checks that can hide unrelated failures; update each affected test to assert the specific expected contract error instead of relying on #[should_panic] or bare is_err(). For the test cases around setup(), initialize(), set_admin(), submit_schema(), get_schema(), and related helpers, match explicitly on the returned error variants such as AlreadyInitialized, Unauthorized, SchemaNotFound, and NotInitialized so each test verifies the exact failure being exercised.contracts/vc-schema-registry/src/events.rs (1)
5-19: 🚀 Performance & Scalability | 🔵 Trivial | ⚡ Quick winMark filter keys as event topics.
schema_id,author, andadminare the fields indexers will likely filter on; with#[contractevent], fields need#[topic]to be included in the event topic list for downstream filtering. (docs.rs)Proposed fix
#[contractevent] pub struct Initialized { + #[topic] pub admin: Address, } #[contractevent] pub struct SchemaRegistered { + #[topic] pub schema_id: BytesN<32>, + #[topic] pub author: Address, } #[contractevent] pub struct SchemaDeprecated { + #[topic] pub schema_id: BytesN<32>, }🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@contracts/vc-schema-registry/src/events.rs` around lines 5 - 19, The event structs in Initialized and SchemaRegistered are missing topic annotations on fields that indexers need to filter by. Update the #[contractevent] definitions so admin, schema_id, and author are marked as #[topic] where appropriate, keeping the event names the same and applying the annotations directly on the fields inside Initialized, SchemaRegistered, and SchemaDeprecated as needed for downstream filtering.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@contracts/vc-schema-registry/README.md`:
- Around line 53-55: The README code fence showing the schema_id formula is
missing a language tag and triggers the markdown lint rule. Update the fenced
block in the vc-schema-registry documentation to use an explicit text language
identifier so the snippet is properly classified, keeping the existing content
unchanged.
In `@contracts/vc-schema-registry/src/storage.rs`:
- Around line 55-72: The schema storage helpers only refresh persistent TTL on
writes, so active schema entries can still expire when accessed through
has_schema and read_schema. Update the schema access paths in
storage.rs—specifically has_schema, read_schema, and the shared DataKey::Schema
lookup—to extend the TTL on successful existence checks and reads, or refactor
the TTL refresh into a helper reused by write_schema, has_schema, and
read_schema.
---
Nitpick comments:
In `@contracts/vc-schema-registry/src/events.rs`:
- Around line 5-19: The event structs in Initialized and SchemaRegistered are
missing topic annotations on fields that indexers need to filter by. Update the
#[contractevent] definitions so admin, schema_id, and author are marked as
#[topic] where appropriate, keeping the event names the same and applying the
annotations directly on the fields inside Initialized, SchemaRegistered, and
SchemaDeprecated as needed for downstream filtering.
In `@contracts/vc-schema-registry/src/test.rs`:
- Around line 42-49: The failure-path tests in test.rs use broad panic/error
checks that can hide unrelated failures; update each affected test to assert the
specific expected contract error instead of relying on #[should_panic] or bare
is_err(). For the test cases around setup(), initialize(), set_admin(),
submit_schema(), get_schema(), and related helpers, match explicitly on the
returned error variants such as AlreadyInitialized, Unauthorized,
SchemaNotFound, and NotInitialized so each test verifies the exact failure being
exercised.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: d5d6c02f-0617-4f24-a1bb-79ce6bff329e
📒 Files selected for processing (10)
Cargo.tomlREADME.mdcontracts/vc-schema-registry/Cargo.tomlcontracts/vc-schema-registry/README.mdcontracts/vc-schema-registry/src/contract.rscontracts/vc-schema-registry/src/error.rscontracts/vc-schema-registry/src/events.rscontracts/vc-schema-registry/src/lib.rscontracts/vc-schema-registry/src/storage.rscontracts/vc-schema-registry/src/test.rs
Summary
vc-schema-registrySoroban contract (contract.rs,error.rs,storage.rs,events.rs,lib.rs,test.rs) with///rustdoc on every public function, error variant, and//!module-level doc inlib.rscontracts/vc-schema-registry/README.mdmirroring thevc-issuer-registrystructure: title, overview, storage layout +SchemaRecordstruct, entry points table with auth column (admin vs author), schema ID derivation (sha256(xdr(author) || xdr(name) || xdr(version))), versioning & deprecation semantics, error codes table, events table, and build & test snippetREADME.mdwith a contracts table listingvc-schema-registryvc-schema-registryto the workspaceCargo.tomlTest plan
cargo build -p vc-schema-registry-contractcompiles without warningscargo test -p vc-schema-registry-contract— all 17 tests passcargo build(workspace) — both contracts compile togetherCloses #7
Summary by CodeRabbit
New Features
Bug Fixes
Documentation