dashpay / platform

L2 solution for seriously fast decentralized applications for the Dash network
https://dashplatform.readme.io/docs/introduction-what-is-dash-platform
MIT License
74 stars 39 forks source link

chore(sdk): various sdk fixes #2328

Open QuantumExplorer opened 1 week ago

QuantumExplorer commented 1 week ago

Issue being fixed or feature implemented

What was done?

How Has This Been Tested?

Breaking Changes

Checklist:

For repository code-owners and collaborators only

Summary by CodeRabbit

coderabbitai[bot] commented 1 week ago

[!IMPORTANT]

Review skipped

Draft detected.

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.

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

Walkthrough

The pull request introduces a series of updates across multiple files, primarily focusing on enhancing the handling of BLS signatures and improving error management within the Dash Platform's codebase. Key changes include updates to dependency versions in Cargo.toml, modifications to the NativeBlsModule for public key and signature handling, and enhancements to various validator and quorum structures to utilize a specific BLS implementation. Additionally, several methods and structures have been adapted to improve type safety, particularly regarding private key representations and error handling mechanisms.

Changes

File Path Change Summary
packages/rs-dpp/Cargo.toml Updated dashcore dependency from 0.32.0 to 0.33.3, added serde feature, modified chrono and bincode dependencies, updated once_cell, and specified dev-dependencies.
packages/rs-dpp/src/bls/native_bls.rs Significant updates to public key validation, signature verification, private key handling, and signing methods, enhancing cryptographic operation specificity.
packages/rs-dpp/src/core_types/validator/mod.rs Updated BlsPublicKey type to BlsPublicKey<Bls12381G2Impl> in ValidatorV0Getters and ValidatorV0Setters methods.
packages/rs-dpp/src/core_types/validator/v0/mod.rs Changed public_key field type to BlsPublicKey<Bls12381G2Impl>, updated encoding and decoding methods for public keys.
packages/rs-dpp/src/core_types/validator_set/mod.rs Updated threshold_public_key type to BlsPublicKey<Bls12381G2Impl> in ValidatorSetV0Getters and ValidatorSetV0Setters.
packages/rs-dpp/src/core_types/validator_set/v0/mod.rs Modified threshold_public_key field type to BlsPublicKey<Bls12381G2Impl>, updated encoding and decoding methods.
packages/rs-dpp/src/errors/protocol_error.rs Added BlsError variant to ProtocolError enum for improved error handling related to BLS signatures.
packages/rs-dpp/src/identity/identity_public_key/key_type.rs Updated methods for handling BLS keys, changing return types to fixed-size arrays and enhancing error management.
packages/rs-dpp/src/identity/identity_public_key/methods/hash/mod.rs Introduced address method to IdentityPublicKeyHashMethodsV0, updated validate_private_key_bytes method to use fixed-size arrays.
packages/rs-dpp/src/identity/identity_public_key/methods/hash/v0/mod.rs Added address method to trait, modified validate_private_key_bytes method to use fixed-size arrays.
packages/rs-dpp/src/identity/identity_public_key/random.rs Updated return types in multiple methods to fixed-size arrays for private keys.
packages/rs-dpp/src/identity/identity_public_key/v0/methods/mod.rs Added address method, modified validate_private_key_bytes method to use fixed-size arrays.
packages/rs-dpp/src/identity/identity_public_key/v0/random.rs Changed return types in various methods to fixed-size arrays for private keys.
packages/rs-dpp/src/identity/random.rs Updated return types in methods to fixed-size arrays for private keys.
packages/rs-dpp/src/identity/v0/random.rs Updated return types in methods to fixed-size arrays for private keys.
packages/rs-dpp/src/lib.rs Modified public exports to include bls_signatures, changing from dashcore::bls_signatures to dashcore::blsful.
packages/rs-drive-abci/Cargo.toml Updated dashcore-rpc dependency from v0.15.8 to v0.15.12.
packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_masternode_identities/update_operator_identity/v0/mod.rs Enhanced handling for operator identity updates, refined identity key management.
packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_quorum_info/v0/mod.rs Updated error handling for BlsPublicKey conversion.
packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/choose_quorum/mod.rs Changed parameter type for quorums to BTreeMap<QuorumHash, BlsPublicKey<Bls12381G2Impl>>.
packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/choose_quorum/v0/mod.rs Updated parameter and return types to BlsPublicKey<Bls12381G2Impl>.
packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock_locally/v0/mod.rs Replaced G2Element with Signature type for signature verification.
packages/rs-drive-abci/src/execution/platform_events/core_instant_send_lock/verify_recent_signature_locally/v0/mod.rs Changed signature creation to use Signature<Bls12381G2Impl>.
packages/rs-drive-abci/src/execution/validation/state_transition/common/asset_lock/transaction/fetch_asset_lock_transaction_output_sync/v0/mod.rs Updated hash type handling in asset lock transaction processing.
packages/rs-drive-abci/src/mimic/mod.rs Updated block signing logic to use SignatureSchemes::Basic.
packages/rs-drive-abci/src/mimic/test_quorum.rs Updated ValidatorInQuorum and TestQuorumInfo to use Bls12381G2Impl.
packages/rs-drive-abci/src/platform_types/commit/mod.rs Changed public_key parameter type in verify_signature method to BlsPublicKey<Bls12381G2Impl>.
packages/rs-drive-abci/src/platform_types/commit/v0/mod.rs Updated verify_signature method to use Bls12381G2Impl.
packages/rs-drive-abci/src/platform_types/platform_state/v0/mod.rs Restricted visibility of PlatformStateForSavingV0 struct and updated field types.
packages/rs-drive-abci/src/platform_types/platform_state/v0/old_structures/mod.rs Introduced new module for managing validator sets.
packages/rs-drive-abci/src/platform_types/signature_verification_quorum_set/mod.rs Added V1 variant to SignatureVerificationQuorumSetForSaving enum.
packages/rs-drive-abci/src/platform_types/signature_verification_quorum_set/v0/for_saving.rs Updated public_key field type in QuorumForSavingV0 to bls_signatures::PublicKey.
packages/rs-drive-abci/src/platform_types/signature_verification_quorum_set/v0/for_saving_v1.rs Introduced SignatureVerificationQuorumSetForSavingV1 struct with conversion implementations.
packages/rs-drive-abci/src/platform_types/signature_verification_quorum_set/v0/mod.rs Added new module for_saving_v1.
packages/rs-drive-abci/src/platform_types/signature_verification_quorum_set/v0/quorums.rs Updated public_key field type in VerificationQuorum and modified signing logic.
packages/rs-drive-abci/src/platform_types/validator/v0/mod.rs Updated public_key parameter type in NewValidatorIfMasternodeInState trait.
packages/rs-drive-abci/src/platform_types/validator_set/v0/mod.rs Updated error handling logic for threshold_public_key comparisons.
packages/rs-drive-abci/src/query/document_query/v0/mod.rs Introduced logging statement in query_documents_v0 method.
packages/rs-drive-abci/src/query/system/current_quorums_info/v0/mod.rs Modified how threshold_public_key is constructed from the validator_set.
packages/rs-drive-abci/tests/strategy_tests/execution.rs Updated private key handling and signature generation processes.
packages/rs-drive-abci/tests/strategy_tests/main.rs Changed import from PrivateKey to SecretKey.
packages/rs-drive-abci/tests/strategy_tests/masternode_list_item_helpers.rs Updated private key generation process to use BlsPrivateKey.
packages/rs-drive-abci/tests/strategy_tests/masternodes.rs Modified private key generation and import statements.
packages/rs-drive-abci/tests/strategy_tests/query.rs Updated ProofVerification struct to use BlsPublicKey<Bls12381G2Impl>.
packages/rs-drive-proof-verifier/src/unproved.rs Enhanced error handling in maybe_from_unproved_with_metadata methods.
packages/rs-drive-proof-verifier/src/verify.rs Updated public key construction and signature handling processes.
packages/rs-drive/src/query/mod.rs Introduced new modules for voting and polling queries.
packages/rs-drive/tests/query_tests.rs Added new test cases for various query scenarios.
packages/rs-drive/tests/supporting_files/contract/withdrawals/withdrawals.json New JSON schema for withdrawal documents added.
packages/rs-sdk/Cargo.toml Updated dashcore-rpc dependency version.
packages/rs-sdk/src/core/dash_core_client.rs Added new error codes and enhanced RPC method error handling.
packages/rs-sdk/src/core/transaction.rs Removed debug logging from wait_for_asset_lock_proof_for_transaction method.
packages/rs-sdk/src/lib.rs Added public export for dapi_grpc module.
packages/simple-signer/Cargo.toml Updated dashcore-rpc dependency version.
packages/simple-signer/src/signer.rs Changed private key fields to fixed-size arrays and updated signing logic.

