Skip to content

docs: add vc-schema-registry README and inline rustdoc#8

Merged
aguilar1x merged 3 commits into
ACTA-Team:mainfrom
OlaGreat:docs/vc-schema-registry
Jul 8, 2026
Merged

docs: add vc-schema-registry README and inline rustdoc#8
aguilar1x merged 3 commits into
ACTA-Team:mainfrom
OlaGreat:docs/vc-schema-registry

Conversation

@OlaGreat

@OlaGreat OlaGreat commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Adds the complete vc-schema-registry Soroban 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 in lib.rs
  • Adds contracts/vc-schema-registry/README.md mirroring the vc-issuer-registry structure: title, overview, storage layout + SchemaRecord struct, 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 snippet
  • Updates root README.md with a contracts table listing vc-schema-registry
  • Adds vc-schema-registry to the workspace Cargo.toml

Test plan

  • cargo build -p vc-schema-registry-contract compiles without warnings
  • cargo test -p vc-schema-registry-contract — all 17 tests pass
  • cargo build (workspace) — both contracts compile together
  • README tables match implementation: function names, auth, error codes, events

Closes #7

Summary by CodeRabbit

  • New Features

    • Added a new VC schema registry contract to the workspace, enabling on-chain registration, lookup, and deprecation of schema definitions.
    • Added contract events and version/admin accessors for easier tracking and integration.
  • Bug Fixes

    • Schema IDs are now derived deterministically from author, name, and version, helping prevent duplicates and inconsistencies.
    • Deprecated schemas remain readable while being clearly marked as deprecated.
  • Documentation

    • Updated the project README with a new Contracts section and added contract-specific usage details.

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

drips-wave Bot commented Jun 24, 2026

Copy link
Copy Markdown

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

Learn more about application limits

@coderabbitai

coderabbitai Bot commented Jun 24, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@aguilar1x, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 58 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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 configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 1b98f36f-3d48-4828-9ada-6373c0cfe201

📥 Commits

Reviewing files that changed from the base of the PR and between dec941a and 6f45d7c.

📒 Files selected for processing (2)
  • README.md
  • contracts/vc-schema-registry/README.md
📝 Walkthrough

Walkthrough

A new vc-schema-registry Soroban smart contract crate is added to the Rust workspace. The contract implements an on-chain registry for versioned VC schema definitions, with one-time initialization, permissioned registration and deprecation, deterministic SHA-256 schema IDs, persistent storage with TTL management, structured error codes, contract events, and a full unit test suite. Root and contract-level README docs are also added.

Changes

vc-schema-registry Soroban contract

Layer / File(s) Summary
Workspace registration, crate manifest, and module wiring
Cargo.toml, contracts/vc-schema-registry/Cargo.toml, contracts/vc-schema-registry/src/lib.rs, README.md, contracts/vc-schema-registry/README.md
Registers the new crate in the workspace members list, defines the Cargo manifest with soroban-sdk dependencies, creates the no_std crate root with public module exports, and adds contract and root-level README documentation.
Storage types, keys, helpers, and TTL management
contracts/vc-schema-registry/src/storage.rs
Defines TTL constants, the DataKey enum (Admin, Schema(BytesN<32>)), the SchemaRecord struct, and all public storage helpers for admin and schema records with persistent and instance TTL extension.
Error codes and contract events
contracts/vc-schema-registry/src/error.rs, contracts/vc-schema-registry/src/events.rs
Defines ContractError with six u32-coded variants, and three #[contractevent] structs (Initialized, SchemaRegistered, SchemaDeprecated) with corresponding publisher functions.
Contract entry points and schema ID derivation
contracts/vc-schema-registry/src/contract.rs
Implements VcSchemaRegistryContract with initialize, register_schema, deprecate_schema, read-only queries (get_schema, schema_exists, schema_id, admin, version), and the internal compute_schema_id SHA-256 helper.
Unit test suite
contracts/vc-schema-registry/src/test.rs
Full test coverage for initialization, registration happy path and error paths, deterministic ID behavior, version isolation, deprecation auth rules, lookup behavior, pre-init failures, auth gating, and post-deprecation record integrity.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related issues

  • #3 — This PR implements the vc-schema-registry contract package, storage, error codes, events, and entry points described in that implementation issue.
  • #6 — This PR includes a comprehensive unit test suite for vc-schema-registry covering the behaviors enumerated in that testing issue.
  • #7 — This PR adds contracts/vc-schema-registry/README.md and updates the root README.md with the contract listing, directly fulfilling the documentation objectives of that issue.

🐇 A new schema hops into the chain,
With author and version and SHA-256 name.
Deprecate softly — the record stays true,
Admin or author, auth gates who can do.
The registry blooms where credentials grow,
Built with no_std and TTL in tow! 🌱

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Out of Scope Changes check ⚠️ Warning The PR also adds the full contract implementation and tests, which exceed the docs-only scope described in #7. Split the implementation and test work into a separate PR, or retarget this PR to the implementation issue and keep #7 limited to docs.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title is concise and matches the main theme of the PR: adding vc-schema-registry documentation and rustdoc.
Linked Issues check ✅ Passed The README, inline rustdoc, and root README updates align with #7, and the summary indicates the required tables and commands match the implementation.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🧹 Nitpick comments (2)
contracts/vc-schema-registry/src/test.rs (1)

42-49: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Use explicit error matching in failure-path tests.

#[should_panic] and bare is_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 win

Mark filter keys as event topics.

schema_id, author, and admin are 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

📥 Commits

Reviewing files that changed from the base of the PR and between 01b522a and dec941a.

📒 Files selected for processing (10)
  • Cargo.toml
  • README.md
  • contracts/vc-schema-registry/Cargo.toml
  • contracts/vc-schema-registry/README.md
  • contracts/vc-schema-registry/src/contract.rs
  • contracts/vc-schema-registry/src/error.rs
  • contracts/vc-schema-registry/src/events.rs
  • contracts/vc-schema-registry/src/lib.rs
  • contracts/vc-schema-registry/src/storage.rs
  • contracts/vc-schema-registry/src/test.rs

Comment thread contracts/vc-schema-registry/README.md Outdated
Comment thread contracts/vc-schema-registry/src/storage.rs

@aguilar1x aguilar1x left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm!

@aguilar1x aguilar1x merged commit 44b6756 into ACTA-Team:main Jul 8, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Docs] vc-schema-registry README and API documentation

2 participants