Skip to content

Commit 5b5833b

Browse files
more work
1 parent ff0eded commit 5b5833b

File tree

20 files changed

+95
-40
lines changed

20 files changed

+95
-40
lines changed

packages/dapi-grpc/protos/platform/v0/platform.proto

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1211,7 +1211,7 @@ message GetCurrentQuorumsInfoResponse {
12111211
bytes current_quorum_hash = 2;
12121212
repeated ValidatorSetV0 validator_sets = 3;
12131213
bytes last_block_proposer = 4;
1214-
ResponseMetadata metadata = 7; // Metadata about the blockchain state
1214+
ResponseMetadata metadata = 5;
12151215
}
12161216
oneof version { GetCurrentQuorumsInfoResponseV0 v0 = 1; }
12171217
}

packages/rs-dpp/Cargo.toml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ all_features = [
8989
"identity-hashing",
9090
"identity-serialization",
9191
"ciborium",
92+
"core-types",
9293
"core-types-serialization",
9394
"core-types-serde-conversion",
9495
"document-serde-conversion",
@@ -133,6 +134,7 @@ dash-sdk-features = [
133134
"document-value-conversion",
134135
"data-contract-value-conversion",
135136
"identity-value-conversion",
137+
"core-types",
136138
"core-types-serialization",
137139
"core-types-serde-conversion",
138140
"state-transition-serde-conversion",
@@ -156,6 +158,7 @@ all_features_without_client = [
156158
"identity-hashing",
157159
"identity-serialization",
158160
"ciborium",
161+
"core-types",
159162
"core-types-serialization",
160163
"core-types-serde-conversion",
161164
"document-serde-conversion",
@@ -195,6 +198,7 @@ abci = [
195198
"identity-serialization",
196199
"vote-serialization",
197200
"platform-value-cbor",
201+
"core-types",
198202
"core-types-serialization",
199203
"core-types-serde-conversion",
200204
]
@@ -269,8 +273,9 @@ state-transition-signing = [
269273
]
270274
vote-serialization = []
271275
vote-serde-conversion = []
272-
core-types-serialization = []
273-
core-types-serde-conversion = []
276+
core-types = ["bls-signatures"]
277+
core-types-serialization = ["core-types"]
278+
core-types-serde-conversion = ["core-types"]
274279
state-transitions = []
275280
system_contracts = ["factories", "data-contracts", "platform-value-json"]
276281
fixtures-and-mocks = ["system_contracts", "platform-value/json"]

packages/rs-dpp/src/core_types/validator/v0/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ use bincode::enc::Encoder;
1313
use bincode::error::{DecodeError, EncodeError};
1414
#[cfg(feature = "core-types-serialization")]
1515
use bincode::{Decode, Encode};
16+
#[cfg(feature = "core-types-serialization")]
1617
use dashcore::hashes::Hash;
1718

1819
/// A validator in the context of a quorum

packages/rs-dpp/src/core_types/validator_set/v0/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ impl Decode for ValidatorSetV0 {
102102
}
103103
}
104104

105+
#[cfg(feature = "core-types-serialization")]
105106
impl<'de> BorrowDecode<'de> for ValidatorSetV0 {
106107
fn borrow_decode<D: Decoder>(decoder: &mut D) -> Result<Self, bincode::error::DecodeError> {
107108
// Decode each field in the same order as they were encoded

packages/rs-dpp/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ pub mod signing;
5353
pub mod system_data_contracts;
5454
pub mod voting;
5555

56+
#[cfg(feature = "core-types")]
5657
pub mod core_types;
5758
pub mod withdrawal;
5859

packages/rs-drive-abci/src/platform_types/validator_set/v0/mod.rs

Lines changed: 7 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ impl ValidatorSetMethodsV0 for ValidatorSetV0 {
103103
}
104104
}),
105105
power: 100,
106-
pro_tx_hash: reverse(pro_tx_hash.as_byte_array()),
106+
pro_tx_hash: pro_tx_hash.as_byte_array().to_vec(),
107107
node_address,
108108
}))
109109
}
@@ -135,7 +135,7 @@ impl ValidatorSetMethodsV0 for ValidatorSetV0 {
135135
}
136136
}),
137137
power: 100,
138-
pro_tx_hash: reverse(&pro_tx_hash.to_byte_array()),
138+
pro_tx_hash: pro_tx_hash.to_byte_array().to_vec(),
139139
node_address,
140140
}))
141141
}
@@ -150,7 +150,7 @@ impl ValidatorSetMethodsV0 for ValidatorSetV0 {
150150
threshold_public_key: Some(crypto::PublicKey {
151151
sum: Some(Bls12381(self.threshold_public_key.to_bytes().to_vec())),
152152
}),
153-
quorum_hash: reverse(&self.quorum_hash.to_byte_array()),
153+
quorum_hash: self.quorum_hash.to_byte_array().to_vec(),
154154
})
155155
}
156156

