Skip to content

Rwa reorg#620

Merged
ozgunozerk merged 4 commits intomainfrom
rwa-reorg
Mar 13, 2026
Merged

Rwa reorg#620
ozgunozerk merged 4 commits intomainfrom
rwa-reorg

Conversation

@ozgunozerk
Copy link
Collaborator

@ozgunozerk ozgunozerk commented Mar 13, 2026

Fixes #617

Also, fixed 2 more very small tasks while I was at it. Since these are very minor, I thought scoped PR's are not necessary
Fixes #618
Fixes #619

PR Checklist

  • Tests
  • Documentation

Summary by CodeRabbit

Release Notes

  • Refactor

    • Consolidated identity verification components under a unified module structure for improved organization.
    • Updated import paths across the codebase to reflect the new module hierarchy.
  • New Features

    • Introduced ComplianceModule trait to enable modular, extensible token compliance implementations with standardized hooks for transfer, creation, and destruction events.
  • Style

    • Refined code formatting in pattern matching blocks and adjusted configuration settings for consistency.

@ozgunozerk ozgunozerk requested a review from brozorec March 13, 2026 14:50
@ozgunozerk ozgunozerk self-assigned this Mar 13, 2026
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 13, 2026

Important

Review skipped

Auto incremental reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 5f1c289c-d8a1-4568-8cad-ad7d346128c2

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Walkthrough

This PR reorganizes the RWA module hierarchy by consolidating identity verification components under a new identity_verification module, replaces relative (super) imports with explicit crate paths throughout the codebase, restructures the compliance module with a new modules submodule, and simplifies rustfmt configuration.

Changes

Cohort / File(s) Summary
Identity Verification Reorganization
packages/tokens/src/rwa/mod.rs, packages/tokens/src/rwa/identity_verification/mod.rs
Introduces new identity_verification module as parent for claim_issuer, claim_topics_and_issuers, identity_claims, identity_registry_storage submodules. Adds public re-exports and module alias identity_verifier for backward compatibility.
Identity Verification Module Migration
packages/tokens/src/rwa/identity_verification/claim_issuer/..., packages/tokens/src/rwa/identity_verification/claim_topics_and_issuers/..., packages/tokens/src/rwa/identity_verification/identity_claims/..., packages/tokens/src/rwa/identity_verification/identity_registry_storage/...
Updates import paths from crate::rwa::<module> to crate::rwa::identity_verification::<module>, removes relative super imports, and relocates submodule files under new parent hierarchy.
Compliance Module Restructuring
packages/tokens/src/rwa/compliance/mod.rs, packages/tokens/src/rwa/compliance/modules/mod.rs, packages/tokens/src/rwa/compliance/storage.rs
Moves ComplianceModule trait from compliance root to new modules submodule. Creates new trait with eight methods for token transfer hooks and compliance checks, annotated with #[contractclient]. Updates import paths in storage.rs.
Import Path Consolidation
examples/rwa/src/identity_registry_storage.rs, packages/tokens/src/fungible/test.rs, packages/tokens/src/non_fungible/extensions/royalties/storage.rs, packages/tokens/src/non_fungible/extensions/consecutive/test.rs, packages/tokens/src/rwa/extensions/doc_manager/storage.rs, packages/tokens/src/rwa/storage.rs, packages/tokens/src/rwa/utils/token_binder/test.rs
Changes relative imports (super::...) to absolute crate paths (crate::...), consolidates import sources, and updates path qualifications across test and storage modules.
Formatting Updates
packages/accounts/src/smart_account/storage.rs, packages/governance/src/votes/storage.rs, packages/tokens/src/rwa/identity_verification/identity_registry_storage/mod.rs
Adds braces to match arm bodies, converting single-line expressions to multi-line blocks; semantically equivalent refactoring.
Test Module Updates
packages/accounts/src/smart_account/test/signers_and_policies.rs, packages/tokens/src/rwa/test.rs
Updates test imports to new module paths and converts MockIdentityVerifier from contractimpl to IdentityVerifier trait implementation with updated method signatures.
Configuration Simplification
rustfmt.toml
Removes match_arm_blocks = false and use_field_init_shorthand = true options, reverting to default rustfmt behavior.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Suggested labels

Small

Suggested reviewers

  • brozorec

Poem

🐰 Hops with glee through reorganized paths,
Where super is gone and crate takes the lead,
Identity verification finds its home so true,
Compliance modules in harmony grew,
Rustfmt simplified—cleaner code, indeed! 🌟

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 inconclusive)

