Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor/dataverse contract #419

Merged
merged 4 commits into from
Nov 15, 2023
Merged

Refactor/dataverse contract #419

merged 4 commits into from
Nov 15, 2023

Conversation

ccamel
Copy link
Member

@ccamel ccamel commented Nov 14, 2023

This PR addresses #328 by introducing a paradigm shift from #321 in the management of resources within the Dataverse, transitioning from a Metadata-centric approach to a Claims-based approach. According to this new framework, all resources with a decentralized identity (e.g. zones, services, digital resources, entites...) can be described through properties asserted about them by an entity. This mechanism offers greater flexibility and standardization, enhancing trust within the Dataverse.

Accordingly, the underlying ontology that supports these principles will be updated to reflect these changes (see axone-protocol/ontology#205).

Summary by CodeRabbit

  • Documentation

    • Updated the README and documentation to provide detailed explanations of the Dataverse, Zones, Resources, Decentralized Identifiers (DID), and Claims within the smart contract context.
    • Refined descriptions and examples for various contract operations such as service registration, digital resource registration, zone founding, and claim submission and revocation.
  • Refactor

    • Simplified the smart contract interface by removing metadata attachment/detachment functions and focusing on claim submission and revocation.
    • Replaced the Iri type with the Uri type for consistency and clarity in the contract's messaging system.

@ccamel ccamel self-assigned this Nov 14, 2023
Copy link

coderabbitai bot commented Nov 14, 2023

Note

Reviews Paused

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Walkthrough

The recent updates to the OKP4 Dataverse smart contract documentation and code comments reflect a shift towards a more claims-based approach, with a focus on Decentralized Identifiers (DID) and the structure of the Dataverse, Zones, and Resources. Metadata attachment functions have been removed in favor of claim submission and revocation, streamlining the contract's functionality around resource identification and verification.

Changes

File Path Change Summary
contracts/okp4-dataverse/README.md
docs/okp4-dataverse.md
Expanded explanations of Dataverse concepts, clarified smart contract roles, and updated examples for execute messages.
contracts/.../src/msg.rs (multiple entries) Updated comments, replaced metadata functions with claims functions, and switched from Iri to Uri type.

🐇 In the Dataverse so wide and vast, 🌌

Claims and DIDs, they're here to last. 📜

No more metadata's tangled web, 🕸️

Just Zones and Resources, the new ebb. 🌊


Tips

Chat with CodeRabbit Bot (@coderabbitai)

  • If you reply to a review comment from CodeRabbit, the bot will automatically respond.
  • To engage with CodeRabbit bot directly around the specific lines of code in the PR, mention @coderabbitai in your review comment
  • Note: Review comments are made on code diffs or files, not on the PR overview.
  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai help to get help.

Note: For conversation with the bot, please use the review comments on code diffs or files.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • The JSON schema for the configuration file is available here.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/coderabbit-overrides.v2.json

@bot-anik
Copy link
Member

bot-anik commented Nov 14, 2023

size-limit report 📦

Path Size
target/wasm32-unknown-unknown/release/okp4_objectarium.wasm 430.75 KB (0%)
target/wasm32-unknown-unknown/release/okp4_law_stone.wasm 645.26 KB (0%)
target/wasm32-unknown-unknown/release/okp4_cognitarium.wasm 824.92 KB (0%)

Copy link

codecov bot commented Nov 14, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (873ee21) 96.93% compared to head (f0d169a) 96.93%.
Report is 2 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #419   +/-   ##
=======================================
  Coverage   96.93%   96.93%           
=======================================
  Files          48       48           
  Lines        9858     9858           
=======================================
  Hits         9556     9556           
  Misses        302      302           

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

@ccamel ccamel marked this pull request as ready for review November 15, 2023 08:08
Copy link

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

Review Status

Actionable comments generated: 0

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between 873ee21 and 0b18fc4.
Files selected for processing (3)
  • contracts/okp4-dataverse/README.md (1 hunks)
  • contracts/okp4-dataverse/src/msg.rs (5 hunks)
  • docs/okp4-dataverse.md (4 hunks)
Additional comments: 12
contracts/okp4-dataverse/README.md (1)
  • 2-44: The documentation has been significantly expanded to provide a detailed understanding of the Dataverse concept, including its structure, components, and their interactions. The explanations of Zones, Resources, DIDs, and Claims are clear and informative, which should help users and developers understand the smart contract's purpose and functionality within the OKP4 protocol. The addition of Dependencies section is also beneficial as it outlines the contract's interactions with other parts of the ecosystem.

One thing to consider is ensuring that all hyperlinks, such as those for Verifiable Presentations and Verifiable Credentials, are up-to-date and lead to the correct resources. This is important for maintaining the integrity and usefulness of the documentation.

docs/okp4-dataverse.md (4)
  • 2-44: The introduction and explanation of the dataverse smart contract's components are well-detailed and provide a clear understanding of the Dataverse, Zones, Resources, DIDs, and Claims. The explanations are thorough and seem to align with the intended functionality of the contract. The use of clear and concise language enhances the readability of the documentation.

  • 49-53: The InstantiateMsg section is clear and concise. It specifies the required parameter name with a clear description. However, ensure that the asterisk formatting for "Required" is consistent and correctly rendered in the markdown or the final documentation format.

  • 59-123: The ExecuteMsg section provides detailed descriptions and parameters for various contract actions such as RegisterService, RegisterDigitalResource, FoundZone, SubmitClaims, and RevokeClaims. The explanations are comprehensive, and the use of preconditions and detailed parameter descriptions will likely help developers understand how to interact with the contract. Ensure that the removal of the AttachMetadata, DetachMetadata, ReviseMetadata functions and their replacement with SubmitClaims and RevokeClaims is reflected across all documentation and client code that interacts with this contract.

  • 214-217: The footer note indicates that the documentation is auto-generated by a tool named Fadroma from a JSON schema. This is a good practice as it ensures consistency between the contract's schema and its documentation. However, verify that the version of the tool and the schema hash (dcbd7d6ba7b75fcf) are up to date with the latest changes in the contract.

contracts/okp4-dataverse/src/msg.rs (7)
  • 4-9: The comment for InstantiateMsg is clear and concise, explaining the purpose of the structure. The field name is well-documented, indicating its role as a unique identifier for the dataverse instance.

  • 14-35: > Note: This review was outside of the patch, so it was mapped to the patch with the greatest overlap. Original lines [14-41]

The comments for RegisterService within the ExecuteMsg enum are detailed and provide a good understanding of the function's purpose and its parameters. The use of Uri and Did types is consistent with the rest of the codebase, and the comments explain the preconditions and roles of each parameter effectively.

  • 43-70: The comments for RegisterDigitalResource are comprehensive, explaining the concept of a Digital Resource and the importance of its unique identification through a URI. The preconditions for the identity and provided_by fields are clearly stated, ensuring that the service must be registered before the dataset can be registered.

  • 74-85: The FoundZone function is well-documented, with clear explanations of the concept of a Zone and the role of the identity and registrar fields. The optional nature of the registrar field is noted, which is a good practice for flexibility.

  • 88-110: The SubmitClaims function is thoroughly commented, explaining the concept of claims, their submission as Verifiable Presentations, and the preconditions that must be met. The metadata and format fields are well-documented, including the default format if one is not provided.

  • 112-120: The RevokeClaims function comments clearly state its purpose and the precondition that the identifier of the claims must exist in the dataverse. The identifier field is well-documented, indicating its role in specifying the claims to be revoked.

  • 165-170: The type aliases Uri and Did are succinctly documented with references to their respective specifications. This is a good practice as it provides developers with a quick way to find more information about these concepts.

@ccamel ccamel requested a review from amimart November 15, 2023 08:20
Copy link
Member

@amimart amimart left a comment

Choose a reason for hiding this comment

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

I like the idea, I just noticed some documentation inconsistencies due to the renaming of RegisterDataset in RegisterDigitalResource :)

contracts/okp4-dataverse/src/msg.rs Outdated Show resolved Hide resolved
contracts/okp4-dataverse/src/msg.rs Outdated Show resolved Hide resolved
contracts/okp4-dataverse/src/msg.rs Outdated Show resolved Hide resolved
Co-authored-by: Arnaud Mimart <33665250+amimart@users.noreply.github.com>
Copy link

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

Review Status

Actionable comments generated: 0

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between 0b18fc4 and 81a50b9.
Files selected for processing (1)
  • contracts/okp4-dataverse/src/msg.rs (4 hunks)
Files skipped from review due to trivial changes (1)
  • contracts/okp4-dataverse/src/msg.rs

@ccamel
Copy link
Member Author

ccamel commented Nov 15, 2023

@coderabbitai pause

@ccamel ccamel requested a review from amimart November 15, 2023 15:13
@ccamel ccamel merged commit 94eea6d into main Nov 15, 2023
18 checks passed
@ccamel ccamel deleted the refactor/dataverse-contract branch November 15, 2023 15:32
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.

3 participants