Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces the ShardIdMatchesStateIdRule to verify that a shard ID is a prefix of the transaction's state ID, integrating this check into the InclusionProofVerificationRule and adding a new SHARD_ID_MISMATCH status. A review comment suggests enhancing the robustness of the new verification logic by adding null checks and validating data lengths to prevent potential NullPointerException or ArrayIndexOutOfBoundsException.
There was a problem hiding this comment.
Pull request overview
Adds verification to ensure the shard id carried by the unicity certificate’s shard tree certificate matches (is a prefix of) the transaction-derived state id.
Changes:
- Introduces
ShardIdMatchesStateIdRuleto validate shard-id prefix vs. transactionStateId. - Adds
SHARD_ID_MISMATCHtoInclusionProofVerificationStatus. - Integrates the shard-id check into
InclusionProofVerificationRuleprior to unicity certificate verification.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| src/main/java/org/unicitylabs/sdk/transaction/verification/ShardIdMatchesStateIdRule.java | New verification rule that checks shard id prefix against transaction state id. |
| src/main/java/org/unicitylabs/sdk/transaction/verification/InclusionProofVerificationStatus.java | Adds a dedicated status for shard-id mismatch failures. |
| src/main/java/org/unicitylabs/sdk/transaction/verification/InclusionProofVerificationRule.java | Runs the new shard-id rule during inclusion proof verification and maps failure to the new status. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
No description provided.