@@ -189,15 +189,15 @@ impl ValidatorSetMethodsV0 for ValidatorSetV0 {
189189
sum: Some(Bls12381(public_key.to_bytes().to_vec())),
190190
}),
191191
power: 100,
192-
pro_tx_hash: reverse(&pro_tx_hash.to_byte_array()),
192+
pro_tx_hash: pro_tx_hash.to_byte_array().to_vec(),
193193
node_address,
194194
})
195195
})
196196
.collect(),
197197
threshold_public_key: Some(crypto::PublicKey {
198198
sum: Some(Bls12381(threshold_public_key.to_bytes().to_vec())),
199199
}),
200-
quorum_hash: reverse(&quorum_hash.to_byte_array()),
200+
quorum_hash: quorum_hash.to_byte_array().to_vec(),
201201
}
202202
}
203203

@@ -236,15 +236,15 @@ impl ValidatorSetMethodsV0 for ValidatorSetV0 {
236236
sum: Some(Bls12381(public_key.to_bytes().to_vec())),
237237
}),
238238
power: 100,
239-
pro_tx_hash: reverse(&pro_tx_hash.to_byte_array()),
239+
pro_tx_hash: pro_tx_hash.to_byte_array().to_vec(),
240240
node_address,
241241
})
242242
})
243243
.collect(),
244244
threshold_public_key: Some(crypto::PublicKey {
245245
sum: Some(Bls12381(threshold_public_key.to_bytes().to_vec())),
246246
}),
247-
quorum_hash: reverse(&quorum_hash.to_byte_array()),
247+
quorum_hash: quorum_hash.to_byte_array().to_vec(),
248248
}
249249
}
250250

@@ -308,13 +308,3 @@ impl ValidatorSetMethodsV0 for ValidatorSetV0 {
308308
})
309309
}
310310
}
311-
312-
/// Reverse bytes
313-
///
314-
/// TODO: This is a workaround for reversed data returned by dashcore_rpc (little endian / big endian handling issue).
315-
/// We need to decide on a consistent approach to endianness and follow it.
316-
fn reverse(data: &[u8]) -> Vec<u8> {
317-
// data.reverse();
318-
319-
data.to_vec()
320-
}

packages/rs-drive-abci/src/query/system/current_quorums_info/mod.rs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,17 @@ impl<C> Platform<C> {
2020
) -> Result<QueryValidationResult<GetCurrentQuorumsInfoResponse>, Error> {
2121
let Some(version) = version else {
2222
return Ok(QueryValidationResult::new_with_error(
23-
QueryError::DecodingError("could not decode epoch info request".to_string()),
23+
QueryError::DecodingError(
24+
"could not decode current quorums info request".to_string(),
25+
),
2426
));
2527
};
2628

27-
let feature_version_bounds = &platform_version.drive_abci.query.system.epoch_infos;
29+
let feature_version_bounds = &platform_version
30+
.drive_abci
31+
.query
32+
.system
33+
.current_quorums_info;
2834

2935
let feature_version = match &version {
3036
RequestVersion::V0(_) => 0,

packages/rs-drive-abci/src/query/system/path_elements/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ impl<C> Platform<C> {
2020
) -> Result<QueryValidationResult<GetPathElementsResponse>, Error> {
2121
let Some(version) = version else {
2222
return Ok(QueryValidationResult::new_with_error(
23-
QueryError::DecodingError("could not decode epoch info request".to_string()),
23+
QueryError::DecodingError("could not decode path elements".to_string()),
2424
));
2525
};
2626

packages/rs-drive-abci/src/query/system/total_credits_in_platform/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ impl<C> Platform<C> {
2222
) -> Result<QueryValidationResult<GetTotalCreditsInPlatformResponse>, Error> {
2323
let Some(version) = version else {
2424
return Ok(QueryValidationResult::new_with_error(
25-
QueryError::DecodingError("could not decode epoch info request".to_string()),
25+
QueryError::DecodingError("could not decode total credits in platform".to_string()),
2626
));
2727
};
2828

packages/rs-drive-proof-verifier/src/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,9 @@ pub use proof::{FromProof, Length};
1313
#[cfg(feature = "mocks")]
1414
pub use provider::MockContextProvider;
1515
pub use provider::{ContextProvider, DataContractProvider};
16+
/// From Request
1617
pub mod from_request;
18+
/// Implementation of unproved verification
1719
pub mod unproved;
1820

1921
// Needed for #[derive(PlatformSerialize, PlatformDeserialize)]

0 commit comments

Comments
 (0)