-
Notifications
You must be signed in to change notification settings - Fork 39
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(sdk): token and group queries #2449
base: v2.0-tokens-dev
Are you sure you want to change the base?
Conversation
WalkthroughThe changes introduce expanded support for new token and group-related message types across several packages. Updates include modifications to constant arrays, multiple new gRPC request/response implementations, conditional serialization derives in the data processing packages, and enhanced error propagation in genesis state creation. Additionally, new modules and query structures are implemented in the proof verifier and SDK, accompanied by extensive unit tests. Several diagnostic files have been removed from the serialization derive package, and a constant function update was applied to the Identifier type. Changes
Sequence Diagram(s)sequenceDiagram
participant C as Client
participant G as PlatformGrpcClient
participant M as MappingConfig
participant D as Drive (Proof Verifier)
C->>G: Send new token/group request (e.g. GetTokenStatusesRequest)
G->>M: Lookup supported VERSIONED_REQUESTS/RESPONSES
M-->>G: Return updated message definitions
G->>D: Process request and validate proofs (via FromProof implementations)
D-->>G: Return verification result and metadata
G->>C: Respond with corresponding message (e.g. GetTokenStatusesResponse)
sequenceDiagram
participant P as Platform
participant T as SDK Test Data Creator
P->>P: Execute create_genesis_state()
alt Error occurs
P-->>P: Propagate error using "?"
else
P->>T: Optionally invoke create_sdk_test_data()
T-->>P: Provide test data for group token queries
P-->>P: Return Ok(())
end
Possibly related PRs
Suggested reviewers
Poem
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 using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
5d54570
to
21de3a4
Compare
@CodeRabbit review |
✅ Actions performedReview triggered.
|
@CodeRabbit review |
✅ Actions performedReview triggered.
|
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: 5
🧹 Nitpick comments (25)
packages/rs-drive-proof-verifier/src/tokens/token_total_supply.rs (1)
30-35
: Consider future-proofing version handling.Currently, the code only handles
Version::V0
. If future versions are introduced, you may want to include a fallback match arm or a more explicit error message for unsupported versions.packages/rs-drive-proof-verifier/src/tokens/token_status.rs (1)
36-45
: Account for potential new versions.Similar to the token total supply logic, consider adding a match arm for future versions, or provide an explicit error for unsupported versions to make this more robust.
packages/rs-sdk/src/platform/tokens/identity_token_balances.rs (2)
14-21
: Consider validating non-empty token IDs.If your business logic requires at least one token, add checks or return a more explicit error when
token_ids
is empty.
44-50
: Validate identity IDs if needed.If your use case mandates at least one identity, ensure the code handles an empty
identity_ids
array appropriately.packages/rs-sdk/src/platform/group_actions.rs (1)
50-105
: Potential code duplication among multiple queries
GroupInfosQuery
and similar query structs below share a near-identical pattern of defining a struct with optional fields and implementingQuery<...>
. If code reuse or maintainability becomes an issue, consider a macro or templated approach to reduce boilerplate.packages/rs-drive-proof-verifier/src/tokens/identity_token_balance.rs (1)
132-198
: Consistent approach in multi-identity proof
Themaybe_from_proof_with_metadata
method follows the same robust verification pattern. The repeated logic might benefit from a shared utility function if this pattern continues in other modules.packages/rs-drive-proof-verifier/src/tokens/token_info.rs (2)
85-85
: Potential debug printing
There's aprintln!
statement at line 85 that logs the proof in hex. Consider removing or gating it behind a debug feature flag to prevent unintentional large or sensitive logs in production.- println!("{:?}", hex::encode(&proof.grovedb_proof)); + // println!("{:?}", hex::encode(&proof.grovedb_proof));
133-198
: Robust multi-identity info verification
Again, the pattern of verifying the proof, mapping errors, and returning(Option<Self>, ResponseMetadata, Proof)
is well-written. If you foresee more repeated proof-verification flows, refactoring into a shared helper might further optimize code reuse.packages/rs-drive-abci/src/execution/platform_events/initialization/create_genesis_state/test/tokens.rs (3)
50-103
: Consider splitting or renaming this function for improved clarity.The
create_data_for_group_token_queries
function performs a variety of operations (identity registration, data contract creation, token minting, freezing, pausing, and adding group actions). This goes beyond simply "creating data." Splitting it into smaller functions or clarifying the name can help enhance readability and maintainability.
72-82
: Clarify the comment on which token is being paused."Pause token 2" might be confusing if you are referring to the token indexed at
TOKEN_ID_2
. Currently, the code usesTOKEN_ID_1
, which is the "second" token in a zero-based index. Consider adjusting the comment for consistency:- // Pause token 2 + // Pause the second token (TOKEN_ID_1)
120-121
: Confirm the handling of private keys.There's a comment hinting that private keys may be printed, but no actual logging takes place. If printing or logging is needed for debugging, add the relevant code. Otherwise, remove or revise the comment to avoid confusion.
packages/rs-drive-proof-verifier/src/group_actions.rs (1)
87-167
: Consider factoring out shared logic.This logic for extracting request fields, verifying proofs, and mapping results repeats across the file. Extracting it into a helper method or utility could reduce duplication and enhance maintainability.
packages/rs-sdk/src/platform/tokens/mod.rs (1)
3-4
: Fix incorrect documentation comment.The documentation comment for
token_info
module is incorrect as it's a copy of theidentity_token_balances
module's comment.Apply this diff to fix the documentation:
-/// Identity token balances queries +/// Token information queriespackages/rs-drive-proof-verifier/src/tokens/mod.rs (1)
1-2
: Maintain consistent module naming across packages.The module name
identity_token_balance
(singular) in the proof verifier differs fromidentity_token_balances
(plural) in the SDK. Consider using consistent naming to improve maintainability.Apply this diff to align with the SDK's naming:
-pub mod identity_token_balance; +pub mod identity_token_balances;packages/rs-sdk/tests/fetch/tokens/token_total_supply.rs (1)
8-14
: Consider adding more test cases.While the test setup is correct, consider adding test cases for:
- Invalid token IDs
- Error handling scenarios
- Edge cases with different supply values
packages/rs-sdk/src/platform/tokens/token_total_supply.rs (1)
7-20
: Consider adding input validation.While the Query implementation is correct, consider adding validation for the token ID before creating the request.
impl Query<GetTokenTotalSupplyRequest> for Identifier { fn query(self, prove: bool) -> Result<GetTokenTotalSupplyRequest, Error> { + if self.is_empty() { + return Err(Error::InvalidInput("Token ID cannot be empty".into())); + } let request = GetTokenTotalSupplyRequest { version: Some(get_token_total_supply_request::Version::V0(packages/rs-drive-abci/src/execution/platform_events/initialization/create_genesis_state/test/mod.rs (1)
17-32
: Consider adding logging for test data generation.While the implementation is correct, adding debug logs would help track test data generation during testing.
pub(super) fn create_sdk_test_data( &self, block_info: &BlockInfo, transaction: TransactionArg, platform_version: &PlatformVersion, ) -> Result<(), Error> { + log::debug!("Creating SDK test data for local network"); if self.config.network != Network::Regtest { return Err(Error::Execution(ExecutionError::CorruptedCodeExecution( "create_sdk_test_data must be called only on local network", ))); } self.create_data_for_group_token_queries(block_info, transaction, platform_version)?; + log::debug!("SDK test data creation completed"); Ok(()) }packages/rs-sdk/tests/fetch/tokens/token_status.rs (1)
21-22
: Improve error handling in test expectation.The current error message doesn't match the actual operation being performed.
.await - .expect("fetch identity token infos"); + .expect("fetch token statuses");packages/rs-sdk/src/platform.rs (1)
3-6
: Consider documenting new modules.While the module additions align with the PR objectives, they should be documented similar to other modules in the file. Also, the TODO comment suggests a future refactor - consider creating a tracking issue.
Would you like me to help create a tracking issue for the TODO regarding proper user-facing API design?
Also applies to: 20-21
packages/rs-sdk/tests/fetch/group_actions.rs (2)
60-87
: Consider removing the debug print statement.The test effectively validates group fetching with pagination. However, the
dbg!
statement on line 78 should be removed as it's not necessary for the test.- dbg!(&groups);
126-156
: Consider removing the debug print statement.The test effectively validates group action fetching. However, the
dbg!
statement on line 148 should be removed as it's not necessary for the test.- dbg!(&group_actions);
packages/rs-sdk/src/mock/requests.rs (1)
287-424
: Consider reducing code duplication in mock implementations.The serialization/deserialization logic is very similar across
IdentityTokenInfos
,IdentitiesTokenInfos
,TokenStatuses
, andGroupActions
. Consider extracting the common pattern into a macro or helper function.Example macro approach:
macro_rules! impl_mock_response_for_retrieved_values { ($type:ty, $value_type:ty) => { impl MockResponse for $type { fn mock_serialize(&self, sdk: &MockDashPlatformSdk) -> Vec<u8> { let vec: Vec<(Identifier, Option<$value_type>)> = self.iter().map(|(k, v)| (*k, v.clone())).collect(); platform_encode_to_vec(vec, BINCODE_CONFIG, sdk.version()) .expect(concat!("encode ", stringify!($type))) } fn mock_deserialize(sdk: &MockDashPlatformSdk, buf: &[u8]) -> Self where Self: Sized, { let vec: Vec<(Identifier, Option<$value_type>)> = platform_versioned_decode_from_slice(buf, BINCODE_CONFIG, sdk.version()) .expect(concat!("decode ", stringify!($type))); RetrievedValues::from_iter(vec) } } }; } // Usage: impl_mock_response_for_retrieved_values!(IdentityTokenInfos, IdentityTokenInfo); impl_mock_response_for_retrieved_values!(IdentitiesTokenInfos, IdentityTokenInfo); impl_mock_response_for_retrieved_values!(TokenStatuses, TokenStatus); impl_mock_response_for_retrieved_values!(GroupActions, GroupAction);packages/rs-sdk/Cargo.toml (1)
62-63
: Track the TODO comment about removing features from default.The comment indicates that
mocks
andoffline-testing
should be removed from default features in the future.Would you like me to create an issue to track this technical debt?
packages/rs-sdk/README.md (2)
96-98
: Clarify Test Vector Generation InstructionsThe updated steps clearly instruct developers to (1) uncomment the
create_sdk_test_data(...)
call, (2) run thegenerate_test_vectors.sh
script, and (3) optionally commit the generated vectors.Suggestion: Consider adding a brief note clarifying whether generated test vector files should be committed or ignored (for example, via a .gitignore rule) to prevent accidental pollution of the repository.
146-147
: Review Duplicate Checklist StepsThe checklist now contains duplicate instructions for:
- Uncommenting
create_sdk_test_data(...)
(see step 2 on line 96 and step 15 on line 146), and- Generating test vectors (step 3 on line 97 versus step 16 on line 147).
Please confirm whether both occurrences are necessary or if these steps can be consolidated to avoid confusion.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (82)
packages/dapi-grpc/build.rs
(3 hunks)packages/rs-dapi-client/src/transport/grpc.rs
(1 hunks)packages/rs-dpp/src/balances/total_single_token_balance/mod.rs
(1 hunks)packages/rs-dpp/src/tokens/info/mod.rs
(2 hunks)packages/rs-dpp/src/tokens/info/v0/mod.rs
(1 hunks)packages/rs-drive-abci/src/execution/platform_events/initialization/create_genesis_state/mod.rs
(2 hunks)packages/rs-drive-abci/src/execution/platform_events/initialization/create_genesis_state/test/mod.rs
(1 hunks)packages/rs-drive-abci/src/execution/platform_events/initialization/create_genesis_state/test/tokens.rs
(1 hunks)packages/rs-drive-proof-verifier/Cargo.toml
(1 hunks)packages/rs-drive-proof-verifier/src/group_actions.rs
(1 hunks)packages/rs-drive-proof-verifier/src/lib.rs
(1 hunks)packages/rs-drive-proof-verifier/src/tokens/identity_token_balance.rs
(1 hunks)packages/rs-drive-proof-verifier/src/tokens/mod.rs
(1 hunks)packages/rs-drive-proof-verifier/src/tokens/token_info.rs
(1 hunks)packages/rs-drive-proof-verifier/src/tokens/token_status.rs
(1 hunks)packages/rs-drive-proof-verifier/src/tokens/token_total_supply.rs
(1 hunks)packages/rs-platform-serialization-derive/rustc-ice-2024-02-20T10_33_46-3251.txt
(0 hunks)packages/rs-platform-serialization-derive/rustc-ice-2024-02-20T10_35_00-10108.txt
(0 hunks)packages/rs-platform-serialization-derive/rustc-ice-2024-02-20T10_35_04-10384.txt
(0 hunks)packages/rs-platform-serialization-derive/rustc-ice-2024-02-20T10_35_08-10643.txt
(0 hunks)packages/rs-platform-serialization-derive/rustc-ice-2024-02-20T10_35_12-10937.txt
(0 hunks)packages/rs-platform-serialization-derive/rustc-ice-2024-02-20T10_35_20-11458.txt
(0 hunks)packages/rs-platform-serialization-derive/rustc-ice-2024-02-20T10_35_23-11733.txt
(0 hunks)packages/rs-platform-serialization-derive/rustc-ice-2024-02-20T10_35_25-11999.txt
(0 hunks)packages/rs-platform-serialization-derive/rustc-ice-2024-02-20T10_35_26-12247.txt
(0 hunks)packages/rs-platform-serialization-derive/rustc-ice-2024-02-20T10_35_28-12710.txt
(0 hunks)packages/rs-platform-serialization-derive/rustc-ice-2024-02-20T10_35_29-12958.txt
(0 hunks)packages/rs-platform-serialization-derive/rustc-ice-2024-02-20T10_35_30-13195.txt
(0 hunks)packages/rs-platform-value/src/types/identifier.rs
(1 hunks)packages/rs-sdk/Cargo.toml
(2 hunks)packages/rs-sdk/README.md
(3 hunks)packages/rs-sdk/src/mock/requests.rs
(6 hunks)packages/rs-sdk/src/mock/sdk.rs
(1 hunks)packages/rs-sdk/src/platform.rs
(1 hunks)packages/rs-sdk/src/platform/group_actions.rs
(1 hunks)packages/rs-sdk/src/platform/tokens/identity_token_balances.rs
(1 hunks)packages/rs-sdk/src/platform/tokens/mod.rs
(1 hunks)packages/rs-sdk/src/platform/tokens/token_info.rs
(1 hunks)packages/rs-sdk/src/platform/tokens/token_status.rs
(1 hunks)packages/rs-sdk/src/platform/tokens/token_total_supply.rs
(1 hunks)packages/rs-sdk/tests/fetch/config.rs
(3 hunks)packages/rs-sdk/tests/fetch/contested_resource_vote_state.rs
(1 hunks)packages/rs-sdk/tests/fetch/generated_data.rs
(1 hunks)packages/rs-sdk/tests/fetch/group_actions.rs
(1 hunks)packages/rs-sdk/tests/fetch/mod.rs
(1 hunks)packages/rs-sdk/tests/fetch/tokens/identity_token_balances.rs
(1 hunks)packages/rs-sdk/tests/fetch/tokens/mod.rs
(1 hunks)packages/rs-sdk/tests/fetch/tokens/token_info.rs
(1 hunks)packages/rs-sdk/tests/fetch/tokens/token_status.rs
(1 hunks)packages/rs-sdk/tests/fetch/tokens/token_total_supply.rs
(1 hunks)packages/rs-sdk/tests/vectors/contested_resource_identity_votes_not_found/quorum_pubkey-106-029045172fbebcf97290db8879490a48ac0d1d60e249d031b5ad79e3e46e3fca.json
(0 hunks)packages/rs-sdk/tests/vectors/contested_resource_identity_votes_not_found/quorum_pubkey-106-1e36eadee30940f5c42271ceb15ed97c58eb057410158b392ceec4d4631eff63.json
(1 hunks)packages/rs-sdk/tests/vectors/contested_resource_vote_states_not_found/data_contract-e668c659af66aee1e72c186dde7b5b7e0a1d712a09c40d5721f622bf53c53155.json
(1 hunks)packages/rs-sdk/tests/vectors/contested_resource_vote_states_not_found/quorum_pubkey-106-029045172fbebcf97290db8879490a48ac0d1d60e249d031b5ad79e3e46e3fca.json
(0 hunks)packages/rs-sdk/tests/vectors/contested_resource_vote_states_not_found/quorum_pubkey-106-1e36eadee30940f5c42271ceb15ed97c58eb057410158b392ceec4d4631eff63.json
(1 hunks)packages/rs-sdk/tests/vectors/document_list_document_query/quorum_pubkey-106-029045172fbebcf97290db8879490a48ac0d1d60e249d031b5ad79e3e46e3fca.json
(0 hunks)packages/rs-sdk/tests/vectors/document_list_document_query/quorum_pubkey-106-1e36eadee30940f5c42271ceb15ed97c58eb057410158b392ceec4d4631eff63.json
(1 hunks)packages/rs-sdk/tests/vectors/document_list_drive_query/quorum_pubkey-106-029045172fbebcf97290db8879490a48ac0d1d60e249d031b5ad79e3e46e3fca.json
(0 hunks)packages/rs-sdk/tests/vectors/document_list_drive_query/quorum_pubkey-106-1e36eadee30940f5c42271ceb15ed97c58eb057410158b392ceec4d4631eff63.json
(1 hunks)packages/rs-sdk/tests/vectors/document_read/quorum_pubkey-106-029045172fbebcf97290db8879490a48ac0d1d60e249d031b5ad79e3e46e3fca.json
(0 hunks)packages/rs-sdk/tests/vectors/document_read/quorum_pubkey-106-1e36eadee30940f5c42271ceb15ed97c58eb057410158b392ceec4d4631eff63.json
(1 hunks)packages/rs-sdk/tests/vectors/document_read_no_contract/quorum_pubkey-106-029045172fbebcf97290db8879490a48ac0d1d60e249d031b5ad79e3e46e3fca.json
(0 hunks)packages/rs-sdk/tests/vectors/document_read_no_contract/quorum_pubkey-106-1e36eadee30940f5c42271ceb15ed97c58eb057410158b392ceec4d4631eff63.json
(1 hunks)packages/rs-sdk/tests/vectors/document_read_no_document/quorum_pubkey-106-029045172fbebcf97290db8879490a48ac0d1d60e249d031b5ad79e3e46e3fca.json
(0 hunks)packages/rs-sdk/tests/vectors/document_read_no_document/quorum_pubkey-106-1e36eadee30940f5c42271ceb15ed97c58eb057410158b392ceec4d4631eff63.json
(1 hunks)packages/rs-sdk/tests/vectors/test_data_contract_read/quorum_pubkey-106-029045172fbebcf97290db8879490a48ac0d1d60e249d031b5ad79e3e46e3fca.json
(0 hunks)packages/rs-sdk/tests/vectors/test_data_contract_read/quorum_pubkey-106-1e36eadee30940f5c42271ceb15ed97c58eb057410158b392ceec4d4631eff63.json
(1 hunks)packages/rs-sdk/tests/vectors/test_data_contract_read_not_found/quorum_pubkey-106-029045172fbebcf97290db8879490a48ac0d1d60e249d031b5ad79e3e46e3fca.json
(0 hunks)packages/rs-sdk/tests/vectors/test_data_contract_read_not_found/quorum_pubkey-106-1e36eadee30940f5c42271ceb15ed97c58eb057410158b392ceec4d4631eff63.json
(1 hunks)packages/rs-sdk/tests/vectors/test_data_contracts_1_ok_1_nx/quorum_pubkey-106-029045172fbebcf97290db8879490a48ac0d1d60e249d031b5ad79e3e46e3fca.json
(0 hunks)packages/rs-sdk/tests/vectors/test_data_contracts_1_ok_1_nx/quorum_pubkey-106-1e36eadee30940f5c42271ceb15ed97c58eb057410158b392ceec4d4631eff63.json
(1 hunks)packages/rs-sdk/tests/vectors/test_data_contracts_2_nx/quorum_pubkey-106-029045172fbebcf97290db8879490a48ac0d1d60e249d031b5ad79e3e46e3fca.json
(0 hunks)packages/rs-sdk/tests/vectors/test_data_contracts_2_nx/quorum_pubkey-106-1e36eadee30940f5c42271ceb15ed97c58eb057410158b392ceec4d4631eff63.json
(1 hunks)packages/rs-sdk/tests/vectors/test_epoch_fetch/quorum_pubkey-106-029045172fbebcf97290db8879490a48ac0d1d60e249d031b5ad79e3e46e3fca.json
(0 hunks)packages/rs-sdk/tests/vectors/test_epoch_fetch/quorum_pubkey-106-1e36eadee30940f5c42271ceb15ed97c58eb057410158b392ceec4d4631eff63.json
(1 hunks)packages/rs-sdk/tests/vectors/test_epoch_fetch_current/quorum_pubkey-106-029045172fbebcf97290db8879490a48ac0d1d60e249d031b5ad79e3e46e3fca.json
(0 hunks)packages/rs-sdk/tests/vectors/test_epoch_fetch_current/quorum_pubkey-106-1e36eadee30940f5c42271ceb15ed97c58eb057410158b392ceec4d4631eff63.json
(1 hunks)packages/rs-sdk/tests/vectors/test_epoch_fetch_future/quorum_pubkey-106-029045172fbebcf97290db8879490a48ac0d1d60e249d031b5ad79e3e46e3fca.json
(0 hunks)packages/rs-sdk/tests/vectors/test_epoch_fetch_future/quorum_pubkey-106-1e36eadee30940f5c42271ceb15ed97c58eb057410158b392ceec4d4631eff63.json
(1 hunks)packages/rs-sdk/tests/vectors/test_epoch_list/quorum_pubkey-106-029045172fbebcf97290db8879490a48ac0d1d60e249d031b5ad79e3e46e3fca.json
(0 hunks)packages/rs-sdk/tests/vectors/test_epoch_list/quorum_pubkey-106-1e36eadee30940f5c42271ceb15ed97c58eb057410158b392ceec4d4631eff63.json
(1 hunks)packages/rs-sdk/tests/vectors/test_epoch_list_limit/quorum_pubkey-106-029045172fbebcf97290db8879490a48ac0d1d60e249d031b5ad79e3e46e3fca.json
(0 hunks)
⛔ Files not processed due to max files limit (31)
- packages/rs-sdk/tests/vectors/test_epoch_list_limit/quorum_pubkey-106-1e36eadee30940f5c42271ceb15ed97c58eb057410158b392ceec4d4631eff63.json
- packages/rs-sdk/tests/vectors/test_identity_balance_read/quorum_pubkey-106-029045172fbebcf97290db8879490a48ac0d1d60e249d031b5ad79e3e46e3fca.json
- packages/rs-sdk/tests/vectors/test_identity_balance_read/quorum_pubkey-106-1e36eadee30940f5c42271ceb15ed97c58eb057410158b392ceec4d4631eff63.json
- packages/rs-sdk/tests/vectors/test_identity_balance_revision_read/quorum_pubkey-106-029045172fbebcf97290db8879490a48ac0d1d60e249d031b5ad79e3e46e3fca.json
- packages/rs-sdk/tests/vectors/test_identity_balance_revision_read/quorum_pubkey-106-1e36eadee30940f5c42271ceb15ed97c58eb057410158b392ceec4d4631eff63.json
- packages/rs-sdk/tests/vectors/test_identity_contract_no_nonce_read/quorum_pubkey-106-029045172fbebcf97290db8879490a48ac0d1d60e249d031b5ad79e3e46e3fca.json
- packages/rs-sdk/tests/vectors/test_identity_contract_no_nonce_read/quorum_pubkey-106-1e36eadee30940f5c42271ceb15ed97c58eb057410158b392ceec4d4631eff63.json
- packages/rs-sdk/tests/vectors/test_identity_public_keys_all_read/quorum_pubkey-106-029045172fbebcf97290db8879490a48ac0d1d60e249d031b5ad79e3e46e3fca.json
- packages/rs-sdk/tests/vectors/test_identity_public_keys_all_read/quorum_pubkey-106-1e36eadee30940f5c42271ceb15ed97c58eb057410158b392ceec4d4631eff63.json
- packages/rs-sdk/tests/vectors/test_identity_read/quorum_pubkey-106-029045172fbebcf97290db8879490a48ac0d1d60e249d031b5ad79e3e46e3fca.json
- packages/rs-sdk/tests/vectors/test_identity_read/quorum_pubkey-106-1e36eadee30940f5c42271ceb15ed97c58eb057410158b392ceec4d4631eff63.json
- packages/rs-sdk/tests/vectors/test_identity_read_by_key/quorum_pubkey-106-029045172fbebcf97290db8879490a48ac0d1d60e249d031b5ad79e3e46e3fca.json
- packages/rs-sdk/tests/vectors/test_identity_read_by_key/quorum_pubkey-106-1e36eadee30940f5c42271ceb15ed97c58eb057410158b392ceec4d4631eff63.json
- packages/rs-sdk/tests/vectors/test_identity_token_info/quorum_pubkey-106-1e36eadee30940f5c42271ceb15ed97c58eb057410158b392ceec4d4631eff63.json
- packages/rs-sdk/tests/vectors/test_multiple_identities_token_balances/quorum_pubkey-106-1e36eadee30940f5c42271ceb15ed97c58eb057410158b392ceec4d4631eff63.json
- packages/rs-sdk/tests/vectors/test_multiple_identities_with_unknown_token_balance/quorum_pubkey-106-1e36eadee30940f5c42271ceb15ed97c58eb057410158b392ceec4d4631eff63.json
- packages/rs-sdk/tests/vectors/test_multiple_identity_token_balances/quorum_pubkey-106-1e36eadee30940f5c42271ceb15ed97c58eb057410158b392ceec4d4631eff63.json
- packages/rs-sdk/tests/vectors/test_prefunded_specialized_balance_not_found/quorum_pubkey-106-029045172fbebcf97290db8879490a48ac0d1d60e249d031b5ad79e3e46e3fca.json
- packages/rs-sdk/tests/vectors/test_prefunded_specialized_balance_not_found/quorum_pubkey-106-1e36eadee30940f5c42271ceb15ed97c58eb057410158b392ceec4d4631eff63.json
- packages/rs-sdk/tests/vectors/test_protocol_version_vote_count/quorum_pubkey-106-029045172fbebcf97290db8879490a48ac0d1d60e249d031b5ad79e3e46e3fca.json
- packages/rs-sdk/tests/vectors/test_protocol_version_vote_count/quorum_pubkey-106-1e36eadee30940f5c42271ceb15ed97c58eb057410158b392ceec4d4631eff63.json
- packages/rs-sdk/tests/vectors/test_protocol_version_votes_limit_2/quorum_pubkey-106-029045172fbebcf97290db8879490a48ac0d1d60e249d031b5ad79e3e46e3fca.json
- packages/rs-sdk/tests/vectors/test_protocol_version_votes_limit_2/quorum_pubkey-106-1e36eadee30940f5c42271ceb15ed97c58eb057410158b392ceec4d4631eff63.json
- packages/rs-sdk/tests/vectors/test_protocol_version_votes_none/quorum_pubkey-106-029045172fbebcf97290db8879490a48ac0d1d60e249d031b5ad79e3e46e3fca.json
- packages/rs-sdk/tests/vectors/test_protocol_version_votes_none/quorum_pubkey-106-1e36eadee30940f5c42271ceb15ed97c58eb057410158b392ceec4d4631eff63.json
- packages/rs-sdk/tests/vectors/test_protocol_version_votes_nx/quorum_pubkey-106-029045172fbebcf97290db8879490a48ac0d1d60e249d031b5ad79e3e46e3fca.json
- packages/rs-sdk/tests/vectors/test_protocol_version_votes_nx/quorum_pubkey-106-1e36eadee30940f5c42271ceb15ed97c58eb057410158b392ceec4d4631eff63.json
- packages/rs-sdk/tests/vectors/test_protocol_version_votes_zeros/quorum_pubkey-106-029045172fbebcf97290db8879490a48ac0d1d60e249d031b5ad79e3e46e3fca.json
- packages/rs-sdk/tests/vectors/test_protocol_version_votes_zeros/quorum_pubkey-106-1e36eadee30940f5c42271ceb15ed97c58eb057410158b392ceec4d4631eff63.json
- packages/rs-sdk/tests/vectors/test_token_status/quorum_pubkey-106-1e36eadee30940f5c42271ceb15ed97c58eb057410158b392ceec4d4631eff63.json
- packages/rs-sdk/tests/vectors/test_token_total_supply/quorum_pubkey-106-1e36eadee30940f5c42271ceb15ed97c58eb057410158b392ceec4d4631eff63.json
💤 Files with no reviewable changes (28)
- packages/rs-sdk/tests/vectors/test_data_contract_read_not_found/quorum_pubkey-106-029045172fbebcf97290db8879490a48ac0d1d60e249d031b5ad79e3e46e3fca.json
- packages/rs-sdk/tests/vectors/test_epoch_fetch_current/quorum_pubkey-106-029045172fbebcf97290db8879490a48ac0d1d60e249d031b5ad79e3e46e3fca.json
- packages/rs-sdk/tests/vectors/test_epoch_list/quorum_pubkey-106-029045172fbebcf97290db8879490a48ac0d1d60e249d031b5ad79e3e46e3fca.json
- packages/rs-sdk/tests/vectors/document_read_no_document/quorum_pubkey-106-029045172fbebcf97290db8879490a48ac0d1d60e249d031b5ad79e3e46e3fca.json
- packages/rs-sdk/tests/vectors/test_data_contracts_1_ok_1_nx/quorum_pubkey-106-029045172fbebcf97290db8879490a48ac0d1d60e249d031b5ad79e3e46e3fca.json
- packages/rs-sdk/tests/vectors/document_list_drive_query/quorum_pubkey-106-029045172fbebcf97290db8879490a48ac0d1d60e249d031b5ad79e3e46e3fca.json
- packages/rs-sdk/tests/vectors/test_data_contracts_2_nx/quorum_pubkey-106-029045172fbebcf97290db8879490a48ac0d1d60e249d031b5ad79e3e46e3fca.json
- packages/rs-sdk/tests/vectors/document_list_document_query/quorum_pubkey-106-029045172fbebcf97290db8879490a48ac0d1d60e249d031b5ad79e3e46e3fca.json
- packages/rs-sdk/tests/vectors/document_read_no_contract/quorum_pubkey-106-029045172fbebcf97290db8879490a48ac0d1d60e249d031b5ad79e3e46e3fca.json
- packages/rs-platform-serialization-derive/rustc-ice-2024-02-20T10_33_46-3251.txt
- packages/rs-platform-serialization-derive/rustc-ice-2024-02-20T10_35_04-10384.txt
- packages/rs-platform-serialization-derive/rustc-ice-2024-02-20T10_35_00-10108.txt
- packages/rs-platform-serialization-derive/rustc-ice-2024-02-20T10_35_20-11458.txt
- packages/rs-sdk/tests/vectors/document_read/quorum_pubkey-106-029045172fbebcf97290db8879490a48ac0d1d60e249d031b5ad79e3e46e3fca.json
- packages/rs-platform-serialization-derive/rustc-ice-2024-02-20T10_35_23-11733.txt
- packages/rs-platform-serialization-derive/rustc-ice-2024-02-20T10_35_12-10937.txt
- packages/rs-sdk/tests/vectors/contested_resource_vote_states_not_found/quorum_pubkey-106-029045172fbebcf97290db8879490a48ac0d1d60e249d031b5ad79e3e46e3fca.json
- packages/rs-sdk/tests/vectors/test_epoch_list_limit/quorum_pubkey-106-029045172fbebcf97290db8879490a48ac0d1d60e249d031b5ad79e3e46e3fca.json
- packages/rs-sdk/tests/vectors/test_epoch_fetch/quorum_pubkey-106-029045172fbebcf97290db8879490a48ac0d1d60e249d031b5ad79e3e46e3fca.json
- packages/rs-sdk/tests/vectors/test_data_contract_read/quorum_pubkey-106-029045172fbebcf97290db8879490a48ac0d1d60e249d031b5ad79e3e46e3fca.json
- packages/rs-platform-serialization-derive/rustc-ice-2024-02-20T10_35_08-10643.txt
- packages/rs-sdk/tests/vectors/contested_resource_identity_votes_not_found/quorum_pubkey-106-029045172fbebcf97290db8879490a48ac0d1d60e249d031b5ad79e3e46e3fca.json
- packages/rs-sdk/tests/vectors/test_epoch_fetch_future/quorum_pubkey-106-029045172fbebcf97290db8879490a48ac0d1d60e249d031b5ad79e3e46e3fca.json
- packages/rs-platform-serialization-derive/rustc-ice-2024-02-20T10_35_25-11999.txt
- packages/rs-platform-serialization-derive/rustc-ice-2024-02-20T10_35_29-12958.txt
- packages/rs-platform-serialization-derive/rustc-ice-2024-02-20T10_35_26-12247.txt
- packages/rs-platform-serialization-derive/rustc-ice-2024-02-20T10_35_30-13195.txt
- packages/rs-platform-serialization-derive/rustc-ice-2024-02-20T10_35_28-12710.txt
✅ Files skipped from review due to trivial changes (1)
- packages/rs-sdk/tests/vectors/contested_resource_vote_states_not_found/data_contract-e668c659af66aee1e72c186dde7b5b7e0a1d712a09c40d5721f622bf53c53155.json
🧰 Additional context used
📓 Learnings (9)
packages/rs-sdk/tests/vectors/contested_resource_vote_states_not_found/quorum_pubkey-106-1e36eadee30940f5c42271ceb15ed97c58eb057410158b392ceec4d4631eff63.json (1)
Learnt from: lklimek
PR: dashpay/platform#2030
File: packages/rs-sdk/tests/vectors/test_asset_lock_proof/quorum_pubkey-100-4ce7fd81273c2b394c0f32367374fc5b09ba912e017aacb366d2171e9ca6f9d5.json:1-1
Timestamp: 2024-12-10T10:56:26.215Z
Learning: In the `packages/rs-sdk/tests/vectors/test_asset_lock_proof/` directory, files with the `.json` extension are mock data that may not follow standard JSON format; this is intentional and acceptable within the project's testing framework.
packages/rs-sdk/tests/vectors/document_list_drive_query/quorum_pubkey-106-1e36eadee30940f5c42271ceb15ed97c58eb057410158b392ceec4d4631eff63.json (1)
Learnt from: lklimek
PR: dashpay/platform#2030
File: packages/rs-sdk/tests/vectors/test_asset_lock_proof/quorum_pubkey-100-4ce7fd81273c2b394c0f32367374fc5b09ba912e017aacb366d2171e9ca6f9d5.json:1-1
Timestamp: 2024-12-10T10:56:26.215Z
Learning: In the `packages/rs-sdk/tests/vectors/test_asset_lock_proof/` directory, files with the `.json` extension are mock data that may not follow standard JSON format; this is intentional and acceptable within the project's testing framework.
packages/rs-sdk/tests/vectors/document_read_no_document/quorum_pubkey-106-1e36eadee30940f5c42271ceb15ed97c58eb057410158b392ceec4d4631eff63.json (1)
Learnt from: lklimek
PR: dashpay/platform#2030
File: packages/rs-sdk/tests/vectors/test_asset_lock_proof/quorum_pubkey-100-4ce7fd81273c2b394c0f32367374fc5b09ba912e017aacb366d2171e9ca6f9d5.json:1-1
Timestamp: 2024-12-10T10:56:26.215Z
Learning: In the `packages/rs-sdk/tests/vectors/test_asset_lock_proof/` directory, files with the `.json` extension are mock data that may not follow standard JSON format; this is intentional and acceptable within the project's testing framework.
packages/rs-sdk/tests/vectors/test_data_contract_read/quorum_pubkey-106-1e36eadee30940f5c42271ceb15ed97c58eb057410158b392ceec4d4631eff63.json (1)
Learnt from: lklimek
PR: dashpay/platform#2030
File: packages/rs-sdk/tests/vectors/test_asset_lock_proof/quorum_pubkey-100-4ce7fd81273c2b394c0f32367374fc5b09ba912e017aacb366d2171e9ca6f9d5.json:1-1
Timestamp: 2024-12-10T10:56:26.215Z
Learning: In the `packages/rs-sdk/tests/vectors/test_asset_lock_proof/` directory, files with the `.json` extension are mock data that may not follow standard JSON format; this is intentional and acceptable within the project's testing framework.
packages/rs-sdk/tests/vectors/test_data_contract_read_not_found/quorum_pubkey-106-1e36eadee30940f5c42271ceb15ed97c58eb057410158b392ceec4d4631eff63.json (1)
Learnt from: lklimek
PR: dashpay/platform#2030
File: packages/rs-sdk/tests/vectors/test_asset_lock_proof/quorum_pubkey-100-4ce7fd81273c2b394c0f32367374fc5b09ba912e017aacb366d2171e9ca6f9d5.json:1-1
Timestamp: 2024-12-10T10:56:26.215Z
Learning: In the `packages/rs-sdk/tests/vectors/test_asset_lock_proof/` directory, files with the `.json` extension are mock data that may not follow standard JSON format; this is intentional and acceptable within the project's testing framework.
packages/rs-sdk/tests/vectors/test_data_contracts_1_ok_1_nx/quorum_pubkey-106-1e36eadee30940f5c42271ceb15ed97c58eb057410158b392ceec4d4631eff63.json (1)
Learnt from: lklimek
PR: dashpay/platform#2030
File: packages/rs-sdk/tests/vectors/test_asset_lock_proof/quorum_pubkey-100-4ce7fd81273c2b394c0f32367374fc5b09ba912e017aacb366d2171e9ca6f9d5.json:1-1
Timestamp: 2024-12-10T10:56:26.215Z
Learning: In the `packages/rs-sdk/tests/vectors/test_asset_lock_proof/` directory, files with the `.json` extension are mock data that may not follow standard JSON format; this is intentional and acceptable within the project's testing framework.
packages/rs-sdk/tests/vectors/test_data_contracts_2_nx/quorum_pubkey-106-1e36eadee30940f5c42271ceb15ed97c58eb057410158b392ceec4d4631eff63.json (1)
Learnt from: lklimek
PR: dashpay/platform#2030
File: packages/rs-sdk/tests/vectors/test_asset_lock_proof/quorum_pubkey-100-4ce7fd81273c2b394c0f32367374fc5b09ba912e017aacb366d2171e9ca6f9d5.json:1-1
Timestamp: 2024-12-10T10:56:26.215Z
Learning: In the `packages/rs-sdk/tests/vectors/test_asset_lock_proof/` directory, files with the `.json` extension are mock data that may not follow standard JSON format; this is intentional and acceptable within the project's testing framework.
packages/rs-sdk/tests/vectors/test_epoch_fetch/quorum_pubkey-106-1e36eadee30940f5c42271ceb15ed97c58eb057410158b392ceec4d4631eff63.json (1)
Learnt from: lklimek
PR: dashpay/platform#2030
File: packages/rs-sdk/tests/vectors/test_asset_lock_proof/quorum_pubkey-100-4ce7fd81273c2b394c0f32367374fc5b09ba912e017aacb366d2171e9ca6f9d5.json:1-1
Timestamp: 2024-12-10T10:56:26.215Z
Learning: In the `packages/rs-sdk/tests/vectors/test_asset_lock_proof/` directory, files with the `.json` extension are mock data that may not follow standard JSON format; this is intentional and acceptable within the project's testing framework.
packages/rs-sdk/tests/vectors/test_epoch_fetch_future/quorum_pubkey-106-1e36eadee30940f5c42271ceb15ed97c58eb057410158b392ceec4d4631eff63.json (1)
Learnt from: lklimek
PR: dashpay/platform#2030
File: packages/rs-sdk/tests/vectors/test_asset_lock_proof/quorum_pubkey-100-4ce7fd81273c2b394c0f32367374fc5b09ba912e017aacb366d2171e9ca6f9d5.json:1-1
Timestamp: 2024-12-10T10:56:26.215Z
Learning: In the `packages/rs-sdk/tests/vectors/test_asset_lock_proof/` directory, files with the `.json` extension are mock data that may not follow standard JSON format; this is intentional and acceptable within the project's testing framework.
🪛 Biome (1.9.4)
packages/rs-sdk/tests/vectors/contested_resource_identity_votes_not_found/quorum_pubkey-106-1e36eadee30940f5c42271ceb15ed97c58eb057410158b392ceec4d4631eff63.json
[error] 1-1: String values must be double quoted.
(parse)
packages/rs-sdk/tests/vectors/contested_resource_vote_states_not_found/quorum_pubkey-106-1e36eadee30940f5c42271ceb15ed97c58eb057410158b392ceec4d4631eff63.json
[error] 1-1: String values must be double quoted.
(parse)
packages/rs-sdk/tests/vectors/document_list_document_query/quorum_pubkey-106-1e36eadee30940f5c42271ceb15ed97c58eb057410158b392ceec4d4631eff63.json
[error] 1-1: String values must be double quoted.
(parse)
packages/rs-sdk/tests/vectors/document_list_drive_query/quorum_pubkey-106-1e36eadee30940f5c42271ceb15ed97c58eb057410158b392ceec4d4631eff63.json
[error] 1-1: String values must be double quoted.
(parse)
packages/rs-sdk/tests/vectors/document_read/quorum_pubkey-106-1e36eadee30940f5c42271ceb15ed97c58eb057410158b392ceec4d4631eff63.json
[error] 1-1: String values must be double quoted.
(parse)
packages/rs-sdk/tests/vectors/document_read_no_contract/quorum_pubkey-106-1e36eadee30940f5c42271ceb15ed97c58eb057410158b392ceec4d4631eff63.json
[error] 1-1: String values must be double quoted.
(parse)
packages/rs-sdk/tests/vectors/document_read_no_document/quorum_pubkey-106-1e36eadee30940f5c42271ceb15ed97c58eb057410158b392ceec4d4631eff63.json
[error] 1-1: String values must be double quoted.
(parse)
packages/rs-sdk/tests/vectors/test_data_contract_read/quorum_pubkey-106-1e36eadee30940f5c42271ceb15ed97c58eb057410158b392ceec4d4631eff63.json
[error] 1-1: String values must be double quoted.
(parse)
packages/rs-sdk/tests/vectors/test_data_contract_read_not_found/quorum_pubkey-106-1e36eadee30940f5c42271ceb15ed97c58eb057410158b392ceec4d4631eff63.json
[error] 1-1: String values must be double quoted.
(parse)
packages/rs-sdk/tests/vectors/test_data_contracts_1_ok_1_nx/quorum_pubkey-106-1e36eadee30940f5c42271ceb15ed97c58eb057410158b392ceec4d4631eff63.json
[error] 1-1: String values must be double quoted.
(parse)
packages/rs-sdk/tests/vectors/test_data_contracts_2_nx/quorum_pubkey-106-1e36eadee30940f5c42271ceb15ed97c58eb057410158b392ceec4d4631eff63.json
[error] 1-1: String values must be double quoted.
(parse)
packages/rs-sdk/tests/vectors/test_epoch_fetch/quorum_pubkey-106-1e36eadee30940f5c42271ceb15ed97c58eb057410158b392ceec4d4631eff63.json
[error] 1-1: String values must be double quoted.
(parse)
packages/rs-sdk/tests/vectors/test_epoch_fetch_current/quorum_pubkey-106-1e36eadee30940f5c42271ceb15ed97c58eb057410158b392ceec4d4631eff63.json
[error] 1-1: String values must be double quoted.
(parse)
packages/rs-sdk/tests/vectors/test_epoch_fetch_future/quorum_pubkey-106-1e36eadee30940f5c42271ceb15ed97c58eb057410158b392ceec4d4631eff63.json
[error] 1-1: String values must be double quoted.
(parse)
packages/rs-sdk/tests/vectors/test_epoch_list/quorum_pubkey-106-1e36eadee30940f5c42271ceb15ed97c58eb057410158b392ceec4d4631eff63.json
[error] 1-1: String values must be double quoted.
(parse)
🔇 Additional comments (70)
packages/rs-sdk/tests/vectors/test_data_contract_read/quorum_pubkey-106-1e36eadee30940f5c42271ceb15ed97c58eb057410158b392ceec4d4631eff63.json (1)
1-1
: Intentional Test Vector Hash AdditionThe added hash value is used as a test vector for validating data contract reads. The file intentionally does not follow standard JSON formatting, which aligns with project-specific practices for mock test data.
🧰 Tools
🪛 Biome (1.9.4)
[error] 1-1: String values must be double quoted.
(parse)
packages/rs-sdk/tests/vectors/test_data_contract_read_not_found/quorum_pubkey-106-1e36eadee30940f5c42271ceb15ed97c58eb057410158b392ceec4d4631eff63.json (1)
1-1
: Intentional Non-Standard JSON Format for Test DataThe file introduces a single-line hash value without the typical double quotes expected in standard JSON. This deviation is intentional according to the project's testing framework, which accepts non-standard JSON formats for mock data files.
🧰 Tools
🪛 Biome (1.9.4)
[error] 1-1: String values must be double quoted.
(parse)
packages/rs-sdk/tests/vectors/test_epoch_fetch_future/quorum_pubkey-106-1e36eadee30940f5c42271ceb15ed97c58eb057410158b392ceec4d4631eff63.json (1)
1-1
: Intentionally Non-Standard JSON Format is AcceptableThe file contains a hash value in plain text without double quotes, which deviates from strict JSON formatting. This is intentional for test vectors in this directory—as noted in previous learnings—even though static analysis flags it. The added newline at the end ensures proper file termination.
🧰 Tools
🪛 Biome (1.9.4)
[error] 1-1: String values must be double quoted.
(parse)
packages/rs-drive-proof-verifier/src/tokens/token_total_supply.rs (1)
44-63
: Implementation looks correct.The logic properly verifies the token total supply proof and aggregated identity balance, and the error handling for GroveDB proof parsing appears solid.
packages/rs-drive-proof-verifier/src/tokens/token_status.rs (1)
54-64
: Approach looks valid.Your approach to verifying token statuses and mapping errors to
GroveDBError
is consistent with the rest of the codebase.packages/rs-sdk/src/platform/tokens/identity_token_balances.rs (1)
52-69
: Well-structured query construction.The creation of gRPC request objects and integration with the
FetchMany
trait aligns nicely with the SDK's existing patterns.packages/rs-sdk/src/platform/group_actions.rs (5)
23-30
: Well-structured group query definition
TheGroupQuery
struct and its fields are clearly documented and self-explanatory. Nice use of doc comments to clarify each field's purpose.
32-45
: Proper request construction
Theimpl Query<GetGroupInfoRequest>
cleanly instantiates the request struct. Consider adding additional validation logic (e.g., whethergroup_contract_position
is valid) if there's a possibility of out-of-range values.Would you like me to generate a script to search for all potential out-of-range casts of
GroupContractPosition
?
46-49
: Simple, consistent fetch interface
Usingimpl Fetch for Group
is straightforward for bridging the entity with the request type.
106-132
: Handled optional start action ID effectively
Your approach of mapping(Identifier, StartAtIncluded)
directly into the request struct is clean and readable. Make sure that usage in other modules is consistent with how optional start IDs are handled here.
134-168
: Consistent approach for group action signers
TheGroupActionSignersQuery
struct and itsQuery<GetGroupActionSignersRequest>
implementation mirror the earlier patterns, keeping the codebase consistent. Good job ensuring all relevant fields (contract ID, position, status, action ID) map to the request.packages/rs-drive-proof-verifier/src/tokens/identity_token_balance.rs (3)
17-39
: Clean newtype for identity token balances
WrappingRetrievedObjects<Identifier, TokenAmount>
inIdentityTokenBalances
is a neat way to provide domain-specific meaning. This pattern helps keep the code self-documenting.
41-107
: Robust proof verification flow
Theimpl FromProof<GetIdentityTokenBalancesRequest>
carefully validates the request, checks for missing metadata, and callsDrive::verify_token_balances_for_identity_id
. The error mapping forGroveDBError
to a custom error type is well done. This ensures precise error reporting.
108-130
: Same pattern extended for multiple identities
Similar toIdentityTokenBalances
,IdentitiesTokenBalances
wrapsRetrievedObjects<Identifier, TokenAmount>
. TheFromIterator
implementation is a nice convenience, allowing flexible construction.packages/rs-drive-proof-verifier/src/tokens/token_info.rs (3)
17-39
: Clear domain structure for token infos
IdentityTokenInfos
provides a straightforward domain type for mapping token IDs toIdentityTokenInfo
. DerivingFrom
andDeref
is a simple yet powerful design, facilitating easy iteration and access.
41-107
: Solid request and proof handling
Theimpl FromProof<GetIdentityTokenInfosRequest>
workflow is carefully laid out, including error handling for invalid 32-byte conversions and thorough proof checks. Great attention to detail with returningError::RequestError
when conversions fail.
110-130
: Similar approach for multiple identities
IdentitiesTokenInfos
mirrors the single-identity struct, which is helpful for maintaining a uniform mental model of token info retrieval.packages/rs-drive-proof-verifier/src/group_actions.rs (3)
21-82
: Implementation looks clear and correct.The proof verification flow and error handling are well structured.
172-278
: Implementation aligns with the established pattern.Everything here follows the same approach as previous blocks, ensuring consistency and clarity. No specific issues found.
283-368
: No issues detected here.Code is consistent with other proof-verification methods in this file.
packages/rs-sdk/tests/fetch/tokens/mod.rs (1)
1-4
: Modules look good.These new modules logically partition token-related tests, improving test organization.
packages/rs-drive-proof-verifier/src/lib.rs (1)
18-21
: LGTM!The new module declarations are properly documented and well-organized.
packages/rs-dpp/src/tokens/info/v0/mod.rs (1)
3-4
: LGTM!The conditional serialization support is properly implemented with appropriate feature flags.
Also applies to: 7-7
packages/rs-sdk/tests/fetch/tokens/token_total_supply.rs (2)
1-7
: LGTM! All necessary imports are present.The imports cover all required dependencies for testing token total supply functionality.
16-26
: Verify the hardcoded test values.The test asserts specific values (100200) for both
token_supply
andaggregated_token_account_balances
. Ensure these values match the expected test data setup.Run this script to verify the test data setup:
✅ Verification successful
Test values confirmed as correct.
The grep results show that the aggregated test data for token supply is consistently set to 100200. Although the identity token balances test for TOKEN_ID_0 expects 100100, note that the total supply calculation (based on aggregation) for TOKEN_ID_0 returns 100200—which aligns with the test data setup (matching the value for TOKEN_ID_1 in identity token balances). The hardcoded values in the token_total_supply test (both fortoken_supply
andaggregated_token_account_balances
) correctly reflect the intended test data.🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify test data setup for token supply values # Search for token supply constant definitions or test data setup rg -A 5 "TOKEN_ID_0|100200" packages/rs-sdk/tests/Length of output: 5312
packages/rs-sdk/tests/fetch/mod.rs (1)
21-22
: LGTM! New modules are properly organized.The new modules
generated_data
,group_actions
, andtokens
are correctly placed under themocks
feature flag, maintaining consistency with the existing structure.Also applies to: 30-30
packages/rs-sdk/src/platform/tokens/token_total_supply.rs (1)
22-24
: LGTM! Fetch trait implementation is correct.The implementation correctly associates TotalSingleTokenBalance with GetTokenTotalSupplyRequest.
packages/rs-sdk/src/platform/tokens/token_status.rs (1)
26-28
: LGTM! FetchMany trait implementation is correct.The implementation correctly associates TokenStatus with GetTokenStatusesRequest.
packages/rs-drive-abci/src/execution/platform_events/initialization/create_genesis_state/test/mod.rs (1)
23-27
: LGTM! Good network restriction check.The function correctly restricts test data generation to local networks only, with appropriate error handling.
packages/rs-sdk/tests/fetch/tokens/token_status.rs (1)
24-29
: LGTM! Comprehensive test assertions.The test effectively verifies all token status scenarios including existing, non-existing, and paused tokens.
packages/rs-dpp/src/tokens/info/mod.rs (1)
9-10
: LGTM! Well-structured conditional serialization.The addition of serialization traits under the "fixtures-and-mocks" feature flag is appropriate and well-implemented.
Also applies to: 27-27
packages/rs-drive-abci/src/execution/platform_events/initialization/create_genesis_state/mod.rs (2)
10-10
: LGTM! New test module added.The addition of the test module aligns with the PR objectives for implementing token and group queries.
46-51
: Improved error handling with future test data generation support.Good improvements:
- Using the
?
operator for better error propagation- The commented code indicates planned support for SDK test data generation, which aligns with the PR objectives.
Please ensure the
create_sdk_test_data
function in the test module is properly implemented and tested before uncommenting line 49.packages/rs-dpp/src/balances/total_single_token_balance/mod.rs (1)
3-6
: LGTM! Clean implementation of conditional serialization.The addition of
Encode
andDecode
traits with feature flag is well-structured and follows Rust best practices.Also applies to: 11-11
packages/rs-sdk/src/platform/tokens/token_info.rs (3)
12-39
: LGTM! Well-structured implementation of IdentityTokenInfosQuery.The implementation is clean, type-safe, and follows SDK patterns for query handling.
41-68
: LGTM! Well-structured implementation of IdentitiesTokenInfosQuery.The implementation properly handles multiple identity IDs for a single token.
70-70
: Address the TODO comment for Fetch trait implementation.The Fetch trait implementation is missing and should be completed for full functionality.
Would you like me to help implement the Fetch trait or create an issue to track this task?
packages/rs-sdk/tests/fetch/generated_data.rs (3)
7-9
: Consider moving DPNS_DASH_TLD_DOCUMENT_ID to data-contracts crate.The TODO comment suggests a valid improvement in code organization.
Would you like me to help create an issue to track moving this constant to the data-contracts crate?
14-33
: LGTM! Well-documented constants with clear references.The constants are well-organized and properly documented with references to their initialization code.
34-45
: LGTM! Efficient use of LazyLock for token IDs.Good use of
LazyLock
for computing token IDs lazily, which improves performance by calculating values only when needed.packages/rs-sdk/tests/fetch/tokens/token_info.rs (3)
13-38
: LGTM! Well-structured test with good coverage.The test effectively validates token info fetching for both frozen and non-existent tokens, with clear assertions and pattern matching.
40-68
: LGTM! Good test coverage for unknown token scenarios.The test effectively validates that unknown token IDs return
None
for all identities, with clear assertions.
70-100
: LGTM! Comprehensive test for token info across multiple identities.The test effectively validates token info fetching using a calculated token ID, with good coverage of both frozen and non-existent cases.
packages/rs-sdk/tests/fetch/tokens/identity_token_balances.rs (3)
15-38
: LGTM! Well-structured test with precise balance assertions.The test effectively validates token balances for both existing and unknown tokens, with clear numeric assertions.
40-73
: LGTM! Good test coverage for unknown token scenarios.The test effectively validates that unknown token IDs return
None
for all identities, with clear assertions.
75-110
: LGTM! Comprehensive test for token balances across multiple identities.The test effectively validates various balance states using a calculated token ID, with good coverage of different scenarios (large balance, small balance, and no balance).
packages/rs-sdk/tests/fetch/group_actions.rs (5)
18-34
: LGTM! Good negative test case.The test effectively validates the behavior when attempting to fetch a non-existing group.
36-58
: LGTM! Well-structured test with good pattern matching.The test effectively validates the structure and content of an existing group.
89-124
: LGTM! Comprehensive test for fetching multiple groups.The test effectively validates fetching multiple groups with inclusive start position, with good pattern matching for each group's structure.
158-188
: LGTM! Well-structured test for paginated group action fetching.The test effectively validates fetching a single group action with pagination parameters.
190-211
: LGTM! Clear test for group action signers.The test effectively validates fetching and verifying group action signers.
packages/rs-sdk/tests/fetch/config.rs (1)
185-185
: LGTM! Good improvement to builder flexibility.Making the builder mutable allows for better configuration flexibility during SDK setup.
packages/rs-platform-value/src/types/identifier.rs (1)
147-147
: Great optimization using const fn!Converting
new
to a const function allows for compile-time evaluation of identifiers, which can improve performance in scenarios where identifiers are created as constants.packages/dapi-grpc/build.rs (1)
50-91
: LGTM! New request and response types added for token and group queries.The changes properly extend the versioned messages support with new token and group-related types. The duplicate checking ensures message uniqueness is maintained.
Also applies to: 98-138
packages/rs-sdk/tests/fetch/contested_resource_vote_state.rs (1)
110-110
: LGTM! Updated error message format in test.Test updated to match the new transport error message format, maintaining test accuracy.
packages/rs-sdk/src/mock/requests.rs (1)
229-230
: LGTM! Improved code clarity by removing unnecessary parentheses.The change improves readability without affecting functionality.
Also applies to: 245-246
packages/rs-sdk/src/mock/sdk.rs (1)
201-230
: LGTM! The implementation of new token and group request types is well-structured.The changes properly integrate token and group-related request types into the mock SDK, following the established patterns and maintaining consistent error handling.
packages/rs-dapi-client/src/transport/grpc.rs (1)
518-606
: LGTM! The gRPC transport implementations for token and group requests are well-implemented.The changes properly implement the
TransportRequest
trait for all new request types, following the established patterns and using appropriate default settings.packages/rs-drive-proof-verifier/Cargo.toml (1)
33-33
: LGTM! The addition of the state-transition-signing feature enhances security.The new feature is properly integrated into the dpp dependency features list.
packages/rs-sdk/Cargo.toml (1)
72-72
: LGTM! The addition of fixtures-and-mocks feature enhances testing capabilities.The new feature is properly integrated into the mocks feature list.
packages/rs-sdk/README.md (1)
16-16
: Correct Dependency DeclarationThe dependency declaration for
dash-sdk
now correctly points to the GitHub repository (https://github.com/dashpay/platform
). Please verify that this URL and its branch or version alignment meet the project's expectations.packages/rs-sdk/tests/vectors/test_data_contracts_1_ok_1_nx/quorum_pubkey-106-1e36eadee30940f5c42271ceb15ed97c58eb057410158b392ceec4d4631eff63.json (1)
1-1
: Mock Data File ReviewThis file contains a single hash value that does not adhere to standard JSON formatting (e.g. lacking double quotes). According to our established testing framework and prior learnings, such deviations are intentional for these mock data files.
🧰 Tools
🪛 Biome (1.9.4)
[error] 1-1: String values must be double quoted.
(parse)
packages/rs-sdk/tests/vectors/document_list_document_query/quorum_pubkey-106-1e36eadee30940f5c42271ceb15ed97c58eb057410158b392ceec4d4631eff63.json (1)
1-1
: Mock Data File ReviewThe appended hash string serves as a test vector. Although it does not conform to standard JSON syntax (e.g. missing double quotes), this is acceptable for the project's mock data format.
🧰 Tools
🪛 Biome (1.9.4)
[error] 1-1: String values must be double quoted.
(parse)
packages/rs-sdk/tests/vectors/test_data_contracts_2_nx/quorum_pubkey-106-1e36eadee30940f5c42271ceb15ed97c58eb057410158b392ceec4d4631eff63.json (1)
1-1
: Mock Data File ReviewThe single-line hash value in this file is intended as mock data. Despite not using standard JSON double quoting, this format is in line with the project's testing guidelines.
🧰 Tools
🪛 Biome (1.9.4)
[error] 1-1: String values must be double quoted.
(parse)
packages/rs-sdk/tests/vectors/test_epoch_fetch/quorum_pubkey-106-1e36eadee30940f5c42271ceb15ed97c58eb057410158b392ceec4d4631eff63.json (1)
1-1
: Mock Data File ReviewThis test vector file contains a hash string that deviates from strict JSON formatting (e.g. missing double quotes). Such formatting is intentional and acceptable for mock data as per the project's standards.
🧰 Tools
🪛 Biome (1.9.4)
[error] 1-1: String values must be double quoted.
(parse)
packages/rs-sdk/tests/vectors/contested_resource_identity_votes_not_found/quorum_pubkey-106-1e36eadee30940f5c42271ceb15ed97c58eb057410158b392ceec4d4631eff63.json (1)
1-1
: Intentionally Non-Standard JSON Format for Mock DataThe file introduces a hash value intended for use in test vectors. Although static analysis suggests that string values should be double quoted, this non-standard formatting is intentional and accepted within the project's testing framework.
🧰 Tools
🪛 Biome (1.9.4)
[error] 1-1: String values must be double quoted.
(parse)
packages/rs-sdk/tests/vectors/contested_resource_vote_states_not_found/quorum_pubkey-106-1e36eadee30940f5c42271ceb15ed97c58eb057410158b392ceec4d4631eff63.json (1)
1-1
: Valid Mock Data Entry with Intentional FormatThis file adds a new hash value used as mock data for scenarios where contested resource vote states are not found. Despite the static analysis note regarding double quoting, the retrieved learnings confirm that the current format is by design.
🧰 Tools
🪛 Biome (1.9.4)
[error] 1-1: String values must be double quoted.
(parse)
packages/rs-sdk/tests/vectors/document_list_drive_query/quorum_pubkey-106-1e36eadee30940f5c42271ceb15ed97c58eb057410158b392ceec4d4631eff63.json (1)
1-1
: Consistent Mock Data Format for Document List Drive QueryThe file contains a single hash value intended for testing document list drive queries. The format, while not standard JSON due to the lack of double quotes, is acceptable per the project’s established pattern for mock data files.
🧰 Tools
🪛 Biome (1.9.4)
[error] 1-1: String values must be double quoted.
(parse)
packages/rs-sdk/tests/vectors/document_read_no_document/quorum_pubkey-106-1e36eadee30940f5c42271ceb15ed97c58eb057410158b392ceec4d4631eff63.json (1)
1-1
: Appropriate Test Vector for Document Read (No Document) ScenarioThis file adds a hash value for a document-read test case where no document is found. Although static analysis flags the missing double quotes, this non-standard representation is intentional and conforms with the project's testing framework for mock files.
🧰 Tools
🪛 Biome (1.9.4)
[error] 1-1: String values must be double quoted.
(parse)
packages/rs-sdk/tests/vectors/document_read/quorum_pubkey-106-1e36eadee30940f5c42271ceb15ed97c58eb057410158b392ceec4d4631eff63.json (1)
1-1
: Valid and Consistent Mock Data for Document ReadThe file introduces a hash value for the document read test vector. The format chosen here—omitting double quotes—is intentional for test robustness and aligns with our project's practices for mock JSON files.
🧰 Tools
🪛 Biome (1.9.4)
[error] 1-1: String values must be double quoted.
(parse)
@@ -0,0 +1 @@ | |||
b1c490a52643759a7c08fc6bdfe7df0aac1d9f82ea66de1e5a9298eee7e1e5778aaab008fc56f74ec1e714bb9b98054d |
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.
🛠️ Refactor suggestion
Invalid JSON Format: Missing Double Quotes
The file currently contains a raw hash value. Since the file extension is .json
, its string content should be enclosed in double quotes to adhere to the JSON specification. This would eliminate the static analysis error and ensure the file is parsed correctly.
Please apply the following diff:
- b1c490a52643759a7c08fc6bdfe7df0aac1d9f82ea66de1e5a9298eee7e1e5778aaab008fc56f74ec1e714bb9b98054d
+ "b1c490a52643759a7c08fc6bdfe7df0aac1d9f82ea66de1e5a9298eee7e1e5778aaab008fc56f74ec1e714bb9b98054d"
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
b1c490a52643759a7c08fc6bdfe7df0aac1d9f82ea66de1e5a9298eee7e1e5778aaab008fc56f74ec1e714bb9b98054d | |
"b1c490a52643759a7c08fc6bdfe7df0aac1d9f82ea66de1e5a9298eee7e1e5778aaab008fc56f74ec1e714bb9b98054d" |
🧰 Tools
🪛 Biome (1.9.4)
[error] 1-1: String values must be double quoted.
(parse)
@@ -0,0 +1 @@ | |||
b1c490a52643759a7c08fc6bdfe7df0aac1d9f82ea66de1e5a9298eee7e1e5778aaab008fc56f74ec1e714bb9b98054d |
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.
Invalid JSON Formatting: Missing Double Quotes
The file is expected to be a valid JSON document, but the string value (hash) is not enclosed in double quotes as required by the JSON specification. Please update the file to wrap the string in double quotes.
Apply this diff to resolve the issue:
- b1c490a52643759a7c08fc6bdfe7df0aac1d9f82ea66de1e5a9298eee7e1e5778aaab008fc56f74ec1e714bb9b98054d
+ "b1c490a52643759a7c08fc6bdfe7df0aac1d9f82ea66de1e5a9298eee7e1e5778aaab008fc56f74ec1e714bb9b98054d"
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
b1c490a52643759a7c08fc6bdfe7df0aac1d9f82ea66de1e5a9298eee7e1e5778aaab008fc56f74ec1e714bb9b98054d | |
"b1c490a52643759a7c08fc6bdfe7df0aac1d9f82ea66de1e5a9298eee7e1e5778aaab008fc56f74ec1e714bb9b98054d" |
🧰 Tools
🪛 Biome (1.9.4)
[error] 1-1: String values must be double quoted.
(parse)
// Freeze tokens for identity 2 | ||
self.drive.token_freeze( | ||
*TOKEN_ID_0, | ||
IDENTITY_ID_1, | ||
block_info, | ||
true, | ||
transaction, | ||
platform_version, | ||
)?; |
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.
Fix mismatch between comment and identity ID.
Comment says "Freeze tokens for identity 2," but the code uses IDENTITY_ID_1
. If the intent is indeed to freeze tokens for identity 2, apply the following fix:
- IDENTITY_ID_1,
+ IDENTITY_ID_2,
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
// Freeze tokens for identity 2 | |
self.drive.token_freeze( | |
*TOKEN_ID_0, | |
IDENTITY_ID_1, | |
block_info, | |
true, | |
transaction, | |
platform_version, | |
)?; | |
// Freeze tokens for identity 2 | |
self.drive.token_freeze( | |
*TOKEN_ID_0, | |
IDENTITY_ID_2, | |
block_info, | |
true, | |
transaction, | |
platform_version, | |
)?; |
impl Query<GetTokenStatusesRequest> for Vec<Identifier> { | ||
fn query(self, prove: bool) -> Result<GetTokenStatusesRequest, Error> { | ||
let request = GetTokenStatusesRequest { | ||
version: Some(get_token_statuses_request::Version::V0( | ||
GetTokenStatusesRequestV0 { | ||
token_ids: self | ||
.into_iter() | ||
.map(|identifier| identifier.to_vec()) | ||
.collect(), | ||
prove, | ||
}, | ||
)), | ||
}; | ||
|
||
Ok(request) | ||
} | ||
} |
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.
🛠️ Refactor suggestion
Consider adding validation for token IDs collection.
The Query implementation should validate the input vector:
- Check for empty vector
- Check for duplicate token IDs
- Consider adding a reasonable limit on the number of token IDs
impl Query<GetTokenStatusesRequest> for Vec<Identifier> {
fn query(self, prove: bool) -> Result<GetTokenStatusesRequest, Error> {
+ if self.is_empty() {
+ return Err(Error::InvalidInput("Token IDs vector cannot be empty".into()));
+ }
+ if self.len() > 100 { // Adjust limit as needed
+ return Err(Error::InvalidInput("Too many token IDs requested".into()));
+ }
+ let unique_ids: std::collections::HashSet<_> = self.iter().collect();
+ if unique_ids.len() != self.len() {
+ return Err(Error::InvalidInput("Duplicate token IDs are not allowed".into()));
+ }
let request = GetTokenStatusesRequest {
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
impl Query<GetTokenStatusesRequest> for Vec<Identifier> { | |
fn query(self, prove: bool) -> Result<GetTokenStatusesRequest, Error> { | |
let request = GetTokenStatusesRequest { | |
version: Some(get_token_statuses_request::Version::V0( | |
GetTokenStatusesRequestV0 { | |
token_ids: self | |
.into_iter() | |
.map(|identifier| identifier.to_vec()) | |
.collect(), | |
prove, | |
}, | |
)), | |
}; | |
Ok(request) | |
} | |
} | |
impl Query<GetTokenStatusesRequest> for Vec<Identifier> { | |
fn query(self, prove: bool) -> Result<GetTokenStatusesRequest, Error> { | |
if self.is_empty() { | |
return Err(Error::InvalidInput("Token IDs vector cannot be empty".into())); | |
} | |
if self.len() > 100 { // Adjust limit as needed | |
return Err(Error::InvalidInput("Too many token IDs requested".into())); | |
} | |
let unique_ids: std::collections::HashSet<_> = self.iter().collect(); | |
if unique_ids.len() != self.len() { | |
return Err(Error::InvalidInput("Duplicate token IDs are not allowed".into())); | |
} | |
let request = GetTokenStatusesRequest { | |
version: Some(get_token_statuses_request::Version::V0( | |
GetTokenStatusesRequestV0 { | |
token_ids: self | |
.into_iter() | |
.map(|identifier| identifier.to_vec()) | |
.collect(), | |
prove, | |
}, | |
)), | |
}; | |
Ok(request) | |
} | |
} |
@@ -0,0 +1 @@ | |||
b1c490a52643759a7c08fc6bdfe7df0aac1d9f82ea66de1e5a9298eee7e1e5778aaab008fc56f74ec1e714bb9b98054d |
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.
JSON Formatting: Enclose the hash string in double quotes.
The static analysis hint specifies that JSON string values must be double quoted. Currently, the hash value is unquoted, which is likely to cause JSON parsing issues. Please update the file to wrap the hash string in double quotes.
- b1c490a52643759a7c08fc6bdfe7df0aac1d9f82ea66de1e5a9298eee7e1e5778aaab008fc56f74ec1e714bb9b98054d
+ "b1c490a52643759a7c08fc6bdfe7df0aac1d9f82ea66de1e5a9298eee7e1e5778aaab008fc56f74ec1e714bb9b98054d"
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
b1c490a52643759a7c08fc6bdfe7df0aac1d9f82ea66de1e5a9298eee7e1e5778aaab008fc56f74ec1e714bb9b98054d | |
"b1c490a52643759a7c08fc6bdfe7df0aac1d9f82ea66de1e5a9298eee7e1e5778aaab008fc56f74ec1e714bb9b98054d" |
🧰 Tools
🪛 Biome (1.9.4)
[error] 1-1: String values must be double quoted.
(parse)
Issue being fixed or feature implemented
We need to support token and group queries in RS SDK
What was done?
fixtures-and-mocks
flag is enabled.How Has This Been Tested?
Breaking Changes
None
Checklist:
For repository code-owners and collaborators only
Summary by CodeRabbit
New Features
Tests
Chore / Dependency Updates