Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
33d6420
replace bls library
QuantumExplorer Oct 19, 2024
91cbe4a
more work
QuantumExplorer Oct 19, 2024
7f814ad
exposed dapi-grpc in sdk
QuantumExplorer Oct 20, 2024
4506f9f
trial
QuantumExplorer Oct 21, 2024
efb4310
fix: add pagination support to sdk
QuantumExplorer Oct 27, 2024
f49b652
Merge branch 'fix/addPaginationSupportToSDK' into test/testWithoutSpan
QuantumExplorer Oct 27, 2024
08e6e66
added more unit tests
QuantumExplorer Oct 27, 2024
1237318
temp
QuantumExplorer Oct 27, 2024
7c77c40
more fixes
QuantumExplorer Oct 27, 2024
0a9e51b
Merge branch 'fix/addPaginationSupportToSDK' into test/testWithoutSpan
QuantumExplorer Oct 27, 2024
2e69847
Merge branch 'v1.4-dev' into test/testWithoutSpan
QuantumExplorer Oct 29, 2024
bb18327
updated rust dash core
QuantumExplorer Oct 30, 2024
ae8257c
more fixes
QuantumExplorer Nov 1, 2024
272f5ac
more fixes
QuantumExplorer Nov 8, 2024
ddf1c8b
retry calls to core in sdk
QuantumExplorer Nov 11, 2024
994f762
Merge branch 'v1.6-dev' into test/testWithoutSpan
QuantumExplorer Nov 12, 2024
0c1ce6d
replace bls library
QuantumExplorer Oct 19, 2024
46d9698
more work
QuantumExplorer Oct 19, 2024
7d44dcb
exposed dapi-grpc in sdk
QuantumExplorer Oct 20, 2024
386d7ba
Merge branch 'refactor/replaceBLSLibrary' into test/testWithoutSpan
lklimek Nov 13, 2024
2b93932
fix(sdk): broken import fails compilation
lklimek Nov 13, 2024
5b6d1f0
Merge remote-tracking branch 'origin/v1.6-dev' into refactor/replaceB…
lklimek Nov 14, 2024
ab74355
chore(dpp): fix bls signatures
lklimek Nov 14, 2024
e6bda11
chore(dpp): fix build errors and some lint warnings
lklimek Nov 14, 2024
5859848
chore(sdk): fmt
lklimek Nov 14, 2024
b86245e
chore(dpp): fix feature build issues
lklimek Nov 14, 2024
ae22fb8
build: experimental: use build base image
lklimek Nov 14, 2024
6164e1b
chore(dpp): fix features
lklimek Nov 14, 2024
98c0215
Revert "build: experimental: use build base image"
lklimek Nov 14, 2024
c9952b1
Merge remote-tracking branch 'origin/refactor/replaceBLSLibrary' into…
lklimek Nov 15, 2024
1267771
fix(drive-abci): invalid chainlock sig deserialization
lklimek Nov 15, 2024
f745857
fix(drive-abci): invalid signature decoding
lklimek Nov 18, 2024
9f9c123
fixes for coderabbit
QuantumExplorer Nov 20, 2024
deda86d
Merge branch 'v1.6-dev' into refactor/replaceBLSLibrary
QuantumExplorer Nov 20, 2024
01d5af7
Merge remote-tracking branch 'origin/v1.7-dev' into refactor/replaceB…
lklimek Dec 2, 2024
0c4dd5c
Merge remote-tracking branch 'origin/v1.7-dev' into refactor/replaceB…
lklimek Dec 5, 2024
6186f2f
Merge branch 'refactor/replaceBLSLibrary' into test/testWithoutSpan
lklimek Dec 6, 2024
6eeec1a
deps: bump dashcore and dashcore-rpc
lklimek Dec 6, 2024
a2a17b2
Merge remote-tracking branch 'origin/refactor/replaceBLSLibrary' into…
lklimek Dec 6, 2024
5c3f318
chore: uncomment logging
lklimek Dec 6, 2024
c3a8f80
refactor(sdk)!: separate dash core client error (#2380)
lklimek Dec 9, 2024
8884df7
Squashed commit of the following:
lklimek Mar 6, 2025
ee9d964
Merge remote-tracking branch 'origin/v2.0-dev' into test/testWithoutSpan
lklimek Mar 6, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 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/rs-dpp/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ authors = [
[dependencies]
anyhow = { version = "1.0.81" }
async-trait = { version = "0.1.79" }
ordered-float = { version = "4.6.0", features = ["serde"]}
ordered-float = { version = "4.6.0", features = ["serde"] }
base64 = "0.22.1"
bs58 = "0.5"
byteorder = { version = "1.4" }
Expand Down
1 change: 1 addition & 0 deletions packages/rs-dpp/src/errors/protocol_error.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
use std::array::TryFromSliceError;
use thiserror::Error;

use crate::consensus::basic::state_transition::InvalidStateTransitionTypeError;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ mod v0;

use crate::identity::IdentityPublicKey;
use crate::ProtocolError;
use dashcore::Network;
use dashcore::{Address, Network};
pub use v0::*;

impl IdentityPublicKeyHashMethodsV0 for IdentityPublicKey {
Expand All @@ -12,6 +12,12 @@ impl IdentityPublicKeyHashMethodsV0 for IdentityPublicKey {
}
}

fn address(&self, network: Network) -> Result<Address, ProtocolError> {
match self {
IdentityPublicKey::V0(v0) => v0.address(network),
}
}

fn validate_private_key_bytes(
&self,
private_key_bytes: &[u8; 32],
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
use crate::ProtocolError;
use dashcore::Network;
use dashcore::{Address, Network};

pub trait IdentityPublicKeyHashMethodsV0 {
/// Get the original public key hash
fn public_key_hash(&self) -> Result<[u8; 20], ProtocolError>;

/// Get the address
fn address(&self, network: Network) -> Result<Address, ProtocolError>;

/// Verifies that the private key bytes match this identity public key
fn validate_private_key_bytes(
&self,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,13 @@ use crate::identity::KeyType;
use crate::util::hash::ripemd160_sha256;
use crate::ProtocolError;
use anyhow::anyhow;
use dashcore::address::Payload;
#[cfg(feature = "ed25519-dalek")]
use dashcore::ed25519_dalek;
use dashcore::hashes::Hash;
use dashcore::key::Secp256k1;
use dashcore::secp256k1::SecretKey;
use dashcore::{Network, PublicKey as ECDSAPublicKey};
use dashcore::{Address, Network, PubkeyHash, PublicKey as ECDSAPublicKey};
use platform_value::Bytes20;
#[cfg(feature = "bls-signatures")]
use {crate::bls_signatures, dashcore::blsful::Bls12381G2Impl};
Expand Down Expand Up @@ -51,6 +52,21 @@ impl IdentityPublicKeyHashMethodsV0 for IdentityPublicKeyV0 {
}
}

fn address(&self, network: Network) -> Result<Address, ProtocolError> {
match self.key_type {
KeyType::BIP13_SCRIPT_HASH => Err(ProtocolError::NotSupported(
"Can not get an address from a single script hash key".to_string(),
)),
_ => {
let public_key_hash = self.public_key_hash()?;
Ok(Address::new(
network,
Payload::PubkeyHash(PubkeyHash::from_byte_array(public_key_hash)),
))
}
}
}

fn validate_private_key_bytes(
&self,
private_key_bytes: &[u8; 32],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ pub trait IdentityCreditTransferTransitionMethodsV0 {
#[cfg(feature = "state-transition-signing")]
fn try_from_identity<S: Signer>(
identity: &Identity,
to_identity_with_identifier: Identifier,
to_identity_with_identifier: platform_value::Identifier,
amount: u64,
user_fee_increase: UserFeeIncrease,
signer: S,
Expand Down
9 changes: 4 additions & 5 deletions packages/rs-drive-abci/src/query/document_query/v0/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,6 @@ mod tests {
use crate::query::tests::{
assert_invalid_identifier, setup_platform, store_data_contract, store_document,
};
use assert_matches::assert_matches;
use ciborium::value::Value as CborValue;
use dpp::dashcore::Network;
use dpp::data_contract::document_type::random_document::CreateRandomDocument;
Expand Down Expand Up @@ -519,7 +518,7 @@ mod tests {
);

let drive_document_query = DriveDocumentQuery {
contract: &created_data_contract.data_contract(),
contract: created_data_contract.data_contract(),
document_type,
internal_clauses: Default::default(),
offset: None,
Expand Down Expand Up @@ -557,7 +556,7 @@ mod tests {
.expect("expected to verify proof");

assert_eq!(documents.len(), 1);
assert_eq!(documents.get(0).expect("first"), &random_document);
assert_eq!(documents.first().expect("first"), &random_document);
}

#[test]
Expand Down Expand Up @@ -592,7 +591,7 @@ mod tests {
}

let drive_document_query = DriveDocumentQuery {
contract: &created_data_contract.data_contract(),
contract: created_data_contract.data_contract(),
document_type,
internal_clauses: Default::default(),
offset: None,
Expand Down Expand Up @@ -677,7 +676,7 @@ mod tests {
.to_buffer();

let drive_document_query = DriveDocumentQuery {
contract: &created_data_contract.data_contract(),
contract: created_data_contract.data_contract(),
document_type,
internal_clauses: Default::default(),
offset: None,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -587,7 +587,7 @@ impl MasternodeListItemWithUpdates {

match closest_height {
Some(h) => &self.updates[&h],
None => &self.masternode,
Option::None => &self.masternode,
}
}
}
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 @@ -119,6 +119,10 @@ pub enum ContextProviderError {
/// Async error, eg. when tokio runtime fails
#[error("async error: {0}")]
AsyncError(String),

/// Dash Core error
#[error("Dash Core error: {0}")]
DashCoreError(String),
}

impl From<drive::error::Error> for Error {
Expand Down
1 change: 0 additions & 1 deletion packages/rs-drive/src/query/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2154,7 +2154,6 @@ impl<'a> DriveDocumentQuery<'a> {
drive_operations,
platform_version,
)?;

let query_result = drive.grove_get_path_query_serialized_results(
&path_query,
transaction,
Expand Down
4 changes: 2 additions & 2 deletions packages/rs-drive/tests/query_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -630,7 +630,7 @@ impl Domain {
let label = first_names.choose(&mut rng).unwrap();
let domain = Domain {
id: Identifier::random_with_rng(&mut rng),
owner_id: if let Some(_) = total_owners {
owner_id: if total_owners.is_some() {
// Pick a random owner from the owners list
*owners.choose(&mut rng).unwrap()
} else {
Expand Down Expand Up @@ -4728,7 +4728,7 @@ fn test_contract_keeps_history_fetch_and_verification() {
#[test]
fn test_dpns_query_first_version() {
let platform_version = PlatformVersion::first();
let (drive, contract) = setup_dpns_tests_with_batches(10, None, 11456, &platform_version);
let (drive, contract) = setup_dpns_tests_with_batches(10, None, 11456, platform_version);

let db_transaction = drive.grove.start_transaction();

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,141 @@
{
"$format_version": "0",
"id": "BnqN3oupH6uCogzgZMvSjjpKxmcdNXAShnNY4Kor33aL",
"ownerId": "BnqN3oupH6uCogzgZMvSjjpKxmcdNXAShnNY4Kor33aL",
"version": 1,
"documentSchemas": {
"withdrawal": {
"description": "Withdrawal document to track underlying withdrawal transactions. Withdrawals should be created with IdentityWithdrawalTransition",
"creationRestrictionMode": 2,
"type": "object",
"indices": [
{
"name": "identityStatus",
"properties": [
{
"$ownerId": "asc"
},
{
"status": "asc"
},
{
"$createdAt": "asc"
}
],
"unique": false
},
{
"name": "identityRecent",
"properties": [
{
"$ownerId": "asc"
},
{
"$updatedAt": "asc"
},
{
"status": "asc"
}
],
"unique": false
},
{
"name": "pooling",
"properties": [
{
"status": "asc"
},
{
"pooling": "asc"
},
{
"coreFeePerByte": "asc"
},
{
"$updatedAt": "asc"
}
],
"unique": false
},
{
"name": "transaction",
"properties": [
{
"status": "asc"
},
{
"transactionIndex": "asc"
}
],
"unique": false
}
],
"properties": {
"transactionIndex": {
"type": "integer",
"description": "Sequential index of asset unlock (withdrawal) transaction. Populated when a withdrawal pooled into withdrawal transaction",
"minimum": 1,
"position": 0
},
"transactionSignHeight": {
"type": "integer",
"description": "The Core height on which transaction was signed",
"minimum": 1,
"position": 1
},
"amount": {
"type": "integer",
"description": "The amount to be withdrawn",
"minimum": 1000,
"position": 2
},
"coreFeePerByte": {
"type": "integer",
"description": "This is the fee that you are willing to spend for this transaction in Duffs/Byte",
"minimum": 1,
"maximum": 4294967295,
"position": 3
},
"pooling": {
"type": "integer",
"description": "This indicated the level at which Platform should try to pool this transaction",
"enum": [
0,
1,
2
],
"position": 4
},
"outputScript": {
"type": "array",
"byteArray": true,
"minItems": 23,
"maxItems": 25,
"position": 5
},
"status": {
"type": "integer",
"enum": [
0,
1,
2,
3,
4
],
"description": "0 - Pending, 1 - Signed, 2 - Broadcasted, 3 - Complete, 4 - Expired",
"position": 6
}
},
"additionalProperties": false,
"required": [
"$createdAt",
"$updatedAt",
"amount",
"coreFeePerByte",
"pooling",
"outputScript",
"status"
]
}
}
}
Loading