Possibly related PRs

Poem

🐰 In the code where rabbits hop,
Changes made, we’ll never stop.
BLS signatures, now so bright,
With error handling, all feels right.
Dependencies updated, oh what a sight!
Hopping forward, coding through the night! 🌙


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?

❤️ Share - [X](https://twitter.com/intent/tweet?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A&url=https%3A//coderabbit.ai) - [Mastodon](https://mastodon.social/share?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A%20https%3A%2F%2Fcoderabbit.ai) - [Reddit](https://www.reddit.com/submit?title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&text=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code.%20Check%20it%20out%3A%20https%3A//coderabbit.ai) - [LinkedIn](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fcoderabbit.ai&mini=true&title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&summary=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code)
🪧 Tips ### Chat There are 3 ways to chat with [CodeRabbit](https://coderabbit.ai): - Review comments: Directly reply to a review comment made by CodeRabbit. Example: - `I pushed a fix in commit , please review it.` - `Generate unit testing code for this file.` - `Open a follow-up GitHub issue for this discussion.` - Files and specific lines of code (under the "Files changed" tab): Tag `@coderabbitai` in a new review comment at the desired location with your query. Examples: - `@coderabbitai generate unit testing code for this file.` - `@coderabbitai modularize this function.` - PR comments: Tag `@coderabbitai` in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples: - `@coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.` - `@coderabbitai read src/utils.ts and generate unit testing code.` - `@coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.` - `@coderabbitai help me debug CodeRabbit configuration file.` 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) - `@coderabbitai pause` to pause the reviews on a PR. - `@coderabbitai resume` to resume the paused reviews. - `@coderabbitai review` to trigger an incremental review. This is useful when automatic reviews are disabled for the repository. - `@coderabbitai full review` to do a full review from scratch and review all the files again. - `@coderabbitai summary` to regenerate the summary of the PR. - `@coderabbitai resolve` resolve all the CodeRabbit review comments. - `@coderabbitai configuration` to show the current CodeRabbit configuration for the repository. - `@coderabbitai help` to get help. ### Other keywords and placeholders - Add `@coderabbitai ignore` anywhere in the PR description to prevent this PR from being reviewed. - Add `@coderabbitai summary` to generate the high-level summary at a specific location in the PR description. - Add `@coderabbitai` anywhere in the PR title to generate the title automatically. ### CodeRabbit Configuration File (`.coderabbit.yaml`) - You can programmatically configure CodeRabbit by adding a `.coderabbit.yaml` file to the root of your repository. - Please see the [configuration documentation](https://docs.coderabbit.ai/guides/configure-coderabbit) for more information. - 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/schema.v2.json` ### Documentation and Community - Visit our [Documentation](https://docs.coderabbit.ai) for detailed information on how to use CodeRabbit. - Join our [Discord Community](http://discord.gg/coderabbit) to get help, request features, and share feedback. - Follow us on [X/Twitter](https://twitter.com/coderabbitai) for updates and announcements.