Check name Status Explanation Resolution
Title check ❓ Inconclusive The title 'Rwa reorg' is overly vague and generic, using a single abbreviation without clearly describing the scope or nature of the reorganization. Use a more descriptive title such as 'Reorganize RWA module hierarchy and remove super keyword usage' to clearly convey the main changes.
Description check ❓ Inconclusive The PR description mentions fixing three issues (#617, #618, #619) but lacks detailed explanation of what changes were made and how they address each issue. Expand the description to explain the key reorganization changes, rustfmt removals, and the scope of super keyword replacements to provide reviewers with better context.
✅ Passed checks (3 passed)
Check name Status Explanation
Linked Issues check ✅ Passed The code changes comprehensively address all three linked issues: RWA hierarchy reorganization into identity_verification/compliance folders [#617], replacement of super keyword with explicit paths [#618], and rustfmt.toml simplification [#619].
Out of Scope Changes check ✅ Passed All code changes align with the stated objectives from the three linked issues; no out-of-scope modifications were detected beyond the reorganization, super keyword removal, and rustfmt configuration updates.
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
  • Post copyable unit tests in a comment
  • Commit unit tests in branch rwa-reorg
📝 Coding Plan
  • Generate coding plan for human review comments

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

Tip

You can disable sequence diagrams in the walkthrough.

Disable the reviews.sequence_diagrams setting to disable sequence diagrams in the walkthrough.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
packages/tokens/src/fungible/test.rs (1)

155-158: Change aligns with PR objective to remove super keyword.

The explicit crate::fungible:: path is clearer than super::. However, since FungibleStorageKey is already imported at line 15, you could simplify for consistency with line 303:

♻️ Optional: use imported `FungibleStorageKey` for consistency
-        let key = crate::fungible::FungibleStorageKey::Allowance(crate::fungible::AllowanceKey {
+        let key = FungibleStorageKey::Allowance(crate::fungible::AllowanceKey {

Alternatively, add AllowanceKey to the import at line 14-16 and use both directly.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/tokens/src/fungible/test.rs` around lines 155 - 158, The current
construction uses fully-qualified paths; replace
crate::fungible::FungibleStorageKey::Allowance(crate::fungible::AllowanceKey {
... }) with the imported types to match project style: use
FungibleStorageKey::Allowance(AllowanceKey { owner: owner.clone(), spender:
spender.clone() }) or alternatively add AllowanceKey to the existing imports and
then use FungibleStorageKey::Allowance(AllowanceKey { owner: owner.clone(),
spender: spender.clone() }) so the code is concise and consistent with other
uses of FungibleStorageKey and AllowanceKey.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@packages/tokens/src/fungible/test.rs`:
- Around line 155-158: The current construction uses fully-qualified paths;
replace
crate::fungible::FungibleStorageKey::Allowance(crate::fungible::AllowanceKey {
... }) with the imported types to match project style: use
FungibleStorageKey::Allowance(AllowanceKey { owner: owner.clone(), spender:
spender.clone() }) or alternatively add AllowanceKey to the existing imports and
then use FungibleStorageKey::Allowance(AllowanceKey { owner: owner.clone(),
spender: spender.clone() }) so the code is concise and consistent with other
uses of FungibleStorageKey and AllowanceKey.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 9388b0d4-47d7-4217-bb61-471ee7868cbd

📥 Commits

Reviewing files that changed from the base of the PR and between 263d86b and c160218.

📒 Files selected for processing (31)
  • examples/rwa/src/identity_registry_storage.rs
  • packages/accounts/src/smart_account/storage.rs
  • packages/accounts/src/smart_account/test/signers_and_policies.rs
  • packages/governance/src/votes/storage.rs
  • packages/tokens/src/fungible/test.rs
  • packages/tokens/src/non_fungible/extensions/consecutive/test.rs
  • packages/tokens/src/non_fungible/extensions/royalties/storage.rs
  • packages/tokens/src/rwa/compliance/mod.rs
  • packages/tokens/src/rwa/compliance/modules/mod.rs
  • packages/tokens/src/rwa/compliance/storage.rs
  • packages/tokens/src/rwa/extensions/doc_manager/storage.rs
  • packages/tokens/src/rwa/identity_verification/claim_issuer/mod.rs
  • packages/tokens/src/rwa/identity_verification/claim_issuer/storage.rs
  • packages/tokens/src/rwa/identity_verification/claim_issuer/test.rs
  • packages/tokens/src/rwa/identity_verification/claim_topics_and_issuers/mod.rs
  • packages/tokens/src/rwa/identity_verification/claim_topics_and_issuers/storage.rs
  • packages/tokens/src/rwa/identity_verification/claim_topics_and_issuers/test.rs
  • packages/tokens/src/rwa/identity_verification/identity_claims/mod.rs
  • packages/tokens/src/rwa/identity_verification/identity_claims/storage.rs
  • packages/tokens/src/rwa/identity_verification/identity_claims/test.rs
  • packages/tokens/src/rwa/identity_verification/identity_registry_storage/mod.rs
  • packages/tokens/src/rwa/identity_verification/identity_registry_storage/storage.rs
  • packages/tokens/src/rwa/identity_verification/identity_registry_storage/test.rs
  • packages/tokens/src/rwa/identity_verification/mod.rs
  • packages/tokens/src/rwa/identity_verification/storage.rs
  • packages/tokens/src/rwa/identity_verification/test.rs
  • packages/tokens/src/rwa/mod.rs
  • packages/tokens/src/rwa/storage.rs
  • packages/tokens/src/rwa/test.rs
  • packages/tokens/src/rwa/utils/token_binder/test.rs
  • rustfmt.toml
💤 Files with no reviewable changes (1)
  • rustfmt.toml

@codecov
Copy link

codecov bot commented Mar 13, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 96.37%. Comparing base (263d86b) to head (1dfcc4f).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #620   +/-   ##
=======================================
  Coverage   96.37%   96.37%           
=======================================
  Files          58       58           
  Lines        5960     5960           
=======================================
  Hits         5744     5744           
  Misses        216      216           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Collaborator

@brozorec brozorec left a comment

Choose a reason for hiding this comment

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

LGTM 👍

@pasevin curious about you opinion on this restructuring

Copy link

@pasevin pasevin left a comment

Choose a reason for hiding this comment

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

LGTM! Once merged, I can resolve conflicts and migrate my PRs:

@ozgunozerk ozgunozerk merged commit 20981b1 into main Mar 13, 2026
7 checks passed
@ozgunozerk ozgunozerk deleted the rwa-reorg branch March 13, 2026 15:50
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.

Simplify rustfmt Get rid of super keyword across the repo Reorganize RWA hierarchy

3 participants