-
Notifications
You must be signed in to change notification settings - Fork 21
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
feat(dataverse)!: rework and enhance vc stored context #625
Conversation
WalkthroughThe changes involve modifications to the Changes
Assessment against linked issues
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configuration File (
|
Codecov ReportAll modified and coverable lines are covered by tests ✅
|
size-limit report 📦
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (4)
- contracts/axone-dataverse/src/contract.rs (4 hunks)
- contracts/axone-dataverse/src/registrar/credential.rs (4 hunks)
- contracts/axone-dataverse/src/registrar/rdf.rs (6 hunks)
- contracts/axone-dataverse/testdata/vc-unsupported-4.nq (1 hunks)
Additional comments not posted (19)
contracts/axone-dataverse/testdata/vc-unsupported-4.nq (1)
3-3
: LGTM! Predicate namespace update.The change from
<dataverse:credential#claim>
to<dataverse:credential:body#claim>
aligns with the new structure for differentiating between the VC's body and context.contracts/axone-dataverse/src/registrar/credential.rs (6)
4-4
: Import statement update.The addition of
Env
andMessageInfo
imports is necessary for the updatedTryFrom
implementation.
9-12
: New fields added toDataverseCredential
.The addition of
height
,timestamp
,tx_index
, andsender
fields enhances the credential's metadata with blockchain context information.
44-54
: UpdatedTryFrom
implementation.The conversion logic now includes environment and message information, allowing the population of new fields with relevant blockchain data.
70-73
: Test utilities import update.The imports for
message_info
,addr
,SENDER
, andmock_env_addr
are necessary for simulating environment and message information in tests.
80-88
: Test case update forDataverseCredential
.The test case now checks for the correct population of new fields, ensuring alignment with the updated conversion logic.
133-134
: Test case update for unsupported credentials.The test case ensures that the updated conversion logic correctly handles unsupported credentials.
contracts/axone-dataverse/src/registrar/rdf.rs (9)
11-20
: Reorganized constants for RDF predicates.The reorganization of constants into
VC_HEADER_
andVC_BODY_
categories improves clarity and semantic organization.
24-52
: New and updated constants for RDF predicates.The new constants for header and body predicates align with the enhanced structure for VC metadata.
100-139
: Updated triples creation logic.The logic for creating triples now uses the new header and body predicates, enhancing the RDF representation of credentials.
144-150
: Conditional handling oftx_index
.The conditional check for
tx_index
allows for flexible serialization of optional attributes.
256-256
: Updated claim triple creation.The use of
VC_BODY_CLAIM
for claim triples aligns with the new structure for RDF representation.
278-280
: Test utilities import update.The imports for
message_info
,addr
,SENDER
, andmock_env_addr
are necessary for simulating environment and message information in tests.
287-303
: Test case update for serialization.The test case ensures that the serialization output aligns with the new structure of header and body predicates.
319-338
: Test case update for named hierarchy serialization.The test case checks the proper serialization of named hierarchies, reflecting the updated RDF structure.
354-356
: Test case for reserved predicates.The test case ensures that claims with reserved predicates are correctly identified and handled.
contracts/axone-dataverse/src/contract.rs (3)
71-71
: LGTM! Theenv
parameter enhances functionality.The addition of the
env
parameter allows theexecute
function to access environmental context, improving its robustness and flexibility.
78-78
: LGTM! Propagatingenv
tosubmit_claims
aligns with the updated signature.Including the
env
parameter in thesubmit_claims
function call ensures that environmental context is utilized throughout the claims processing workflow.
Line range hint
95-106
: LGTM! Theenv
parameter enhances credential verification.The updated function signature and logic in
submit_claims
leverage theenv
parameter, improving the processing and verification of credentials.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lgtm 👍
Closes #615
Details
Brings the changes proposed in #615 by making the difference between VC's body and context (i.e. considered as headers in the RDF), and enhance this context with block information (i.e.
height
,timestamp
&tx_index
).Those changes are considered breaking as it breaks the model stored in the cognitarium.
Summary by CodeRabbit
New Features
DataverseCredential
structure to include new fields for better context representation.Bug Fixes
Documentation
Refactor