Skip to content

Commit

Permalink
Merge branch 'v1.4-dev' into chore/contestedResourceUnitTests
Browse files Browse the repository at this point in the history
  • Loading branch information
shumkov committed Oct 12, 2024
2 parents 66dd35e + c071a36 commit ff55ddd
Show file tree
Hide file tree
Showing 30 changed files with 431 additions and 199 deletions.
24 changes: 12 additions & 12 deletions .pnp.cjs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file not shown.
Binary file not shown.
23 changes: 16 additions & 7 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/bench-suite/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"lint": ""
},
"dependencies": {
"@dashevo/dashcore-lib": "~0.21.3",
"@dashevo/dashcore-lib": "~0.22.0",
"@dashevo/dpns-contract": "workspace:*",
"@dashevo/wallet-lib": "workspace:*",
"@dashevo/wasm-dpp": "workspace:*",
Expand Down
2 changes: 1 addition & 1 deletion packages/dapi/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
"dependencies": {
"@dashevo/bls": "~1.2.9",
"@dashevo/dapi-grpc": "workspace:*",
"@dashevo/dashcore-lib": "~0.21.3",
"@dashevo/dashcore-lib": "~0.22.0",
"@dashevo/dashd-rpc": "^19.0.0",
"@dashevo/grpc-common": "workspace:*",
"@dashevo/wasm-dpp": "workspace:*",
Expand Down
2 changes: 1 addition & 1 deletion packages/dash-spv/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"dependencies": {
"@dashevo/dark-gravity-wave": "^1.1.1",
"@dashevo/dash-util": "^2.0.3",
"@dashevo/dashcore-lib": "~0.21.3",
"@dashevo/dashcore-lib": "~0.22.0",
"levelup": "^4.4.0",
"memdown": "^5.1.0",
"wasm-x11-hash": "~0.0.2"
Expand Down
2 changes: 1 addition & 1 deletion packages/dashmate/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
"dependencies": {
"@dashevo/bls": "~1.2.9",
"@dashevo/dapi-client": "workspace:*",
"@dashevo/dashcore-lib": "~0.21.3",
"@dashevo/dashcore-lib": "~0.22.0",
"@dashevo/dashd-rpc": "^19.0.0",
"@dashevo/docker-compose": "^0.24.4",
"@dashevo/wallet-lib": "workspace:*",
Expand Down
2 changes: 1 addition & 1 deletion packages/js-dapi-client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"dependencies": {
"@dashevo/dapi-grpc": "workspace:*",
"@dashevo/dash-spv": "workspace:*",
"@dashevo/dashcore-lib": "~0.21.3",
"@dashevo/dashcore-lib": "~0.22.0",
"@dashevo/grpc-common": "workspace:*",
"@dashevo/wasm-dpp": "workspace:*",
"bs58": "^4.0.1",
Expand Down
2 changes: 1 addition & 1 deletion packages/js-dash-sdk/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
"@dashevo/bls": "~1.2.9",
"@dashevo/dapi-client": "workspace:*",
"@dashevo/dapi-grpc": "workspace:*",
"@dashevo/dashcore-lib": "~0.21.3",
"@dashevo/dashcore-lib": "~0.22.0",
"@dashevo/dashpay-contract": "workspace:*",
"@dashevo/dpns-contract": "workspace:*",
"@dashevo/grpc-common": "workspace:*",
Expand Down
2 changes: 1 addition & 1 deletion packages/platform-test-suite/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"homepage": "https://github.com/dashevo/platform-test-suite#readme",
"dependencies": {
"@dashevo/dapi-client": "workspace:*",
"@dashevo/dashcore-lib": "~0.21.3",
"@dashevo/dashcore-lib": "~0.22.0",
"@dashevo/dpns-contract": "workspace:*",
"@dashevo/feature-flags-contract": "workspace:*",
"@dashevo/grpc-common": "workspace:*",
Expand Down
4 changes: 4 additions & 0 deletions packages/rs-drive-proof-verifier/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,10 @@ pub enum ContextProviderError {
/// Core Fork Error
#[error("activation fork error: {0}")]
ActivationForkError(String),

/// Async error, eg. when tokio runtime fails
#[error("async error: {0}")]
AsyncError(String),
}

impl From<drive::error::Error> for Error {
Expand Down
5 changes: 3 additions & 2 deletions packages/rs-sdk/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ drive-proof-verifier = { path = "../rs-drive-proof-verifier" }
dapi-grpc-macros = { path = "../rs-dapi-grpc-macros" }
http = { version = "1.1" }
thiserror = "1.0.64"
tokio = { version = "1.40", features = ["macros"] }
tokio = { version = "1.40", features = ["macros", "rt-multi-thread"] }
tokio-util = { version = "0.7.12" }
async-trait = { version = "0.1.83" }
ciborium = { git = "https://github.com/qrayven/ciborium", branch = "feat-ser-null-as-undefined" }
Expand All @@ -36,7 +36,7 @@ derive_more = { version = "1.0", features = ["from"] }
dashcore-rpc = { git = "https://github.com/dashpay/rust-dashcore-rpc", tag = "v0.15.4" }
lru = { version = "0.12.3", optional = true }
bip37-bloom-filter = { git = "https://github.com/dashpay/rs-bip37-bloom-filter", branch = "develop" }
pollster = { version = "0.3.0" }
zeroize = { version = "1.8", features = ["derive"] }

[dev-dependencies]
tokio = { version = "1.40", features = ["macros", "rt-multi-thread"] }
Expand Down Expand Up @@ -71,6 +71,7 @@ mocks = [
"dep:dotenvy",
"dep:envy",
"dep:lru",
"zeroize/serde",
]

# Run integration tests using test vectors from `tests/vectors/` instead of connecting to live Dash Platform.
Expand Down
5 changes: 3 additions & 2 deletions packages/rs-sdk/examples/read_contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ use clap::Parser;
use dash_sdk::{mock::provider::GrpcContextProvider, platform::Fetch, Sdk, SdkBuilder};
use dpp::prelude::{DataContract, Identifier};
use rs_dapi_client::AddressList;
use zeroize::Zeroizing;

#[derive(clap::Parser, Debug)]
#[command(version)]
Expand All @@ -22,7 +23,7 @@ pub struct Config {

// Dash Core RPC password
#[arg(short = 'p', long)]
pub core_password: String,
pub core_password: Zeroizing<String>,

/// Dash Platform DAPI port
#[arg(short = 'd', long)]
Expand Down Expand Up @@ -86,7 +87,7 @@ fn setup_sdk(config: &Config) -> Sdk {
.expect("parse uri");

// Now, we create the Sdk with the wallet and context provider.
let mut sdk = SdkBuilder::new(AddressList::from_iter([uri]))
let sdk = SdkBuilder::new(AddressList::from_iter([uri]))
.build()
.expect("cannot build sdk");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,33 @@ use dpp::dashcore::ProTxHash;
use dpp::prelude::CoreBlockHeight;
use drive_proof_verifier::error::ContextProviderError;
use std::{fmt::Debug, sync::Mutex};
use zeroize::Zeroizing;

/// Core RPC client that can be used to retrieve quorum keys from core.
///
/// Implements [`ContextProvider`] trait.
///
/// TODO: This is a temporary implementation, effective until we integrate SPV.
pub struct CoreClient {
pub struct LowLevelDashCoreClient {
core: Mutex<Client>,
server_address: String,
core_user: String,
core_password: Zeroizing<String>,
core_port: u16,
}

impl Debug for CoreClient {
impl Clone for LowLevelDashCoreClient {
// As Client does not implement Clone, we just create a new instance of CoreClient here.
fn clone(&self) -> Self {
LowLevelDashCoreClient::new(
&self.server_address,
self.core_port,
&self.core_user,
&self.core_password,
)
.expect("Failed to clone CoreClient when cloning, this should not happen")
}
}

impl Debug for LowLevelDashCoreClient {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
f.debug_struct("CoreClient")
.field("server_address", &self.server_address)
Expand All @@ -37,7 +50,7 @@ impl Debug for CoreClient {
}
}

impl CoreClient {
impl LowLevelDashCoreClient {
/// Create new Dash Core client.
///
/// # Arguments
Expand All @@ -63,13 +76,14 @@ impl CoreClient {
core: Mutex::new(core),
server_address: server_address.to_string(),
core_user: core_user.to_string(),
core_password: core_password.to_string().into(),
core_port,
})
}
}

// Wallet functions
impl CoreClient {
impl LowLevelDashCoreClient {
/// List unspent transactions
///
/// ## Arguments
Expand Down
4 changes: 4 additions & 0 deletions packages/rs-sdk/src/core/mod.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
//! Dash Core SDK implementation.
//!
//! TODO: This is work in progress.
#[cfg(feature = "mocks")]
mod dash_core_client;
mod transaction;
#[cfg(feature = "mocks")]
pub use dash_core_client::LowLevelDashCoreClient;
3 changes: 1 addition & 2 deletions packages/rs-sdk/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,6 @@
#![allow(rustdoc::private_intra_doc_links)]

pub mod core;
#[cfg(feature = "mocks")]
mod core_client;
pub mod error;
mod internal_cache;
pub mod mock;
Expand All @@ -78,6 +76,7 @@ pub use dpp;
pub use drive;
pub use drive_proof_verifier::types as query_types;
pub use rs_dapi_client as dapi_client;
pub mod sync;

/// Version of the SDK
pub const VERSION: &str = env!("CARGO_PKG_VERSION");
Loading

0 comments on commit ff55ddd

Please sign in to comment.