Skip to content
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

chore(sdk): various sdk fixes #2328

Draft
wants to merge 23 commits into
base: refactor/replaceBLSLibrary
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 22 commits
Commits
Show all changes
23 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
386d7ba
Merge branch 'refactor/replaceBLSLibrary' into test/testWithoutSpan
lklimek Nov 13, 2024
2b93932
fix(sdk): broken import fails compilation
lklimek Nov 13, 2024
c9952b1
Merge remote-tracking branch 'origin/refactor/replaceBLSLibrary' into…
lklimek Nov 15, 2024
6186f2f
Merge branch 'refactor/replaceBLSLibrary' into test/testWithoutSpan
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
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
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
2 changes: 2 additions & 0 deletions packages/rs-drive-abci/src/query/document_query/v0/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,8 @@ impl<C> Platform<C> {
&self.config.drive,
));

println!("{:?}", drive_query);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove debug output


let response = if prove {
let proof =
match drive_query.execute_with_proof(&self.drive, None, None, platform_version) {
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 @@ -2143,7 +2143,6 @@ impl<'a> DriveDocumentQuery<'a> {
drive_operations,
platform_version,
)?;

let query_result = drive.grove_get_path_query_serialized_results(
&path_query,
transaction,
Expand Down
2 changes: 2 additions & 0 deletions packages/rs-drive/tests/query_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4662,6 +4662,8 @@ fn test_dpns_query_start_after_with_null_id() {
)
.expect("query should be built");

println!("{:?}", query);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove debug output


// We are commenting this out on purpose to make it easier to find
// let mut query_operations: Vec<QueryOperation> = vec![];
// let path_query = query
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