diff --git a/Cargo.lock b/Cargo.lock index b1af1f80794..d05a1f3eeff 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1308,9 +1308,9 @@ dependencies = [ name = "dash-sdk" version = "1.0.0-dev.15" dependencies = [ + "arc-swap", "async-trait", "base64 0.22.1", - "bincode 2.0.0-rc.3", "bip37-bloom-filter", "ciborium", "clap 4.5.7", @@ -1328,6 +1328,7 @@ dependencies = [ "hex", "http 0.2.12", "lru", + "pollster", "rs-dapi-client", "sanitize-filename", "serde", @@ -1705,10 +1706,14 @@ dependencies = [ name = "drive-proof-verifier" version = "1.0.0-dev.15" dependencies = [ + "bincode 2.0.0-rc.3", "dapi-grpc", + "derive_more", "dpp", "drive", "hex", + "platform-serialization", + "platform-serialization-derive", "serde", "serde_json", "tenderdash-abci", @@ -3815,6 +3820,12 @@ dependencies = [ "windows-sys 0.48.0", ] +[[package]] +name = "pollster" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "22686f4785f02a4fcc856d3b3bb19bf6c8160d103f7a99cc258bddd0251dc7f2" + [[package]] name = "portable-atomic" version = "1.6.0" diff --git a/Dockerfile b/Dockerfile index a7c30303022..74ff9b5809d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -174,6 +174,9 @@ WORKDIR /platform COPY . . +# Workaround: as we cache dapi-grpc, its build.rs is not rerun, so we need to touch it +RUN touch /platform/packages/dapi-grpc/build.rs + # # STAGE: BUILD RS-DRIVE-ABCI # diff --git a/packages/dapi-grpc/build.rs b/packages/dapi-grpc/build.rs index 4ca7d670d7c..6392c84e38a 100644 --- a/packages/dapi-grpc/build.rs +++ b/packages/dapi-grpc/build.rs @@ -1,4 +1,5 @@ use std::{ + collections::HashSet, fs::{create_dir_all, remove_dir_all}, path::PathBuf, process::exit, @@ -104,6 +105,9 @@ fn configure_platform(mut platform: MappingConfig) -> MappingConfig { "GetVotePollsByEndDateResponse", ]; + check_unique(&VERSIONED_REQUESTS).expect("VERSIONED_REQUESTS"); + check_unique(&VERSIONED_RESPONSES).expect("VERSIONED_RESPONSES"); + // Derive VersionedGrpcMessage on requests for msg in VERSIONED_REQUESTS { platform = platform @@ -158,6 +162,28 @@ fn configure_platform(mut platform: MappingConfig) -> MappingConfig { platform } +/// Check for duplicate messages in the list. +fn check_unique(messages: &[&'static str]) -> Result<(), String> { + let mut hashset: HashSet<&'static str> = HashSet::new(); + let mut duplicates = String::new(); + + for value in messages { + if !hashset.insert(*value) { + duplicates.push_str(value); + duplicates.push_str(", "); + } + } + + if duplicates.is_empty() { + Ok(()) + } else { + Err(format!( + "Duplicate messages found: {}", + duplicates.trim_end_matches(", ") + )) + } +} + fn configure_core(core: MappingConfig) -> MappingConfig { // All messages can be mocked. let core = core.message_attribute(".", r#"#[derive(::dapi_grpc_macros::Mockable)]"#); diff --git a/packages/rs-dapi-client/src/dump.rs b/packages/rs-dapi-client/src/dump.rs index 26f90f57d9c..ad3796340aa 100644 --- a/packages/rs-dapi-client/src/dump.rs +++ b/packages/rs-dapi-client/src/dump.rs @@ -107,19 +107,16 @@ impl DumpData { /// Filename consists of: /// /// * [DapiClient::DUMP_FILE_PREFIX] - /// * current timestamp /// * basename of the type of request, like `GetIdentityRequest` /// * unique identifier (hash) of the request pub fn filename(&self) -> Result { - let now = chrono::Utc::now().to_rfc3339_opts(chrono::SecondsFormat::Nanos, true); let key = Key::try_new(&self.serialized_request)?; // get request type without underscores (which we use as a file name separator) let request_type = Self::request_type().replace('_', "-"); let file = format!( - "{}_{}_{}_{}.json", + "{}_{}_{}.json", DapiClient::DUMP_FILE_PREFIX, - now, request_type, key ); diff --git a/packages/rs-dapi-client/src/transport/grpc.rs b/packages/rs-dapi-client/src/transport/grpc.rs index 91276fe4d1a..9309943818d 100644 --- a/packages/rs-dapi-client/src/transport/grpc.rs +++ b/packages/rs-dapi-client/src/transport/grpc.rs @@ -281,6 +281,58 @@ impl_transport_request_grpc!( get_data_contracts ); +// rpc getContestedResources(GetContestedResourcesRequest) returns (GetContestedResourcesResponse); +impl_transport_request_grpc!( + platform_proto::GetContestedResourcesRequest, + platform_proto::GetContestedResourcesResponse, + PlatformGrpcClient, + RequestSettings::default(), + get_contested_resources +); + +// rpc getContestedResourceVoteState(GetContestedResourceVoteStateRequest) returns (GetContestedResourceVoteStateResponse); +impl_transport_request_grpc!( + platform_proto::GetContestedResourceVoteStateRequest, + platform_proto::GetContestedResourceVoteStateResponse, + PlatformGrpcClient, + RequestSettings::default(), + get_contested_resource_vote_state +); + +// rpc getContestedResourceVotersForIdentity(GetContestedResourceVotersForIdentityRequest) returns (GetContestedResourceVotersForIdentityResponse); +impl_transport_request_grpc!( + platform_proto::GetContestedResourceVotersForIdentityRequest, + platform_proto::GetContestedResourceVotersForIdentityResponse, + PlatformGrpcClient, + RequestSettings::default(), + get_contested_resource_voters_for_identity +); +// rpc getContestedResourceIdentityVoteStatus(GetContestedResourceIdentityVoteStatusRequest) returns (GetContestedResourceIdentityVoteStatusResponse); +impl_transport_request_grpc!( + platform_proto::GetContestedResourceIdentityVotesRequest, + platform_proto::GetContestedResourceIdentityVotesResponse, + PlatformGrpcClient, + RequestSettings::default(), + get_contested_resource_identity_votes +); +// rpc GetVotePollsByEndDateRequest(GetVotePollsByEndDateRequest) returns (GetVotePollsByEndDateResponse); +impl_transport_request_grpc!( + platform_proto::GetVotePollsByEndDateRequest, + platform_proto::GetVotePollsByEndDateResponse, + PlatformGrpcClient, + RequestSettings::default(), + get_vote_polls_by_end_date +); + +// rpc getPrefundedSpecializedBalance(GetPrefundedSpecializedBalanceRequest) returns (GetPrefundedSpecializedBalanceResponse); +impl_transport_request_grpc!( + platform_proto::GetPrefundedSpecializedBalanceRequest, + platform_proto::GetPrefundedSpecializedBalanceResponse, + PlatformGrpcClient, + RequestSettings::default(), + get_prefunded_specialized_balance +); + // Link to each core gRPC request what client and method to use: impl_transport_request_grpc!( diff --git a/packages/rs-dpp/Cargo.toml b/packages/rs-dpp/Cargo.toml index 8fa295f718f..12df1d7925a 100644 --- a/packages/rs-dpp/Cargo.toml +++ b/packages/rs-dpp/Cargo.toml @@ -234,7 +234,10 @@ identity-cbor-conversion = [ "platform-value-cbor", ] index-serde-conversion = [] -state-transition-serde-conversion = ["data-contract-serde-conversion", "vote-serde-conversion"] +state-transition-serde-conversion = [ + "data-contract-serde-conversion", + "vote-serde-conversion", +] state-transition-value-conversion = [ "platform-value", "state-transition-serde-conversion", diff --git a/packages/rs-dpp/src/document/extended_document/serialize.rs b/packages/rs-dpp/src/document/extended_document/serialize.rs index 993c0ba2c0b..fed22526ab3 100644 --- a/packages/rs-dpp/src/document/extended_document/serialize.rs +++ b/packages/rs-dpp/src/document/extended_document/serialize.rs @@ -4,6 +4,9 @@ use crate::document::serialization_traits::ExtendedDocumentPlatformConversionMet use crate::prelude::ExtendedDocument; use crate::version::PlatformVersion; use crate::ProtocolError; +use bincode::enc::Encoder; +use bincode::error::EncodeError; +use platform_serialization::{PlatformVersionEncode, PlatformVersionedDecode}; use platform_version::version::FeatureVersion; impl ExtendedDocumentPlatformConversionMethodsV0 for ExtendedDocument { @@ -66,3 +69,32 @@ impl ExtendedDocumentPlatformConversionMethodsV0 for ExtendedDocument { } } } + +impl PlatformVersionEncode for ExtendedDocument { + fn platform_encode( + &self, + encoder: &mut E, + platform_version: &PlatformVersion, + ) -> Result<(), EncodeError> { + let serialized = self.serialize_to_bytes(platform_version).map_err(|e| { + EncodeError::OtherString(format!("Failed to serialize ExtendedDocument: {}", e)) + })?; + + serialized.platform_encode(encoder, platform_version) + } +} + +impl PlatformVersionedDecode for ExtendedDocument { + fn platform_versioned_decode( + decoder: &mut D, + platform_version: &PlatformVersion, + ) -> Result { + let bytes = Vec::::platform_versioned_decode(decoder, platform_version)?; + + Self::from_bytes(&bytes, platform_version) + .map_err(|e| { + EncodeError::OtherString(format!("Failed to serialize ExtendedDocument: {}", e)) + }) + .map_err(|e| bincode::error::DecodeError::OtherString(e.to_string())) + } +} diff --git a/packages/rs-dpp/src/voting/contender_structs/contender/v0/mod.rs b/packages/rs-dpp/src/voting/contender_structs/contender/v0/mod.rs index 32f8d6e16de..7ff0929f612 100644 --- a/packages/rs-dpp/src/voting/contender_structs/contender/v0/mod.rs +++ b/packages/rs-dpp/src/voting/contender_structs/contender/v0/mod.rs @@ -2,12 +2,9 @@ use crate::data_contract::document_type::DocumentTypeRef; use crate::document::serialization_traits::DocumentPlatformConversionMethodsV0; use crate::document::Document; use crate::identity::state_transition::asset_lock_proof::{Decode, Encode}; -use crate::prelude::ConsensusValidationResult; -use crate::serialization::PlatformSerializable; -use crate::voting::contender_structs::ContenderWithSerializedDocument; use crate::ProtocolError; use platform_value::Identifier; -use platform_version::version::{FeatureVersion, PlatformVersion}; +use platform_version::version::PlatformVersion; /// Represents a contender in the contested document vote poll. /// diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/masternode_vote/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/masternode_vote/mod.rs index 432334ee39b..4889eb5689c 100644 --- a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/masternode_vote/mod.rs +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/masternode_vote/mod.rs @@ -1772,6 +1772,10 @@ mod tests { mod identity_given_votes_query { use super::*; + use drive::query::{ + contested_resource_votes_given_by_identity_query::ContestedResourceVotesGivenByIdentityQuery, + contract_lookup_fn_for_contract, + }; fn get_identity_given_votes( platform: &TempPlatform, @@ -1916,7 +1920,7 @@ mod tests { query .verify_identity_votes_given_proof( proof.grovedb_proof.as_slice(), - contract, + &contract_lookup_fn_for_contract(Arc::new(contract.to_owned())), platform_version, ) .expect("expected to verify proof") diff --git a/packages/rs-drive-proof-verifier/Cargo.toml b/packages/rs-drive-proof-verifier/Cargo.toml index 685f0727ba6..9ff302579f9 100644 --- a/packages/rs-drive-proof-verifier/Cargo.toml +++ b/packages/rs-drive-proof-verifier/Cargo.toml @@ -8,8 +8,14 @@ crate-type = ["cdylib"] [features] default = ["mocks"] -mocks = ["dep:serde", "json"] -json = ["dep:serde_json"] +mocks = [ + "dep:serde", + "dep:serde_json", + "dep:bincode", + "dep:platform-serialization-derive", + "dep:platform-serialization", + "dpp/document-serde-conversion", +] [dependencies] @@ -18,9 +24,16 @@ dapi-grpc = { path = "../dapi-grpc" } drive = { path = "../rs-drive", default-features = false, features = [ "verify", ] } -dpp = { path = "../rs-dpp", features = ["bls-signatures"], default-features = false } +dpp = { path = "../rs-dpp", features = [ + "bls-signatures", + "document-value-conversion", + "extended-document", +], default-features = false } +bincode = { version = "2.0.0-rc.3", features = ["serde"], optional = true } +platform-serialization-derive = { path = "../rs-platform-serialization-derive", optional = true } +platform-serialization = { path = "../rs-platform-serialization", optional = true } tenderdash-abci = { git = "https://github.com/dashpay/rs-tenderdash-abci", version = "0.14.0-dev.12", features = [ - "crypto" + "crypto", ], default-features = false } tracing = { version = "0.1.37" } serde = { version = "1.0.197", default-features = false, optional = true } @@ -28,3 +41,4 @@ serde_json = { version = "1.0.103", features = [ "preserve_order", ], optional = true } hex = { version = "0.4.3" } +derive_more = { version = "0.99.11" } diff --git a/packages/rs-drive-proof-verifier/src/error.rs b/packages/rs-drive-proof-verifier/src/error.rs index 300fd2c6e9e..7b7848f1dbd 100644 --- a/packages/rs-drive-proof-verifier/src/error.rs +++ b/packages/rs-drive-proof-verifier/src/error.rs @@ -37,7 +37,7 @@ pub enum Error { /// Decode protobuf error #[error("decode request: {error}")] - RequestDecodeError { error: String }, + RequestError { error: String }, /// Decode protobuf response error #[error("decode response: {error}")] @@ -97,7 +97,7 @@ pub enum ContextProviderError { /// Data contract is invalid or not found, or some error occurred during data contract retrieval #[error("cannot get data contract: {0}")] - InvalidDataContract(String), + DataContractFailure(String), /// Provided quorum is invalid #[error("invalid quorum: {0}")] diff --git a/packages/rs-drive-proof-verifier/src/from_request.rs b/packages/rs-drive-proof-verifier/src/from_request.rs new file mode 100644 index 00000000000..0eee6607bb7 --- /dev/null +++ b/packages/rs-drive-proof-verifier/src/from_request.rs @@ -0,0 +1,443 @@ +//! Conversions between Drive queries and dapi-grpc requests. + +use dapi_grpc::platform::v0::{ + self as proto, + get_contested_resource_vote_state_request::{ + self, get_contested_resource_vote_state_request_v0, + }, + get_contested_resources_request::{ + self, get_contested_resources_request_v0, GetContestedResourcesRequestV0, + }, + get_vote_polls_by_end_date_request::{self}, + GetContestedResourceIdentityVotesRequest, GetContestedResourceVoteStateRequest, + GetContestedResourceVotersForIdentityRequest, GetContestedResourcesRequest, + GetPrefundedSpecializedBalanceRequest, GetVotePollsByEndDateRequest, +}; +use dpp::{ + identifier::Identifier, platform_value::Value, + voting::vote_polls::contested_document_resource_vote_poll::ContestedDocumentResourceVotePoll, +}; +use drive::query::{ + contested_resource_votes_given_by_identity_query::ContestedResourceVotesGivenByIdentityQuery, + vote_poll_contestant_votes_query::ContestedDocumentVotePollVotesDriveQuery, + vote_poll_vote_state_query::{ + ContestedDocumentVotePollDriveQuery, ContestedDocumentVotePollDriveQueryResultType, + }, + vote_polls_by_document_type_query::VotePollsByDocumentTypeQuery, + VotePollsByEndDateDriveQuery, +}; + +use crate::Error; + +const BINCODE_CONFIG: dpp::bincode::config::Configuration = dpp::bincode::config::standard(); + +/// Conver a gRPC request into a query object. +/// +/// This trait is implemented on Drive queries that can be created from gRPC requests. +/// +/// # Generic Type Parameters +/// +/// * `T`: The type of the gRPC request. +pub trait TryFromRequest: Sized { + /// Create based on some `grpc_request`. + fn try_from_request(grpc_request: T) -> Result; + + /// Try to convert the request into a gRPC query. + fn try_to_request(&self) -> Result; +} + +impl TryFromRequest + for ContestedDocumentVotePollDriveQueryResultType +{ + fn try_from_request( + grpc_request: get_contested_resource_vote_state_request_v0::ResultType, + ) -> Result { + use get_contested_resource_vote_state_request_v0::ResultType as GrpcResultType; + use ContestedDocumentVotePollDriveQueryResultType as DriveResultType; + + Ok(match grpc_request { + GrpcResultType::Documents => DriveResultType::Documents, + GrpcResultType::DocumentsAndVoteTally => DriveResultType::DocumentsAndVoteTally, + GrpcResultType::VoteTally => DriveResultType::VoteTally, + }) + } + fn try_to_request( + &self, + ) -> Result { + use get_contested_resource_vote_state_request_v0::ResultType as GrpcResultType; + use ContestedDocumentVotePollDriveQueryResultType as DriveResultType; + + Ok(match self { + DriveResultType::Documents => GrpcResultType::Documents, + DriveResultType::DocumentsAndVoteTally => GrpcResultType::DocumentsAndVoteTally, + DriveResultType::VoteTally => GrpcResultType::VoteTally, + }) + } +} + +impl TryFromRequest for ContestedDocumentVotePollDriveQuery { + fn try_from_request(grpc_request: GetContestedResourceVoteStateRequest) -> Result { + let result = match grpc_request.version.ok_or(Error::EmptyVersion)? { + get_contested_resource_vote_state_request::Version::V0(v) => { + ContestedDocumentVotePollDriveQuery { + limit: v.count.map(|v| v as u16), + vote_poll: ContestedDocumentResourceVotePoll { + contract_id: Identifier::from_bytes(&v.contract_id).map_err(|e| { + Error::RequestError { + error: format!("cannot decode contract id: {}", e), + } + })?, + document_type_name: v.document_type_name.clone(), + index_name: v.index_name.clone(), + index_values: bincode_decode_values(v.index_values.iter())?, + }, + result_type: match v.result_type() { + get_contested_resource_vote_state_request_v0::ResultType::Documents => { + ContestedDocumentVotePollDriveQueryResultType::Documents + } + get_contested_resource_vote_state_request_v0::ResultType::DocumentsAndVoteTally => { + ContestedDocumentVotePollDriveQueryResultType::DocumentsAndVoteTally + } + get_contested_resource_vote_state_request_v0::ResultType::VoteTally => { + ContestedDocumentVotePollDriveQueryResultType::VoteTally + } + }, + start_at: v + .start_at_identifier_info + .map(|v| to_bytes32(&v.start_identifier).map(|id| (id, v.start_identifier_included))) + .transpose() + .map_err(|e| { + Error::RequestError { + error: format!( + "cannot decode start_at: {}", + e + )}} + )?, + offset: None, // offset is not supported when we use proofs + allow_include_locked_and_abstaining_vote_tally: v + .allow_include_locked_and_abstaining_vote_tally, + } + } + }; + Ok(result) + } + + fn try_to_request(&self) -> Result { + use proto::get_contested_resource_vote_state_request::get_contested_resource_vote_state_request_v0 as request_v0; + if self.offset.is_some() { + return Err(Error::RequestError{error:"ContestedDocumentVotePollDriveQuery.offset field is internal and must be set to None".into()}); + } + + let start_at_identifier_info = self.start_at.map(|v| request_v0::StartAtIdentifierInfo { + start_identifier: v.0.to_vec(), + start_identifier_included: v.1, + }); + + use proto::get_contested_resource_vote_state_request:: get_contested_resource_vote_state_request_v0::ResultType as GrpcResultType; + Ok(proto::get_contested_resource_vote_state_request::GetContestedResourceVoteStateRequestV0 { + prove:true, + contract_id:self.vote_poll.contract_id.to_vec(), + count: self.limit.map(|v| v as u32), + document_type_name: self.vote_poll.document_type_name.clone(), + index_name: self.vote_poll.index_name.clone(), + index_values: self.vote_poll.index_values.iter().map(|v| + dpp::bincode::encode_to_vec(v, BINCODE_CONFIG).map_err(|e|Error::RequestError { error: e.to_string() } )).collect::,_>>()?, + result_type:match self.result_type { + ContestedDocumentVotePollDriveQueryResultType::Documents => GrpcResultType::Documents.into(), + ContestedDocumentVotePollDriveQueryResultType::DocumentsAndVoteTally => GrpcResultType::DocumentsAndVoteTally.into(), + ContestedDocumentVotePollDriveQueryResultType::VoteTally => GrpcResultType::VoteTally.into(), + }, + start_at_identifier_info, + allow_include_locked_and_abstaining_vote_tally: self.allow_include_locked_and_abstaining_vote_tally, + } + .into()) + } +} + +fn to_bytes32(v: &[u8]) -> Result<[u8; 32], Error> { + let result: Result<[u8; 32], std::array::TryFromSliceError> = v.try_into(); + match result { + Ok(id) => Ok(id), + Err(e) => Err(Error::RequestError { + error: format!("cannot decode id: {}", e), + }), + } +} + +impl TryFromRequest + for ContestedResourceVotesGivenByIdentityQuery +{ + fn try_from_request( + grpc_request: GetContestedResourceIdentityVotesRequest, + ) -> Result { + let proto::get_contested_resource_identity_votes_request::Version::V0(value) = + grpc_request.version.ok_or(Error::EmptyVersion)?; + let start_at = value + .start_at_vote_poll_id_info + .map(|v| { + to_bytes32(&v.start_at_poll_identifier) + .map(|id| (id, v.start_poll_identifier_included)) + }) + .transpose()?; + + Ok(Self { + identity_id: Identifier::from_vec(value.identity_id.to_vec()).map_err(|e| { + Error::RequestError { + error: e.to_string(), + } + })?, + offset: None, + limit: value.limit.map(|x| x as u16), + start_at, + order_ascending: value.order_ascending, + }) + } + + fn try_to_request(&self) -> Result { + use proto::get_contested_resource_identity_votes_request::get_contested_resource_identity_votes_request_v0 as request_v0; + if self.offset.is_some() { + return Err(Error::RequestError{error:"ContestedResourceVotesGivenByIdentityQuery.offset field is internal and must be set to None".into()}); + } + + Ok(proto::get_contested_resource_identity_votes_request::GetContestedResourceIdentityVotesRequestV0 { + prove: true, + identity_id: self.identity_id.to_vec(), + offset: self.offset.map(|x| x as u32), + limit: self.limit.map(|x| x as u32), + start_at_vote_poll_id_info: self.start_at.map(|(id, included)| { + request_v0::StartAtVotePollIdInfo { + start_at_poll_identifier: id.to_vec(), + start_poll_identifier_included: included, + } + }), + order_ascending: self.order_ascending, + }.into() + ) + } +} + +use dapi_grpc::platform::v0::get_contested_resource_voters_for_identity_request; + +impl TryFromRequest + for ContestedDocumentVotePollVotesDriveQuery +{ + fn try_from_request( + value: GetContestedResourceVotersForIdentityRequest, + ) -> Result { + let result = match value.version.ok_or(Error::EmptyVersion)? { + get_contested_resource_voters_for_identity_request::Version::V0(v) => { + ContestedDocumentVotePollVotesDriveQuery { + vote_poll: ContestedDocumentResourceVotePoll { + contract_id: Identifier::from_bytes(&v.contract_id).map_err(|e| { + Error::RequestError { + error: format!("cannot decode contract id: {}", e), + } + })?, + document_type_name: v.document_type_name.clone(), + index_name: v.index_name.clone(), + index_values: bincode_decode_values(v.index_values.iter())?, + }, + contestant_id: Identifier::from_bytes(&v.contestant_id).map_err(|e| { + Error::RequestError { + error: format!("cannot decode contestant_id: {}", e), + } + })?, + limit: v.count.map(|v| v as u16), + offset: None, + start_at: v + .start_at_identifier_info + .map(|v| { + to_bytes32(&v.start_identifier) + .map(|id| (id, v.start_identifier_included)) + }) + .transpose() + .map_err(|e| Error::RequestError { + error: format!("cannot decode start_at value: {}", e), + })?, + order_ascending: v.order_ascending, + } + } + }; + + Ok(result) + } + fn try_to_request(&self) -> Result { + use proto::get_contested_resource_voters_for_identity_request::get_contested_resource_voters_for_identity_request_v0 as request_v0; + if self.offset.is_some() { + return Err(Error::RequestError{error:"ContestedDocumentVotePollVotesDriveQuery.offset field is internal and must be set to None".into()}); + } + + Ok(proto::get_contested_resource_voters_for_identity_request::GetContestedResourceVotersForIdentityRequestV0 { + prove:true, + contract_id: self.vote_poll.contract_id.to_vec(), + document_type_name: self.vote_poll.document_type_name.clone(), + index_name: self.vote_poll.index_name.clone(), + index_values: self.vote_poll.index_values.iter().map(|v| + dpp::bincode::encode_to_vec(v, BINCODE_CONFIG).map_err(|e| + Error::RequestError { error: e.to_string()})).collect::,_>>()?, + order_ascending: self.order_ascending, + count: self.limit.map(|v| v as u32), + contestant_id: self.contestant_id.to_vec(), + start_at_identifier_info: self.start_at.map(|v| request_v0::StartAtIdentifierInfo{ + start_identifier: v.0.to_vec(), + start_identifier_included: v.1, + }), + } + .into()) + } +} + +impl TryFromRequest for VotePollsByDocumentTypeQuery { + fn try_from_request(value: GetContestedResourcesRequest) -> Result { + let result = match value.version.ok_or(Error::EmptyVersion)? { + get_contested_resources_request::Version::V0(req) => VotePollsByDocumentTypeQuery { + contract_id: Identifier::from_bytes(&req.contract_id).map_err(|e| { + Error::RequestError { + error: format!("cannot decode contract id: {}", e), + } + })?, + document_type_name: req.document_type_name.clone(), + index_name: req.index_name.clone(), + start_at_value: req + .start_at_value_info + .map(|i| (i.start_value, i.start_value_included)), + start_index_values: bincode_decode_values(req.start_index_values.iter())?, + end_index_values: bincode_decode_values(req.end_index_values.iter())?, + limit: req.count.map(|v| v as u16), + order_ascending: req.order_ascending, + }, + }; + Ok(result) + } + + fn try_to_request(&self) -> Result { + Ok(GetContestedResourcesRequestV0 { + prove: true, + contract_id: self.contract_id.to_vec(), + count: self.limit.map(|v| v as u32), + document_type_name: self.document_type_name.clone(), + end_index_values: bincode_encode_values(&self.end_index_values)?, + start_index_values: bincode_encode_values(&self.start_index_values)?, + index_name: self.index_name.clone(), + order_ascending: self.order_ascending, + start_at_value_info: self.start_at_value.as_ref().map( + |(start_value, start_value_included)| { + get_contested_resources_request_v0::StartAtValueInfo { + start_value: start_value.clone(), + start_value_included: *start_value_included, + } + }, + ), + } + .into()) + } +} + +impl TryFromRequest for VotePollsByEndDateDriveQuery { + fn try_from_request(value: GetVotePollsByEndDateRequest) -> Result { + let result = match value.version.ok_or(Error::EmptyVersion)? { + get_vote_polls_by_end_date_request::Version::V0(v) => VotePollsByEndDateDriveQuery { + start_time: v + .start_time_info + .map(|v| (v.start_time_ms, v.start_time_included)), + end_time: v + .end_time_info + .map(|v| (v.end_time_ms, v.end_time_included)), + limit: v.limit.map(|v| v as u16), + offset: v.offset.map(|v| v as u16), + order_ascending: v.ascending, + }, + }; + Ok(result) + } + + fn try_to_request(&self) -> Result { + use proto::get_vote_polls_by_end_date_request::get_vote_polls_by_end_date_request_v0 as request_v0; + if self.offset.is_some() { + return Err(Error::RequestError { + error: + "VotePollsByEndDateDriveQuery.offset field is internal and must be set to None" + .into(), + }); + } + + Ok( + proto::get_vote_polls_by_end_date_request::GetVotePollsByEndDateRequestV0 { + prove: true, + start_time_info: self.start_time.map(|(start_time_ms, start_time_included)| { + request_v0::StartAtTimeInfo { + start_time_ms, + start_time_included, + } + }), + end_time_info: self.end_time.map(|(end_time_ms, end_time_included)| { + request_v0::EndAtTimeInfo { + end_time_ms, + end_time_included, + } + }), + limit: self.limit.map(|v| v as u32), + offset: self.offset.map(|v| v as u32), + ascending: self.order_ascending, + } + .into(), + ) + } +} + +impl TryFromRequest for Identifier { + fn try_to_request(&self) -> Result { + Ok( + proto::get_prefunded_specialized_balance_request::GetPrefundedSpecializedBalanceRequestV0 { + prove:true, + id: self.to_vec(), + }.into() + ) + } + + fn try_from_request( + grpc_request: GetPrefundedSpecializedBalanceRequest, + ) -> Result { + match grpc_request.version.ok_or(Error::EmptyVersion)? { + proto::get_prefunded_specialized_balance_request::Version::V0(v) => { + Identifier::from_bytes(&v.id).map_err(|e| Error::RequestError { + error: format!("cannot decode id: {}", e), + }) + } + } + } +} + +/// Convert a sequence of byte vectors into a sequence of [values](platform_value::Value). +/// +/// Small utility function to decode a sequence of byte vectors into a sequence of [values](platform_value::Value). +fn bincode_decode_values, T: IntoIterator>( + values: T, +) -> Result, Error> { + values + .into_iter() + .map(|v| { + dpp::bincode::decode_from_slice(v.as_ref(), BINCODE_CONFIG) + .map_err(|e| Error::RequestError { + error: format!("cannot decode value: {}", e), + }) + .map(|(v, _)| v) + }) + .collect() +} + +/// Convert a sequence of [values](platform_value::Value) into a sequence of byte vectors. +/// +/// Small utility function to encode a sequence of [values](platform_value::Value) into a sequence of byte vectors. +fn bincode_encode_values<'a, T: IntoIterator>( + values: T, +) -> Result>, Error> { + values + .into_iter() + .map(|v| { + dpp::bincode::encode_to_vec(v, BINCODE_CONFIG).map_err(|e| Error::RequestError { + error: format!("cannot encode value: {}", e), + }) + }) + .collect::, _>>() +} diff --git a/packages/rs-drive-proof-verifier/src/lib.rs b/packages/rs-drive-proof-verifier/src/lib.rs index ffd35ac5a1a..bee807bda66 100644 --- a/packages/rs-drive-proof-verifier/src/lib.rs +++ b/packages/rs-drive-proof-verifier/src/lib.rs @@ -13,3 +13,8 @@ pub use proof::FromProof; pub use provider::ContextProvider; #[cfg(feature = "mocks")] pub use provider::MockContextProvider; +pub mod from_request; + +// Needed for #[derive(PlatformSerialize, PlatformDeserialize)] +#[cfg(feature = "mocks")] +use dpp::serialization; diff --git a/packages/rs-drive-proof-verifier/src/proof.rs b/packages/rs-drive-proof-verifier/src/proof.rs index b9db571ae23..bdd0a506149 100644 --- a/packages/rs-drive-proof-verifier/src/proof.rs +++ b/packages/rs-drive-proof-verifier/src/proof.rs @@ -1,16 +1,20 @@ +use crate::from_request::TryFromRequest; use crate::{types, types::*, ContextProvider, Error}; +use dapi_grpc::platform::v0::get_identities_contract_keys_request::GetIdentitiesContractKeysRequestV0; +use dapi_grpc::platform::v0::get_path_elements_request::GetPathElementsRequestV0; use dapi_grpc::platform::v0::get_protocol_version_upgrade_vote_status_request::{ self, GetProtocolVersionUpgradeVoteStatusRequestV0, }; use dapi_grpc::platform::v0::security_level_map::KeyKindRequestType as GrpcKeyKind; use dapi_grpc::platform::v0::{ - get_data_contract_history_request, get_data_contract_request, get_data_contracts_request, - get_epochs_info_request, get_identities_contract_keys_request, - get_identity_balance_and_revision_request, get_identity_balance_request, - get_identity_by_public_key_hash_request, get_identity_contract_nonce_request, - get_identity_keys_request, get_identity_nonce_request, get_identity_request, - get_path_elements_request, GetIdentitiesContractKeysRequest, GetPathElementsRequest, - GetPathElementsResponse, GetProtocolVersionUpgradeStateRequest, + get_contested_resource_identity_votes_request, get_data_contract_history_request, + get_data_contract_request, get_data_contracts_request, get_epochs_info_request, + get_identities_contract_keys_request, get_identity_balance_and_revision_request, + get_identity_balance_request, get_identity_by_public_key_hash_request, + get_identity_contract_nonce_request, get_identity_keys_request, get_identity_nonce_request, + get_identity_request, get_path_elements_request, get_prefunded_specialized_balance_request, + GetContestedResourceVotersForIdentityRequest, GetContestedResourceVotersForIdentityResponse, + GetPathElementsRequest, GetPathElementsResponse, GetProtocolVersionUpgradeStateRequest, GetProtocolVersionUpgradeStateResponse, GetProtocolVersionUpgradeVoteStatusRequest, GetProtocolVersionUpgradeVoteStatusResponse, ResponseMetadata, }; @@ -18,29 +22,31 @@ use dapi_grpc::platform::{ v0::{self as platform, key_request_type, KeyRequestType as GrpcKeyType}, VersionedGrpcResponse, }; +use dpp::block::block_info::BlockInfo; use dpp::block::epoch::{EpochIndex, MAX_EPOCH}; use dpp::block::extended_epoch_info::ExtendedEpochInfo; use dpp::dashcore::hashes::Hash; use dpp::dashcore::ProTxHash; use dpp::document::{Document, DocumentV0Getters}; +use dpp::identity::identities_contract_keys::IdentitiesContractKeys; +use dpp::identity::Purpose; +use dpp::platform_value::{self}; use dpp::prelude::{DataContract, Identifier, Identity}; use dpp::serialization::PlatformDeserializable; use dpp::state_transition::proof_result::StateTransitionProofResult; use dpp::state_transition::StateTransition; use dpp::version::PlatformVersion; +use dpp::voting::votes::Vote; use drive::drive::identity::key::fetch::{ IdentityKeysRequest, KeyKindRequestType, KeyRequestType, PurposeU8, SecurityLevelU8, }; - -use dapi_grpc::platform::v0::get_identities_contract_keys_request::GetIdentitiesContractKeysRequestV0; -use dapi_grpc::platform::v0::get_path_elements_request::GetPathElementsRequestV0; -use dpp::block::block_info::BlockInfo; -use dpp::identity::identities_contract_keys::IdentitiesContractKeys; -use dpp::identity::{IdentityPublicKey, Purpose}; -use dpp::platform_value; use drive::drive::Drive; use drive::error::proof::ProofError; -use drive::query::DriveQuery; +use drive::query::contested_resource_votes_given_by_identity_query::ContestedResourceVotesGivenByIdentityQuery; +use drive::query::vote_poll_contestant_votes_query::ContestedDocumentVotePollVotesDriveQuery; +use drive::query::vote_poll_vote_state_query::ContestedDocumentVotePollDriveQuery; +use drive::query::vote_polls_by_document_type_query::VotePollsByDocumentTypeQuery; +use drive::query::{ContractLookupFn, DriveQuery, VotePollsByEndDateDriveQuery}; use std::array::TryFromSliceError; use std::collections::BTreeMap; use std::num::TryFromIntError; @@ -203,7 +209,6 @@ impl FromProof for Identity { // Parse response to read proof and metadata let proof = response.proof().or(Err(Error::NoProofInResult))?; - let mtd = response.metadata().or(Err(Error::EmptyResponseMetadata))?; let id = match request.version.ok_or(Error::EmptyVersion)? { @@ -395,11 +400,11 @@ impl FromProof for IdentityPublicKeys { fn parse_key_request_type(request: &Option) -> Result { let key_request_type = request .to_owned() - .ok_or(Error::RequestDecodeError { + .ok_or(Error::RequestError { error: "missing key request type".to_string(), })? .request - .ok_or(Error::RequestDecodeError { + .ok_or(Error::RequestError { error: "empty request field in key request type".to_string(), })?; @@ -423,7 +428,7 @@ fn parse_key_request_type(request: &Option) -> Result { Ok(KeyKindRequestType::AllKeysOfKindRequest) } - _ => Err(Error::RequestDecodeError { + _ => Err(Error::RequestError { error: format!("missing requested key type: {}", kind), }), }; @@ -724,11 +729,9 @@ impl FromProof for DataContracts { let ids = ids .iter() .map(|id| { - id.clone() - .try_into() - .map_err(|_e| Error::RequestDecodeError { - error: format!("wrong id size: expected: {}, got: {}", 32, id.len()), - }) + id.clone().try_into().map_err(|_e| Error::RequestError { + error: format!("wrong id size: expected: {}, got: {}", 32, id.len()), + }) }) .collect::, Error>>()?; @@ -858,18 +861,13 @@ impl FromProof for StateTransitionPro epoch: (metadata.epoch as u16).try_into()?, }; - let known_contracts_provider_fn = - |id: &Identifier| -> Result>, drive::error::Error> { - provider.get_data_contract(id).map_err(|e| { - drive::error::Error::Proof(ProofError::ErrorRetrievingContract(e.to_string())) - }) - }; + let contracts_provider_fn = known_contracts_provider_fn(provider); let (root_hash, result) = Drive::verify_state_transition_was_executed_with_proof( &state_transition, &block_info, &proof.grovedb_proof, - &known_contracts_provider_fn, + &contracts_provider_fn, platform_version, ) .map_err(|e| Error::DriveError { @@ -904,7 +902,7 @@ impl FromProof for ExtendedEpochInfo { if let Some(mut e) = epochs.0 { if e.len() != 1 { - return Err(Error::RequestDecodeError { + return Err(Error::RequestError { error: format!("expected 1 epoch, got {}", e.len()), }); } @@ -974,19 +972,13 @@ impl FromProof for ExtendedEpochInfos { verify_tenderdash_proof(proof, mtd, &root_hash, provider)?; - let maybe_epoch_info = if epoch_info.count_some() > 0 { - Some(epoch_info) - } else { - None - }; - - Ok((maybe_epoch_info, mtd.clone())) + Ok((epoch_info.into_option(), mtd.clone())) } } fn try_u32_to_u16(i: u32) -> Result { i.try_into() - .map_err(|e: TryFromIntError| Error::RequestDecodeError { + .map_err(|e: TryFromIntError| Error::RequestError { error: e.to_string(), }) } @@ -1009,19 +1001,15 @@ impl FromProof for ProtocolVersionUpgrade let proof = response.proof().or(Err(Error::NoProofInResult))?; let mtd = response.metadata().or(Err(Error::EmptyResponseMetadata))?; - let (root_hash, object) = + let (root_hash, objects) = Drive::verify_upgrade_state(&proof.grovedb_proof, platform_version)?; verify_tenderdash_proof(proof, mtd, &root_hash, provider)?; - if object.is_empty() { - return Ok((None, mtd.clone())); - } + // Convert objects to a map of Option values + let response: Self = objects.into_iter().map(|(k, v)| (k, Some(v))).collect(); - Ok(( - Some(object.into_iter().map(|(k, v)| (k, Some(v))).collect()), - mtd.clone(), - )) + Ok((response.into_option(), mtd.clone())) } } @@ -1054,7 +1042,7 @@ impl FromProof for MasternodeProtoco None } else { Some(request_v0.start_pro_tx_hash[..].try_into().map_err( - |e: TryFromSliceError| Error::RequestDecodeError { + |e: TryFromSliceError| Error::RequestError { error: e.to_string(), }, )?) @@ -1091,7 +1079,7 @@ impl FromProof for MasternodeProtoco }) .collect::>()?; - Ok((Some(votes), mtd.clone())) + Ok((votes.into_option(), mtd.clone())) } } @@ -1127,7 +1115,7 @@ impl FromProof for Elements { verify_tenderdash_proof(proof, mtd, &root_hash, provider)?; - Ok((Some(objects), mtd.clone())) + Ok((objects.into_option(), mtd.clone())) } } @@ -1157,7 +1145,7 @@ where request .clone() .try_into() - .map_err(|e: Q::Error| Error::RequestDecodeError { + .map_err(|e: Q::Error| Error::RequestError { error: e.to_string(), })?; @@ -1178,11 +1166,7 @@ where verify_tenderdash_proof(proof, mtd, &root_hash, provider)?; - if documents.is_empty() { - Ok((None, mtd.clone())) - } else { - Ok((Some(documents), mtd.clone())) - } + Ok((documents.into_option(), mtd.clone())) } } @@ -1216,7 +1200,7 @@ impl FromProof for IdentitiesContrac contract_id, document_type_name, purposes, - prove, + prove: _, } = v0; let identifiers = identities_ids .into_iter() @@ -1261,19 +1245,337 @@ impl FromProof for IdentitiesContrac verify_tenderdash_proof(proof, mtd, &root_hash, provider)?; + if identities_contract_keys.is_empty() { + return Ok((None, mtd.clone())); + } + Ok((Some(identities_contract_keys), mtd.clone())) } } +impl FromProof for ContestedResources { + type Request = platform::GetContestedResourcesRequest; + type Response = platform::GetContestedResourcesResponse; + + fn maybe_from_proof_with_metadata<'a, I: Into, O: Into>( + request: I, + response: O, + platform_version: &PlatformVersion, + provider: &'a dyn ContextProvider, + ) -> Result<(Option, ResponseMetadata), Error> + where + Self: Sized + 'a, + { + let request: Self::Request = request.into(); + let response: Self::Response = response.into(); + + // Decode request to get drive query + let drive_query = VotePollsByDocumentTypeQuery::try_from_request(request)?; + let resolved_request = drive_query + .resolve_with_known_contracts_provider(&known_contracts_provider_fn(provider))?; + + // Parse response to read proof and metadata + let proof = response.proof().or(Err(Error::NoProofInResult))?; + let mtd = response.metadata().or(Err(Error::EmptyResponseMetadata))?; + + let (root_hash, items) = resolved_request + .verify_contests_proof(&proof.grovedb_proof, platform_version) + .map_err(|e| Error::DriveError { + error: e.to_string(), + })?; + + verify_tenderdash_proof(proof, mtd, &root_hash, provider)?; + + let resources: ContestedResources = + items.into_iter().map(ContestedResource::Value).collect(); + + Ok((resources.into_option(), mtd.clone())) + } +} + +// rpc getContestedResourceVoteState(GetContestedResourceVoteStateRequest) returns (GetContestedResourceVoteStateResponse); +impl FromProof for Contenders { + type Request = platform::GetContestedResourceVoteStateRequest; + type Response = platform::GetContestedResourceVoteStateResponse; + + fn maybe_from_proof_with_metadata<'a, I: Into, O: Into>( + request: I, + response: O, + platform_version: &PlatformVersion, + provider: &'a dyn ContextProvider, + ) -> Result<(Option, ResponseMetadata), Error> + where + Self: 'a, + { + let request: Self::Request = request.into(); + let response: Self::Response = response.into(); + + // Decode request to get drive query + let drive_query = ContestedDocumentVotePollDriveQuery::try_from_request(request)?; + + // Resolve request to get verify_*_proof + let contracts_provider = known_contracts_provider_fn(provider); + let resolved_request = + drive_query.resolve_with_known_contracts_provider(&contracts_provider)?; + + // Parse response to read proof and metadata + let proof = response.proof().or(Err(Error::NoProofInResult))?; + let mtd = response.metadata().or(Err(Error::EmptyResponseMetadata))?; + + let (root_hash, contested_resource_vote_state) = resolved_request + .verify_vote_poll_vote_state_proof(&proof.grovedb_proof, platform_version) + .map_err(|e| Error::DriveError { + error: e.to_string(), + })?; + + verify_tenderdash_proof(proof, mtd, &root_hash, provider)?; + + let contenders = contested_resource_vote_state + .contenders + .into_iter() + .map(|v| (v.identity_id(), v)) + .collect(); + + let response = Contenders { + contenders, + abstain_vote_tally: contested_resource_vote_state.abstaining_vote_tally, + lock_vote_tally: contested_resource_vote_state.locked_vote_tally, + }; + Ok((response.into_option(), mtd.clone())) + } +} + +impl FromProof for Voters { + type Request = GetContestedResourceVotersForIdentityRequest; + type Response = GetContestedResourceVotersForIdentityResponse; + + fn maybe_from_proof_with_metadata<'a, I: Into, O: Into>( + request: I, + response: O, + platform_version: &PlatformVersion, + provider: &'a dyn ContextProvider, + ) -> Result<(Option, ResponseMetadata), Error> + where + Self: Sized + 'a, + { + let request: Self::Request = request.into(); + let response: Self::Response = response.into(); + + // Decode request to get drive query + let drive_query = ContestedDocumentVotePollVotesDriveQuery::try_from_request(request)?; + + // Parse request to get resolved contract that implements verify_*_proof + let contracts_provider = known_contracts_provider_fn(provider); + + let resolved_request = + drive_query.resolve_with_known_contracts_provider(&contracts_provider)?; + + // Parse response to read proof and metadata + let proof = response.proof().or(Err(Error::NoProofInResult))?; + let mtd = response.metadata().or(Err(Error::EmptyResponseMetadata))?; + + let (root_hash, voters) = resolved_request + .verify_vote_poll_votes_proof(&proof.grovedb_proof, platform_version) + .map_err(|e| Error::DriveError { + error: e.to_string(), + })?; + + verify_tenderdash_proof(proof, mtd, &root_hash, provider)?; + + if voters.is_empty() { + return Ok((None, mtd.clone())); + } + let result: Voters = voters.into_iter().map(Voter::from).collect(); + + Ok((result.into_option(), mtd.clone())) + } +} + +impl FromProof for ResourceVotesByIdentity { + type Request = platform::GetContestedResourceIdentityVotesRequest; + type Response = platform::GetContestedResourceIdentityVotesResponse; + + fn maybe_from_proof_with_metadata<'a, I: Into, O: Into>( + request: I, + response: O, + platform_version: &PlatformVersion, + provider: &'a dyn ContextProvider, + ) -> Result<(Option, ResponseMetadata), Error> + where + Self: Sized + 'a, + { + let request: Self::Request = request.into(); + let response: Self::Response = response.into(); + + // Decode request to get drive query + let drive_query = ContestedResourceVotesGivenByIdentityQuery::try_from_request(request)?; + + // Parse response to read proof and metadata + let proof = response.proof().or(Err(Error::NoProofInResult))?; + let mtd = response.metadata().or(Err(Error::EmptyResponseMetadata))?; + + let contract_provider_fn = known_contracts_provider_fn(provider); + let (root_hash, voters) = drive_query + .verify_identity_votes_given_proof( + &proof.grovedb_proof, + &contract_provider_fn, + platform_version, + ) + .map_err(|e| Error::DriveError { + error: e.to_string(), + })?; + + verify_tenderdash_proof(proof, mtd, &root_hash, provider)?; + + let response: ResourceVotesByIdentity = voters + .into_iter() + .map(|(id, vote)| (id, Some(vote))) + .collect(); + + Ok((response.into_option(), mtd.clone())) + } +} + +impl FromProof for VotePollsGroupedByTimestamp { + type Request = platform::GetVotePollsByEndDateRequest; + type Response = platform::GetVotePollsByEndDateResponse; + + fn maybe_from_proof_with_metadata<'a, I: Into, O: Into>( + request: I, + response: O, + platform_version: &PlatformVersion, + provider: &'a dyn ContextProvider, + ) -> Result<(Option, ResponseMetadata), Error> + where + Self: Sized + 'a, + { + let request: Self::Request = request.into(); + let response: Self::Response = response.into(); + + // Decode request to get drive query + let drive_query = VotePollsByEndDateDriveQuery::try_from_request(request)?; + + // Parse response to read proof and metadata + let proof = response.proof().or(Err(Error::NoProofInResult))?; + let mtd = response.metadata().or(Err(Error::EmptyResponseMetadata))?; + + let (root_hash, vote_polls) = drive_query + .verify_vote_polls_by_end_date_proof(&proof.grovedb_proof, platform_version) + .map_err(|e| Error::DriveError { + error: e.to_string(), + })?; + + verify_tenderdash_proof(proof, mtd, &root_hash, provider)?; + + let response = VotePollsGroupedByTimestamp::from_iter(vote_polls); + + Ok((response.into_option(), mtd.clone())) + } +} + +impl FromProof for PrefundedSpecializedBalance { + type Request = platform::GetPrefundedSpecializedBalanceRequest; + type Response = platform::GetPrefundedSpecializedBalanceResponse; + + fn maybe_from_proof_with_metadata<'a, I: Into, O: Into>( + request: I, + response: O, + platform_version: &PlatformVersion, + provider: &'a dyn ContextProvider, + ) -> Result<(Option, ResponseMetadata), Error> + where + Self: Sized + 'a, + { + let request: Self::Request = request.into(); + let response: Self::Response = response.into(); + + let balance_id = match request.version.ok_or(Error::EmptyVersion)? { + get_prefunded_specialized_balance_request::Version::V0(v0) => { + Identifier::from_vec(v0.id).map_err(|e| Error::RequestError { + error: e.to_string(), + })? + } + }; + + let proof = response.proof().or(Err(Error::NoProofInResult))?; + + let (root_hash, balance) = Drive::verify_specialized_balance( + &proof.grovedb_proof, + balance_id.into_buffer(), + false, + platform_version, + )?; + + let mtd = response.metadata().or(Err(Error::EmptyResponseMetadata))?; + + verify_tenderdash_proof(proof, mtd, &root_hash, provider)?; + + Ok((balance.map(|v| v.into()), mtd.clone())) + } +} + +impl FromProof for Vote { + type Request = platform::GetContestedResourceIdentityVotesRequest; + type Response = platform::GetContestedResourceIdentityVotesResponse; + + fn maybe_from_proof_with_metadata<'a, I: Into, O: Into>( + request: I, + response: O, + platform_version: &PlatformVersion, + provider: &'a dyn ContextProvider, + ) -> Result<(Option, ResponseMetadata), Error> + where + Self: Sized + 'a, + { + let request = request.into(); + let id_in_request = match request.version.as_ref().ok_or(Error::EmptyVersion)? { + get_contested_resource_identity_votes_request::Version::V0(v0) => { + Identifier::from_bytes(&v0.identity_id).map_err(|e| Error::RequestError { + error: e.to_string(), + })? + } + }; + + let (mut maybe_votes, mtd) = ResourceVotesByIdentity::maybe_from_proof_with_metadata( + request, + response, + platform_version, + provider, + )?; + + let (id, vote) = match maybe_votes.as_mut() { + Some(v) if v.len() > 1 => { + return Err(Error::ResponseDecodeError { + error: format!("expected 1 vote, got {}", v.len()), + }) + } + Some(v) if v.is_empty() => return Ok((None, mtd)), + Some(v) => v.pop_first().expect("is_empty() must detect empty map"), + None => return Ok((None, mtd)), + }; + + if id != id_in_request { + return Err(Error::ResponseDecodeError { + error: format!( + "expected vote for identity {}, got vote for identity {}", + id_in_request, id + ), + }); + } + + Ok((vote.map(Vote::ResourceVote), mtd)) + } +} + /// Convert u32, if 0 return None, otherwise return Some(u16). /// Errors when value is out of range. fn u32_to_u16_opt(i: u32) -> Result, Error> { let i: Option = if i != 0 { - let i: u16 = - i.try_into() - .map_err(|e: std::num::TryFromIntError| Error::RequestDecodeError { - error: format!("value {} out of range: {}", i, e), - })?; + let i: u16 = i + .try_into() + .map_err(|e: std::num::TryFromIntError| Error::RequestError { + error: format!("value {} out of range: {}", i, e), + })?; Some(i) } else { None @@ -1282,6 +1584,19 @@ fn u32_to_u16_opt(i: u32) -> Result, Error> { Ok(i) } +/// Returns function that uses [ContextProvider] to provide a [DataContract] to Drive proof verification functions +fn known_contracts_provider_fn<'a, P: ContextProvider + ?Sized + 'a>( + provider: &'a P, +) -> Box { + let f = |id: &Identifier| -> Result>, drive::error::Error> { + provider.get_data_contract(id).map_err(|e| { + drive::error::Error::Proof(ProofError::ErrorRetrievingContract(e.to_string())) + }) + }; + + Box::new(f) +} + /// Determine number of non-None elements pub trait Length { /// Return number of non-None elements in the data structure @@ -1311,7 +1626,7 @@ impl Length for Vec<(K, Option)> { impl Length for BTreeMap> { fn count_some(&self) -> usize { - self.iter().filter(|(_, v)| v.is_some()).count() + self.values().filter(|v| v.is_some()).count() } } @@ -1337,10 +1652,38 @@ macro_rules! define_length { define_length!(DataContract); define_length!(DataContractHistory, |d: &DataContractHistory| d.len()); -// define_length!(DataContracts, |d: &DataContracts| d.count_some()); define_length!(Document); -// define_length!(Documents, |x: &Documents| x.len()); define_length!(Identity); define_length!(IdentityBalance); define_length!(IdentityBalanceAndRevision); -// define_length!(IdentityPublicKeys, |d: &IdentityPublicKeys| d.count_some()); +define_length!(IdentitiesContractKeys, |x: &IdentitiesContractKeys| x + .values() + .map(|v| v.count_some()) + .sum()); +define_length!(ContestedResources, |x: &ContestedResources| x.0.len()); +define_length!(Contenders, |x: &Contenders| x.contenders.len()); +define_length!(Voters, |x: &Voters| x.0.len()); +define_length!( + VotePollsGroupedByTimestamp, + |x: &VotePollsGroupedByTimestamp| x.0.values().map(|v| v.len()).sum() +); +trait IntoOption +where + Self: Sized, +{ + /// For zero-length data structures, return None, otherwise return Some(self) + fn into_option(self) -> Option; +} + +impl IntoOption for L { + fn into_option(self) -> Option + where + Self: Sized, + { + if self.count_some() == 0 { + None + } else { + Some(self) + } + } +} diff --git a/packages/rs-drive-proof-verifier/src/provider.rs b/packages/rs-drive-proof-verifier/src/provider.rs index d5e8b45b729..305154207e7 100644 --- a/packages/rs-drive-proof-verifier/src/provider.rs +++ b/packages/rs-drive-proof-verifier/src/provider.rs @@ -1,8 +1,8 @@ -use std::{ops::Deref, sync::Arc}; - use crate::error::ContextProviderError; use dpp::prelude::{DataContract, Identifier}; +#[cfg(feature = "mocks")] use hex::ToHex; +use std::{io::ErrorKind, ops::Deref, sync::Arc}; /// Interface between the Sdk and state of the application. /// @@ -168,18 +168,44 @@ impl ContextProvider for MockContextProvider { } }; - let key: Vec = serde_json::from_reader(f).expect("cannot parse quorum key"); + let data = std::io::read_to_string(f).expect("cannot read quorum key file"); + let key: Vec = hex::decode(data).expect("cannot parse quorum key"); Ok(key.try_into().expect("quorum key format mismatch")) } fn get_data_contract( &self, - _data_contract_id: &Identifier, + data_contract_id: &Identifier, ) -> Result>, ContextProviderError> { - todo!("not implemented yet"); + let path = match &self.quorum_keys_dir { + Some(p) => p, + None => return Err(ContextProviderError::Config("dump dir not set".to_string())), + }; + + let file = path.join(format!( + "data_contract-{}.json", + data_contract_id.encode_hex::() + )); + + let f = match std::fs::File::open(&file) { + Ok(f) => f, + Err(e) if e.kind() == ErrorKind::NotFound => return Ok(None), + Err(e) => { + return Err(ContextProviderError::DataContractFailure(format!( + "cannot load data contract file {}: {}", + file.to_string_lossy(), + e + ))) + } + }; + + let dc: DataContract = serde_json::from_reader(f).expect("cannot parse data contract"); + + Ok(Some(Arc::new(dc))) } } + // the trait `std::convert::AsRef<(dyn drive_proof_verifier::ContextProvider + 'static)>` // is not implemented for `std::sync::Arc>` impl<'a, T: ContextProvider + 'a> AsRef for Arc { diff --git a/packages/rs-drive-proof-verifier/src/types.rs b/packages/rs-drive-proof-verifier/src/types.rs index f1ea8dbc4c7..b1a89489dba 100644 --- a/packages/rs-drive-proof-verifier/src/types.rs +++ b/packages/rs-drive-proof-verifier/src/types.rs @@ -5,13 +5,17 @@ //! In this case, the [FromProof](crate::FromProof) trait is implemented for dedicated object type //! defined in this module. -use std::collections::BTreeMap; - -use dpp::prelude::IdentityNonce; +use dpp::data_contract::document_type::DocumentType; +use dpp::fee::Credits; +use dpp::platform_value::Value; +use dpp::prelude::{IdentityNonce, TimestampMillis}; +use dpp::version::PlatformVersion; pub use dpp::version::ProtocolVersionVoteCount; -use dpp::voting::contender_structs::Contender; +use dpp::voting::contender_structs::{Contender, ContenderWithSerializedDocument}; use dpp::voting::vote_choices::resource_vote_choice::ResourceVoteChoice; use dpp::voting::vote_polls::contested_document_resource_vote_poll::ContestedDocumentResourceVotePoll; +use dpp::voting::vote_polls::VotePoll; +use dpp::voting::votes::resource_vote::ResourceVote; use dpp::{ block::{epoch::EpochIndex, extended_epoch_info::ExtendedEpochInfo}, dashcore::ProTxHash, @@ -21,6 +25,14 @@ use dpp::{ util::deserializer::ProtocolVersion, }; use drive::grovedb::Element; +use std::collections::{BTreeMap, BTreeSet}; +#[cfg(feature = "mocks")] +use { + bincode::{Decode, Encode}, + dpp::{dashcore::hashes::Hash, version as platform_version, ProtocolError}, + platform_serialization::{PlatformVersionEncode, PlatformVersionedDecode}, + platform_serialization_derive::{PlatformDeserialize, PlatformSerialize}, +}; /// A data structure that holds a set of objects of a generic type `O`, indexed by a key of type `K`. /// @@ -52,7 +64,88 @@ pub type DataContracts = RetrievedObjects; /// /// Mapping between the contenders identity IDs and their info. /// If a contender is not found, it is represented as `None`. -pub type Contenders = RetrievedObjects; +#[derive(Default)] +#[cfg_attr( + feature = "mocks", + derive(Encode, Decode, PlatformSerialize, PlatformDeserialize,), + platform_serialize(unversioned) +)] +pub struct Contenders { + /// Contenders indexed by their identity IDs. + pub contenders: BTreeMap, + /// Tally of abstain votes. + pub abstain_vote_tally: Option, + /// Tally of lock votes. + pub lock_vote_tally: Option, +} + +impl Contenders { + /// Return a map of deserialized [Contender] objects indexed by their identity IDs. + pub fn to_contenders( + &self, + document_type: &DocumentType, + platform_version: &PlatformVersion, + ) -> Result, crate::Error> { + self.contenders + .iter() + .map(|(id, v)| { + let contender = v.try_to_contender(document_type.as_ref(), platform_version)?; + Ok((*id, contender)) + }) + .collect::, dpp::ProtocolError>>() + .map_err(Into::into) + } +} + +/// Create Contenders from an iterator of tuples. +/// +/// This trait is a requirement of the [FetchMany](crate::FetchMany) trait. +impl FromIterator<(Identifier, Option)> for Contenders { + fn from_iter)>>( + iter: T, + ) -> Self { + Self { + contenders: BTreeMap::from_iter( + iter.into_iter().filter_map(|(k, v)| v.map(|v| (k, v))), + ), + abstain_vote_tally: None, + lock_vote_tally: None, + } + } +} + +/// Identifier of a single voter +#[derive(Debug, PartialOrd, Ord, PartialEq, Eq, Hash, Clone, derive_more::From, Default)] +#[cfg_attr( + feature = "mocks", + derive(Encode, Decode, PlatformSerialize, PlatformDeserialize,), + platform_serialize(unversioned) +)] +pub struct Voter(pub Identifier); + +/// Multiple voters. +#[derive(Debug, Clone, derive_more::From, Default)] +#[cfg_attr( + feature = "mocks", + derive(Encode, Decode, PlatformSerialize, PlatformDeserialize,), + platform_serialize(unversioned) +)] +pub struct Voters(pub BTreeSet); + +/// Create [Voters] from an iterator of tuples. +/// +/// This trait is a requirement of the [FetchMany](crate::FetchMany) trait. +impl FromIterator<(A, Option)> for Voters { + fn from_iter)>>(iter: T) -> Self { + Self::from_iter(iter.into_iter().filter_map(|(_, v)| v)) + } +} + +impl FromIterator for Voters { + fn from_iter>(iter: T) -> Self { + iter.into_iter().collect::>().into() + } +} /// Multiple grovedb elements. /// @@ -65,8 +158,159 @@ pub type IdentityBalance = u64; /// Identity balance and revision of the identity. pub type IdentityBalanceAndRevision = (u64, Revision); +/// Contested resource values. +#[derive(Debug, derive_more::From, Clone)] +pub enum ContestedResource { + /// Generic [Value] + Value(Value), +} + +#[cfg(feature = "mocks")] +impl PlatformVersionEncode for ContestedResource { + fn platform_encode( + &self, + encoder: &mut E, + _platform_version: &platform_version::PlatformVersion, + ) -> Result<(), bincode::error::EncodeError> { + match self { + ContestedResource::Value(document) => document.encode(encoder), + } + } +} + +#[cfg(feature = "mocks")] +impl PlatformVersionedDecode for ContestedResource { + fn platform_versioned_decode( + decoder: &mut D, + _platform_version: &platform_version::PlatformVersion, + ) -> Result { + Ok(ContestedResource::Value(Value::decode(decoder)?)) + } +} + +/// Contested resources +#[derive(derive_more::From, Clone, Debug, Default)] +pub struct ContestedResources(pub Vec); + +#[cfg(feature = "mocks")] +impl PlatformVersionEncode for ContestedResources { + fn platform_encode( + &self, + encoder: &mut E, + platform_version: &platform_version::PlatformVersion, + ) -> Result<(), bincode::error::EncodeError> { + self.0.platform_encode(encoder, platform_version) + } +} + +#[cfg(feature = "mocks")] +impl PlatformVersionedDecode for ContestedResources { + fn platform_versioned_decode( + decoder: &mut D, + platform_version: &platform_version::PlatformVersion, + ) -> Result { + let inner = >::platform_versioned_decode(decoder, platform_version)?; + Ok(Self(inner)) + } +} + +/// Create [ContestedResources] from an iterator of tuples. +/// +/// This trait is a requirement of the [FetchMany](crate::FetchMany) trait. +impl FromIterator<(A, Option)> for ContestedResources { + fn from_iter)>>(iter: T) -> Self { + Self::from_iter(iter.into_iter().filter_map(|(_k, v)| v)) + } +} + +impl FromIterator for ContestedResources { + fn from_iter>(iter: T) -> Self { + Self(iter.into_iter().collect()) + } +} + /// A contested vote for querying -pub type ContestedVote = (ContestedDocumentResourceVotePoll, ResourceVoteChoice); +#[derive(Debug, derive_more::From, Clone)] +#[cfg_attr( + feature = "mocks", + derive(PlatformSerialize, PlatformDeserialize, Encode, Decode), + platform_serialize(unversioned) +)] +pub struct ContestedVote(ContestedDocumentResourceVotePoll, ResourceVoteChoice); + +/// Votes casted by some identity. +pub type ResourceVotesByIdentity = RetrievedObjects; + +/// Prefunded specialized balance. +#[derive(Debug, derive_more::From, Copy, Clone)] +#[cfg_attr( + feature = "mocks", + derive(Encode, Decode, PlatformSerialize, PlatformDeserialize), + platform_serialize(unversioned) +)] +pub struct PrefundedSpecializedBalance(Credits); +impl PrefundedSpecializedBalance { + /// Get the balance. + pub fn to_credits(&self) -> Credits { + Credits::from(self) + } +} + +impl From<&PrefundedSpecializedBalance> for Credits { + fn from(value: &PrefundedSpecializedBalance) -> Self { + value.0 + } +} + +/// Contested document resource vote polls grouped by timestamp. +#[derive(Clone, Debug, Default, derive_more::From)] +#[cfg_attr( + feature = "mocks", + derive(Encode, Decode, PlatformSerialize, PlatformDeserialize), + platform_serialize(unversioned) +)] +pub struct VotePollsGroupedByTimestamp(pub BTreeMap>); + +/// Insert items into the map, appending them to the existing values for the same key. +impl FromIterator<(u64, Vec)> for VotePollsGroupedByTimestamp { + fn from_iter)>>(iter: T) -> Self { + let mut map = BTreeMap::new(); + + for (timestamp, vote_poll) in iter { + let entry = map.entry(timestamp).or_insert_with(Vec::new); + entry.extend(vote_poll); + } + + Self(map) + } +} + +/// Insert items into the map, grouping them by timestamp. +impl FromIterator<(u64, VotePoll)> for VotePollsGroupedByTimestamp { + fn from_iter>(iter: T) -> Self { + Self::from_iter(iter.into_iter().map(|(k, v)| (k, vec![v]))) + } +} + +/// Create [VotePollsGroupedByTimestamp] from an iterator of tuples. +/// +/// If multiple vote polls are found for the same timestamp, they are appended to the same vector. +/// +/// This trait is a requirement of the [FetchMany](crate::FetchMany) trait. +impl FromIterator<(u64, Option)> for VotePollsGroupedByTimestamp { + fn from_iter)>>(iter: T) -> Self { + Self::from_iter(iter.into_iter().filter_map(|(k, v)| v.map(|v| (k, v)))) + } +} + +impl IntoIterator for VotePollsGroupedByTimestamp { + type Item = (u64, Vec); + type IntoIter = std::collections::btree_map::IntoIter>; + + fn into_iter(self) -> Self::IntoIter { + self.0.into_iter() + } +} /// An identity nonce #[derive(Debug)] @@ -99,8 +343,8 @@ pub type ExtendedEpochInfos = RetrievedObjects; pub type ProtocolVersionUpgrades = RetrievedObjects; /// Vote of a masternode for a protocol version. -#[cfg_attr(feature = "mocks", derive(serde::Serialize, serde::Deserialize))] #[derive(Debug)] +#[cfg_attr(feature = "mocks", derive(serde::Serialize, serde::Deserialize))] pub struct MasternodeProtocolVote { /// ProTxHash of the masternode pub pro_tx_hash: ProTxHash, @@ -108,6 +352,37 @@ pub struct MasternodeProtocolVote { pub voted_version: ProtocolVersion, } +#[cfg(feature = "mocks")] +impl PlatformVersionEncode for MasternodeProtocolVote { + fn platform_encode( + &self, + encoder: &mut E, + platform_version: &platform_version::PlatformVersion, + ) -> Result<(), bincode::error::EncodeError> { + let protx_bytes: [u8; 32] = self.pro_tx_hash.to_raw_hash().to_byte_array(); + protx_bytes.platform_encode(encoder, platform_version)?; + + self.voted_version + .platform_encode(encoder, platform_version) + } +} + +#[cfg(feature = "mocks")] +impl PlatformVersionedDecode for MasternodeProtocolVote { + fn platform_versioned_decode( + decoder: &mut D, + platform_version: &PlatformVersion, + ) -> Result { + let pro_tx_hash_bytes = <[u8; 32]>::platform_versioned_decode(decoder, platform_version)?; + let pro_tx_hash = ProTxHash::from_byte_array(pro_tx_hash_bytes); + let voted_version = ProtocolVersion::platform_versioned_decode(decoder, platform_version)?; + Ok(Self { + pro_tx_hash, + voted_version, + }) + } +} + /// Information about protocol version voted by each node. /// /// Information about protocol version voted by each node, returned by [ProtocolVersion::fetch_many()]. diff --git a/packages/rs-drive/Cargo.toml b/packages/rs-drive/Cargo.toml index 6614151e6f5..38f913a1ce7 100644 --- a/packages/rs-drive/Cargo.toml +++ b/packages/rs-drive/Cargo.toml @@ -26,10 +26,12 @@ indexmap = { version = "2.0.2" } sqlparser = { version = "0.38.0" } # used for int maps and needed in the verifier nohash-hasher = { version = "0.2.0" } -dpp = { path = "../rs-dpp", features = ["state-transitions"], default-features = false, optional = true } +dpp = { path = "../rs-dpp", features = [ + "state-transitions", +], default-features = false, optional = true } thiserror = { version = "1.0.59" } tracing = { version = "0.1.37", default-features = false, features = [] } -derive_more = { version = "0.99.17"} +derive_more = { version = "0.99.17" } hex = { version = "0.4.3" } # optional dependencies @@ -38,7 +40,10 @@ ciborium = { git = "https://github.com/qrayven/ciborium", branch = "feat-ser-nul arc-swap = { version = "1.7.0", optional = true } serde = { version = "1.0.197", features = ["derive"], optional = true } rand = { version = "0.8.4", features = ["small_rng"], optional = true } -moka = { version = "0.11.1", features = ["future", "futures-util"], optional = true } +moka = { version = "0.11.1", features = [ + "future", + "futures-util", +], optional = true } bs58 = { version = "0.5.0", optional = true } base64 = { version = "0.22.1", optional = true } tempfile = { version = "3", optional = true } @@ -77,7 +82,13 @@ harness = false [features] default = ["full", "verify", "fixtures-and-mocks", "cbor_query"] fee-distribution = ["dpp/fee-distribution"] -fixtures-and-mocks = ["full", "dpp/fixtures-and-mocks", "verify", "dpp/data-contract-json-conversion", "dpp/random-public-keys"] +fixtures-and-mocks = [ + "full", + "dpp/fixtures-and-mocks", + "verify", + "dpp/data-contract-json-conversion", + "dpp/random-public-keys", +] server = [ "serde", "parking_lot", @@ -92,19 +103,11 @@ server = [ "grovedb-storage", "grovedb-costs", "itertools", - "rand", #todo: this should be removed eventually + "rand", #todo: this should be removed eventually "enum-map", "intmap", ] -full = [ - "server", - "ciborium", - "serde", - "bs58", - "tempfile", - "base64", - "chrono", -] +full = ["server", "ciborium", "serde", "bs58", "tempfile", "base64", "chrono"] cbor_query = ["ciborium", "dpp/platform-value-cbor", "dpp/cbor"] grovedb_operations_logging = [] verify = ["grovedb/verify", "grovedb-costs", "dpp/state-transitions"] diff --git a/packages/rs-drive/src/drive/verify/mod.rs b/packages/rs-drive/src/drive/verify/mod.rs index 605cdb9fa65..b4c627718e2 100644 --- a/packages/rs-drive/src/drive/verify/mod.rs +++ b/packages/rs-drive/src/drive/verify/mod.rs @@ -12,7 +12,7 @@ pub mod system; /// Verifies that a state transition contents exist in the proof pub mod state_transition; -mod voting; +pub mod voting; /// Represents the root hash of the grovedb tree pub type RootHash = [u8; 32]; diff --git a/packages/rs-drive/src/drive/verify/state_transition/verify_state_transition_was_executed_with_proof/mod.rs b/packages/rs-drive/src/drive/verify/state_transition/verify_state_transition_was_executed_with_proof/mod.rs index 24906c4ad5e..9dc0fa79a9d 100644 --- a/packages/rs-drive/src/drive/verify/state_transition/verify_state_transition_was_executed_with_proof/mod.rs +++ b/packages/rs-drive/src/drive/verify/state_transition/verify_state_transition_was_executed_with_proof/mod.rs @@ -4,13 +4,11 @@ use crate::drive::verify::RootHash; use crate::drive::Drive; use crate::error::drive::DriveError; use crate::error::Error; +use crate::query::ContractLookupFn; use dpp::block::block_info::BlockInfo; -use dpp::data_contract::DataContract; -use dpp::identifier::Identifier; use dpp::state_transition::proof_result::StateTransitionProofResult; use dpp::state_transition::StateTransition; use dpp::version::PlatformVersion; -use std::sync::Arc; mod v0; @@ -46,7 +44,7 @@ impl Drive { state_transition: &StateTransition, block_info: &BlockInfo, proof: &[u8], - known_contracts_provider_fn: &impl Fn(&Identifier) -> Result>, Error>, + known_contracts_provider_fn: &ContractLookupFn, platform_version: &PlatformVersion, ) -> Result<(RootHash, StateTransitionProofResult), Error> { match platform_version diff --git a/packages/rs-drive/src/drive/verify/state_transition/verify_state_transition_was_executed_with_proof/v0/mod.rs b/packages/rs-drive/src/drive/verify/state_transition/verify_state_transition_was_executed_with_proof/v0/mod.rs index 4207abff859..2e1a04adfc3 100644 --- a/packages/rs-drive/src/drive/verify/state_transition/verify_state_transition_was_executed_with_proof/v0/mod.rs +++ b/packages/rs-drive/src/drive/verify/state_transition/verify_state_transition_was_executed_with_proof/v0/mod.rs @@ -1,5 +1,4 @@ -use std::collections::{BTreeMap}; -use std::sync::Arc; +use std::collections::BTreeMap; use dpp::block::block_info::BlockInfo; use dpp::data_contract::accessors::v0::DataContractV0Getters; use dpp::data_contract::document_type::accessors::DocumentTypeV0Getters; @@ -10,7 +9,6 @@ use dpp::document::property_names::PRICE; use dpp::fee::Credits; use dpp::identity::PartialIdentity; use dpp::platform_value::btreemap_extensions::BTreeValueMapHelper; -use dpp::prelude::{DataContract, Identifier}; use dpp::state_transition::data_contract_create_transition::accessors::DataContractCreateTransitionAccessorsV0; use dpp::state_transition::data_contract_update_transition::accessors::DataContractUpdateTransitionAccessorsV0; use dpp::state_transition::documents_batch_transition::accessors::DocumentsBatchTransitionAccessorsV0; @@ -43,7 +41,7 @@ use crate::drive::identity::key::fetch::IdentityKeysRequest; use crate::drive::verify::RootHash; use crate::error::Error; use crate::error::proof::ProofError; -use crate::query::{SingleDocumentDriveQuery, SingleDocumentDriveQueryContestedStatus}; +use crate::query::{ContractLookupFn, SingleDocumentDriveQuery, SingleDocumentDriveQueryContestedStatus}; impl Drive { #[inline(always)] @@ -51,7 +49,7 @@ impl Drive { state_transition: &StateTransition, block_info: &BlockInfo, proof: &[u8], - known_contracts_provider_fn: &impl Fn(&Identifier) -> Result>, Error>, + known_contracts_provider_fn: &ContractLookupFn, platform_version: &PlatformVersion, ) -> Result<(RootHash, StateTransitionProofResult), Error> { match state_transition { diff --git a/packages/rs-drive/src/drive/verify/voting/mod.rs b/packages/rs-drive/src/drive/verify/voting/mod.rs index 540c8999f5a..b3839b625cd 100644 --- a/packages/rs-drive/src/drive/verify/voting/mod.rs +++ b/packages/rs-drive/src/drive/verify/voting/mod.rs @@ -1,3 +1,5 @@ +//! Voting verification + mod verify_contests_proof; mod verify_identity_votes_given_proof; mod verify_masternode_vote; diff --git a/packages/rs-drive/src/drive/verify/voting/verify_identity_votes_given_proof/mod.rs b/packages/rs-drive/src/drive/verify/voting/verify_identity_votes_given_proof/mod.rs index c4611d9d414..e97a7069f1e 100644 --- a/packages/rs-drive/src/drive/verify/voting/verify_identity_votes_given_proof/mod.rs +++ b/packages/rs-drive/src/drive/verify/voting/verify_identity_votes_given_proof/mod.rs @@ -2,8 +2,8 @@ mod v0; use crate::drive::verify::RootHash; use crate::error::drive::DriveError; +use crate::query::ContractLookupFn; use dpp::identifier::Identifier; -use dpp::prelude::DataContract; use std::collections::BTreeMap; use crate::error::Error; @@ -20,7 +20,7 @@ impl ContestedResourceVotesGivenByIdentityQuery { /// # Arguments /// /// * `proof` - A byte slice representing the serialized proof to be verified. - /// * `data_contract` - A reference to the data contract relevant to the proof. + /// * `contract_lookup_fn` - Function that retrieves data contract based on its identifier. /// * `platform_version` - A reference to the platform version to be used for verification. /// /// # Returns @@ -37,7 +37,7 @@ impl ContestedResourceVotesGivenByIdentityQuery { pub fn verify_identity_votes_given_proof( &self, proof: &[u8], - data_contract: &DataContract, + contract_lookup_fn: &ContractLookupFn, platform_version: &PlatformVersion, ) -> Result<(RootHash, BTreeMap), Error> { match platform_version @@ -47,7 +47,11 @@ impl ContestedResourceVotesGivenByIdentityQuery { .voting .verify_identity_votes_given_proof { - 0 => self.verify_identity_votes_given_proof_v0(proof, data_contract, platform_version), + 0 => self.verify_identity_votes_given_proof_v0( + proof, + contract_lookup_fn, + platform_version, + ), version => Err(Error::Drive(DriveError::UnknownVersionMismatch { method: "verify_identity_votes_given_proof".to_string(), known_versions: vec![0], diff --git a/packages/rs-drive/src/drive/verify/voting/verify_identity_votes_given_proof/v0/mod.rs b/packages/rs-drive/src/drive/verify/voting/verify_identity_votes_given_proof/v0/mod.rs index 7850d5fda86..b2be4be4766 100644 --- a/packages/rs-drive/src/drive/verify/voting/verify_identity_votes_given_proof/v0/mod.rs +++ b/packages/rs-drive/src/drive/verify/voting/verify_identity_votes_given_proof/v0/mod.rs @@ -1,14 +1,14 @@ use crate::drive::verify::RootHash; +use crate::drive::votes::storage_form::contested_document_resource_reference_storage_form::ContestedDocumentResourceVoteReferenceStorageForm; use crate::drive::votes::storage_form::contested_document_resource_storage_form::ContestedDocumentResourceVoteStorageForm; use crate::drive::votes::tree_path_storage_form::TreePathStorageForm; use crate::error::drive::DriveError; use crate::error::Error; use crate::query::contested_resource_votes_given_by_identity_query::ContestedResourceVotesGivenByIdentityQuery; +use crate::query::ContractLookupFn; use dpp::bincode; -use dpp::data_contract::DataContract; use dpp::identifier::Identifier; use dpp::voting::votes::resource_vote::ResourceVote; -use grovedb::reference_path::ReferencePathType; use grovedb::GroveDb; use platform_version::version::PlatformVersion; use std::collections::BTreeMap; @@ -18,7 +18,7 @@ impl ContestedResourceVotesGivenByIdentityQuery { pub(super) fn verify_identity_votes_given_proof_v0( &self, proof: &[u8], - data_contract: &DataContract, + contract_lookup_fn: &ContractLookupFn, platform_version: &PlatformVersion, ) -> Result<(RootHash, BTreeMap), Error> { let path_query = self.construct_path_query()?; @@ -32,7 +32,7 @@ impl ContestedResourceVotesGivenByIdentityQuery { let bincode_config = bincode::config::standard() .with_big_endian() .with_no_limit(); - let reference: ReferencePathType = + let reference_storage_form: ContestedDocumentResourceVoteReferenceStorageForm = bincode::decode_from_slice(&serialized_reference, bincode_config) .map_err(|e| { Error::Drive(DriveError::CorruptedSerialization(format!( @@ -42,13 +42,20 @@ impl ContestedResourceVotesGivenByIdentityQuery { ))) })? .0; - let absolute_path = - reference.absolute_path(path.as_slice(), Some(key.as_slice()))?; + let absolute_path = reference_storage_form + .reference_path_type + .absolute_path(path.as_slice(), Some(key.as_slice()))?; let vote_id = Identifier::from_vec(key)?; let vote_storage_form = ContestedDocumentResourceVoteStorageForm::try_from_tree_path(absolute_path)?; + let data_contract = contract_lookup_fn(&vote_storage_form.contract_id)?.ok_or( + Error::Drive(DriveError::DataContractNotFound(format!( + "data contract with id {} not found when verifying vote {}", + vote_storage_form.contract_id, vote_id + ))), + )?; let resource_vote = - vote_storage_form.resolve_with_contract(data_contract, platform_version)?; + vote_storage_form.resolve_with_contract(&data_contract, platform_version)?; Ok((vote_id, resource_vote)) }) .collect::, Error>>()?; diff --git a/packages/rs-drive/src/drive/verify/voting/verify_masternode_vote/mod.rs b/packages/rs-drive/src/drive/verify/voting/verify_masternode_vote/mod.rs index dbbb7b89ad3..1268310ddf2 100644 --- a/packages/rs-drive/src/drive/verify/voting/verify_masternode_vote/mod.rs +++ b/packages/rs-drive/src/drive/verify/voting/verify_masternode_vote/mod.rs @@ -1,13 +1,11 @@ +//! Masternode vote proof verification + mod v0; +use crate::drive::verify::RootHash; use crate::drive::Drive; - use crate::error::drive::DriveError; - use crate::error::Error; - -use crate::drive::verify::RootHash; - use dpp::version::PlatformVersion; use dpp::voting::votes::Vote; diff --git a/packages/rs-drive/src/drive/verify/voting/verify_vote_poll_vote_state_proof/mod.rs b/packages/rs-drive/src/drive/verify/voting/verify_vote_poll_vote_state_proof/mod.rs index c65041dbe5d..7fd0471a597 100644 --- a/packages/rs-drive/src/drive/verify/voting/verify_vote_poll_vote_state_proof/mod.rs +++ b/packages/rs-drive/src/drive/verify/voting/verify_vote_poll_vote_state_proof/mod.rs @@ -1,3 +1,5 @@ +//! Verification of the vote poll proofs + mod v0; use crate::drive::verify::RootHash; diff --git a/packages/rs-drive/src/drive/votes/resolved/vote_polls/contested_document_resource_vote_poll/resolve.rs b/packages/rs-drive/src/drive/votes/resolved/vote_polls/contested_document_resource_vote_poll/resolve.rs index 6c6a3b72901..e0f770cfd31 100644 --- a/packages/rs-drive/src/drive/votes/resolved/vote_polls/contested_document_resource_vote_poll/resolve.rs +++ b/packages/rs-drive/src/drive/votes/resolved/vote_polls/contested_document_resource_vote_poll/resolve.rs @@ -1,19 +1,16 @@ #[cfg(feature = "server")] use crate::drive::contract::DataContractFetchInfo; -#[cfg(feature = "server")] use crate::drive::object_size_info::DataContractOwnedResolvedInfo; #[cfg(any(feature = "server", feature = "verify"))] use crate::drive::object_size_info::DataContractResolvedInfo; -#[cfg(feature = "server")] use crate::drive::votes::resolved::vote_polls::contested_document_resource_vote_poll::ContestedDocumentResourceVotePollWithContractInfo; #[cfg(any(feature = "server", feature = "verify"))] use crate::drive::votes::resolved::vote_polls::contested_document_resource_vote_poll::ContestedDocumentResourceVotePollWithContractInfoAllowBorrowed; use crate::drive::Drive; use crate::error::contract::DataContractError; use crate::error::Error; +use crate::query::ContractLookupFn; use dpp::data_contract::accessors::v0::DataContractV0Getters; -#[cfg(feature = "verify")] -use dpp::identifier::Identifier; #[cfg(any(feature = "server", feature = "verify"))] use dpp::prelude::DataContract; use dpp::voting::vote_polls::contested_document_resource_vote_poll::ContestedDocumentResourceVotePoll; @@ -79,7 +76,7 @@ pub trait ContestedDocumentResourceVotePollResolver { /// Resolves into a struct, the contract itself will be held with Arc fn resolve_with_known_contracts_provider<'a>( &self, - known_contracts_provider_fn: &impl Fn(&Identifier) -> Result>, Error>, + known_contracts_provider_fn: &ContractLookupFn, ) -> Result, Error>; #[cfg(any(feature = "verify", feature = "server"))] @@ -188,7 +185,7 @@ impl ContestedDocumentResourceVotePollResolver for ContestedDocumentResourceVote #[cfg(feature = "verify")] fn resolve_with_known_contracts_provider<'a>( &self, - known_contracts_provider_fn: &impl Fn(&Identifier) -> Result>, Error>, + known_contracts_provider_fn: &ContractLookupFn, ) -> Result, Error> { let ContestedDocumentResourceVotePoll { contract_id, diff --git a/packages/rs-drive/src/error/drive.rs b/packages/rs-drive/src/error/drive.rs index 361f28e5aea..74bd830129a 100644 --- a/packages/rs-drive/src/error/drive.rs +++ b/packages/rs-drive/src/error/drive.rs @@ -184,4 +184,8 @@ pub enum DriveError { /// Error #[error("prefunded specialized balance does not have enough credits: we have {0}, we want to deduct {1}")] PrefundedSpecializedBalanceNotEnough(Credits, Credits), + + /// Data Contract not found + #[error("data contract not found: {0}")] + DataContractNotFound(String), } diff --git a/packages/rs-drive/src/query/mod.rs b/packages/rs-drive/src/query/mod.rs index 7da9335e9a9..c611be410df 100644 --- a/packages/rs-drive/src/query/mod.rs +++ b/packages/rs-drive/src/query/mod.rs @@ -1,3 +1,5 @@ +use std::sync::Arc; + #[cfg(any(feature = "server", feature = "verify"))] pub use { conditions::{WhereClause, WhereOperator}, @@ -94,6 +96,39 @@ pub mod vote_polls_by_end_date_query; /// Vote polls by document type query pub mod vote_polls_by_document_type_query; +/// Function type for looking up a contract by identifier +/// +/// This function is used to look up a contract by its identifier. +/// It should be implemented by the caller in order to provide data +/// contract required for operations like proof verification. +#[cfg(any(feature = "server", feature = "verify"))] +pub type ContractLookupFn<'a> = dyn Fn(&dpp::identifier::Identifier) -> Result>, crate::error::Error> + + 'a; + +/// Creates a [ContractLookupFn] function that returns provided data contract when requested. +/// +/// # Arguments +/// +/// * `data_contract` - [Arc](DataContract) to return +/// +/// # Returns +/// +/// [ContractLookupFn] that will return the `data_contract`, or `None` if +/// the requested contract is not the same as the provided one. +#[cfg(any(feature = "server", feature = "verify"))] +pub fn contract_lookup_fn_for_contract<'a>( + data_contract: Arc, +) -> Box> { + let func = move + |id: &dpp::identifier::Identifier| -> Result>, crate::error::Error> { + if data_contract.id().ne(id) { + return Ok(None); + } + Ok(Some(Arc::clone(&data_contract))) + }; + Box::new(func) +} + #[cfg(any(feature = "server", feature = "verify"))] /// A query to get the votes given out by an identity pub mod contested_resource_votes_given_by_identity_query; diff --git a/packages/rs-drive/src/query/vote_poll_contestant_votes_query.rs b/packages/rs-drive/src/query/vote_poll_contestant_votes_query.rs index 86875c59ab4..ba210a35532 100644 --- a/packages/rs-drive/src/query/vote_poll_contestant_votes_query.rs +++ b/packages/rs-drive/src/query/vote_poll_contestant_votes_query.rs @@ -1,5 +1,6 @@ +use super::ContractLookupFn; use crate::drive::votes::paths::VotePollPaths; -#[cfg(feature = "server")] +#[cfg(any(feature = "server", feature = "verify"))] use crate::drive::votes::resolved::vote_polls::contested_document_resource_vote_poll::resolve::ContestedDocumentResourceVotePollResolver; use crate::drive::votes::resolved::vote_polls::contested_document_resource_vote_poll::ContestedDocumentResourceVotePollWithContractInfoAllowBorrowed; #[cfg(feature = "server")] @@ -87,6 +88,32 @@ impl ContestedDocumentVotePollVotesDriveQuery { }) } + /// Resolves the contested document vote poll drive query. + /// + /// See [ContestedDocumentVotePollVotesDriveQuery::resolve](ContestedDocumentVotePollVotesDriveQuery::resolve) for more information. + #[cfg(feature = "verify")] + pub fn resolve_with_known_contracts_provider<'a>( + &self, + known_contracts_provider: &ContractLookupFn, + ) -> Result, Error> { + let ContestedDocumentVotePollVotesDriveQuery { + vote_poll, + contestant_id, + offset, + limit, + start_at, + order_ascending, + } = self; + Ok(ResolvedContestedDocumentVotePollVotesDriveQuery { + vote_poll: vote_poll.resolve_with_known_contracts_provider(known_contracts_provider)?, + contestant_id: *contestant_id, + offset: *offset, + limit: *limit, + start_at: *start_at, + order_ascending: *order_ascending, + }) + } + #[cfg(feature = "server")] /// Executes a query with proof and returns the items and fee. pub fn execute_with_proof( @@ -235,7 +262,6 @@ impl ContestedDocumentVotePollVotesDriveQuery { } } } - /// Vote Poll Drive Query struct #[derive(Debug, PartialEq, Clone)] pub struct ResolvedContestedDocumentVotePollVotesDriveQuery<'a> { diff --git a/packages/rs-drive/src/query/vote_poll_vote_state_query.rs b/packages/rs-drive/src/query/vote_poll_vote_state_query.rs index 898f295e48f..021c93f6711 100644 --- a/packages/rs-drive/src/query/vote_poll_vote_state_query.rs +++ b/packages/rs-drive/src/query/vote_poll_vote_state_query.rs @@ -224,7 +224,7 @@ impl ContestedDocumentVotePollDriveQuery { /// Resolves with a known contract provider pub fn resolve_with_known_contracts_provider<'a>( &self, - known_contracts_provider_fn: &impl Fn(&Identifier) -> Result>, Error>, + known_contracts_provider_fn: &super::ContractLookupFn, ) -> Result, Error> { let ContestedDocumentVotePollDriveQuery { vote_poll, @@ -587,7 +587,7 @@ impl ContestedDocumentVotePollDriveQuery { )))); } - match identity_bytes.get(0) { + match identity_bytes.first() { Some(key) if key == &RESOURCE_LOCK_VOTE_TREE_KEY_U8 => { locked_vote_tally = Some(sum_tree_value as u32); } diff --git a/packages/rs-drive/src/query/vote_polls_by_document_type_query.rs b/packages/rs-drive/src/query/vote_polls_by_document_type_query.rs index e9aab6d3dbf..8040288a5b1 100644 --- a/packages/rs-drive/src/query/vote_polls_by_document_type_query.rs +++ b/packages/rs-drive/src/query/vote_polls_by_document_type_query.rs @@ -1,3 +1,4 @@ +use super::ContractLookupFn; use crate::drive::object_size_info::DataContractResolvedInfo; use crate::drive::votes::paths::vote_contested_resource_active_polls_contract_document_tree_path_vec; #[cfg(feature = "server")] @@ -29,7 +30,6 @@ use grovedb::query_result_type::QueryResultType; use grovedb::TransactionArg; use grovedb::{PathQuery, SizedQuery}; use platform_version::version::PlatformVersion; -use std::sync::Arc; /// Vote Poll Drive Query struct #[derive(Debug, PartialEq, Clone)] @@ -140,7 +140,7 @@ impl VotePollsByDocumentTypeQuery { /// Resolves with a known contract provider pub fn resolve_with_known_contracts_provider( &self, - known_contracts_provider_fn: &impl Fn(&Identifier) -> Result>, Error>, + known_contracts_provider_fn: &ContractLookupFn, ) -> Result { let VotePollsByDocumentTypeQuery { contract_id, @@ -293,14 +293,14 @@ impl<'a> ResolvedVotePollsByDocumentTypeQuery<'a> { platform_version: &PlatformVersion, ) -> Result<(Vec>, Vec>), Error> { let document_type = self.document_type()?; - let mut properties_iter = index.properties.iter(); + let properties_iter = index.properties.iter(); let mut start_values_iter = self.start_index_values.iter(); let mut end_values_iter = self.end_index_values.iter(); let mut start_values_vec = vec![]; let mut end_values_vec = vec![]; let mut ended_start_values = false; let mut started_end_values = false; - while let Some(index_property) = properties_iter.next() { + for index_property in properties_iter { if !ended_start_values { if let Some(start_value) = start_values_iter.next() { let encoded = document_type.serialize_value_for_key( diff --git a/packages/rs-drive/src/query/vote_polls_by_end_date_query.rs b/packages/rs-drive/src/query/vote_polls_by_end_date_query.rs index b0a4d475444..36e769e53b3 100644 --- a/packages/rs-drive/src/query/vote_polls_by_end_date_query.rs +++ b/packages/rs-drive/src/query/vote_polls_by_end_date_query.rs @@ -3,7 +3,6 @@ use crate::drive::votes::paths::vote_end_date_queries_tree_path_vec; use crate::drive::Drive; #[cfg(feature = "server")] use crate::error::drive::DriveError; -#[cfg(feature = "server")] use crate::error::Error; #[cfg(feature = "server")] use crate::fee::op::LowLevelDriveOperation; diff --git a/packages/rs-platform-value/src/types/identifier.rs b/packages/rs-platform-value/src/types/identifier.rs index bc6feb8a0bf..07bdcbd425e 100644 --- a/packages/rs-platform-value/src/types/identifier.rs +++ b/packages/rs-platform-value/src/types/identifier.rs @@ -47,6 +47,16 @@ impl platform_serialization::PlatformVersionEncode for Identifier { } } +impl platform_serialization::PlatformVersionedDecode for Identifier { + fn platform_versioned_decode( + decoder: &mut D, + _platform_version: &platform_version::version::PlatformVersion, + ) -> Result { + let bytes = <[u8; 32]>::decode(decoder)?; + Ok(Identifier::new(bytes)) + } +} + impl AsRef<[u8]> for Identifier { fn as_ref(&self) -> &[u8] { &(self.0 .0) diff --git a/packages/rs-sdk/Cargo.toml b/packages/rs-sdk/Cargo.toml index 1539873b821..afd978dc435 100644 --- a/packages/rs-sdk/Cargo.toml +++ b/packages/rs-sdk/Cargo.toml @@ -4,6 +4,7 @@ version = "1.0.0-dev.15" edition = "2021" [dependencies] +arc-swap = { version = "1.7.1" } dpp = { path = "../rs-dpp", default-features = false, features = [ "dash-sdk-features", ] } @@ -11,18 +12,18 @@ dapi-grpc = { path = "../dapi-grpc" } rs-dapi-client = { path = "../rs-dapi-client", default-features = false } drive = { path = "../rs-drive", default-features = false, features = [ "verify", - "serde", ] } drive-proof-verifier = { path = "../rs-drive-proof-verifier" } dapi-grpc-macros = { path = "../rs-dapi-grpc-macros" } -bincode = { version = "2.0.0-rc.3", features = ["serde"], optional = true } thiserror = "1.0.58" tokio = { version = "1.36.0", features = ["macros"] } tokio-util = { version = "0.7.10" } async-trait = { version = "0.1.79" } http = { version = "0.2.12" } ciborium = { git = "https://github.com/qrayven/ciborium", branch = "feat-ser-null-as-undefined" } -serde = { version = "1.0.197", default-features = false, features = ["rc"] } +serde = { version = "1.0.197", default-features = false, features = [ + "rc", +], optional = true } serde_json = { version = "1.0", features = ["preserve_order"], optional = true } tracing = { version = "0.1.40" } hex = { version = "0.4.3", optional = true } @@ -34,7 +35,7 @@ derive_more = { version = "0.99.17" } dashcore-rpc = { git = "https://github.com/dashpay/rust-dashcore-rpc", tag = "v0.15.2" } 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" } [dev-dependencies] tokio = { version = "1.36.0", features = ["macros", "rt-multi-thread"] } @@ -55,14 +56,14 @@ sanitize-filename = { version = "0.5.0" } default = ["mocks", "offline-testing"] mocks = [ + "dep:serde", "dep:serde_json", "rs-dapi-client/mocks", "rs-dapi-client/dump", "dpp/document-cbor-conversion", - "dpp/identity-value-conversion", "dpp/random-identities", + "drive/serde", "drive-proof-verifier/mocks", - "dep:bincode", "dep:hex", "dep:dotenvy", "dep:envy", diff --git a/packages/rs-sdk/README.md b/packages/rs-sdk/README.md index 2f7c583cff1..16182f7fa6d 100644 --- a/packages/rs-sdk/README.md +++ b/packages/rs-sdk/README.md @@ -109,6 +109,7 @@ Definitions: 2. `Response` - gRPC response type, as generated in `packages/dapi-grpc/protos/platform/v0/platform.proto`. 3. `Object` - object type that should be returned by rs-sdk, most likely defined in `dpp` crate. In some cases, it can be defined in `packages/rs-drive-proof-verifier/src/types.rs`. +4. `Key` - some unique identifier of the `Object`, for example `platform_value::Identifier` Checklist: @@ -125,8 +126,10 @@ in `packages/rs-dapi-client/src/transport/grpc.rs`. that will store collection of returned objects, indexd by some key. 5. [ ] Implement `FromProof` trait for the `Object` (or type defined in `types.rs`) in `packages/rs-drive-proof-verifier/src/proof.rs`. 6. [ ] Implement `Query` trait for the `Request` in `packages/rs-sdk/src/platform/query.rs`. -7. [ ] Implement `Fetch\` trait for the `Object` (or type defined in `types.rs`) in `packages/rs-sdk/src/platform/fetch.rs`. -8. [ ] Implement `FetchMany\` trait for the `Object` (or type defined in `types.rs`) in `packages/rs-sdk/src/platform/fetch_many.rs`. +7. [ ] Implement `Fetch` trait for the `Object` (or type defined in `types.rs`), with inner type Request = `Request`, + in `packages/rs-sdk/src/platform/fetch.rs`. +8. [ ] Implement `FetchMany\` trait for the `Object` (or type defined in `types.rs`), + with inner type Request = `Request`, in `packages/rs-sdk/src/platform/fetch_many.rs`. 9. [ ] Add `mod ...;` clause to `packages/rs-sdk/tests/fetch/main.rs` 10. [ ] Implement unit tests in `packages/rs-sdk/tests/fetch/*object*.rs` 11. [ ] Add name of request type to match clause in `packages/rs-sdk/src/mock/sdk.rs` : `load_expectations()` diff --git a/packages/rs-sdk/examples/read_contract.rs b/packages/rs-sdk/examples/read_contract.rs index 0f025efd8ae..7dd8a3614ab 100644 --- a/packages/rs-sdk/examples/read_contract.rs +++ b/packages/rs-sdk/examples/read_contract.rs @@ -66,7 +66,7 @@ fn setup_sdk(config: &Config) -> Sdk { // We'll first provide `None` Sdk, and then update it later. // // To modify context provider, we need locks and Arc to overcome ownership rules. - let mut context_provider = GrpcContextProvider::new( + let context_provider = GrpcContextProvider::new( None, &config.server_address, config.core_port, diff --git a/packages/rs-sdk/src/lib.rs b/packages/rs-sdk/src/lib.rs index 887cffbc146..aee6acc380f 100644 --- a/packages/rs-sdk/src/lib.rs +++ b/packages/rs-sdk/src/lib.rs @@ -62,6 +62,7 @@ #![allow(rustdoc::private_intra_doc_links)] pub mod core; +#[cfg(feature = "mocks")] mod core_client; pub mod error; mod internal_cache; diff --git a/packages/rs-sdk/src/mock/provider.rs b/packages/rs-sdk/src/mock/provider.rs index aa5c6f1a666..17d1195723e 100644 --- a/packages/rs-sdk/src/mock/provider.rs +++ b/packages/rs-sdk/src/mock/provider.rs @@ -1,16 +1,16 @@ //! Example ContextProvider that uses the Core gRPC API to fetch data from the platform. -use std::hash::Hash; -use std::num::NonZeroUsize; -use std::sync::Arc; - -use dpp::prelude::{DataContract, Identifier}; -use drive_proof_verifier::error::ContextProviderError; -use drive_proof_verifier::ContextProvider; - use crate::core_client::CoreClient; use crate::platform::Fetch; use crate::{Error, Sdk}; +use arc_swap::ArcSwapAny; +use dpp::prelude::{DataContract, Identifier}; +use drive_proof_verifier::error::ContextProviderError; +use drive_proof_verifier::ContextProvider; +use pollster::FutureExt; +use std::hash::Hash; +use std::num::NonZeroUsize; +use std::sync::Arc; /// Context provider that uses the Core gRPC API to fetch data from the platform. /// @@ -24,7 +24,7 @@ pub struct GrpcContextProvider { /// values set by the user in the caches: `data_contracts_cache`, `quorum_public_keys_cache`. /// /// We use [Arc] as we have circular dependencies between Sdk and ContextProvider. - sdk: Option, + sdk: ArcSwapAny>>, /// Data contracts cache. /// @@ -65,7 +65,7 @@ impl GrpcContextProvider { let core_client = CoreClient::new(core_ip, core_port, core_user, core_password)?; Ok(Self { core: core_client, - sdk, + sdk: ArcSwapAny::new(Arc::new(sdk)), data_contracts_cache: Cache::new(data_contracts_cache_size), quorum_public_keys_cache: Cache::new(quorum_public_keys_cache_size), #[cfg(feature = "mocks")] @@ -78,8 +78,8 @@ impl GrpcContextProvider { /// /// Note that if the `sdk` is `None`, the context provider will not be able to fetch data itself and will rely on /// values set by the user in the caches: `data_contracts_cache`, `quorum_public_keys_cache`. - pub fn set_sdk(&mut self, sdk: Option) { - self.sdk = sdk; + pub fn set_sdk(&self, sdk: Option) { + self.sdk.store(Arc::new(sdk)); } /// Set the directory where to store dumped data. /// @@ -111,7 +111,7 @@ impl GrpcContextProvider { None => return, }; - let encoded = serde_json::to_vec(public_key).expect("encode quorum hash to json"); + let encoded = hex::encode(public_key); let file = path.join(format!( "quorum_pubkey-{}-{}.json", @@ -123,6 +123,32 @@ impl GrpcContextProvider { tracing::warn!("Unable to write dump file {:?}: {}", path, e); } } + + /// Save data contract to disk. + /// + /// Files are named: `quorum_pubkey--.json` + /// + /// Note that this will overwrite files with the same quorum type and quorum hash. + /// + /// Any errors are logged on `warn` level and ignored. + #[cfg(feature = "mocks")] + fn dump_data_contract(&self, data_contract: &DataContract) { + use dpp::data_contract::accessors::v0::DataContractV0Getters; + use hex::ToHex; + + let path = match &self.dump_dir { + Some(p) => p, + None => return, + }; + let id = data_contract.id(); + + let file = path.join(format!("data_contract-{}.json", id.encode_hex::())); + + let encoded = serde_json::to_vec(data_contract).expect("serialize data contract"); + if let Err(e) = std::fs::write(file, encoded) { + tracing::warn!("Unable to write dump file {:?}: {}", path, e); + } + } } impl ContextProvider for GrpcContextProvider { @@ -157,8 +183,8 @@ impl ContextProvider for GrpcContextProvider { if let Some(contract) = self.data_contracts_cache.get(data_contract_id) { return Ok(Some(contract)); }; - - let sdk = match &self.sdk { + let sdk_guard = self.sdk.load(); + let sdk = match sdk_guard.as_ref() { Some(sdk) => sdk, None => { tracing::warn!("data contract cache miss and no sdk provided, skipping fetch"); @@ -166,26 +192,21 @@ impl ContextProvider for GrpcContextProvider { } }; - let handle = match tokio::runtime::Handle::try_current() { - Ok(handle) => handle, - // not an error, we rely on the caller to provide a data contract using - Err(e) => { - tracing::warn!( - error = e.to_string(), - "data contract cache miss and no tokio runtime detected, skipping fetch" - ); - return Ok(None); - } - }; + let contract_id = *data_contract_id; - let data_contract = handle - .block_on(DataContract::fetch(sdk, *data_contract_id)) - .map_err(|e| ContextProviderError::InvalidDataContract(e.to_string()))?; + let data_contract: Option = DataContract::fetch(sdk, contract_id) + .block_on() + .map_err(|e| ContextProviderError::DataContractFailure(e.to_string()))?; if let Some(ref dc) = data_contract { self.data_contracts_cache.put(*data_contract_id, dc.clone()); }; + #[cfg(feature = "mocks")] + if let Some(ref dc) = data_contract { + self.dump_data_contract(dc); + } + Ok(data_contract.map(Arc::new)) } } diff --git a/packages/rs-sdk/src/mock/requests.rs b/packages/rs-sdk/src/mock/requests.rs index 0c997f3e59c..015da012bf4 100644 --- a/packages/rs-sdk/src/mock/requests.rs +++ b/packages/rs-sdk/src/mock/requests.rs @@ -1,22 +1,26 @@ -use std::collections::BTreeMap; - +use super::MockDashPlatformSdk; use dpp::{ + bincode, block::extended_epoch_info::ExtendedEpochInfo, - document::serialization_traits::DocumentCborMethodsV0, - document::Document, - platform_serialization::{ - platform_encode_to_vec, platform_versioned_decode_from_slice, PlatformVersionEncode, - PlatformVersionedDecode, - }, + dashcore::{hashes::Hash, ProTxHash}, + document::{serialization_traits::DocumentCborMethodsV0, Document}, + identifier::Identifier, + identity::IdentityPublicKey, + platform_serialization::{platform_encode_to_vec, platform_versioned_decode_from_slice}, prelude::{DataContract, Identity}, serialization::{ PlatformDeserializableWithPotentialValidationFromVersionedStructure, PlatformSerializableWithPlatformVersion, }, + voting::votes::{resource_vote::ResourceVote, Vote}, +}; +use drive_proof_verifier::types::{ + Contenders, ContestedResources, IdentityBalanceAndRevision, MasternodeProtocolVote, + PrefundedSpecializedBalance, VotePollsGroupedByTimestamp, Voters, }; -use serde::{Deserialize, Serialize}; +use std::collections::BTreeMap; -use super::MockDashPlatformSdk; +static BINCODE_CONFIG: bincode::config::Configuration = bincode::config::standard(); /// Trait implemented by objects that can be used in mock expectation responses. /// @@ -65,7 +69,7 @@ impl MockResponse for Vec { where Self: Sized, { - let items: Vec> = bincode::decode_from_slice(buf, bincode::config::standard()) + let items: Vec> = bincode::decode_from_slice(buf, BINCODE_CONFIG) .expect("decode vec of data") .0; items @@ -80,44 +84,54 @@ impl MockResponse for Vec { .map(|item| item.mock_serialize(mock_sdk)) .collect(); - bincode::encode_to_vec(data, bincode::config::standard()).expect("encode vec of data") + bincode::encode_to_vec(data, BINCODE_CONFIG).expect("encode vec of data") } } -impl Deserialize<'de>, V: Serialize + for<'de> Deserialize<'de>> - MockResponse for BTreeMap -{ - fn mock_deserialize(_sdk: &MockDashPlatformSdk, buf: &[u8]) -> Self + +impl MockResponse for BTreeMap { + fn mock_deserialize(sdk: &MockDashPlatformSdk, buf: &[u8]) -> Self where Self: Sized, { - serde_json::from_slice(buf).expect("decode vec of data") - } + let (data, _): (BTreeMap, Vec>, _) = + bincode::decode_from_slice(buf, BINCODE_CONFIG).expect("decode BTreeMap"); - fn mock_serialize(&self, _sdk: &MockDashPlatformSdk) -> Vec { - serde_json::to_vec(self).expect("encode vec of data") + data.into_iter() + .map(|(k, v)| (K::mock_deserialize(sdk, &k), V::mock_deserialize(sdk, &v))) + .collect() } -} -impl MockResponse for Identity -where - Self: PlatformVersionedDecode + PlatformVersionEncode, -{ fn mock_serialize(&self, sdk: &MockDashPlatformSdk) -> Vec { - // self.clone().serialize_to_bytes().expect("serialize data") - platform_encode_to_vec(self, bincode::config::standard(), sdk.version()) - .expect("serialize data") - } + let data: BTreeMap, Vec> = self + .iter() + .map(|(k, v)| (k.mock_serialize(sdk), v.mock_serialize(sdk))) + .collect(); - fn mock_deserialize(sdk: &MockDashPlatformSdk, buf: &[u8]) -> Self - where - Self: Sized + PlatformVersionedDecode, - { - // Self::deserialize_from_bytes(buf).expect("deserialize data") - platform_versioned_decode_from_slice(buf, bincode::config::standard(), sdk.version()) - .expect("deserialize data") + bincode::encode_to_vec(data, BINCODE_CONFIG).expect("encode BTreeMap") } } +/// Serialize and deserialize the object for mocking using bincode. +/// +/// Use this macro when the object implements platform serialization. +macro_rules! impl_mock_response { + ($name:ident) => { + impl MockResponse for $name { + fn mock_serialize(&self, sdk: &MockDashPlatformSdk) -> Vec { + platform_encode_to_vec(self, BINCODE_CONFIG, sdk.version()) + .expect(concat!("encode ", stringify!($name))) + } + fn mock_deserialize(sdk: &MockDashPlatformSdk, buf: &[u8]) -> Self + where + Self: Sized, + { + platform_versioned_decode_from_slice(buf, BINCODE_CONFIG, sdk.version()) + .expect(concat!("decode ", stringify!($name))) + } + } + }; +} + // FIXME: Seems that DataContract doesn't implement PlatformVersionedDecode + PlatformVersionEncode, // so we just use some methods implemented directly on these objects. impl MockResponse for DataContract { @@ -149,19 +163,6 @@ impl MockResponse for Document { } } -impl MockResponse for drive_proof_verifier::types::IdentityBalance { - fn mock_serialize(&self, _sdk: &MockDashPlatformSdk) -> Vec { - (*self).to_be_bytes().to_vec() - } - - fn mock_deserialize(_sdk: &MockDashPlatformSdk, buf: &[u8]) -> Self - where - Self: Sized, - { - Self::from_be_bytes(buf.try_into().expect("balance should be 8 bytes")) - } -} - impl MockResponse for drive_proof_verifier::types::IdentityNonceFetcher { fn mock_serialize(&self, _sdk: &MockDashPlatformSdk) -> Vec { (self.0).to_be_bytes().to_vec() @@ -193,33 +194,34 @@ impl MockResponse for drive_proof_verifier::types::IdentityContractNonceFetcher )) } } - -impl MockResponse for drive_proof_verifier::types::IdentityBalanceAndRevision { - fn mock_serialize(&self, _sdk: &MockDashPlatformSdk) -> Vec { - bincode::encode_to_vec(self, bincode::config::standard()) - .expect("encode IdentityBalanceAndRevision") - } - - fn mock_deserialize(_sdk: &MockDashPlatformSdk, buf: &[u8]) -> Self - where - Self: Sized, - { - let (item, _len) = bincode::decode_from_slice(buf, bincode::config::standard()) - .expect("decode IdentityBalanceAndRevision"); - item - } -} - -impl MockResponse for ExtendedEpochInfo { +impl MockResponse for ProTxHash { fn mock_serialize(&self, sdk: &MockDashPlatformSdk) -> Vec { - platform_encode_to_vec(self, bincode::config::standard(), sdk.version()) - .expect("encode ExtendedEpochInfo") + let data = self.as_raw_hash().as_byte_array(); + platform_encode_to_vec(data, BINCODE_CONFIG, sdk.version()).expect("encode ProTxHash") } fn mock_deserialize(sdk: &MockDashPlatformSdk, buf: &[u8]) -> Self where Self: Sized, { - platform_versioned_decode_from_slice(buf, bincode::config::standard(), sdk.version()) - .expect("decode ExtendedEpochInfo") + let data = platform_versioned_decode_from_slice(buf, BINCODE_CONFIG, sdk.version()) + .expect("decode ProTxHash"); + ProTxHash::from_raw_hash(Hash::from_byte_array(data)) } } + +impl_mock_response!(Identity); +impl_mock_response!(IdentityPublicKey); +impl_mock_response!(Identifier); +impl_mock_response!(MasternodeProtocolVote); +impl_mock_response!(ResourceVote); +impl_mock_response!(u16); +impl_mock_response!(u32); +impl_mock_response!(u64); +impl_mock_response!(Vote); +impl_mock_response!(ExtendedEpochInfo); +impl_mock_response!(ContestedResources); +impl_mock_response!(IdentityBalanceAndRevision); +impl_mock_response!(Contenders); +impl_mock_response!(Voters); +impl_mock_response!(VotePollsGroupedByTimestamp); +impl_mock_response!(PrefundedSpecializedBalance); diff --git a/packages/rs-sdk/src/mock/sdk.rs b/packages/rs-sdk/src/mock/sdk.rs index 56cd074095b..57872bd10cc 100644 --- a/packages/rs-sdk/src/mock/sdk.rs +++ b/packages/rs-sdk/src/mock/sdk.rs @@ -104,7 +104,7 @@ impl MockDashPlatformSdk { for filename in &files { let basename = filename.file_name().unwrap().to_str().unwrap(); - let request_type = basename.split('_').nth(2).unwrap_or_default(); + let request_type = basename.split('_').nth(1).unwrap_or_default(); match request_type { "DocumentQuery" => self.load_expectation::(filename).await?, @@ -156,6 +156,34 @@ impl MockDashPlatformSdk { ) .await? } + "GetContestedResourcesRequest" => { + self.load_expectation::(filename) + .await? + } + "GetContestedResourceVoteStateRequest" => { + self.load_expectation::(filename) + .await? + } + "GetContestedResourceVotersForIdentityRequest" => { + self.load_expectation::( + filename, + ) + .await? + } + "GetContestedResourceIdentityVotesRequest" => { + self.load_expectation::( + filename, + ) + .await? + } + "GetVotePollsByEndDateRequest" => { + self.load_expectation::(filename) + .await? + } + "GetPrefundedSpecializedBalanceRequest" => { + self.load_expectation::(filename) + .await? + } _ => { return Err(Error::Config(format!( "unknown request type {} in {}", @@ -279,20 +307,21 @@ impl MockDashPlatformSdk { /// object must be a vector of objects. pub async fn expect_fetch_many< K: Ord, - O: FetchMany, - Q: Query<>::Request>, + O: FetchMany, + Q: Query<>::Request>, + R: FromIterator<(K, Option)> + MockResponse + Send + Default, >( &mut self, query: Q, - objects: Option>>, + objects: Option, ) -> Result<&mut Self, Error> where - BTreeMap>: MockResponse, - <>::Request as TransportRequest>::Response: Default, - BTreeMap>: FromProof< - >::Request, - Request = >::Request, - Response = <>::Request as TransportRequest>::Response, + R: MockResponse, + <>::Request as TransportRequest>::Response: Default, + R: FromProof< + >::Request, + Request = >::Request, + Response = <>::Request as TransportRequest>::Response, > + Sync, { let grpc_request = query.query(self.prove).expect("query must be correct"); diff --git a/packages/rs-sdk/src/platform/document_query.rs b/packages/rs-sdk/src/platform/document_query.rs index e477d647873..0b5f85ee0ff 100644 --- a/packages/rs-sdk/src/platform/document_query.rs +++ b/packages/rs-sdk/src/platform/document_query.rs @@ -201,7 +201,7 @@ impl FromProof for drive_proof_verifier::types::Documents { let drive_query: DriveQuery = (&request) .try_into() - .map_err(|e| drive_proof_verifier::Error::RequestDecodeError { + .map_err(|e| drive_proof_verifier::Error::RequestError { error: format!("Failed to convert DocumentQuery to DriveQuery: {}", e), })?; diff --git a/packages/rs-sdk/src/platform/fetch.rs b/packages/rs-sdk/src/platform/fetch.rs index 793f44d10b0..661445c206a 100644 --- a/packages/rs-sdk/src/platform/fetch.rs +++ b/packages/rs-sdk/src/platform/fetch.rs @@ -11,11 +11,11 @@ use crate::mock::MockResponse; use crate::{error::Error, platform::query::Query, Sdk}; use dapi_grpc::platform::v0::{self as platform_proto, ResponseMetadata}; -use dpp::block::extended_epoch_info::ExtendedEpochInfo; -use dpp::platform_value::Identifier; use dpp::voting::votes::Vote; -use dpp::{document::Document, prelude::Identity}; -use drive_proof_verifier::types::ContestedVote; +use dpp::{ + block::extended_epoch_info::ExtendedEpochInfo, document::Document, platform_value::Identifier, + prelude::Identity, +}; use drive_proof_verifier::FromProof; use rs_dapi_client::{transport::TransportRequest, DapiRequest, RequestSettings}; use std::fmt::Debug; @@ -28,6 +28,9 @@ use super::DocumentQuery; /// To fetch an object from the platform, you need to define some query (criteria that fetched object must match) and /// use [Fetch::fetch()] for your object type. /// +/// Implementators of this trait should implement at least the [fetch_with_metadata()](Fetch::fetch_with_metadata) +/// method, as other methods are convenience methods that call it with default settings. +/// /// ## Example /// /// A common use case is to fetch an [Identity] object by its [Identifier]. As [Identifier] implements [Query] for @@ -160,19 +163,8 @@ where query: Q, settings: RequestSettings, ) -> Result, Error> { - let request = query.query(sdk.prove())?; - - let response = request.clone().execute(sdk, settings).await?; - - let object_type = std::any::type_name::().to_string(); - tracing::trace!(request = ?request, response = ?response, object_type, "fetched object from platform"); - - let object: Option = sdk.parse_proof(request, response).await?; - - match object { - Some(item) => Ok(item.into()), - None => Ok(None), - } + let (object, _) = Self::fetch_with_metadata(sdk, query, Some(settings)).await?; + Ok(object) } /// Fetch single object from the Platform by identifier. @@ -229,6 +221,10 @@ impl Fetch for ExtendedEpochInfo { type Request = platform_proto::GetEpochsInfoRequest; } -impl Fetch for ContestedVote { +impl Fetch for drive_proof_verifier::types::PrefundedSpecializedBalance { + type Request = platform_proto::GetPrefundedSpecializedBalanceRequest; +} + +impl Fetch for Vote { type Request = platform_proto::GetContestedResourceIdentityVotesRequest; } diff --git a/packages/rs-sdk/src/platform/fetch_many.rs b/packages/rs-sdk/src/platform/fetch_many.rs index 12e012b7ca1..c625f1a1577 100644 --- a/packages/rs-sdk/src/platform/fetch_many.rs +++ b/packages/rs-sdk/src/platform/fetch_many.rs @@ -4,7 +4,6 @@ //! //! ## Traits //! - `[FetchMany]`: An async trait that fetches multiple items of a specific type from the platform. - use crate::{ error::Error, mock::MockResponse, @@ -12,22 +11,28 @@ use crate::{ Sdk, }; use dapi_grpc::platform::v0::{ - GetContestedResourceVoteStateRequest, GetDataContractsRequest, GetDocumentsResponse, - GetEpochsInfoRequest, GetIdentitiesContractKeysRequest, GetIdentityKeysRequest, + GetContestedResourceIdentityVotesRequest, GetContestedResourceVoteStateRequest, + GetContestedResourceVotersForIdentityRequest, GetContestedResourcesRequest, + GetDataContractsRequest, GetDocumentsResponse, GetEpochsInfoRequest, GetIdentityKeysRequest, GetProtocolVersionUpgradeStateRequest, GetProtocolVersionUpgradeVoteStatusRequest, + GetVotePollsByEndDateRequest, }; use dashcore_rpc::dashcore::ProTxHash; -use dpp::block::epoch::EpochIndex; -use dpp::block::extended_epoch_info::ExtendedEpochInfo; use dpp::data_contract::DataContract; -use dpp::document::Document; use dpp::identity::KeyID; use dpp::prelude::{Identifier, IdentityPublicKey}; use dpp::util::deserializer::ProtocolVersion; use dpp::version::ProtocolVersionVoteCount; -use dpp::voting::vote_polls::contested_document_resource_vote_poll::ContestedDocumentResourceVotePoll; -use drive::query::vote_poll_vote_state_query::Contender; -use drive_proof_verifier::types::{MasternodeProtocolVote, RetrievedObjects}; +use dpp::{block::epoch::EpochIndex, prelude::TimestampMillis, voting::vote_polls::VotePoll}; +use dpp::{ + block::extended_epoch_info::ExtendedEpochInfo, voting::votes::resource_vote::ResourceVote, +}; +use dpp::{document::Document, voting::contender_structs::ContenderWithSerializedDocument}; +use drive_proof_verifier::types::{ + Contenders, ContestedResource, ContestedResources, DataContracts, ExtendedEpochInfos, + IdentityPublicKeys, MasternodeProtocolVote, MasternodeProtocolVotes, ProtocolVersionUpgrades, + ResourceVotesByIdentity, VotePollsGroupedByTimestamp, Voter, Voters, +}; use drive_proof_verifier::{types::Documents, FromProof}; use rs_dapi_client::{transport::TransportRequest, DapiRequest, RequestSettings}; use std::collections::BTreeMap; @@ -46,6 +51,7 @@ use super::LimitQuery; /// ## Generic Parameters /// /// - `K`: The type of the key used to index the object +/// - `O`: The type of returned container (eg. map) that holds the fetched objects /// /// ## Example /// @@ -71,15 +77,16 @@ use super::LimitQuery; /// let data_contract = DataContract::fetch_many(&sdk, query); /// ``` #[async_trait::async_trait] -pub trait FetchMany +pub trait FetchMany)>> where Self: Sized, - BTreeMap>: MockResponse + O: MockResponse + FromProof< Self::Request, Request = Self::Request, - Response = <>::Request as TransportRequest>::Response, - > + Sync, + Response = <>::Request as TransportRequest>::Response, + > + Send + + Default, { /// Type of request used to fetch multiple objects from the platform. /// @@ -87,7 +94,7 @@ where /// /// This type must implement [`TransportRequest`] and [`MockRequest`](crate::mock::MockRequest). type Request: TransportRequest - + Into<> as FromProof<>::Request>>::Request>; + + Into<>::Request>>::Request>; /// Fetch (or search) multiple objects on the Dash Platform /// @@ -103,7 +110,7 @@ where /// /// ## Generic Parameters /// - /// - `K`: The type of the key used to index the object in the returned collection + /// - `Q`: The type of [Query] used to generate a request /// /// ## Parameters /// @@ -112,7 +119,7 @@ where /// /// ## Returns /// - /// Returns a `Result` containing either : + /// Returns a `Result` containing either: /// /// * list of objects matching the [Query] indexed by a key type `K`, where an item can be None of /// the object was not found for provided key @@ -127,10 +134,10 @@ where /// ## Error Handling /// /// Any errors encountered during the execution are returned as [`Error`](crate::error::Error) instances. - async fn fetch_many>::Request>>( + async fn fetch_many>::Request>>( sdk: &Sdk, query: Q, - ) -> Result, Error> { + ) -> Result { let request = query.query(sdk.prove())?; let response = request @@ -141,10 +148,8 @@ where let object_type = std::any::type_name::().to_string(); tracing::trace!(request = ?request, response = ?response, object_type, "fetched object from platform"); - let object: BTreeMap> = sdk - .parse_proof::<>::Request, BTreeMap>>( - request, response, - ) + let object: O = sdk + .parse_proof::<>::Request, O>(request, response) .await? .unwrap_or_default(); @@ -167,9 +172,9 @@ where async fn fetch_by_identifiers + Send>( sdk: &Sdk, identifiers: I, - ) -> Result, Error> + ) -> Result where - Vec: Query<>::Request>, + Vec: Query<>::Request>, { let ids = identifiers.into_iter().collect::>(); Self::fetch_many(sdk, ids).await @@ -185,17 +190,18 @@ where /// - `sdk`: An instance of [Sdk]. /// - `query`: A query parameter implementing [`Query`](crate::platform::query::Query) to specify the data to be retrieved. /// - `limit`: Maximum number of objects to fetch. - async fn fetch_many_with_limit>::Request>>( + async fn fetch_many_with_limit>::Request>>( sdk: &Sdk, query: Q, limit: u32, - ) -> Result, Error> + ) -> Result where - LimitQuery: Query<>::Request>, + LimitQuery: Query<>::Request>, { let limit_query = LimitQuery { limit: Some(limit), query, + start_info: None, }; Self::fetch_many(sdk, limit_query).await @@ -209,17 +215,17 @@ where /// ## Supported query types /// /// * [DriveQuery](crate::platform::DriveQuery) - query that specifies document matching criteria -/// * [DocumentQuery](crate::platform::document_query::DocumentQuery) - +/// * [DocumentQuery](crate::platform::document_query::DocumentQuery) #[async_trait::async_trait] -impl FetchMany for Document { +impl FetchMany for Document { // We need to use the DocumentQuery type here because the DocumentQuery // type stores full contract, which is missing in the GetDocumentsRequest type. // TODO: Refactor to use ContextProvider type Request = DocumentQuery; - async fn fetch_many>::Request>>( + async fn fetch_many>::Request>>( sdk: &Sdk, query: Q, - ) -> Result>, Error> { + ) -> Result { let document_query: DocumentQuery = query.query(sdk.prove())?; let request = document_query.clone(); @@ -246,7 +252,7 @@ impl FetchMany for Document { /// ## Supported query types /// /// * [Identifier] - [Identity](crate::platform::Identity) ID for which to retrieve keys -impl FetchMany for IdentityPublicKey { +impl FetchMany for IdentityPublicKey { type Request = GetIdentityKeysRequest; } @@ -261,7 +267,7 @@ impl FetchMany for IdentityPublicKey { /// [DEFAULT_EPOCH_QUERY_LIMIT](super::query::DEFAULT_EPOCH_QUERY_LIMIT) objects starting from this index /// * [`LimitQuery`](super::LimitQuery), [`LimitQuery`](super::LimitQuery) - limit query /// that allows to specify maximum number of objects to fetch; see also [FetchMany::fetch_many_with_limit()]. -impl FetchMany for ExtendedEpochInfo { +impl FetchMany for ExtendedEpochInfo { type Request = GetEpochsInfoRequest; } @@ -285,7 +291,7 @@ impl FetchMany for ExtendedEpochInfo { /// let result = ProtocolVersionVoteCount::fetch_many(&sdk, ()).await; /// # }); /// ``` -impl FetchMany for ProtocolVersionVoteCount { +impl FetchMany for ProtocolVersionVoteCount { type Request = GetProtocolVersionUpgradeStateRequest; } @@ -303,20 +309,67 @@ impl FetchMany for ProtocolVersionVoteCount { /// the query will return all objects /// * [`LimitQuery`](super::LimitQuery) - limit query that allows to specify maximum number of objects /// to fetch; see also [FetchMany::fetch_many_with_limit()]. -impl FetchMany for MasternodeProtocolVote { +impl FetchMany for MasternodeProtocolVote { type Request = GetProtocolVersionUpgradeVoteStatusRequest; } /// Fetch multiple data contracts. /// /// Returns [DataContracts](drive_proof_verifier::types::DataContracts) indexed by [Identifier](dpp::prelude::Identifier). -impl FetchMany for DataContract { +/// +/// ## Supported query types +/// +/// * [Vec](dpp::prelude::Identifier) - list of identifiers of data contracts to fetch +/// +impl FetchMany for DataContract { type Request = GetDataContractsRequest; } +/// Fetch multiple [ContestedResource], indexed by Identifier. +/// +/// ## Supported query types +/// +/// * [VotePollsByDocumentTypeQuery] +impl FetchMany for ContestedResource { + type Request = GetContestedResourcesRequest; +} + /// Fetch multiple contenders for a contested document resource vote poll. /// /// Returns [Contender](drive_proof_verifier::types::Contenders) indexed by [Identifier](dpp::prelude::Identifier). -impl FetchMany for Contender { +/// +/// ## Supported query types +/// +/// * [ContestedDocumentVotePollDriveQuery] +#[async_trait::async_trait] +impl FetchMany for ContenderWithSerializedDocument { type Request = GetContestedResourceVoteStateRequest; } + +///  Fetch voters +/// ## Supported query types +/// +/// * [ContestedDocumentVotePollVotesDriveQuery] +impl FetchMany for Voter { + type Request = GetContestedResourceVotersForIdentityRequest; +} + +// GetContestedResourceIdentityVoteStatus +/// Fetch votes of some identity for a contested document resource vote poll. +/// +/// ## Supported query types +/// +/// * [ContestedResourceVotesGivenByIdentityQuery] +impl FetchMany for ResourceVote { + type Request = GetContestedResourceIdentityVotesRequest; +} + +// +/// Fetch multiple vote polls grouped by timestamp. +/// +/// ## Supported query types +/// +/// * [VotePollsByEndDateDriveQuery] +impl FetchMany for VotePoll { + type Request = GetVotePollsByEndDateRequest; +} diff --git a/packages/rs-sdk/src/platform/identities_contract_keys_query.rs b/packages/rs-sdk/src/platform/identities_contract_keys_query.rs index 4716982231e..15570d23a71 100644 --- a/packages/rs-sdk/src/platform/identities_contract_keys_query.rs +++ b/packages/rs-sdk/src/platform/identities_contract_keys_query.rs @@ -10,7 +10,8 @@ use crate::platform::Identifier; use crate::Error; /// Request that is used to query identities' contract keys -#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, dapi_grpc_macros::Mockable)] +#[derive(Debug, Clone, dapi_grpc_macros::Mockable)] +#[cfg_attr(feature = "mocks", derive(serde::Serialize, serde::Deserialize))] pub struct IdentitiesContractKeysQuery { /// The identities' identifiers that we want to query pub identities_ids: Vec, diff --git a/packages/rs-sdk/src/platform/query.rs b/packages/rs-sdk/src/platform/query.rs index a6eebda1c55..21cba50abdc 100644 --- a/packages/rs-sdk/src/platform/query.rs +++ b/packages/rs-sdk/src/platform/query.rs @@ -1,24 +1,33 @@ //! Query trait representing criteria for fetching data from the platform. //! //! [Query] trait is used to specify individual objects as well as search criteria for fetching multiple objects from the platform. -use std::fmt::Debug; - use dapi_grpc::mock::Mockable; +use dapi_grpc::platform::v0::get_contested_resource_identity_votes_request::GetContestedResourceIdentityVotesRequestV0; use dapi_grpc::platform::v0::{ self as proto, get_identity_keys_request, get_identity_keys_request::GetIdentityKeysRequestV0, - AllKeys, GetContestedResourceVoteStateRequest, GetEpochsInfoRequest, GetIdentityKeysRequest, + AllKeys, GetContestedResourceVoteStateRequest, GetContestedResourceVotersForIdentityRequest, + GetContestedResourcesRequest, GetEpochsInfoRequest, GetIdentityKeysRequest, GetProtocolVersionUpgradeStateRequest, GetProtocolVersionUpgradeVoteStatusRequest, KeyRequestType, }; +use dapi_grpc::platform::v0::{ + GetContestedResourceIdentityVotesRequest, GetPrefundedSpecializedBalanceRequest, + GetVotePollsByEndDateRequest, +}; use dashcore_rpc::dashcore::{hashes::Hash, ProTxHash}; use dpp::{block::epoch::EpochIndex, prelude::Identifier}; -use drive::query::DriveQuery; +use drive::query::contested_resource_votes_given_by_identity_query::ContestedResourceVotesGivenByIdentityQuery; +use drive::query::vote_poll_contestant_votes_query::ContestedDocumentVotePollVotesDriveQuery; +use drive::query::vote_poll_vote_state_query::ContestedDocumentVotePollDriveQuery; +use drive::query::vote_polls_by_document_type_query::VotePollsByDocumentTypeQuery; +use drive::query::{DriveQuery, VotePollsByEndDateDriveQuery}; +use drive_proof_verifier::from_request::TryFromRequest; use rs_dapi_client::transport::TransportRequest; +use std::fmt::Debug; use crate::{error::Error, platform::document_query::DocumentQuery}; use super::types::epoch::EpochQuery; - /// Default limit of epoch records returned by the platform. pub const DEFAULT_EPOCH_QUERY_LIMIT: u32 = 100; /// Default limit of epoch records returned by the platform. @@ -272,6 +281,7 @@ impl Query for LimitQuery for Option { fn query(self, prove: bool) -> Result { LimitQuery::from(self).query(prove) @@ -297,4 +307,111 @@ impl Query for LimitQuery } } -impl Query for LimitQuery {} +impl Query for VotePollsByDocumentTypeQuery { + fn query(self, prove: bool) -> Result { + if !prove { + unimplemented!("queries without proofs are not supported yet"); + } + + self.try_to_request().map_err(|e| e.into()) + } +} + +impl Query for ContestedDocumentVotePollDriveQuery { + fn query(self, prove: bool) -> Result { + if !prove { + unimplemented!("queries without proofs are not supported yet"); + } + + if self.offset.is_some() { + return Err(Error::Generic("ContestedDocumentVotePollDriveQuery.offset field is internal and must be set to None".into())); + } + self.try_to_request().map_err(|e| e.into()) + } +} + +impl Query + for ContestedDocumentVotePollVotesDriveQuery +{ + fn query(self, prove: bool) -> Result { + if !prove { + unimplemented!("queries without proofs are not supported yet"); + } + if self.offset.is_some() { + return Err(Error::Generic("ContestedDocumentVotePollVotesDriveQuery.offset field is internal and must be set to None".into())); + } + + self.try_to_request().map_err(|e| e.into()) + } +} + +impl Query + for ContestedResourceVotesGivenByIdentityQuery +{ + fn query(self, prove: bool) -> Result { + if !prove { + unimplemented!("queries without proofs are not supported yet"); + } + if self.offset.is_some() { + return Err(Error::Generic("ContestedResourceVotesGivenByIdentityQuery.offset field is internal and must be set to None".into())); + } + + self.try_to_request().map_err(|e| e.into()) + } +} + +impl Query for VotePollsByEndDateDriveQuery { + fn query(self, prove: bool) -> Result { + if !prove { + unimplemented!("queries without proofs are not supported yet"); + } + + self.try_to_request().map_err(|e| e.into()) + } +} + +impl Query for Identifier { + fn query(self, prove: bool) -> Result { + if !prove { + unimplemented!("queries without proofs are not supported yet"); + } + self.try_to_request().map_err(|e| e.into()) + } +} + +/// Query for single vote. +#[derive(Debug, Clone)] +pub struct VoteQuery { + pub identity_id: Identifier, + pub vote_poll_id: Identifier, +} +impl VoteQuery { + pub fn new(identity_id: Identifier, vote_poll_id: Identifier) -> Self { + Self { + identity_id, + vote_poll_id, + } + } +} + +impl Query for VoteQuery { + fn query(self, prove: bool) -> Result { + if !prove { + unimplemented!("queries without proofs are not supported yet"); + } + use proto::get_contested_resource_identity_votes_request::get_contested_resource_identity_votes_request_v0::StartAtVotePollIdInfo; + + Ok(GetContestedResourceIdentityVotesRequestV0 { + identity_id: self.identity_id.to_vec(), + prove, + limit: Some(1), + offset: None, + order_ascending: true, + start_at_vote_poll_id_info: Some(StartAtVotePollIdInfo { + start_at_poll_identifier: self.vote_poll_id.to_vec(), + start_poll_identifier_included: true, + }), + } + .into()) + } +} diff --git a/packages/rs-sdk/src/platform/transition/vote.rs b/packages/rs-sdk/src/platform/transition/vote.rs index a23517c3068..42caa451bc9 100644 --- a/packages/rs-sdk/src/platform/transition/vote.rs +++ b/packages/rs-sdk/src/platform/transition/vote.rs @@ -1,17 +1,17 @@ +use crate::platform::block_info_from_metadata::block_info_from_metadata; +use crate::platform::query::VoteQuery; use crate::platform::transition::broadcast_request::BroadcastRequestForStateTransition; +use crate::platform::transition::put_settings::PutSettings; use crate::platform::Fetch; use crate::{Error, Sdk}; - use dapi_grpc::platform::VersionedGrpcResponse; use dpp::identity::signer::Signer; use dpp::identity::IdentityPublicKey; use dpp::prelude::Identifier; use dpp::state_transition::masternode_vote_transition::methods::MasternodeVoteTransitionMethodsV0; use dpp::state_transition::masternode_vote_transition::MasternodeVoteTransition; - -use crate::platform::block_info_from_metadata::block_info_from_metadata; -use crate::platform::transition::put_settings::PutSettings; use dpp::state_transition::proof_result::StateTransitionProofResult; +use dpp::voting::votes::resource_vote::accessors::v0::ResourceVoteGettersV0; use dpp::voting::votes::Vote; use drive::drive::Drive; use rs_dapi_client::DapiRequest; @@ -85,6 +85,9 @@ impl PutVote for Vote { let settings = settings.unwrap_or_default(); + let Vote::ResourceVote(resource_vote) = self; + let vote_poll_id = resource_vote.vote_poll().unique_id()?; + let masternode_vote_transition = MasternodeVoteTransition::try_from_vote_with_signer( self.clone(), signer, @@ -103,16 +106,18 @@ impl PutVote for Vote { //todo make this more reliable Err(e) => { if e.to_string().contains("already exists") { - let vote = Vote::fetch(sdk, voter_pro_tx_hash).await?; + let vote = + Vote::fetch(sdk, VoteQuery::new(voter_pro_tx_hash, vote_poll_id)).await?; return vote.ok_or(Error::DapiClientError( "vote was proved to not exist but was said to exist".to_string(), )); + } else { + return Err(e.into()); } } } let request = masternode_vote_transition.wait_for_state_transition_result_request()?; - let response = request.execute(sdk, settings.request_settings).await?; let block_info = block_info_from_metadata(response.metadata()?)?; diff --git a/packages/rs-sdk/src/platform/types/epoch.rs b/packages/rs-sdk/src/platform/types/epoch.rs index 88def823bfe..6db702cbfdb 100644 --- a/packages/rs-sdk/src/platform/types/epoch.rs +++ b/packages/rs-sdk/src/platform/types/epoch.rs @@ -21,17 +21,8 @@ pub trait ExtendedEpochInfoEx: Sized { #[async_trait] impl ExtendedEpochInfoEx for ExtendedEpochInfo { async fn fetch_current(sdk: &Sdk) -> Result { - let query = LimitQuery { - query: EpochQuery { - start: None, - ascending: false, - }, - limit: Some(1), - }; - - let epoch = Self::fetch(sdk, query).await?; - - epoch.ok_or(Error::EpochNotFound) + let (epoch, _) = Self::fetch_current_with_metadata(sdk).await?; + Ok(epoch) } async fn fetch_current_with_metadata(sdk: &Sdk) -> Result<(Self, ResponseMetadata), Error> { @@ -41,6 +32,7 @@ impl ExtendedEpochInfoEx for ExtendedEpochInfo { ascending: false, }, limit: Some(1), + start_info: None, }; let (epoch, metadata) = Self::fetch_with_metadata(sdk, query, None).await?; diff --git a/packages/rs-sdk/src/platform/types/version_votes.rs b/packages/rs-sdk/src/platform/types/version_votes.rs index 651472cb05b..4c926850d94 100644 --- a/packages/rs-sdk/src/platform/types/version_votes.rs +++ b/packages/rs-sdk/src/platform/types/version_votes.rs @@ -44,6 +44,7 @@ impl MasternodeProtocolVoteEx for MasternodeProtocolVote { LimitQuery { query: start_protxhash, limit, + start_info: None, }, ) .await diff --git a/packages/rs-sdk/src/sdk.rs b/packages/rs-sdk/src/sdk.rs index bf3618fa754..3976ee7c544 100644 --- a/packages/rs-sdk/src/sdk.rs +++ b/packages/rs-sdk/src/sdk.rs @@ -1,9 +1,5 @@ //! [Sdk] entrypoint to Dash Platform. -use std::collections::btree_map::Entry; -use std::sync::Arc; -use std::{fmt::Debug, num::NonZeroUsize}; - use crate::error::Error; use crate::internal_cache::InternalSdkCache; use crate::mock::MockResponse; @@ -29,8 +25,13 @@ use rs_dapi_client::{ transport::{TransportClient, TransportRequest}, DapiClient, DapiClientError, DapiRequestExecutor, }; +use std::collections::btree_map::Entry; +use std::fmt::Debug; +#[cfg(feature = "mocks")] +use std::num::NonZeroUsize; #[cfg(feature = "mocks")] use std::path::{Path, PathBuf}; +use std::sync::Arc; use std::time::{SystemTime, UNIX_EPOCH}; #[cfg(feature = "mocks")] use tokio::sync::{Mutex, MutexGuard}; @@ -514,8 +515,12 @@ pub struct SdkBuilder { /// Platform version to use in this Sdk version: &'static PlatformVersion, - /// Cache settings + /// Cache size for data contracts. Used by mock [GrpcContextProvider]. + #[cfg(feature = "mocks")] data_contract_cache_size: NonZeroUsize, + + /// Cache size for quorum public keys. Used by mock [GrpcContextProvider]. + #[cfg(feature = "mocks")] quorum_public_keys_cache_size: NonZeroUsize, /// Context provider used by the SDK. @@ -542,8 +547,10 @@ impl Default for SdkBuilder { proofs: true, + #[cfg(feature = "mocks")] data_contract_cache_size: NonZeroUsize::new(DEFAULT_CONTRACT_CACHE_SIZE) .expect("data conttact cache size must be positive"), + #[cfg(feature = "mocks")] quorum_public_keys_cache_size: NonZeroUsize::new(DEFAULT_QUORUM_PUBLIC_KEYS_CACHE_SIZE) .expect("quorum public keys cache size must be positive"), @@ -661,8 +668,7 @@ impl SdkBuilder { /// This function will create the directory if it does not exist and save dumps of /// * all requests and responses - in files named `msg-*.json` /// * retrieved quorum public keys - in files named `quorum_pubkey-*.json` - /// - /// Data is saved in JSON format. + /// * retrieved data contracts - in files named `data_contract-*.json` /// /// These files can be used together with [MockDashPlatformSdk] to replay the requests and responses. /// See [MockDashPlatformSdk::load_expectations()] for more information. @@ -691,6 +697,7 @@ impl SdkBuilder { #[cfg(feature = "mocks")] let dapi = dapi.dump_dir(self.dump_dir.clone()); + #[allow(unused_mut)] // needs to be mutable for #[cfg(feature = "mocks")] let mut sdk= Sdk{ inner:SdkInstance::Dapi { dapi, version:self.version }, proofs:self.proofs, @@ -707,15 +714,18 @@ impl SdkBuilder { tracing::warn!("ContextProvider not set; mocking with Dash Core. \ Please provide your own ContextProvider with SdkBuilder::with_context_provider()."); - let mut context_provider = GrpcContextProvider::new(Some(sdk.clone()), - &self.core_ip, self.core_port, &self.core_user, &self.core_password, - self.data_contract_cache_size, self.quorum_public_keys_cache_size)?; + let mut context_provider = GrpcContextProvider::new(None, + &self.core_ip, self.core_port, &self.core_user, &self.core_password, + self.data_contract_cache_size, self.quorum_public_keys_cache_size)?; #[cfg(feature = "mocks")] if sdk.dump_dir.is_some() { context_provider.set_dump_dir(sdk.dump_dir.clone()); } - - sdk.context_provider.replace(Arc::new(Box::new(context_provider))); + // We have cyclical dependency Sdk <-> GrpcContextProvider, so we just do some + // workaround using additional Arc. + let context_provider=Arc::new(context_provider); + sdk.context_provider.replace(Arc::new(Box::new(context_provider.clone()))); + context_provider.set_sdk(Some(sdk.clone())); } else{ tracing::warn!( "Configure ContextProvider with Sdk::with_context_provider(); otherwise Sdk will fail"); diff --git a/packages/rs-sdk/tests/fetch/broadcast.rs b/packages/rs-sdk/tests/fetch/broadcast.rs index b6566bc0b14..56e26f457e3 100644 --- a/packages/rs-sdk/tests/fetch/broadcast.rs +++ b/packages/rs-sdk/tests/fetch/broadcast.rs @@ -6,7 +6,6 @@ mod online { wait_for_state_transition_result_request::WaitForStateTransitionResultRequestV0, WaitForStateTransitionResultRequest, }; - use dash_sdk::Sdk; use rs_dapi_client::{DapiRequest, RequestSettings}; use std::time::Duration; diff --git a/packages/rs-sdk/tests/fetch/common.rs b/packages/rs-sdk/tests/fetch/common.rs index e286593bb61..e7847db9f22 100644 --- a/packages/rs-sdk/tests/fetch/common.rs +++ b/packages/rs-sdk/tests/fetch/common.rs @@ -72,7 +72,7 @@ pub fn mock_data_contract( pub fn setup_logs() { tracing_subscriber::fmt::fmt() .with_env_filter(tracing_subscriber::EnvFilter::new( - "info,dash_sdk=trace,h2=info", + "info,dash_sdk=trace,drive_proof_verifier=trace,main=debug,h2=info", )) .pretty() .with_ansi(true) diff --git a/packages/rs-sdk/tests/fetch/contested_resource.rs b/packages/rs-sdk/tests/fetch/contested_resource.rs new file mode 100644 index 00000000000..5ee7257fefa --- /dev/null +++ b/packages/rs-sdk/tests/fetch/contested_resource.rs @@ -0,0 +1,39 @@ +//! Tests of ContestedResource object + +use crate::fetch::{common::setup_logs, config::Config}; +use dash_sdk::platform::FetchMany; +use dpp::platform_value::Value; +use drive::query::vote_polls_by_document_type_query::VotePollsByDocumentTypeQuery; +use drive_proof_verifier::types::ContestedResource; + +#[tokio::test(flavor = "multi_thread", worker_threads = 1)] +#[cfg_attr( + feature = "network-testing", + ignore = "requires a DPNS name to be registered" +)] +async fn test_contested_resources_ok() { + setup_logs(); + + let cfg = Config::new(); + + let sdk = cfg.setup_api("test_contested_resources_ok").await; + + let index_name = "parentNameAndLabel"; + + let query = VotePollsByDocumentTypeQuery { + contract_id: cfg.existing_data_contract_id, + document_type_name: cfg.existing_document_type_name.clone(), + index_name: index_name.to_string(), + start_at_value: None, + start_index_values: vec![Value::Text("dash".into())], + end_index_values: vec![], + limit: None, + order_ascending: false, + }; + + let rss = ContestedResource::fetch_many(&sdk, query) + .await + .expect("fetch contested resources"); + + assert!(!rss.0.is_empty()); +} diff --git a/packages/rs-sdk/tests/fetch/contested_resource_identity_votes.rs b/packages/rs-sdk/tests/fetch/contested_resource_identity_votes.rs new file mode 100644 index 00000000000..addda645e87 --- /dev/null +++ b/packages/rs-sdk/tests/fetch/contested_resource_identity_votes.rs @@ -0,0 +1,31 @@ +//! Test GetContestedResourceIdentityVotesRequest + +use crate::fetch::{common::setup_logs, config::Config}; +use dash_sdk::platform::FetchMany; +use dpp::voting::votes::resource_vote::ResourceVote; +use drive::query::contested_resource_votes_given_by_identity_query::ContestedResourceVotesGivenByIdentityQuery; + +/// Given some data contract ID, document type and document ID, when I fetch it, then I get it. +#[tokio::test(flavor = "multi_thread", worker_threads = 1)] +async fn contested_resource_identity_votes_not_found() { + setup_logs(); + + let cfg = Config::new(); + let sdk = cfg + .setup_api("contested_resource_identity_votes_not_found") + .await; + + let query = ContestedResourceVotesGivenByIdentityQuery { + identity_id: cfg.existing_identity_id, + limit: None, + offset: None, + order_ascending: true, + start_at: None, + }; + + let votes = ResourceVote::fetch_many(&sdk, query) + .await + .expect("fetch votes for identity"); + + assert!(votes.is_empty(), "no votes expected for this query"); +} diff --git a/packages/rs-sdk/tests/fetch/contested_resource_pools_by_ts.rs b/packages/rs-sdk/tests/fetch/contested_resource_pools_by_ts.rs new file mode 100644 index 00000000000..805763d9117 --- /dev/null +++ b/packages/rs-sdk/tests/fetch/contested_resource_pools_by_ts.rs @@ -0,0 +1,34 @@ +//! Test VotePollsByEndDateDriveQuery + +use dash_sdk::platform::FetchMany; +use dpp::voting::vote_polls::VotePoll; +use drive::query::VotePollsByEndDateDriveQuery; + +use crate::fetch::{common::setup_logs, config::Config}; + +#[tokio::test(flavor = "multi_thread", worker_threads = 1)] +#[cfg_attr( + feature = "network-testing", + ignore = "requires a DPNS name to be registered" +)] +async fn test_vote_polls_by_ts_ok() { + setup_logs(); + + let cfg = Config::new(); + + let sdk = cfg.setup_api("test_vote_polls_by_ts_ok").await; + + let query = VotePollsByEndDateDriveQuery { + limit: None, + offset: None, + order_ascending: true, + start_time: None, + end_time: None, + }; + + let rss = VotePoll::fetch_many(&sdk, query) + .await + .expect("fetch contested resources"); + tracing::info!("vote polls retrieved: {:?}", rss); + assert!(!rss.0.is_empty()); +} diff --git a/packages/rs-sdk/tests/fetch/contested_resource_vote_state.rs b/packages/rs-sdk/tests/fetch/contested_resource_vote_state.rs new file mode 100644 index 00000000000..18c8c1056f2 --- /dev/null +++ b/packages/rs-sdk/tests/fetch/contested_resource_vote_state.rs @@ -0,0 +1,73 @@ +//! Tests for SDK requests that return one or more [Contender] objects. +use crate::fetch::{common::setup_logs, config::Config}; +use dash_sdk::platform::{DocumentQuery, Fetch, FetchMany}; +use dpp::{ + data_contract::DataContract, + document::Document, + voting::{ + contender_structs::ContenderWithSerializedDocument, + vote_polls::contested_document_resource_vote_poll::ContestedDocumentResourceVotePoll, + }, +}; +use drive::query::vote_poll_vote_state_query::{ + ContestedDocumentVotePollDriveQuery, ContestedDocumentVotePollDriveQueryResultType, +}; +use std::sync::Arc; + +/// Given some data contract ID, document type and document ID, when I fetch it, then I get it. +#[tokio::test(flavor = "multi_thread", worker_threads = 1)] +async fn contested_resource_vote_states_not_found() { + setup_logs(); + + let cfg = Config::new(); + let sdk = cfg + .setup_api("contested_resource_vote_states_not_found") + .await; + + let data_contract_id = cfg.existing_data_contract_id; + + let contract = Arc::new( + DataContract::fetch(&sdk, data_contract_id) + .await + .expect("fetch data contract") + .expect("data contract not found"), + ); + + // Fetch multiple documents so that we get document ID + let all_docs_query = + DocumentQuery::new(Arc::clone(&contract), &cfg.existing_document_type_name) + .expect("create SdkDocumentQuery"); + let first_doc = Document::fetch_many(&sdk, all_docs_query) + .await + .expect("fetch many documents") + .pop_first() + .expect("first item must exist") + .1 + .expect("document must exist"); + + tracing::info!("first_doc: {}", first_doc.to_string()); + // Now query for individual document + let query = ContestedDocumentVotePollDriveQuery { + limit: None, + offset: None, + start_at: None, + vote_poll: ContestedDocumentResourceVotePoll { + index_name: "parentNameAndLabel".to_string(), + index_values: vec!["dash".into()], + document_type_name: cfg.existing_document_type_name, + contract_id: data_contract_id, + }, + allow_include_locked_and_abstaining_vote_tally: true, + // TODO test other result types + result_type: ContestedDocumentVotePollDriveQueryResultType::DocumentsAndVoteTally, + }; + + let contenders = ContenderWithSerializedDocument::fetch_many(&sdk, query) + .await + .expect("fetch many contenders"); + + assert!( + contenders.contenders.is_empty(), + "no contenders expected for this query" + ); +} diff --git a/packages/rs-sdk/tests/fetch/contested_resource_voters.rs b/packages/rs-sdk/tests/fetch/contested_resource_voters.rs new file mode 100644 index 00000000000..9e507fe3a24 --- /dev/null +++ b/packages/rs-sdk/tests/fetch/contested_resource_voters.rs @@ -0,0 +1,40 @@ +//! Test GetContestedResourceVotersForIdentityRequest + +use dash_sdk::platform::FetchMany; +use drive::query::vote_poll_contestant_votes_query::ContestedDocumentVotePollVotesDriveQuery; +use drive_proof_verifier::types::Voter; + +use crate::fetch::{common::setup_logs, config::Config}; + +#[tokio::test(flavor = "multi_thread", worker_threads = 1)] +async fn test_contested_resource_voters_for_identity_not_found() { + setup_logs(); + + let cfg = Config::new(); + + let sdk = cfg + .setup_api("test_contested_resource_voters_for_identity_not_found") + .await; + + let index_name = "parentNameAndLabel"; + + let query = ContestedDocumentVotePollVotesDriveQuery { + limit: None, + offset: None, + order_ascending: true, + start_at: None, + vote_poll: dpp::voting::vote_polls::contested_document_resource_vote_poll::ContestedDocumentResourceVotePoll { + contract_id: cfg.existing_data_contract_id, + document_type_name: cfg.existing_document_type_name, + index_name: index_name.to_string(), + index_values: vec!["dash".into()], + }, + contestant_id: cfg.existing_identity_id, + }; + + let rss = Voter::fetch_many(&sdk, query) + .await + .expect("fetch contested resources"); + + assert!(rss.0.is_empty()); +} diff --git a/packages/rs-sdk/tests/fetch/data_contract.rs b/packages/rs-sdk/tests/fetch/data_contract.rs index bfcd383e15b..62cda24a575 100644 --- a/packages/rs-sdk/tests/fetch/data_contract.rs +++ b/packages/rs-sdk/tests/fetch/data_contract.rs @@ -100,8 +100,12 @@ async fn test_data_contracts_2_nx() { // The contract for this test was pre-created with // `packages/platform-test-suite/test/functional/platform/DataContract.spec.js` // and stored as a test vector for offline testing only. -#[cfg(not(feature = "network-testing"))] +// #[cfg(not(feature = "network-testing"))] #[tokio::test(flavor = "multi_thread", worker_threads = 1)] +#[cfg_attr( + feature = "network-testing", + ignore = "This test requires special procedure to regenerate test vectors" +)] async fn test_data_contract_history_read() { let cfg = Config::new(); let id = Identifier::from_string( diff --git a/packages/rs-sdk/tests/fetch/document.rs b/packages/rs-sdk/tests/fetch/document.rs index 8893814374a..942687eaa61 100644 --- a/packages/rs-sdk/tests/fetch/document.rs +++ b/packages/rs-sdk/tests/fetch/document.rs @@ -8,7 +8,7 @@ use dpp::data_contract::accessors::v0::DataContractV0Getters; use dpp::document::{Document, DocumentV0Getters}; use dpp::platform_value::string_encoding::Encoding; use dpp::prelude::{DataContract, Identifier}; -use drive::query::DriveQuery; +use drive::query::{DriveQuery, OrderClause, WhereClause}; /// Given some data contract ID, document type and document ID, when I fetch it, then I get it. #[tokio::test(flavor = "multi_thread", worker_threads = 1)] @@ -103,8 +103,6 @@ async fn document_read_no_document() { /// Given some data contract ID and document type with at least one document, when I fetch many documents using DriveQuery /// as a query, then I get one or more items. -/// -/// This test is ignored because it requires a running Platform. To run it, set constants in `common.rs` and run: #[tokio::test(flavor = "multi_thread", worker_threads = 1)] async fn document_list_drive_query() { setup_logs(); @@ -181,3 +179,46 @@ async fn document_list_document_query() { tracing::info!(documents=?doc_ids, "fetched documents"); } + +/// Check if bug when processing Where clause containing `Value::Text("l")` string is fixed. +/// +///query: storage: protocol: value error: structure error: value was a string, but could not be decoded from base 58 +/// Given document query with where clause contains to `"l"` string, +/// when I fetch documents, +/// then I don't get error: +/// `query: storage: protocol: value error: structure error: value was a string, but could not be decoded from base 58`. +#[tokio::test(flavor = "multi_thread", worker_threads = 1)] +async fn document_list_bug_value_text_decode_base58() { + setup_logs(); + + let cfg = Config::new(); + let sdk = cfg + .setup_api("document_list_bug_value_text_decode_base58") + .await; + + let data_contract_id = cfg.existing_data_contract_id; + + let contract = Arc::new( + DataContract::fetch(&sdk, data_contract_id) + .await + .expect("fetch data contract") + .expect("data contract not found"), + ); + + // Fetch multiple documents so that we get document ID + let query = DocumentQuery::new(Arc::clone(&contract), &cfg.existing_document_type_name) + .expect("create SdkDocumentQuery") + .with_where(WhereClause { + field: "records.dashUniqueIdentityId".to_string(), + operator: drive::query::WhereOperator::Equal, + value: dpp::platform_value::Value::Text("l".into()), + }) + .with_order_by(OrderClause { + field: "records.dashUniqueIdentityId".to_string(), + ascending: true, + }); + + let _docs = Document::fetch_many(&sdk, query) + .await + .expect("fetch many documents"); +} diff --git a/packages/rs-sdk/tests/fetch/epoch.rs b/packages/rs-sdk/tests/fetch/epoch.rs index 411592995ba..603bc4669e8 100644 --- a/packages/rs-sdk/tests/fetch/epoch.rs +++ b/packages/rs-sdk/tests/fetch/epoch.rs @@ -118,6 +118,7 @@ async fn test_epoch_list_limit() { let query: LimitQuery = LimitQuery { query: starting_epoch, limit: Some(limit), + start_info: None, }; let epochs = ExtendedEpochInfo::fetch_many(&sdk, query) diff --git a/packages/rs-sdk/tests/fetch/mod.rs b/packages/rs-sdk/tests/fetch/mod.rs index 261cfa7364f..bdcb4073d6c 100644 --- a/packages/rs-sdk/tests/fetch/mod.rs +++ b/packages/rs-sdk/tests/fetch/mod.rs @@ -9,6 +9,11 @@ compile_error!("network-testing or offline-testing must be enabled for tests"); mod broadcast; mod common; mod config; +mod contested_resource; +mod contested_resource_identity_votes; +mod contested_resource_pools_by_ts; +mod contested_resource_vote_state; +mod contested_resource_voters; mod data_contract; mod document; mod epoch; @@ -16,5 +21,6 @@ mod identity; mod identity_contract_nonce; mod mock_fetch; mod mock_fetch_many; +mod prefunded_specialized_balance; mod protocol_version_vote_count; mod protocol_version_votes; diff --git a/packages/rs-sdk/tests/fetch/prefunded_specialized_balance.rs b/packages/rs-sdk/tests/fetch/prefunded_specialized_balance.rs new file mode 100644 index 00000000000..8ab44ccd40e --- /dev/null +++ b/packages/rs-sdk/tests/fetch/prefunded_specialized_balance.rs @@ -0,0 +1,25 @@ +//! Test GetPrefundedSpecializedBalanceRequest + +use crate::fetch::{common::setup_logs, config::Config}; +use dash_sdk::platform::Fetch; +use dpp::identifier::Identifier; +use drive_proof_verifier::types::PrefundedSpecializedBalance; + +#[tokio::test(flavor = "multi_thread", worker_threads = 1)] +async fn test_prefunded_specialized_balance_not_found() { + setup_logs(); + + let cfg = Config::new(); + + let sdk = cfg + .setup_api("test_prefunded_specialized_balance_not_found") + .await; + + let query = Identifier::from_bytes(&[1u8; 32]).expect("create identifier"); + + let rss = PrefundedSpecializedBalance::fetch(&sdk, query) + .await + .expect("fetch prefunded specialized balance"); + + assert!(rss.is_none()); +} diff --git a/packages/rs-sdk/tests/vectors/contested_resource_identity_votes_not_found/.gitkeep b/packages/rs-sdk/tests/vectors/contested_resource_identity_votes_not_found/.gitkeep new file mode 100644 index 00000000000..e69de29bb2d diff --git a/packages/rs-sdk/tests/vectors/contested_resource_identity_votes_not_found/msg_GetContestedResourceIdentityVotesRequest_fc465faa351b8e30b6ab9dbcfbd85b36d7aae743e0cd2e02170cdb8fb70b7568.json b/packages/rs-sdk/tests/vectors/contested_resource_identity_votes_not_found/msg_GetContestedResourceIdentityVotesRequest_fc465faa351b8e30b6ab9dbcfbd85b36d7aae743e0cd2e02170cdb8fb70b7568.json new file mode 100644 index 00000000000..528728d7673 Binary files /dev/null and b/packages/rs-sdk/tests/vectors/contested_resource_identity_votes_not_found/msg_GetContestedResourceIdentityVotesRequest_fc465faa351b8e30b6ab9dbcfbd85b36d7aae743e0cd2e02170cdb8fb70b7568.json differ diff --git a/packages/rs-sdk/tests/vectors/contested_resource_identity_votes_not_found/quorum_pubkey-106-492dae0f1dd6ead4f24c870bd0c119aacf74ce5a6e2b6587fd5a1b4dd74623ae.json b/packages/rs-sdk/tests/vectors/contested_resource_identity_votes_not_found/quorum_pubkey-106-492dae0f1dd6ead4f24c870bd0c119aacf74ce5a6e2b6587fd5a1b4dd74623ae.json new file mode 100644 index 00000000000..ccd69e38275 --- /dev/null +++ b/packages/rs-sdk/tests/vectors/contested_resource_identity_votes_not_found/quorum_pubkey-106-492dae0f1dd6ead4f24c870bd0c119aacf74ce5a6e2b6587fd5a1b4dd74623ae.json @@ -0,0 +1 @@ +aa51132a4e62cec89b731aa8baf4043fea777c484a4856e3b7c9a13c651ff2a9057d30cd251190bde749ac8f7c0026b6 \ No newline at end of file diff --git a/packages/rs-sdk/tests/vectors/contested_resource_vote_states_not_found/.gitkeep b/packages/rs-sdk/tests/vectors/contested_resource_vote_states_not_found/.gitkeep new file mode 100644 index 00000000000..e69de29bb2d diff --git a/packages/rs-sdk/tests/vectors/contested_resource_vote_states_not_found/data_contract-e668c659af66aee1e72c186dde7b5b7e0a1d712a09c40d5721f622bf53c53155.json b/packages/rs-sdk/tests/vectors/contested_resource_vote_states_not_found/data_contract-e668c659af66aee1e72c186dde7b5b7e0a1d712a09c40d5721f622bf53c53155.json new file mode 100644 index 00000000000..e67826094c9 --- /dev/null +++ b/packages/rs-sdk/tests/vectors/contested_resource_vote_states_not_found/data_contract-e668c659af66aee1e72c186dde7b5b7e0a1d712a09c40d5721f622bf53c53155.json @@ -0,0 +1 @@ +{"$format_version":"0","id":"GWRSAVFMjXx8HpQFaNJMqBV7MBgMK4br5UESsB4S31Ec","config":{"$format_version":"0","canBeDeleted":false,"readonly":false,"keepsHistory":false,"documentsKeepHistoryContractDefault":false,"documentsMutableContractDefault":true,"documentsCanBeDeletedContractDefault":true,"requiresIdentityEncryptionBoundedKey":null,"requiresIdentityDecryptionBoundedKey":null},"version":1,"ownerId":"4EfA9Jrvv3nnCFdSf7fad59851iiTRZ6Wcu6YVJ4iSeF","schemaDefs":null,"documentSchemas":{"domain":{"type":"object","documentsMutable":false,"canBeDeleted":false,"indices":[{"name":"parentNameAndLabel","properties":[{"normalizedParentDomainName":"asc"},{"normalizedLabel":"asc"}],"unique":true,"contested":{"fieldMatches":[{"field":"normalizedLabel","regexPattern":"^[a-zA-Z01]{3,19}$"}],"resolution":0,"description":"If the normalized label part of this index is less than 20 characters (all alphabet a-z and 0 and 1) then this index is non unique while contest resolution takes place."}},{"name":"dashIdentityId","properties":[{"records.dashUniqueIdentityId":"asc"}],"unique":true},{"name":"dashAlias","properties":[{"records.dashAliasIdentityId":"asc"}]}],"properties":{"label":{"type":"string","pattern":"^[a-zA-Z0-9][a-zA-Z0-9-]{0,61}[a-zA-Z0-9]$","minLength":3,"maxLength":63,"position":0,"description":"Domain label. e.g. 'Bob'."},"normalizedLabel":{"type":"string","pattern":"^[a-hj-km-np-z0-9][a-hj-km-np-z0-9-]{0,61}[a-hj-km-np-z0-9]$","maxLength":63,"position":1,"description":"Domain label converted to lowercase for case-insensitive uniqueness validation. \"o\", \"i\" and \"l\" replaced with \"0\" and \"1\" to mitigate homograph attack. e.g. 'b0b'","$comment":"Must be equal to the label in lowercase. \"o\", \"i\" and \"l\" must be replaced with \"0\" and \"1\"."},"parentDomainName":{"type":"string","pattern":"^$|^[a-zA-Z0-9][a-zA-Z0-9-]{0,61}[a-zA-Z0-9]$","minLength":0,"maxLength":63,"position":2,"description":"A full parent domain name. e.g. 'dash'."},"normalizedParentDomainName":{"type":"string","pattern":"^$|^[a-hj-km-np-z0-9][a-hj-km-np-z0-9-\\.]{0,61}[a-hj-km-np-z0-9]$","minLength":0,"maxLength":63,"position":3,"description":"A parent domain name in lowercase for case-insensitive uniqueness validation. \"o\", \"i\" and \"l\" replaced with \"0\" and \"1\" to mitigate homograph attack. e.g. 'dash'","$comment":"Must either be equal to an existing domain or empty to create a top level domain. \"o\", \"i\" and \"l\" must be replaced with \"0\" and \"1\". Only the data contract owner can create top level domains."},"preorderSalt":{"type":"array","byteArray":true,"minItems":32,"maxItems":32,"position":4,"description":"Salt used in the preorder document"},"records":{"type":"object","properties":{"dashUniqueIdentityId":{"type":"array","byteArray":true,"minItems":32,"maxItems":32,"position":0,"contentMediaType":"application/x.dash.dpp.identifier","description":"Identity ID to be used to create the primary name the Identity","$comment":"Must be equal to the document owner"},"dashAliasIdentityId":{"type":"array","byteArray":true,"minItems":32,"maxItems":32,"position":1,"contentMediaType":"application/x.dash.dpp.identifier","description":"Identity ID to be used to create alias names for the Identity","$comment":"Must be equal to the document owner"}},"minProperties":1,"maxProperties":1,"position":5,"additionalProperties":false,"$comment":"Constraint with max and min properties ensure that only one identity record is used - either a `dashUniqueIdentityId` or a `dashAliasIdentityId`"},"subdomainRules":{"type":"object","properties":{"allowSubdomains":{"type":"boolean","description":"This option defines who can create subdomains: true - anyone; false - only the domain owner","$comment":"Only the domain owner is allowed to create subdomains for non top-level domains","position":0}},"position":6,"description":"Subdomain rules allow domain owners to define rules for subdomains","additionalProperties":false,"required":["allowSubdomains"]}},"required":["label","normalizedLabel","normalizedParentDomainName","preorderSalt","records","subdomainRules"],"additionalProperties":false,"$comment":"In order to register a domain you need to create a preorder. The preorder step is needed to prevent man-in-the-middle attacks. normalizedLabel + '.' + normalizedParentDomain must not be longer than 253 chars length as defined by RFC 1035. Domain documents are immutable: modification and deletion are restricted"},"preorder":{"type":"object","documentsMutable":false,"canBeDeleted":true,"indices":[{"name":"saltedHash","properties":[{"saltedDomainHash":"asc"}],"unique":true}],"properties":{"saltedDomainHash":{"type":"array","byteArray":true,"minItems":32,"maxItems":32,"position":0,"description":"Double sha-256 of the concatenation of a 32 byte random salt and a normalized domain name"}},"required":["saltedDomainHash"],"additionalProperties":false,"$comment":"Preorder documents are immutable: modification and deletion are restricted"}}} \ No newline at end of file diff --git a/packages/rs-sdk/tests/vectors/document_read/msg_2024-04-24T00:37:29.597728000Z_DocumentQuery_466b07ebed6757e3497ed2487cd8a6c7c92c604537febea6e2287e0e3f386284.json b/packages/rs-sdk/tests/vectors/contested_resource_vote_states_not_found/msg_DocumentQuery_22942c9d389d6b8518bda36199d5789c2cb3ec52359f6119ce08b53acca4ee93.json similarity index 63% rename from packages/rs-sdk/tests/vectors/document_read/msg_2024-04-24T00:37:29.597728000Z_DocumentQuery_466b07ebed6757e3497ed2487cd8a6c7c92c604537febea6e2287e0e3f386284.json rename to packages/rs-sdk/tests/vectors/contested_resource_vote_states_not_found/msg_DocumentQuery_22942c9d389d6b8518bda36199d5789c2cb3ec52359f6119ce08b53acca4ee93.json index 2ba70ef6edf..affacd4a01f 100644 Binary files a/packages/rs-sdk/tests/vectors/document_read/msg_2024-04-24T00:37:29.597728000Z_DocumentQuery_466b07ebed6757e3497ed2487cd8a6c7c92c604537febea6e2287e0e3f386284.json and b/packages/rs-sdk/tests/vectors/contested_resource_vote_states_not_found/msg_DocumentQuery_22942c9d389d6b8518bda36199d5789c2cb3ec52359f6119ce08b53acca4ee93.json differ diff --git a/packages/rs-sdk/tests/vectors/contested_resource_vote_states_not_found/msg_GetContestedResourceVoteStateRequest_a7fa439911e16ae02a457f40a4a3968800dd88d3cd55c96ddc7005206ae8a91f.json b/packages/rs-sdk/tests/vectors/contested_resource_vote_states_not_found/msg_GetContestedResourceVoteStateRequest_a7fa439911e16ae02a457f40a4a3968800dd88d3cd55c96ddc7005206ae8a91f.json new file mode 100644 index 00000000000..b570da68b8c Binary files /dev/null and b/packages/rs-sdk/tests/vectors/contested_resource_vote_states_not_found/msg_GetContestedResourceVoteStateRequest_a7fa439911e16ae02a457f40a4a3968800dd88d3cd55c96ddc7005206ae8a91f.json differ diff --git a/packages/rs-sdk/tests/vectors/test_data_contracts_1_ok_1_nx/msg_2024-04-24T00:37:29.544223000Z_GetDataContractsRequest_f229a0e58a5c4fb050f57c087bf067bd9ccc29eca3092a5664a5a9ba3bb7e967.json b/packages/rs-sdk/tests/vectors/contested_resource_vote_states_not_found/msg_GetDataContractRequest_e87a2e6acef76975c30eb7272da71733fb6ad13495beb7ca1b6a6c4ceb30e0f7.json similarity index 89% rename from packages/rs-sdk/tests/vectors/test_data_contracts_1_ok_1_nx/msg_2024-04-24T00:37:29.544223000Z_GetDataContractsRequest_f229a0e58a5c4fb050f57c087bf067bd9ccc29eca3092a5664a5a9ba3bb7e967.json rename to packages/rs-sdk/tests/vectors/contested_resource_vote_states_not_found/msg_GetDataContractRequest_e87a2e6acef76975c30eb7272da71733fb6ad13495beb7ca1b6a6c4ceb30e0f7.json index 4fcf0041b93..35d918b6b3a 100644 Binary files a/packages/rs-sdk/tests/vectors/test_data_contracts_1_ok_1_nx/msg_2024-04-24T00:37:29.544223000Z_GetDataContractsRequest_f229a0e58a5c4fb050f57c087bf067bd9ccc29eca3092a5664a5a9ba3bb7e967.json and b/packages/rs-sdk/tests/vectors/contested_resource_vote_states_not_found/msg_GetDataContractRequest_e87a2e6acef76975c30eb7272da71733fb6ad13495beb7ca1b6a6c4ceb30e0f7.json differ diff --git a/packages/rs-sdk/tests/vectors/contested_resource_vote_states_not_found/quorum_pubkey-106-492dae0f1dd6ead4f24c870bd0c119aacf74ce5a6e2b6587fd5a1b4dd74623ae.json b/packages/rs-sdk/tests/vectors/contested_resource_vote_states_not_found/quorum_pubkey-106-492dae0f1dd6ead4f24c870bd0c119aacf74ce5a6e2b6587fd5a1b4dd74623ae.json new file mode 100644 index 00000000000..ccd69e38275 --- /dev/null +++ b/packages/rs-sdk/tests/vectors/contested_resource_vote_states_not_found/quorum_pubkey-106-492dae0f1dd6ead4f24c870bd0c119aacf74ce5a6e2b6587fd5a1b4dd74623ae.json @@ -0,0 +1 @@ +aa51132a4e62cec89b731aa8baf4043fea777c484a4856e3b7c9a13c651ff2a9057d30cd251190bde749ac8f7c0026b6 \ No newline at end of file diff --git a/packages/rs-sdk/tests/vectors/document_list_document_query/msg_2024-04-24T00:37:29.546154000Z_GetDataContractRequest_e87a2e6acef76975c30eb7272da71733fb6ad13495beb7ca1b6a6c4ceb30e0f7.json b/packages/rs-sdk/tests/vectors/document_list_document_query/msg_2024-04-24T00:37:29.546154000Z_GetDataContractRequest_e87a2e6acef76975c30eb7272da71733fb6ad13495beb7ca1b6a6c4ceb30e0f7.json deleted file mode 100644 index a20af6fd4f9..00000000000 Binary files a/packages/rs-sdk/tests/vectors/document_list_document_query/msg_2024-04-24T00:37:29.546154000Z_GetDataContractRequest_e87a2e6acef76975c30eb7272da71733fb6ad13495beb7ca1b6a6c4ceb30e0f7.json and /dev/null differ diff --git a/packages/rs-sdk/tests/vectors/document_list_document_query/msg_DocumentQuery_22942c9d389d6b8518bda36199d5789c2cb3ec52359f6119ce08b53acca4ee93.json b/packages/rs-sdk/tests/vectors/document_list_document_query/msg_DocumentQuery_22942c9d389d6b8518bda36199d5789c2cb3ec52359f6119ce08b53acca4ee93.json new file mode 100644 index 00000000000..affacd4a01f Binary files /dev/null and b/packages/rs-sdk/tests/vectors/document_list_document_query/msg_DocumentQuery_22942c9d389d6b8518bda36199d5789c2cb3ec52359f6119ce08b53acca4ee93.json differ diff --git a/packages/rs-sdk/tests/vectors/document_read/msg_2024-04-24T00:37:29.546204000Z_GetDataContractRequest_e87a2e6acef76975c30eb7272da71733fb6ad13495beb7ca1b6a6c4ceb30e0f7.json b/packages/rs-sdk/tests/vectors/document_list_document_query/msg_GetDataContractRequest_e87a2e6acef76975c30eb7272da71733fb6ad13495beb7ca1b6a6c4ceb30e0f7.json similarity index 88% rename from packages/rs-sdk/tests/vectors/document_read/msg_2024-04-24T00:37:29.546204000Z_GetDataContractRequest_e87a2e6acef76975c30eb7272da71733fb6ad13495beb7ca1b6a6c4ceb30e0f7.json rename to packages/rs-sdk/tests/vectors/document_list_document_query/msg_GetDataContractRequest_e87a2e6acef76975c30eb7272da71733fb6ad13495beb7ca1b6a6c4ceb30e0f7.json index a20af6fd4f9..35d918b6b3a 100644 Binary files a/packages/rs-sdk/tests/vectors/document_read/msg_2024-04-24T00:37:29.546204000Z_GetDataContractRequest_e87a2e6acef76975c30eb7272da71733fb6ad13495beb7ca1b6a6c4ceb30e0f7.json and b/packages/rs-sdk/tests/vectors/document_list_document_query/msg_GetDataContractRequest_e87a2e6acef76975c30eb7272da71733fb6ad13495beb7ca1b6a6c4ceb30e0f7.json differ diff --git a/packages/rs-sdk/tests/vectors/document_list_document_query/quorum_pubkey-106-32f78e1ab8f7beb1edc06a461c486e1afd90c1d4732f93cf8287fa0e9c27e35e.json b/packages/rs-sdk/tests/vectors/document_list_document_query/quorum_pubkey-106-32f78e1ab8f7beb1edc06a461c486e1afd90c1d4732f93cf8287fa0e9c27e35e.json deleted file mode 100644 index ca9f21e7523..00000000000 --- a/packages/rs-sdk/tests/vectors/document_list_document_query/quorum_pubkey-106-32f78e1ab8f7beb1edc06a461c486e1afd90c1d4732f93cf8287fa0e9c27e35e.json +++ /dev/null @@ -1 +0,0 @@ -[183,213,77,25,46,6,139,69,130,159,190,72,193,8,131,191,105,54,247,90,65,206,156,68,41,55,185,93,114,209,189,211,207,236,91,86,76,47,4,205,217,32,122,8,123,104,168,118] \ No newline at end of file diff --git a/packages/rs-sdk/tests/vectors/document_list_document_query/quorum_pubkey-106-492dae0f1dd6ead4f24c870bd0c119aacf74ce5a6e2b6587fd5a1b4dd74623ae.json b/packages/rs-sdk/tests/vectors/document_list_document_query/quorum_pubkey-106-492dae0f1dd6ead4f24c870bd0c119aacf74ce5a6e2b6587fd5a1b4dd74623ae.json new file mode 100644 index 00000000000..ccd69e38275 --- /dev/null +++ b/packages/rs-sdk/tests/vectors/document_list_document_query/quorum_pubkey-106-492dae0f1dd6ead4f24c870bd0c119aacf74ce5a6e2b6587fd5a1b4dd74623ae.json @@ -0,0 +1 @@ +aa51132a4e62cec89b731aa8baf4043fea777c484a4856e3b7c9a13c651ff2a9057d30cd251190bde749ac8f7c0026b6 \ No newline at end of file diff --git a/packages/rs-sdk/tests/vectors/document_list_drive_query/msg_2024-04-24T00:37:29.598737000Z_DocumentQuery_f7b86e21e5bcf796a7c9d570c64ee4e5ee0324e5f38b49daf9dc9d1f1384bdae.json b/packages/rs-sdk/tests/vectors/document_list_drive_query/msg_DocumentQuery_eda8ea924aaa3972122082f3d304d6e67d46cde3c59fddbd27974d2603212fc1.json similarity index 73% rename from packages/rs-sdk/tests/vectors/document_list_drive_query/msg_2024-04-24T00:37:29.598737000Z_DocumentQuery_f7b86e21e5bcf796a7c9d570c64ee4e5ee0324e5f38b49daf9dc9d1f1384bdae.json rename to packages/rs-sdk/tests/vectors/document_list_drive_query/msg_DocumentQuery_eda8ea924aaa3972122082f3d304d6e67d46cde3c59fddbd27974d2603212fc1.json index 29d1cf16b88..6957a93f2ad 100644 Binary files a/packages/rs-sdk/tests/vectors/document_list_drive_query/msg_2024-04-24T00:37:29.598737000Z_DocumentQuery_f7b86e21e5bcf796a7c9d570c64ee4e5ee0324e5f38b49daf9dc9d1f1384bdae.json and b/packages/rs-sdk/tests/vectors/document_list_drive_query/msg_DocumentQuery_eda8ea924aaa3972122082f3d304d6e67d46cde3c59fddbd27974d2603212fc1.json differ diff --git a/packages/rs-sdk/tests/vectors/document_read_no_document/msg_2024-04-24T00:37:29.545143000Z_GetDataContractRequest_e87a2e6acef76975c30eb7272da71733fb6ad13495beb7ca1b6a6c4ceb30e0f7.json b/packages/rs-sdk/tests/vectors/document_list_drive_query/msg_GetDataContractRequest_e87a2e6acef76975c30eb7272da71733fb6ad13495beb7ca1b6a6c4ceb30e0f7.json similarity index 88% rename from packages/rs-sdk/tests/vectors/document_read_no_document/msg_2024-04-24T00:37:29.545143000Z_GetDataContractRequest_e87a2e6acef76975c30eb7272da71733fb6ad13495beb7ca1b6a6c4ceb30e0f7.json rename to packages/rs-sdk/tests/vectors/document_list_drive_query/msg_GetDataContractRequest_e87a2e6acef76975c30eb7272da71733fb6ad13495beb7ca1b6a6c4ceb30e0f7.json index a20af6fd4f9..35d918b6b3a 100644 Binary files a/packages/rs-sdk/tests/vectors/document_read_no_document/msg_2024-04-24T00:37:29.545143000Z_GetDataContractRequest_e87a2e6acef76975c30eb7272da71733fb6ad13495beb7ca1b6a6c4ceb30e0f7.json and b/packages/rs-sdk/tests/vectors/document_list_drive_query/msg_GetDataContractRequest_e87a2e6acef76975c30eb7272da71733fb6ad13495beb7ca1b6a6c4ceb30e0f7.json differ diff --git a/packages/rs-sdk/tests/vectors/document_list_drive_query/quorum_pubkey-106-32f78e1ab8f7beb1edc06a461c486e1afd90c1d4732f93cf8287fa0e9c27e35e.json b/packages/rs-sdk/tests/vectors/document_list_drive_query/quorum_pubkey-106-32f78e1ab8f7beb1edc06a461c486e1afd90c1d4732f93cf8287fa0e9c27e35e.json deleted file mode 100644 index ca9f21e7523..00000000000 --- a/packages/rs-sdk/tests/vectors/document_list_drive_query/quorum_pubkey-106-32f78e1ab8f7beb1edc06a461c486e1afd90c1d4732f93cf8287fa0e9c27e35e.json +++ /dev/null @@ -1 +0,0 @@ -[183,213,77,25,46,6,139,69,130,159,190,72,193,8,131,191,105,54,247,90,65,206,156,68,41,55,185,93,114,209,189,211,207,236,91,86,76,47,4,205,217,32,122,8,123,104,168,118] \ No newline at end of file diff --git a/packages/rs-sdk/tests/vectors/document_list_drive_query/quorum_pubkey-106-492dae0f1dd6ead4f24c870bd0c119aacf74ce5a6e2b6587fd5a1b4dd74623ae.json b/packages/rs-sdk/tests/vectors/document_list_drive_query/quorum_pubkey-106-492dae0f1dd6ead4f24c870bd0c119aacf74ce5a6e2b6587fd5a1b4dd74623ae.json new file mode 100644 index 00000000000..ccd69e38275 --- /dev/null +++ b/packages/rs-sdk/tests/vectors/document_list_drive_query/quorum_pubkey-106-492dae0f1dd6ead4f24c870bd0c119aacf74ce5a6e2b6587fd5a1b4dd74623ae.json @@ -0,0 +1 @@ +aa51132a4e62cec89b731aa8baf4043fea777c484a4856e3b7c9a13c651ff2a9057d30cd251190bde749ac8f7c0026b6 \ No newline at end of file diff --git a/packages/rs-sdk/tests/vectors/document_read/msg_DocumentQuery_22942c9d389d6b8518bda36199d5789c2cb3ec52359f6119ce08b53acca4ee93.json b/packages/rs-sdk/tests/vectors/document_read/msg_DocumentQuery_22942c9d389d6b8518bda36199d5789c2cb3ec52359f6119ce08b53acca4ee93.json new file mode 100644 index 00000000000..affacd4a01f Binary files /dev/null and b/packages/rs-sdk/tests/vectors/document_read/msg_DocumentQuery_22942c9d389d6b8518bda36199d5789c2cb3ec52359f6119ce08b53acca4ee93.json differ diff --git a/packages/rs-sdk/tests/vectors/document_list_document_query/msg_2024-04-24T00:37:29.598081000Z_DocumentQuery_466b07ebed6757e3497ed2487cd8a6c7c92c604537febea6e2287e0e3f386284.json b/packages/rs-sdk/tests/vectors/document_read/msg_DocumentQuery_bb911bae7a87785f351551f5d25a5ab933a8790ad5212dec1ee7aacc097d722b.json similarity index 72% rename from packages/rs-sdk/tests/vectors/document_list_document_query/msg_2024-04-24T00:37:29.598081000Z_DocumentQuery_466b07ebed6757e3497ed2487cd8a6c7c92c604537febea6e2287e0e3f386284.json rename to packages/rs-sdk/tests/vectors/document_read/msg_DocumentQuery_bb911bae7a87785f351551f5d25a5ab933a8790ad5212dec1ee7aacc097d722b.json index 2ba70ef6edf..d1ba9a23969 100644 Binary files a/packages/rs-sdk/tests/vectors/document_list_document_query/msg_2024-04-24T00:37:29.598081000Z_DocumentQuery_466b07ebed6757e3497ed2487cd8a6c7c92c604537febea6e2287e0e3f386284.json and b/packages/rs-sdk/tests/vectors/document_read/msg_DocumentQuery_bb911bae7a87785f351551f5d25a5ab933a8790ad5212dec1ee7aacc097d722b.json differ diff --git a/packages/rs-sdk/tests/vectors/document_list_drive_query/msg_2024-04-24T00:37:29.544194000Z_GetDataContractRequest_e87a2e6acef76975c30eb7272da71733fb6ad13495beb7ca1b6a6c4ceb30e0f7.json b/packages/rs-sdk/tests/vectors/document_read/msg_GetDataContractRequest_e87a2e6acef76975c30eb7272da71733fb6ad13495beb7ca1b6a6c4ceb30e0f7.json similarity index 88% rename from packages/rs-sdk/tests/vectors/document_list_drive_query/msg_2024-04-24T00:37:29.544194000Z_GetDataContractRequest_e87a2e6acef76975c30eb7272da71733fb6ad13495beb7ca1b6a6c4ceb30e0f7.json rename to packages/rs-sdk/tests/vectors/document_read/msg_GetDataContractRequest_e87a2e6acef76975c30eb7272da71733fb6ad13495beb7ca1b6a6c4ceb30e0f7.json index a20af6fd4f9..35d918b6b3a 100644 Binary files a/packages/rs-sdk/tests/vectors/document_list_drive_query/msg_2024-04-24T00:37:29.544194000Z_GetDataContractRequest_e87a2e6acef76975c30eb7272da71733fb6ad13495beb7ca1b6a6c4ceb30e0f7.json and b/packages/rs-sdk/tests/vectors/document_read/msg_GetDataContractRequest_e87a2e6acef76975c30eb7272da71733fb6ad13495beb7ca1b6a6c4ceb30e0f7.json differ diff --git a/packages/rs-sdk/tests/vectors/document_read/quorum_pubkey-106-32f78e1ab8f7beb1edc06a461c486e1afd90c1d4732f93cf8287fa0e9c27e35e.json b/packages/rs-sdk/tests/vectors/document_read/quorum_pubkey-106-32f78e1ab8f7beb1edc06a461c486e1afd90c1d4732f93cf8287fa0e9c27e35e.json deleted file mode 100644 index ca9f21e7523..00000000000 --- a/packages/rs-sdk/tests/vectors/document_read/quorum_pubkey-106-32f78e1ab8f7beb1edc06a461c486e1afd90c1d4732f93cf8287fa0e9c27e35e.json +++ /dev/null @@ -1 +0,0 @@ -[183,213,77,25,46,6,139,69,130,159,190,72,193,8,131,191,105,54,247,90,65,206,156,68,41,55,185,93,114,209,189,211,207,236,91,86,76,47,4,205,217,32,122,8,123,104,168,118] \ No newline at end of file diff --git a/packages/rs-sdk/tests/vectors/document_read/quorum_pubkey-106-492dae0f1dd6ead4f24c870bd0c119aacf74ce5a6e2b6587fd5a1b4dd74623ae.json b/packages/rs-sdk/tests/vectors/document_read/quorum_pubkey-106-492dae0f1dd6ead4f24c870bd0c119aacf74ce5a6e2b6587fd5a1b4dd74623ae.json new file mode 100644 index 00000000000..ccd69e38275 --- /dev/null +++ b/packages/rs-sdk/tests/vectors/document_read/quorum_pubkey-106-492dae0f1dd6ead4f24c870bd0c119aacf74ce5a6e2b6587fd5a1b4dd74623ae.json @@ -0,0 +1 @@ +aa51132a4e62cec89b731aa8baf4043fea777c484a4856e3b7c9a13c651ff2a9057d30cd251190bde749ac8f7c0026b6 \ No newline at end of file diff --git a/packages/rs-sdk/tests/vectors/document_read_no_contract/msg_2024-04-24T00:37:29.543524000Z_GetDataContractRequest_e4cf74168e03a40bd159451456b501c1ba166a2dd8f6efb31b0289dc011da983.json b/packages/rs-sdk/tests/vectors/document_read_no_contract/msg_GetDataContractRequest_e4cf74168e03a40bd159451456b501c1ba166a2dd8f6efb31b0289dc011da983.json similarity index 65% rename from packages/rs-sdk/tests/vectors/document_read_no_contract/msg_2024-04-24T00:37:29.543524000Z_GetDataContractRequest_e4cf74168e03a40bd159451456b501c1ba166a2dd8f6efb31b0289dc011da983.json rename to packages/rs-sdk/tests/vectors/document_read_no_contract/msg_GetDataContractRequest_e4cf74168e03a40bd159451456b501c1ba166a2dd8f6efb31b0289dc011da983.json index c3d5d74ec79..5a8009226cd 100644 Binary files a/packages/rs-sdk/tests/vectors/document_read_no_contract/msg_2024-04-24T00:37:29.543524000Z_GetDataContractRequest_e4cf74168e03a40bd159451456b501c1ba166a2dd8f6efb31b0289dc011da983.json and b/packages/rs-sdk/tests/vectors/document_read_no_contract/msg_GetDataContractRequest_e4cf74168e03a40bd159451456b501c1ba166a2dd8f6efb31b0289dc011da983.json differ diff --git a/packages/rs-sdk/tests/vectors/document_read_no_contract/quorum_pubkey-106-32f78e1ab8f7beb1edc06a461c486e1afd90c1d4732f93cf8287fa0e9c27e35e.json b/packages/rs-sdk/tests/vectors/document_read_no_contract/quorum_pubkey-106-32f78e1ab8f7beb1edc06a461c486e1afd90c1d4732f93cf8287fa0e9c27e35e.json deleted file mode 100644 index ca9f21e7523..00000000000 --- a/packages/rs-sdk/tests/vectors/document_read_no_contract/quorum_pubkey-106-32f78e1ab8f7beb1edc06a461c486e1afd90c1d4732f93cf8287fa0e9c27e35e.json +++ /dev/null @@ -1 +0,0 @@ -[183,213,77,25,46,6,139,69,130,159,190,72,193,8,131,191,105,54,247,90,65,206,156,68,41,55,185,93,114,209,189,211,207,236,91,86,76,47,4,205,217,32,122,8,123,104,168,118] \ No newline at end of file diff --git a/packages/rs-sdk/tests/vectors/document_read_no_contract/quorum_pubkey-106-492dae0f1dd6ead4f24c870bd0c119aacf74ce5a6e2b6587fd5a1b4dd74623ae.json b/packages/rs-sdk/tests/vectors/document_read_no_contract/quorum_pubkey-106-492dae0f1dd6ead4f24c870bd0c119aacf74ce5a6e2b6587fd5a1b4dd74623ae.json new file mode 100644 index 00000000000..ccd69e38275 --- /dev/null +++ b/packages/rs-sdk/tests/vectors/document_read_no_contract/quorum_pubkey-106-492dae0f1dd6ead4f24c870bd0c119aacf74ce5a6e2b6587fd5a1b4dd74623ae.json @@ -0,0 +1 @@ +aa51132a4e62cec89b731aa8baf4043fea777c484a4856e3b7c9a13c651ff2a9057d30cd251190bde749ac8f7c0026b6 \ No newline at end of file diff --git a/packages/rs-sdk/tests/vectors/document_read_no_document/msg_2024-04-24T00:37:29.598817000Z_DocumentQuery_d67f67ad2f9ff259ca475971fae971699f696f184c08c2a12a5930a1d6631661.json b/packages/rs-sdk/tests/vectors/document_read_no_document/msg_2024-04-24T00:37:29.598817000Z_DocumentQuery_d67f67ad2f9ff259ca475971fae971699f696f184c08c2a12a5930a1d6631661.json deleted file mode 100644 index 1fd3f33a522..00000000000 Binary files a/packages/rs-sdk/tests/vectors/document_read_no_document/msg_2024-04-24T00:37:29.598817000Z_DocumentQuery_d67f67ad2f9ff259ca475971fae971699f696f184c08c2a12a5930a1d6631661.json and /dev/null differ diff --git a/packages/rs-sdk/tests/vectors/document_read/msg_2024-04-24T00:37:29.611459000Z_DocumentQuery_254e866b054c1427a47d649d455dfd789f4e600ee4aa306f63d281b740f2d0e7.json b/packages/rs-sdk/tests/vectors/document_read_no_document/msg_DocumentQuery_730331421a5ff158d32f29e7ca145640b23ad6cd3c90cbb059fdefbcf0eb6b5e.json similarity index 77% rename from packages/rs-sdk/tests/vectors/document_read/msg_2024-04-24T00:37:29.611459000Z_DocumentQuery_254e866b054c1427a47d649d455dfd789f4e600ee4aa306f63d281b740f2d0e7.json rename to packages/rs-sdk/tests/vectors/document_read_no_document/msg_DocumentQuery_730331421a5ff158d32f29e7ca145640b23ad6cd3c90cbb059fdefbcf0eb6b5e.json index e92d96a3240..a42f34c97b0 100644 Binary files a/packages/rs-sdk/tests/vectors/document_read/msg_2024-04-24T00:37:29.611459000Z_DocumentQuery_254e866b054c1427a47d649d455dfd789f4e600ee4aa306f63d281b740f2d0e7.json and b/packages/rs-sdk/tests/vectors/document_read_no_document/msg_DocumentQuery_730331421a5ff158d32f29e7ca145640b23ad6cd3c90cbb059fdefbcf0eb6b5e.json differ diff --git a/packages/rs-sdk/tests/vectors/document_read_no_document/msg_GetDataContractRequest_e87a2e6acef76975c30eb7272da71733fb6ad13495beb7ca1b6a6c4ceb30e0f7.json b/packages/rs-sdk/tests/vectors/document_read_no_document/msg_GetDataContractRequest_e87a2e6acef76975c30eb7272da71733fb6ad13495beb7ca1b6a6c4ceb30e0f7.json new file mode 100644 index 00000000000..35d918b6b3a Binary files /dev/null and b/packages/rs-sdk/tests/vectors/document_read_no_document/msg_GetDataContractRequest_e87a2e6acef76975c30eb7272da71733fb6ad13495beb7ca1b6a6c4ceb30e0f7.json differ diff --git a/packages/rs-sdk/tests/vectors/document_read_no_document/quorum_pubkey-106-32f78e1ab8f7beb1edc06a461c486e1afd90c1d4732f93cf8287fa0e9c27e35e.json b/packages/rs-sdk/tests/vectors/document_read_no_document/quorum_pubkey-106-32f78e1ab8f7beb1edc06a461c486e1afd90c1d4732f93cf8287fa0e9c27e35e.json deleted file mode 100644 index ca9f21e7523..00000000000 --- a/packages/rs-sdk/tests/vectors/document_read_no_document/quorum_pubkey-106-32f78e1ab8f7beb1edc06a461c486e1afd90c1d4732f93cf8287fa0e9c27e35e.json +++ /dev/null @@ -1 +0,0 @@ -[183,213,77,25,46,6,139,69,130,159,190,72,193,8,131,191,105,54,247,90,65,206,156,68,41,55,185,93,114,209,189,211,207,236,91,86,76,47,4,205,217,32,122,8,123,104,168,118] \ No newline at end of file diff --git a/packages/rs-sdk/tests/vectors/document_read_no_document/quorum_pubkey-106-492dae0f1dd6ead4f24c870bd0c119aacf74ce5a6e2b6587fd5a1b4dd74623ae.json b/packages/rs-sdk/tests/vectors/document_read_no_document/quorum_pubkey-106-492dae0f1dd6ead4f24c870bd0c119aacf74ce5a6e2b6587fd5a1b4dd74623ae.json new file mode 100644 index 00000000000..ccd69e38275 --- /dev/null +++ b/packages/rs-sdk/tests/vectors/document_read_no_document/quorum_pubkey-106-492dae0f1dd6ead4f24c870bd0c119aacf74ce5a6e2b6587fd5a1b4dd74623ae.json @@ -0,0 +1 @@ +aa51132a4e62cec89b731aa8baf4043fea777c484a4856e3b7c9a13c651ff2a9057d30cd251190bde749ac8f7c0026b6 \ No newline at end of file diff --git a/packages/rs-sdk/tests/vectors/test_contested_resource_voters_for_identity_not_found/.gitkeep b/packages/rs-sdk/tests/vectors/test_contested_resource_voters_for_identity_not_found/.gitkeep new file mode 100644 index 00000000000..e69de29bb2d diff --git a/packages/rs-sdk/tests/vectors/test_contested_resource_voters_for_identity_not_found/data_contract-e668c659af66aee1e72c186dde7b5b7e0a1d712a09c40d5721f622bf53c53155.json b/packages/rs-sdk/tests/vectors/test_contested_resource_voters_for_identity_not_found/data_contract-e668c659af66aee1e72c186dde7b5b7e0a1d712a09c40d5721f622bf53c53155.json new file mode 100644 index 00000000000..e67826094c9 --- /dev/null +++ b/packages/rs-sdk/tests/vectors/test_contested_resource_voters_for_identity_not_found/data_contract-e668c659af66aee1e72c186dde7b5b7e0a1d712a09c40d5721f622bf53c53155.json @@ -0,0 +1 @@ +{"$format_version":"0","id":"GWRSAVFMjXx8HpQFaNJMqBV7MBgMK4br5UESsB4S31Ec","config":{"$format_version":"0","canBeDeleted":false,"readonly":false,"keepsHistory":false,"documentsKeepHistoryContractDefault":false,"documentsMutableContractDefault":true,"documentsCanBeDeletedContractDefault":true,"requiresIdentityEncryptionBoundedKey":null,"requiresIdentityDecryptionBoundedKey":null},"version":1,"ownerId":"4EfA9Jrvv3nnCFdSf7fad59851iiTRZ6Wcu6YVJ4iSeF","schemaDefs":null,"documentSchemas":{"domain":{"type":"object","documentsMutable":false,"canBeDeleted":false,"indices":[{"name":"parentNameAndLabel","properties":[{"normalizedParentDomainName":"asc"},{"normalizedLabel":"asc"}],"unique":true,"contested":{"fieldMatches":[{"field":"normalizedLabel","regexPattern":"^[a-zA-Z01]{3,19}$"}],"resolution":0,"description":"If the normalized label part of this index is less than 20 characters (all alphabet a-z and 0 and 1) then this index is non unique while contest resolution takes place."}},{"name":"dashIdentityId","properties":[{"records.dashUniqueIdentityId":"asc"}],"unique":true},{"name":"dashAlias","properties":[{"records.dashAliasIdentityId":"asc"}]}],"properties":{"label":{"type":"string","pattern":"^[a-zA-Z0-9][a-zA-Z0-9-]{0,61}[a-zA-Z0-9]$","minLength":3,"maxLength":63,"position":0,"description":"Domain label. e.g. 'Bob'."},"normalizedLabel":{"type":"string","pattern":"^[a-hj-km-np-z0-9][a-hj-km-np-z0-9-]{0,61}[a-hj-km-np-z0-9]$","maxLength":63,"position":1,"description":"Domain label converted to lowercase for case-insensitive uniqueness validation. \"o\", \"i\" and \"l\" replaced with \"0\" and \"1\" to mitigate homograph attack. e.g. 'b0b'","$comment":"Must be equal to the label in lowercase. \"o\", \"i\" and \"l\" must be replaced with \"0\" and \"1\"."},"parentDomainName":{"type":"string","pattern":"^$|^[a-zA-Z0-9][a-zA-Z0-9-]{0,61}[a-zA-Z0-9]$","minLength":0,"maxLength":63,"position":2,"description":"A full parent domain name. e.g. 'dash'."},"normalizedParentDomainName":{"type":"string","pattern":"^$|^[a-hj-km-np-z0-9][a-hj-km-np-z0-9-\\.]{0,61}[a-hj-km-np-z0-9]$","minLength":0,"maxLength":63,"position":3,"description":"A parent domain name in lowercase for case-insensitive uniqueness validation. \"o\", \"i\" and \"l\" replaced with \"0\" and \"1\" to mitigate homograph attack. e.g. 'dash'","$comment":"Must either be equal to an existing domain or empty to create a top level domain. \"o\", \"i\" and \"l\" must be replaced with \"0\" and \"1\". Only the data contract owner can create top level domains."},"preorderSalt":{"type":"array","byteArray":true,"minItems":32,"maxItems":32,"position":4,"description":"Salt used in the preorder document"},"records":{"type":"object","properties":{"dashUniqueIdentityId":{"type":"array","byteArray":true,"minItems":32,"maxItems":32,"position":0,"contentMediaType":"application/x.dash.dpp.identifier","description":"Identity ID to be used to create the primary name the Identity","$comment":"Must be equal to the document owner"},"dashAliasIdentityId":{"type":"array","byteArray":true,"minItems":32,"maxItems":32,"position":1,"contentMediaType":"application/x.dash.dpp.identifier","description":"Identity ID to be used to create alias names for the Identity","$comment":"Must be equal to the document owner"}},"minProperties":1,"maxProperties":1,"position":5,"additionalProperties":false,"$comment":"Constraint with max and min properties ensure that only one identity record is used - either a `dashUniqueIdentityId` or a `dashAliasIdentityId`"},"subdomainRules":{"type":"object","properties":{"allowSubdomains":{"type":"boolean","description":"This option defines who can create subdomains: true - anyone; false - only the domain owner","$comment":"Only the domain owner is allowed to create subdomains for non top-level domains","position":0}},"position":6,"description":"Subdomain rules allow domain owners to define rules for subdomains","additionalProperties":false,"required":["allowSubdomains"]}},"required":["label","normalizedLabel","normalizedParentDomainName","preorderSalt","records","subdomainRules"],"additionalProperties":false,"$comment":"In order to register a domain you need to create a preorder. The preorder step is needed to prevent man-in-the-middle attacks. normalizedLabel + '.' + normalizedParentDomain must not be longer than 253 chars length as defined by RFC 1035. Domain documents are immutable: modification and deletion are restricted"},"preorder":{"type":"object","documentsMutable":false,"canBeDeleted":true,"indices":[{"name":"saltedHash","properties":[{"saltedDomainHash":"asc"}],"unique":true}],"properties":{"saltedDomainHash":{"type":"array","byteArray":true,"minItems":32,"maxItems":32,"position":0,"description":"Double sha-256 of the concatenation of a 32 byte random salt and a normalized domain name"}},"required":["saltedDomainHash"],"additionalProperties":false,"$comment":"Preorder documents are immutable: modification and deletion are restricted"}}} \ No newline at end of file diff --git a/packages/rs-sdk/tests/vectors/test_contested_resource_voters_for_identity_not_found/msg_GetContestedResourceVotersForIdentityRequest_6ee5672ba607f7fd39968536cb5fa9c21aaa42d6cae81b7acd0e6ce350975d0e.json b/packages/rs-sdk/tests/vectors/test_contested_resource_voters_for_identity_not_found/msg_GetContestedResourceVotersForIdentityRequest_6ee5672ba607f7fd39968536cb5fa9c21aaa42d6cae81b7acd0e6ce350975d0e.json new file mode 100644 index 00000000000..9389d32b708 Binary files /dev/null and b/packages/rs-sdk/tests/vectors/test_contested_resource_voters_for_identity_not_found/msg_GetContestedResourceVotersForIdentityRequest_6ee5672ba607f7fd39968536cb5fa9c21aaa42d6cae81b7acd0e6ce350975d0e.json differ diff --git a/packages/rs-sdk/tests/vectors/test_contested_resource_voters_for_identity_not_found/msg_GetDataContractRequest_e87a2e6acef76975c30eb7272da71733fb6ad13495beb7ca1b6a6c4ceb30e0f7.json b/packages/rs-sdk/tests/vectors/test_contested_resource_voters_for_identity_not_found/msg_GetDataContractRequest_e87a2e6acef76975c30eb7272da71733fb6ad13495beb7ca1b6a6c4ceb30e0f7.json new file mode 100644 index 00000000000..35d918b6b3a Binary files /dev/null and b/packages/rs-sdk/tests/vectors/test_contested_resource_voters_for_identity_not_found/msg_GetDataContractRequest_e87a2e6acef76975c30eb7272da71733fb6ad13495beb7ca1b6a6c4ceb30e0f7.json differ diff --git a/packages/rs-sdk/tests/vectors/test_contested_resource_voters_for_identity_not_found/quorum_pubkey-106-492dae0f1dd6ead4f24c870bd0c119aacf74ce5a6e2b6587fd5a1b4dd74623ae.json b/packages/rs-sdk/tests/vectors/test_contested_resource_voters_for_identity_not_found/quorum_pubkey-106-492dae0f1dd6ead4f24c870bd0c119aacf74ce5a6e2b6587fd5a1b4dd74623ae.json new file mode 100644 index 00000000000..ccd69e38275 --- /dev/null +++ b/packages/rs-sdk/tests/vectors/test_contested_resource_voters_for_identity_not_found/quorum_pubkey-106-492dae0f1dd6ead4f24c870bd0c119aacf74ce5a6e2b6587fd5a1b4dd74623ae.json @@ -0,0 +1 @@ +aa51132a4e62cec89b731aa8baf4043fea777c484a4856e3b7c9a13c651ff2a9057d30cd251190bde749ac8f7c0026b6 \ No newline at end of file diff --git a/packages/rs-sdk/tests/vectors/test_contested_resources_ok/.gitkeep b/packages/rs-sdk/tests/vectors/test_contested_resources_ok/.gitkeep new file mode 100644 index 00000000000..e69de29bb2d diff --git a/packages/rs-sdk/tests/vectors/test_contested_resources_ok/data_contract-e668c659af66aee1e72c186dde7b5b7e0a1d712a09c40d5721f622bf53c53155.json b/packages/rs-sdk/tests/vectors/test_contested_resources_ok/data_contract-e668c659af66aee1e72c186dde7b5b7e0a1d712a09c40d5721f622bf53c53155.json new file mode 100644 index 00000000000..e67826094c9 --- /dev/null +++ b/packages/rs-sdk/tests/vectors/test_contested_resources_ok/data_contract-e668c659af66aee1e72c186dde7b5b7e0a1d712a09c40d5721f622bf53c53155.json @@ -0,0 +1 @@ +{"$format_version":"0","id":"GWRSAVFMjXx8HpQFaNJMqBV7MBgMK4br5UESsB4S31Ec","config":{"$format_version":"0","canBeDeleted":false,"readonly":false,"keepsHistory":false,"documentsKeepHistoryContractDefault":false,"documentsMutableContractDefault":true,"documentsCanBeDeletedContractDefault":true,"requiresIdentityEncryptionBoundedKey":null,"requiresIdentityDecryptionBoundedKey":null},"version":1,"ownerId":"4EfA9Jrvv3nnCFdSf7fad59851iiTRZ6Wcu6YVJ4iSeF","schemaDefs":null,"documentSchemas":{"domain":{"type":"object","documentsMutable":false,"canBeDeleted":false,"indices":[{"name":"parentNameAndLabel","properties":[{"normalizedParentDomainName":"asc"},{"normalizedLabel":"asc"}],"unique":true,"contested":{"fieldMatches":[{"field":"normalizedLabel","regexPattern":"^[a-zA-Z01]{3,19}$"}],"resolution":0,"description":"If the normalized label part of this index is less than 20 characters (all alphabet a-z and 0 and 1) then this index is non unique while contest resolution takes place."}},{"name":"dashIdentityId","properties":[{"records.dashUniqueIdentityId":"asc"}],"unique":true},{"name":"dashAlias","properties":[{"records.dashAliasIdentityId":"asc"}]}],"properties":{"label":{"type":"string","pattern":"^[a-zA-Z0-9][a-zA-Z0-9-]{0,61}[a-zA-Z0-9]$","minLength":3,"maxLength":63,"position":0,"description":"Domain label. e.g. 'Bob'."},"normalizedLabel":{"type":"string","pattern":"^[a-hj-km-np-z0-9][a-hj-km-np-z0-9-]{0,61}[a-hj-km-np-z0-9]$","maxLength":63,"position":1,"description":"Domain label converted to lowercase for case-insensitive uniqueness validation. \"o\", \"i\" and \"l\" replaced with \"0\" and \"1\" to mitigate homograph attack. e.g. 'b0b'","$comment":"Must be equal to the label in lowercase. \"o\", \"i\" and \"l\" must be replaced with \"0\" and \"1\"."},"parentDomainName":{"type":"string","pattern":"^$|^[a-zA-Z0-9][a-zA-Z0-9-]{0,61}[a-zA-Z0-9]$","minLength":0,"maxLength":63,"position":2,"description":"A full parent domain name. e.g. 'dash'."},"normalizedParentDomainName":{"type":"string","pattern":"^$|^[a-hj-km-np-z0-9][a-hj-km-np-z0-9-\\.]{0,61}[a-hj-km-np-z0-9]$","minLength":0,"maxLength":63,"position":3,"description":"A parent domain name in lowercase for case-insensitive uniqueness validation. \"o\", \"i\" and \"l\" replaced with \"0\" and \"1\" to mitigate homograph attack. e.g. 'dash'","$comment":"Must either be equal to an existing domain or empty to create a top level domain. \"o\", \"i\" and \"l\" must be replaced with \"0\" and \"1\". Only the data contract owner can create top level domains."},"preorderSalt":{"type":"array","byteArray":true,"minItems":32,"maxItems":32,"position":4,"description":"Salt used in the preorder document"},"records":{"type":"object","properties":{"dashUniqueIdentityId":{"type":"array","byteArray":true,"minItems":32,"maxItems":32,"position":0,"contentMediaType":"application/x.dash.dpp.identifier","description":"Identity ID to be used to create the primary name the Identity","$comment":"Must be equal to the document owner"},"dashAliasIdentityId":{"type":"array","byteArray":true,"minItems":32,"maxItems":32,"position":1,"contentMediaType":"application/x.dash.dpp.identifier","description":"Identity ID to be used to create alias names for the Identity","$comment":"Must be equal to the document owner"}},"minProperties":1,"maxProperties":1,"position":5,"additionalProperties":false,"$comment":"Constraint with max and min properties ensure that only one identity record is used - either a `dashUniqueIdentityId` or a `dashAliasIdentityId`"},"subdomainRules":{"type":"object","properties":{"allowSubdomains":{"type":"boolean","description":"This option defines who can create subdomains: true - anyone; false - only the domain owner","$comment":"Only the domain owner is allowed to create subdomains for non top-level domains","position":0}},"position":6,"description":"Subdomain rules allow domain owners to define rules for subdomains","additionalProperties":false,"required":["allowSubdomains"]}},"required":["label","normalizedLabel","normalizedParentDomainName","preorderSalt","records","subdomainRules"],"additionalProperties":false,"$comment":"In order to register a domain you need to create a preorder. The preorder step is needed to prevent man-in-the-middle attacks. normalizedLabel + '.' + normalizedParentDomain must not be longer than 253 chars length as defined by RFC 1035. Domain documents are immutable: modification and deletion are restricted"},"preorder":{"type":"object","documentsMutable":false,"canBeDeleted":true,"indices":[{"name":"saltedHash","properties":[{"saltedDomainHash":"asc"}],"unique":true}],"properties":{"saltedDomainHash":{"type":"array","byteArray":true,"minItems":32,"maxItems":32,"position":0,"description":"Double sha-256 of the concatenation of a 32 byte random salt and a normalized domain name"}},"required":["saltedDomainHash"],"additionalProperties":false,"$comment":"Preorder documents are immutable: modification and deletion are restricted"}}} \ No newline at end of file diff --git a/packages/rs-sdk/tests/vectors/test_identity_balance_revision_read/msg_2024-04-24T00:37:29.615871000Z_GetIdentityBalanceAndRevisionRequest_e4060c14ceaca6844d682c7393d7776113debe4287515ae60d0645da450a80a1.json b/packages/rs-sdk/tests/vectors/test_contested_resources_ok/msg_GetContestedResourcesRequest_c8608f7aed7bbe4ced03c9c23f1ce28a227def58e23c39e0384e0cc02fe6360b.json similarity index 65% rename from packages/rs-sdk/tests/vectors/test_identity_balance_revision_read/msg_2024-04-24T00:37:29.615871000Z_GetIdentityBalanceAndRevisionRequest_e4060c14ceaca6844d682c7393d7776113debe4287515ae60d0645da450a80a1.json rename to packages/rs-sdk/tests/vectors/test_contested_resources_ok/msg_GetContestedResourcesRequest_c8608f7aed7bbe4ced03c9c23f1ce28a227def58e23c39e0384e0cc02fe6360b.json index c23d877534b..bd808c99dbc 100644 Binary files a/packages/rs-sdk/tests/vectors/test_identity_balance_revision_read/msg_2024-04-24T00:37:29.615871000Z_GetIdentityBalanceAndRevisionRequest_e4060c14ceaca6844d682c7393d7776113debe4287515ae60d0645da450a80a1.json and b/packages/rs-sdk/tests/vectors/test_contested_resources_ok/msg_GetContestedResourcesRequest_c8608f7aed7bbe4ced03c9c23f1ce28a227def58e23c39e0384e0cc02fe6360b.json differ diff --git a/packages/rs-sdk/tests/vectors/test_contested_resources_ok/msg_GetDataContractRequest_e87a2e6acef76975c30eb7272da71733fb6ad13495beb7ca1b6a6c4ceb30e0f7.json b/packages/rs-sdk/tests/vectors/test_contested_resources_ok/msg_GetDataContractRequest_e87a2e6acef76975c30eb7272da71733fb6ad13495beb7ca1b6a6c4ceb30e0f7.json new file mode 100644 index 00000000000..8c90b65007f Binary files /dev/null and b/packages/rs-sdk/tests/vectors/test_contested_resources_ok/msg_GetDataContractRequest_e87a2e6acef76975c30eb7272da71733fb6ad13495beb7ca1b6a6c4ceb30e0f7.json differ diff --git a/packages/rs-sdk/tests/vectors/test_contested_resources_ok/quorum_pubkey-106-399f52014ff85abf36a169323ce01ac5667a0849e89fa3de829d3aba4306050b.json b/packages/rs-sdk/tests/vectors/test_contested_resources_ok/quorum_pubkey-106-399f52014ff85abf36a169323ce01ac5667a0849e89fa3de829d3aba4306050b.json new file mode 100644 index 00000000000..2a4e45b5ad5 --- /dev/null +++ b/packages/rs-sdk/tests/vectors/test_contested_resources_ok/quorum_pubkey-106-399f52014ff85abf36a169323ce01ac5667a0849e89fa3de829d3aba4306050b.json @@ -0,0 +1 @@ +980213d7bff3e7427a4fe50f78bd7a3442f12017e3aea9200b4a6d73f591796a80d73db20ec7bfd0decda3f1d57bbcee \ No newline at end of file diff --git a/packages/rs-sdk/tests/vectors/test_data_contract_history_read/msg_2024-04-26T12:12:57.324522000Z_GetDataContractHistoryRequest_9659531622bd289c14efcc20c8c036b2cfcb3e5818816e3bc8a7c250a9cf384e.json b/packages/rs-sdk/tests/vectors/test_data_contract_history_read/msg_2024-04-26T12:12:57.324522000Z_GetDataContractHistoryRequest_9659531622bd289c14efcc20c8c036b2cfcb3e5818816e3bc8a7c250a9cf384e.json deleted file mode 100644 index d09d7251385..00000000000 Binary files a/packages/rs-sdk/tests/vectors/test_data_contract_history_read/msg_2024-04-26T12:12:57.324522000Z_GetDataContractHistoryRequest_9659531622bd289c14efcc20c8c036b2cfcb3e5818816e3bc8a7c250a9cf384e.json and /dev/null differ diff --git a/packages/rs-sdk/tests/vectors/test_data_contract_history_read/quorum_pubkey-106-61ba8a20d570891f2ba1f7d30c1d16b80a691707cf7fd94a349b3c2cb029a601.json b/packages/rs-sdk/tests/vectors/test_data_contract_history_read/quorum_pubkey-106-61ba8a20d570891f2ba1f7d30c1d16b80a691707cf7fd94a349b3c2cb029a601.json deleted file mode 100644 index bed4309348f..00000000000 --- a/packages/rs-sdk/tests/vectors/test_data_contract_history_read/quorum_pubkey-106-61ba8a20d570891f2ba1f7d30c1d16b80a691707cf7fd94a349b3c2cb029a601.json +++ /dev/null @@ -1 +0,0 @@ -[140,189,175,71,98,121,233,120,71,207,91,48,163,17,244,248,75,84,17,15,148,190,121,226,87,25,99,23,140,63,240,67,249,255,41,0,216,142,186,97,243,57,221,222,107,11,110,19] \ No newline at end of file diff --git a/packages/rs-sdk/tests/vectors/test_data_contract_read/msg_2024-04-24T00:37:29.546319000Z_GetDataContractRequest_e87a2e6acef76975c30eb7272da71733fb6ad13495beb7ca1b6a6c4ceb30e0f7.json b/packages/rs-sdk/tests/vectors/test_data_contract_read/msg_2024-04-24T00:37:29.546319000Z_GetDataContractRequest_e87a2e6acef76975c30eb7272da71733fb6ad13495beb7ca1b6a6c4ceb30e0f7.json deleted file mode 100644 index a20af6fd4f9..00000000000 Binary files a/packages/rs-sdk/tests/vectors/test_data_contract_read/msg_2024-04-24T00:37:29.546319000Z_GetDataContractRequest_e87a2e6acef76975c30eb7272da71733fb6ad13495beb7ca1b6a6c4ceb30e0f7.json and /dev/null differ diff --git a/packages/rs-sdk/tests/vectors/test_data_contract_read/msg_GetDataContractRequest_e87a2e6acef76975c30eb7272da71733fb6ad13495beb7ca1b6a6c4ceb30e0f7.json b/packages/rs-sdk/tests/vectors/test_data_contract_read/msg_GetDataContractRequest_e87a2e6acef76975c30eb7272da71733fb6ad13495beb7ca1b6a6c4ceb30e0f7.json new file mode 100644 index 00000000000..35d918b6b3a Binary files /dev/null and b/packages/rs-sdk/tests/vectors/test_data_contract_read/msg_GetDataContractRequest_e87a2e6acef76975c30eb7272da71733fb6ad13495beb7ca1b6a6c4ceb30e0f7.json differ diff --git a/packages/rs-sdk/tests/vectors/test_data_contract_read/quorum_pubkey-106-32f78e1ab8f7beb1edc06a461c486e1afd90c1d4732f93cf8287fa0e9c27e35e.json b/packages/rs-sdk/tests/vectors/test_data_contract_read/quorum_pubkey-106-32f78e1ab8f7beb1edc06a461c486e1afd90c1d4732f93cf8287fa0e9c27e35e.json deleted file mode 100644 index ca9f21e7523..00000000000 --- a/packages/rs-sdk/tests/vectors/test_data_contract_read/quorum_pubkey-106-32f78e1ab8f7beb1edc06a461c486e1afd90c1d4732f93cf8287fa0e9c27e35e.json +++ /dev/null @@ -1 +0,0 @@ -[183,213,77,25,46,6,139,69,130,159,190,72,193,8,131,191,105,54,247,90,65,206,156,68,41,55,185,93,114,209,189,211,207,236,91,86,76,47,4,205,217,32,122,8,123,104,168,118] \ No newline at end of file diff --git a/packages/rs-sdk/tests/vectors/test_data_contract_read/quorum_pubkey-106-492dae0f1dd6ead4f24c870bd0c119aacf74ce5a6e2b6587fd5a1b4dd74623ae.json b/packages/rs-sdk/tests/vectors/test_data_contract_read/quorum_pubkey-106-492dae0f1dd6ead4f24c870bd0c119aacf74ce5a6e2b6587fd5a1b4dd74623ae.json new file mode 100644 index 00000000000..ccd69e38275 --- /dev/null +++ b/packages/rs-sdk/tests/vectors/test_data_contract_read/quorum_pubkey-106-492dae0f1dd6ead4f24c870bd0c119aacf74ce5a6e2b6587fd5a1b4dd74623ae.json @@ -0,0 +1 @@ +aa51132a4e62cec89b731aa8baf4043fea777c484a4856e3b7c9a13c651ff2a9057d30cd251190bde749ac8f7c0026b6 \ No newline at end of file diff --git a/packages/rs-sdk/tests/vectors/test_data_contract_read_not_found/msg_2024-04-24T00:37:29.544535000Z_GetDataContractRequest_1d1e53ab5e04d9ec5dce4ff9ac048c03122daf7ab2e77108f4bf44af1ad15eae.json b/packages/rs-sdk/tests/vectors/test_data_contract_read_not_found/msg_GetDataContractRequest_1d1e53ab5e04d9ec5dce4ff9ac048c03122daf7ab2e77108f4bf44af1ad15eae.json similarity index 65% rename from packages/rs-sdk/tests/vectors/test_data_contract_read_not_found/msg_2024-04-24T00:37:29.544535000Z_GetDataContractRequest_1d1e53ab5e04d9ec5dce4ff9ac048c03122daf7ab2e77108f4bf44af1ad15eae.json rename to packages/rs-sdk/tests/vectors/test_data_contract_read_not_found/msg_GetDataContractRequest_1d1e53ab5e04d9ec5dce4ff9ac048c03122daf7ab2e77108f4bf44af1ad15eae.json index 3cc40f9459e..00f5f92c8ca 100644 Binary files a/packages/rs-sdk/tests/vectors/test_data_contract_read_not_found/msg_2024-04-24T00:37:29.544535000Z_GetDataContractRequest_1d1e53ab5e04d9ec5dce4ff9ac048c03122daf7ab2e77108f4bf44af1ad15eae.json and b/packages/rs-sdk/tests/vectors/test_data_contract_read_not_found/msg_GetDataContractRequest_1d1e53ab5e04d9ec5dce4ff9ac048c03122daf7ab2e77108f4bf44af1ad15eae.json differ diff --git a/packages/rs-sdk/tests/vectors/test_data_contract_read_not_found/quorum_pubkey-106-32f78e1ab8f7beb1edc06a461c486e1afd90c1d4732f93cf8287fa0e9c27e35e.json b/packages/rs-sdk/tests/vectors/test_data_contract_read_not_found/quorum_pubkey-106-32f78e1ab8f7beb1edc06a461c486e1afd90c1d4732f93cf8287fa0e9c27e35e.json deleted file mode 100644 index ca9f21e7523..00000000000 --- a/packages/rs-sdk/tests/vectors/test_data_contract_read_not_found/quorum_pubkey-106-32f78e1ab8f7beb1edc06a461c486e1afd90c1d4732f93cf8287fa0e9c27e35e.json +++ /dev/null @@ -1 +0,0 @@ -[183,213,77,25,46,6,139,69,130,159,190,72,193,8,131,191,105,54,247,90,65,206,156,68,41,55,185,93,114,209,189,211,207,236,91,86,76,47,4,205,217,32,122,8,123,104,168,118] \ No newline at end of file diff --git a/packages/rs-sdk/tests/vectors/test_data_contract_read_not_found/quorum_pubkey-106-492dae0f1dd6ead4f24c870bd0c119aacf74ce5a6e2b6587fd5a1b4dd74623ae.json b/packages/rs-sdk/tests/vectors/test_data_contract_read_not_found/quorum_pubkey-106-492dae0f1dd6ead4f24c870bd0c119aacf74ce5a6e2b6587fd5a1b4dd74623ae.json new file mode 100644 index 00000000000..ccd69e38275 --- /dev/null +++ b/packages/rs-sdk/tests/vectors/test_data_contract_read_not_found/quorum_pubkey-106-492dae0f1dd6ead4f24c870bd0c119aacf74ce5a6e2b6587fd5a1b4dd74623ae.json @@ -0,0 +1 @@ +aa51132a4e62cec89b731aa8baf4043fea777c484a4856e3b7c9a13c651ff2a9057d30cd251190bde749ac8f7c0026b6 \ No newline at end of file diff --git a/packages/rs-sdk/tests/vectors/test_data_contracts_1_ok_1_nx/msg_GetDataContractsRequest_f229a0e58a5c4fb050f57c087bf067bd9ccc29eca3092a5664a5a9ba3bb7e967.json b/packages/rs-sdk/tests/vectors/test_data_contracts_1_ok_1_nx/msg_GetDataContractsRequest_f229a0e58a5c4fb050f57c087bf067bd9ccc29eca3092a5664a5a9ba3bb7e967.json new file mode 100644 index 00000000000..6cf23561eaf Binary files /dev/null and b/packages/rs-sdk/tests/vectors/test_data_contracts_1_ok_1_nx/msg_GetDataContractsRequest_f229a0e58a5c4fb050f57c087bf067bd9ccc29eca3092a5664a5a9ba3bb7e967.json differ diff --git a/packages/rs-sdk/tests/vectors/test_data_contracts_1_ok_1_nx/quorum_pubkey-106-32f78e1ab8f7beb1edc06a461c486e1afd90c1d4732f93cf8287fa0e9c27e35e.json b/packages/rs-sdk/tests/vectors/test_data_contracts_1_ok_1_nx/quorum_pubkey-106-32f78e1ab8f7beb1edc06a461c486e1afd90c1d4732f93cf8287fa0e9c27e35e.json deleted file mode 100644 index ca9f21e7523..00000000000 --- a/packages/rs-sdk/tests/vectors/test_data_contracts_1_ok_1_nx/quorum_pubkey-106-32f78e1ab8f7beb1edc06a461c486e1afd90c1d4732f93cf8287fa0e9c27e35e.json +++ /dev/null @@ -1 +0,0 @@ -[183,213,77,25,46,6,139,69,130,159,190,72,193,8,131,191,105,54,247,90,65,206,156,68,41,55,185,93,114,209,189,211,207,236,91,86,76,47,4,205,217,32,122,8,123,104,168,118] \ No newline at end of file diff --git a/packages/rs-sdk/tests/vectors/test_data_contracts_1_ok_1_nx/quorum_pubkey-106-492dae0f1dd6ead4f24c870bd0c119aacf74ce5a6e2b6587fd5a1b4dd74623ae.json b/packages/rs-sdk/tests/vectors/test_data_contracts_1_ok_1_nx/quorum_pubkey-106-492dae0f1dd6ead4f24c870bd0c119aacf74ce5a6e2b6587fd5a1b4dd74623ae.json new file mode 100644 index 00000000000..ccd69e38275 --- /dev/null +++ b/packages/rs-sdk/tests/vectors/test_data_contracts_1_ok_1_nx/quorum_pubkey-106-492dae0f1dd6ead4f24c870bd0c119aacf74ce5a6e2b6587fd5a1b4dd74623ae.json @@ -0,0 +1 @@ +aa51132a4e62cec89b731aa8baf4043fea777c484a4856e3b7c9a13c651ff2a9057d30cd251190bde749ac8f7c0026b6 \ No newline at end of file diff --git a/packages/rs-sdk/tests/vectors/test_data_contracts_2_nx/msg_2024-04-24T00:37:29.547687000Z_GetDataContractsRequest_93bdf343bce1bafb96fd873236cabbc4ac6ad7e80f0e55fe98bbcfbebf6c0878.json b/packages/rs-sdk/tests/vectors/test_data_contracts_2_nx/msg_GetDataContractsRequest_93bdf343bce1bafb96fd873236cabbc4ac6ad7e80f0e55fe98bbcfbebf6c0878.json similarity index 64% rename from packages/rs-sdk/tests/vectors/test_data_contracts_2_nx/msg_2024-04-24T00:37:29.547687000Z_GetDataContractsRequest_93bdf343bce1bafb96fd873236cabbc4ac6ad7e80f0e55fe98bbcfbebf6c0878.json rename to packages/rs-sdk/tests/vectors/test_data_contracts_2_nx/msg_GetDataContractsRequest_93bdf343bce1bafb96fd873236cabbc4ac6ad7e80f0e55fe98bbcfbebf6c0878.json index 4123a0044a3..d61907f1128 100644 Binary files a/packages/rs-sdk/tests/vectors/test_data_contracts_2_nx/msg_2024-04-24T00:37:29.547687000Z_GetDataContractsRequest_93bdf343bce1bafb96fd873236cabbc4ac6ad7e80f0e55fe98bbcfbebf6c0878.json and b/packages/rs-sdk/tests/vectors/test_data_contracts_2_nx/msg_GetDataContractsRequest_93bdf343bce1bafb96fd873236cabbc4ac6ad7e80f0e55fe98bbcfbebf6c0878.json differ diff --git a/packages/rs-sdk/tests/vectors/test_data_contracts_2_nx/quorum_pubkey-106-32f78e1ab8f7beb1edc06a461c486e1afd90c1d4732f93cf8287fa0e9c27e35e.json b/packages/rs-sdk/tests/vectors/test_data_contracts_2_nx/quorum_pubkey-106-32f78e1ab8f7beb1edc06a461c486e1afd90c1d4732f93cf8287fa0e9c27e35e.json deleted file mode 100644 index ca9f21e7523..00000000000 --- a/packages/rs-sdk/tests/vectors/test_data_contracts_2_nx/quorum_pubkey-106-32f78e1ab8f7beb1edc06a461c486e1afd90c1d4732f93cf8287fa0e9c27e35e.json +++ /dev/null @@ -1 +0,0 @@ -[183,213,77,25,46,6,139,69,130,159,190,72,193,8,131,191,105,54,247,90,65,206,156,68,41,55,185,93,114,209,189,211,207,236,91,86,76,47,4,205,217,32,122,8,123,104,168,118] \ No newline at end of file diff --git a/packages/rs-sdk/tests/vectors/test_data_contracts_2_nx/quorum_pubkey-106-492dae0f1dd6ead4f24c870bd0c119aacf74ce5a6e2b6587fd5a1b4dd74623ae.json b/packages/rs-sdk/tests/vectors/test_data_contracts_2_nx/quorum_pubkey-106-492dae0f1dd6ead4f24c870bd0c119aacf74ce5a6e2b6587fd5a1b4dd74623ae.json new file mode 100644 index 00000000000..ccd69e38275 --- /dev/null +++ b/packages/rs-sdk/tests/vectors/test_data_contracts_2_nx/quorum_pubkey-106-492dae0f1dd6ead4f24c870bd0c119aacf74ce5a6e2b6587fd5a1b4dd74623ae.json @@ -0,0 +1 @@ +aa51132a4e62cec89b731aa8baf4043fea777c484a4856e3b7c9a13c651ff2a9057d30cd251190bde749ac8f7c0026b6 \ No newline at end of file diff --git a/packages/rs-sdk/tests/vectors/test_epoch_fetch/msg_2024-04-24T00:37:29.754758000Z_GetEpochsInfoRequest_b2b426ac4a52cb4cb08904c63386caf3663c40a12d3b03827006d66058e439ac.json b/packages/rs-sdk/tests/vectors/test_epoch_fetch/msg_GetEpochsInfoRequest_b2b426ac4a52cb4cb08904c63386caf3663c40a12d3b03827006d66058e439ac.json similarity index 99% rename from packages/rs-sdk/tests/vectors/test_epoch_fetch/msg_2024-04-24T00:37:29.754758000Z_GetEpochsInfoRequest_b2b426ac4a52cb4cb08904c63386caf3663c40a12d3b03827006d66058e439ac.json rename to packages/rs-sdk/tests/vectors/test_epoch_fetch/msg_GetEpochsInfoRequest_b2b426ac4a52cb4cb08904c63386caf3663c40a12d3b03827006d66058e439ac.json index 4d1eaa7fe52..b1fada2de8e 100644 Binary files a/packages/rs-sdk/tests/vectors/test_epoch_fetch/msg_2024-04-24T00:37:29.754758000Z_GetEpochsInfoRequest_b2b426ac4a52cb4cb08904c63386caf3663c40a12d3b03827006d66058e439ac.json and b/packages/rs-sdk/tests/vectors/test_epoch_fetch/msg_GetEpochsInfoRequest_b2b426ac4a52cb4cb08904c63386caf3663c40a12d3b03827006d66058e439ac.json differ diff --git a/packages/rs-sdk/tests/vectors/test_epoch_list/msg_2024-04-24T00:37:29.599207000Z_GetIdentityRequest_e4060c14ceaca6844d682c7393d7776113debe4287515ae60d0645da450a80a1.json b/packages/rs-sdk/tests/vectors/test_epoch_fetch/msg_GetIdentityRequest_e4060c14ceaca6844d682c7393d7776113debe4287515ae60d0645da450a80a1.json similarity index 76% rename from packages/rs-sdk/tests/vectors/test_epoch_list/msg_2024-04-24T00:37:29.599207000Z_GetIdentityRequest_e4060c14ceaca6844d682c7393d7776113debe4287515ae60d0645da450a80a1.json rename to packages/rs-sdk/tests/vectors/test_epoch_fetch/msg_GetIdentityRequest_e4060c14ceaca6844d682c7393d7776113debe4287515ae60d0645da450a80a1.json index 883396a628a..d69a35e9da3 100644 Binary files a/packages/rs-sdk/tests/vectors/test_epoch_list/msg_2024-04-24T00:37:29.599207000Z_GetIdentityRequest_e4060c14ceaca6844d682c7393d7776113debe4287515ae60d0645da450a80a1.json and b/packages/rs-sdk/tests/vectors/test_epoch_fetch/msg_GetIdentityRequest_e4060c14ceaca6844d682c7393d7776113debe4287515ae60d0645da450a80a1.json differ diff --git a/packages/rs-sdk/tests/vectors/test_epoch_fetch/quorum_pubkey-106-32f78e1ab8f7beb1edc06a461c486e1afd90c1d4732f93cf8287fa0e9c27e35e.json b/packages/rs-sdk/tests/vectors/test_epoch_fetch/quorum_pubkey-106-32f78e1ab8f7beb1edc06a461c486e1afd90c1d4732f93cf8287fa0e9c27e35e.json deleted file mode 100644 index ca9f21e7523..00000000000 --- a/packages/rs-sdk/tests/vectors/test_epoch_fetch/quorum_pubkey-106-32f78e1ab8f7beb1edc06a461c486e1afd90c1d4732f93cf8287fa0e9c27e35e.json +++ /dev/null @@ -1 +0,0 @@ -[183,213,77,25,46,6,139,69,130,159,190,72,193,8,131,191,105,54,247,90,65,206,156,68,41,55,185,93,114,209,189,211,207,236,91,86,76,47,4,205,217,32,122,8,123,104,168,118] \ No newline at end of file diff --git a/packages/rs-sdk/tests/vectors/test_epoch_fetch/quorum_pubkey-106-492dae0f1dd6ead4f24c870bd0c119aacf74ce5a6e2b6587fd5a1b4dd74623ae.json b/packages/rs-sdk/tests/vectors/test_epoch_fetch/quorum_pubkey-106-492dae0f1dd6ead4f24c870bd0c119aacf74ce5a6e2b6587fd5a1b4dd74623ae.json new file mode 100644 index 00000000000..ccd69e38275 --- /dev/null +++ b/packages/rs-sdk/tests/vectors/test_epoch_fetch/quorum_pubkey-106-492dae0f1dd6ead4f24c870bd0c119aacf74ce5a6e2b6587fd5a1b4dd74623ae.json @@ -0,0 +1 @@ +aa51132a4e62cec89b731aa8baf4043fea777c484a4856e3b7c9a13c651ff2a9057d30cd251190bde749ac8f7c0026b6 \ No newline at end of file diff --git a/packages/rs-sdk/tests/vectors/test_epoch_fetch_current/msg_2024-04-24T00:37:29.606190000Z_GetEpochsInfoRequest_1b87e649557ccb609adb9e2904c67089535588985622579e77969e0ffd68afc7.json b/packages/rs-sdk/tests/vectors/test_epoch_fetch_current/msg_GetEpochsInfoRequest_1b87e649557ccb609adb9e2904c67089535588985622579e77969e0ffd68afc7.json similarity index 81% rename from packages/rs-sdk/tests/vectors/test_epoch_fetch_current/msg_2024-04-24T00:37:29.606190000Z_GetEpochsInfoRequest_1b87e649557ccb609adb9e2904c67089535588985622579e77969e0ffd68afc7.json rename to packages/rs-sdk/tests/vectors/test_epoch_fetch_current/msg_GetEpochsInfoRequest_1b87e649557ccb609adb9e2904c67089535588985622579e77969e0ffd68afc7.json index 4e023eea4ea..2dc6b692478 100644 Binary files a/packages/rs-sdk/tests/vectors/test_epoch_fetch_current/msg_2024-04-24T00:37:29.606190000Z_GetEpochsInfoRequest_1b87e649557ccb609adb9e2904c67089535588985622579e77969e0ffd68afc7.json and b/packages/rs-sdk/tests/vectors/test_epoch_fetch_current/msg_GetEpochsInfoRequest_1b87e649557ccb609adb9e2904c67089535588985622579e77969e0ffd68afc7.json differ diff --git a/packages/rs-sdk/tests/vectors/test_epoch_fetch_future/msg_2024-04-24T00:37:29.598638000Z_GetIdentityRequest_e4060c14ceaca6844d682c7393d7776113debe4287515ae60d0645da450a80a1.json b/packages/rs-sdk/tests/vectors/test_epoch_fetch_current/msg_GetIdentityRequest_e4060c14ceaca6844d682c7393d7776113debe4287515ae60d0645da450a80a1.json similarity index 76% rename from packages/rs-sdk/tests/vectors/test_epoch_fetch_future/msg_2024-04-24T00:37:29.598638000Z_GetIdentityRequest_e4060c14ceaca6844d682c7393d7776113debe4287515ae60d0645da450a80a1.json rename to packages/rs-sdk/tests/vectors/test_epoch_fetch_current/msg_GetIdentityRequest_e4060c14ceaca6844d682c7393d7776113debe4287515ae60d0645da450a80a1.json index 883396a628a..d69a35e9da3 100644 Binary files a/packages/rs-sdk/tests/vectors/test_epoch_fetch_future/msg_2024-04-24T00:37:29.598638000Z_GetIdentityRequest_e4060c14ceaca6844d682c7393d7776113debe4287515ae60d0645da450a80a1.json and b/packages/rs-sdk/tests/vectors/test_epoch_fetch_current/msg_GetIdentityRequest_e4060c14ceaca6844d682c7393d7776113debe4287515ae60d0645da450a80a1.json differ diff --git a/packages/rs-sdk/tests/vectors/test_epoch_fetch_current/quorum_pubkey-106-32f78e1ab8f7beb1edc06a461c486e1afd90c1d4732f93cf8287fa0e9c27e35e.json b/packages/rs-sdk/tests/vectors/test_epoch_fetch_current/quorum_pubkey-106-32f78e1ab8f7beb1edc06a461c486e1afd90c1d4732f93cf8287fa0e9c27e35e.json deleted file mode 100644 index ca9f21e7523..00000000000 --- a/packages/rs-sdk/tests/vectors/test_epoch_fetch_current/quorum_pubkey-106-32f78e1ab8f7beb1edc06a461c486e1afd90c1d4732f93cf8287fa0e9c27e35e.json +++ /dev/null @@ -1 +0,0 @@ -[183,213,77,25,46,6,139,69,130,159,190,72,193,8,131,191,105,54,247,90,65,206,156,68,41,55,185,93,114,209,189,211,207,236,91,86,76,47,4,205,217,32,122,8,123,104,168,118] \ No newline at end of file diff --git a/packages/rs-sdk/tests/vectors/test_epoch_fetch_current/quorum_pubkey-106-492dae0f1dd6ead4f24c870bd0c119aacf74ce5a6e2b6587fd5a1b4dd74623ae.json b/packages/rs-sdk/tests/vectors/test_epoch_fetch_current/quorum_pubkey-106-492dae0f1dd6ead4f24c870bd0c119aacf74ce5a6e2b6587fd5a1b4dd74623ae.json new file mode 100644 index 00000000000..ccd69e38275 --- /dev/null +++ b/packages/rs-sdk/tests/vectors/test_epoch_fetch_current/quorum_pubkey-106-492dae0f1dd6ead4f24c870bd0c119aacf74ce5a6e2b6587fd5a1b4dd74623ae.json @@ -0,0 +1 @@ +aa51132a4e62cec89b731aa8baf4043fea777c484a4856e3b7c9a13c651ff2a9057d30cd251190bde749ac8f7c0026b6 \ No newline at end of file diff --git a/packages/rs-sdk/tests/vectors/test_epoch_fetch_future/msg_2024-04-24T00:37:30.085258000Z_GetEpochsInfoRequest_6a828350e795a088dbc835260a1add01a7428085ffdcf1e11cccf19c48c5f7a1.json b/packages/rs-sdk/tests/vectors/test_epoch_fetch_future/msg_GetEpochsInfoRequest_6a828350e795a088dbc835260a1add01a7428085ffdcf1e11cccf19c48c5f7a1.json similarity index 99% rename from packages/rs-sdk/tests/vectors/test_epoch_fetch_future/msg_2024-04-24T00:37:30.085258000Z_GetEpochsInfoRequest_6a828350e795a088dbc835260a1add01a7428085ffdcf1e11cccf19c48c5f7a1.json rename to packages/rs-sdk/tests/vectors/test_epoch_fetch_future/msg_GetEpochsInfoRequest_6a828350e795a088dbc835260a1add01a7428085ffdcf1e11cccf19c48c5f7a1.json index 374fc7868a5..0506a2793bb 100644 Binary files a/packages/rs-sdk/tests/vectors/test_epoch_fetch_future/msg_2024-04-24T00:37:30.085258000Z_GetEpochsInfoRequest_6a828350e795a088dbc835260a1add01a7428085ffdcf1e11cccf19c48c5f7a1.json and b/packages/rs-sdk/tests/vectors/test_epoch_fetch_future/msg_GetEpochsInfoRequest_6a828350e795a088dbc835260a1add01a7428085ffdcf1e11cccf19c48c5f7a1.json differ diff --git a/packages/rs-sdk/tests/vectors/test_epoch_fetch/msg_2024-04-24T00:37:29.599078000Z_GetIdentityRequest_e4060c14ceaca6844d682c7393d7776113debe4287515ae60d0645da450a80a1.json b/packages/rs-sdk/tests/vectors/test_epoch_fetch_future/msg_GetIdentityRequest_e4060c14ceaca6844d682c7393d7776113debe4287515ae60d0645da450a80a1.json similarity index 76% rename from packages/rs-sdk/tests/vectors/test_epoch_fetch/msg_2024-04-24T00:37:29.599078000Z_GetIdentityRequest_e4060c14ceaca6844d682c7393d7776113debe4287515ae60d0645da450a80a1.json rename to packages/rs-sdk/tests/vectors/test_epoch_fetch_future/msg_GetIdentityRequest_e4060c14ceaca6844d682c7393d7776113debe4287515ae60d0645da450a80a1.json index 883396a628a..d69a35e9da3 100644 Binary files a/packages/rs-sdk/tests/vectors/test_epoch_fetch/msg_2024-04-24T00:37:29.599078000Z_GetIdentityRequest_e4060c14ceaca6844d682c7393d7776113debe4287515ae60d0645da450a80a1.json and b/packages/rs-sdk/tests/vectors/test_epoch_fetch_future/msg_GetIdentityRequest_e4060c14ceaca6844d682c7393d7776113debe4287515ae60d0645da450a80a1.json differ diff --git a/packages/rs-sdk/tests/vectors/test_epoch_fetch_future/quorum_pubkey-106-32f78e1ab8f7beb1edc06a461c486e1afd90c1d4732f93cf8287fa0e9c27e35e.json b/packages/rs-sdk/tests/vectors/test_epoch_fetch_future/quorum_pubkey-106-32f78e1ab8f7beb1edc06a461c486e1afd90c1d4732f93cf8287fa0e9c27e35e.json deleted file mode 100644 index ca9f21e7523..00000000000 --- a/packages/rs-sdk/tests/vectors/test_epoch_fetch_future/quorum_pubkey-106-32f78e1ab8f7beb1edc06a461c486e1afd90c1d4732f93cf8287fa0e9c27e35e.json +++ /dev/null @@ -1 +0,0 @@ -[183,213,77,25,46,6,139,69,130,159,190,72,193,8,131,191,105,54,247,90,65,206,156,68,41,55,185,93,114,209,189,211,207,236,91,86,76,47,4,205,217,32,122,8,123,104,168,118] \ No newline at end of file diff --git a/packages/rs-sdk/tests/vectors/test_epoch_fetch_future/quorum_pubkey-106-492dae0f1dd6ead4f24c870bd0c119aacf74ce5a6e2b6587fd5a1b4dd74623ae.json b/packages/rs-sdk/tests/vectors/test_epoch_fetch_future/quorum_pubkey-106-492dae0f1dd6ead4f24c870bd0c119aacf74ce5a6e2b6587fd5a1b4dd74623ae.json new file mode 100644 index 00000000000..ccd69e38275 --- /dev/null +++ b/packages/rs-sdk/tests/vectors/test_epoch_fetch_future/quorum_pubkey-106-492dae0f1dd6ead4f24c870bd0c119aacf74ce5a6e2b6587fd5a1b4dd74623ae.json @@ -0,0 +1 @@ +aa51132a4e62cec89b731aa8baf4043fea777c484a4856e3b7c9a13c651ff2a9057d30cd251190bde749ac8f7c0026b6 \ No newline at end of file diff --git a/packages/rs-sdk/tests/vectors/test_epoch_list/msg_2024-04-24T00:37:30.072218000Z_GetEpochsInfoRequest_734f6594c67fe6a9ab170191031d592c8fe7361bed628d9a36747664c9789bf1.json b/packages/rs-sdk/tests/vectors/test_epoch_list/msg_GetEpochsInfoRequest_734f6594c67fe6a9ab170191031d592c8fe7361bed628d9a36747664c9789bf1.json similarity index 99% rename from packages/rs-sdk/tests/vectors/test_epoch_list/msg_2024-04-24T00:37:30.072218000Z_GetEpochsInfoRequest_734f6594c67fe6a9ab170191031d592c8fe7361bed628d9a36747664c9789bf1.json rename to packages/rs-sdk/tests/vectors/test_epoch_list/msg_GetEpochsInfoRequest_734f6594c67fe6a9ab170191031d592c8fe7361bed628d9a36747664c9789bf1.json index 34407691cb2..2902f498307 100644 Binary files a/packages/rs-sdk/tests/vectors/test_epoch_list/msg_2024-04-24T00:37:30.072218000Z_GetEpochsInfoRequest_734f6594c67fe6a9ab170191031d592c8fe7361bed628d9a36747664c9789bf1.json and b/packages/rs-sdk/tests/vectors/test_epoch_list/msg_GetEpochsInfoRequest_734f6594c67fe6a9ab170191031d592c8fe7361bed628d9a36747664c9789bf1.json differ diff --git a/packages/rs-sdk/tests/vectors/test_epoch_list/msg_GetIdentityRequest_e4060c14ceaca6844d682c7393d7776113debe4287515ae60d0645da450a80a1.json b/packages/rs-sdk/tests/vectors/test_epoch_list/msg_GetIdentityRequest_e4060c14ceaca6844d682c7393d7776113debe4287515ae60d0645da450a80a1.json new file mode 100644 index 00000000000..d69a35e9da3 Binary files /dev/null and b/packages/rs-sdk/tests/vectors/test_epoch_list/msg_GetIdentityRequest_e4060c14ceaca6844d682c7393d7776113debe4287515ae60d0645da450a80a1.json differ diff --git a/packages/rs-sdk/tests/vectors/test_epoch_list/quorum_pubkey-106-32f78e1ab8f7beb1edc06a461c486e1afd90c1d4732f93cf8287fa0e9c27e35e.json b/packages/rs-sdk/tests/vectors/test_epoch_list/quorum_pubkey-106-32f78e1ab8f7beb1edc06a461c486e1afd90c1d4732f93cf8287fa0e9c27e35e.json deleted file mode 100644 index ca9f21e7523..00000000000 --- a/packages/rs-sdk/tests/vectors/test_epoch_list/quorum_pubkey-106-32f78e1ab8f7beb1edc06a461c486e1afd90c1d4732f93cf8287fa0e9c27e35e.json +++ /dev/null @@ -1 +0,0 @@ -[183,213,77,25,46,6,139,69,130,159,190,72,193,8,131,191,105,54,247,90,65,206,156,68,41,55,185,93,114,209,189,211,207,236,91,86,76,47,4,205,217,32,122,8,123,104,168,118] \ No newline at end of file diff --git a/packages/rs-sdk/tests/vectors/test_epoch_list/quorum_pubkey-106-492dae0f1dd6ead4f24c870bd0c119aacf74ce5a6e2b6587fd5a1b4dd74623ae.json b/packages/rs-sdk/tests/vectors/test_epoch_list/quorum_pubkey-106-492dae0f1dd6ead4f24c870bd0c119aacf74ce5a6e2b6587fd5a1b4dd74623ae.json new file mode 100644 index 00000000000..ccd69e38275 --- /dev/null +++ b/packages/rs-sdk/tests/vectors/test_epoch_list/quorum_pubkey-106-492dae0f1dd6ead4f24c870bd0c119aacf74ce5a6e2b6587fd5a1b4dd74623ae.json @@ -0,0 +1 @@ +aa51132a4e62cec89b731aa8baf4043fea777c484a4856e3b7c9a13c651ff2a9057d30cd251190bde749ac8f7c0026b6 \ No newline at end of file diff --git a/packages/rs-sdk/tests/vectors/test_epoch_list_limit/msg_2024-04-24T00:37:29.599593000Z_GetIdentityRequest_e4060c14ceaca6844d682c7393d7776113debe4287515ae60d0645da450a80a1.json b/packages/rs-sdk/tests/vectors/test_epoch_list_limit/msg_2024-04-24T00:37:29.599593000Z_GetIdentityRequest_e4060c14ceaca6844d682c7393d7776113debe4287515ae60d0645da450a80a1.json deleted file mode 100644 index 883396a628a..00000000000 Binary files a/packages/rs-sdk/tests/vectors/test_epoch_list_limit/msg_2024-04-24T00:37:29.599593000Z_GetIdentityRequest_e4060c14ceaca6844d682c7393d7776113debe4287515ae60d0645da450a80a1.json and /dev/null differ diff --git a/packages/rs-sdk/tests/vectors/test_epoch_list_limit/msg_2024-04-24T00:37:30.072303000Z_GetEpochsInfoRequest_ae2b6b4e09e8e68e73f2df9af38b0b93d9d2e841a5e3d60755f8e7be3b93315b.json b/packages/rs-sdk/tests/vectors/test_epoch_list_limit/msg_GetEpochsInfoRequest_ae2b6b4e09e8e68e73f2df9af38b0b93d9d2e841a5e3d60755f8e7be3b93315b.json similarity index 99% rename from packages/rs-sdk/tests/vectors/test_epoch_list_limit/msg_2024-04-24T00:37:30.072303000Z_GetEpochsInfoRequest_ae2b6b4e09e8e68e73f2df9af38b0b93d9d2e841a5e3d60755f8e7be3b93315b.json rename to packages/rs-sdk/tests/vectors/test_epoch_list_limit/msg_GetEpochsInfoRequest_ae2b6b4e09e8e68e73f2df9af38b0b93d9d2e841a5e3d60755f8e7be3b93315b.json index 30a0e8c0d78..0b20e69ccd3 100644 Binary files a/packages/rs-sdk/tests/vectors/test_epoch_list_limit/msg_2024-04-24T00:37:30.072303000Z_GetEpochsInfoRequest_ae2b6b4e09e8e68e73f2df9af38b0b93d9d2e841a5e3d60755f8e7be3b93315b.json and b/packages/rs-sdk/tests/vectors/test_epoch_list_limit/msg_GetEpochsInfoRequest_ae2b6b4e09e8e68e73f2df9af38b0b93d9d2e841a5e3d60755f8e7be3b93315b.json differ diff --git a/packages/rs-sdk/tests/vectors/test_epoch_list_limit/msg_GetIdentityRequest_e4060c14ceaca6844d682c7393d7776113debe4287515ae60d0645da450a80a1.json b/packages/rs-sdk/tests/vectors/test_epoch_list_limit/msg_GetIdentityRequest_e4060c14ceaca6844d682c7393d7776113debe4287515ae60d0645da450a80a1.json new file mode 100644 index 00000000000..d69a35e9da3 Binary files /dev/null and b/packages/rs-sdk/tests/vectors/test_epoch_list_limit/msg_GetIdentityRequest_e4060c14ceaca6844d682c7393d7776113debe4287515ae60d0645da450a80a1.json differ diff --git a/packages/rs-sdk/tests/vectors/test_epoch_list_limit/quorum_pubkey-106-32f78e1ab8f7beb1edc06a461c486e1afd90c1d4732f93cf8287fa0e9c27e35e.json b/packages/rs-sdk/tests/vectors/test_epoch_list_limit/quorum_pubkey-106-32f78e1ab8f7beb1edc06a461c486e1afd90c1d4732f93cf8287fa0e9c27e35e.json deleted file mode 100644 index ca9f21e7523..00000000000 --- a/packages/rs-sdk/tests/vectors/test_epoch_list_limit/quorum_pubkey-106-32f78e1ab8f7beb1edc06a461c486e1afd90c1d4732f93cf8287fa0e9c27e35e.json +++ /dev/null @@ -1 +0,0 @@ -[183,213,77,25,46,6,139,69,130,159,190,72,193,8,131,191,105,54,247,90,65,206,156,68,41,55,185,93,114,209,189,211,207,236,91,86,76,47,4,205,217,32,122,8,123,104,168,118] \ No newline at end of file diff --git a/packages/rs-sdk/tests/vectors/test_epoch_list_limit/quorum_pubkey-106-492dae0f1dd6ead4f24c870bd0c119aacf74ce5a6e2b6587fd5a1b4dd74623ae.json b/packages/rs-sdk/tests/vectors/test_epoch_list_limit/quorum_pubkey-106-492dae0f1dd6ead4f24c870bd0c119aacf74ce5a6e2b6587fd5a1b4dd74623ae.json new file mode 100644 index 00000000000..ccd69e38275 --- /dev/null +++ b/packages/rs-sdk/tests/vectors/test_epoch_list_limit/quorum_pubkey-106-492dae0f1dd6ead4f24c870bd0c119aacf74ce5a6e2b6587fd5a1b4dd74623ae.json @@ -0,0 +1 @@ +aa51132a4e62cec89b731aa8baf4043fea777c484a4856e3b7c9a13c651ff2a9057d30cd251190bde749ac8f7c0026b6 \ No newline at end of file diff --git a/packages/rs-sdk/tests/vectors/test_identity_balance_read/msg_2024-04-24T00:37:29.611908000Z_GetIdentityBalanceRequest_e4060c14ceaca6844d682c7393d7776113debe4287515ae60d0645da450a80a1.json b/packages/rs-sdk/tests/vectors/test_identity_balance_read/msg_GetIdentityBalanceRequest_e4060c14ceaca6844d682c7393d7776113debe4287515ae60d0645da450a80a1.json similarity index 70% rename from packages/rs-sdk/tests/vectors/test_identity_balance_read/msg_2024-04-24T00:37:29.611908000Z_GetIdentityBalanceRequest_e4060c14ceaca6844d682c7393d7776113debe4287515ae60d0645da450a80a1.json rename to packages/rs-sdk/tests/vectors/test_identity_balance_read/msg_GetIdentityBalanceRequest_e4060c14ceaca6844d682c7393d7776113debe4287515ae60d0645da450a80a1.json index ed92121f133..8901dbb1cb2 100644 Binary files a/packages/rs-sdk/tests/vectors/test_identity_balance_read/msg_2024-04-24T00:37:29.611908000Z_GetIdentityBalanceRequest_e4060c14ceaca6844d682c7393d7776113debe4287515ae60d0645da450a80a1.json and b/packages/rs-sdk/tests/vectors/test_identity_balance_read/msg_GetIdentityBalanceRequest_e4060c14ceaca6844d682c7393d7776113debe4287515ae60d0645da450a80a1.json differ diff --git a/packages/rs-sdk/tests/vectors/test_identity_balance_read/quorum_pubkey-106-32f78e1ab8f7beb1edc06a461c486e1afd90c1d4732f93cf8287fa0e9c27e35e.json b/packages/rs-sdk/tests/vectors/test_identity_balance_read/quorum_pubkey-106-32f78e1ab8f7beb1edc06a461c486e1afd90c1d4732f93cf8287fa0e9c27e35e.json deleted file mode 100644 index ca9f21e7523..00000000000 --- a/packages/rs-sdk/tests/vectors/test_identity_balance_read/quorum_pubkey-106-32f78e1ab8f7beb1edc06a461c486e1afd90c1d4732f93cf8287fa0e9c27e35e.json +++ /dev/null @@ -1 +0,0 @@ -[183,213,77,25,46,6,139,69,130,159,190,72,193,8,131,191,105,54,247,90,65,206,156,68,41,55,185,93,114,209,189,211,207,236,91,86,76,47,4,205,217,32,122,8,123,104,168,118] \ No newline at end of file diff --git a/packages/rs-sdk/tests/vectors/test_identity_balance_read/quorum_pubkey-106-492dae0f1dd6ead4f24c870bd0c119aacf74ce5a6e2b6587fd5a1b4dd74623ae.json b/packages/rs-sdk/tests/vectors/test_identity_balance_read/quorum_pubkey-106-492dae0f1dd6ead4f24c870bd0c119aacf74ce5a6e2b6587fd5a1b4dd74623ae.json new file mode 100644 index 00000000000..ccd69e38275 --- /dev/null +++ b/packages/rs-sdk/tests/vectors/test_identity_balance_read/quorum_pubkey-106-492dae0f1dd6ead4f24c870bd0c119aacf74ce5a6e2b6587fd5a1b4dd74623ae.json @@ -0,0 +1 @@ +aa51132a4e62cec89b731aa8baf4043fea777c484a4856e3b7c9a13c651ff2a9057d30cd251190bde749ac8f7c0026b6 \ No newline at end of file diff --git a/packages/rs-sdk/tests/vectors/test_epoch_fetch_current/msg_2024-04-24T00:37:29.598966000Z_GetIdentityRequest_e4060c14ceaca6844d682c7393d7776113debe4287515ae60d0645da450a80a1.json b/packages/rs-sdk/tests/vectors/test_identity_balance_revision_read/msg_GetIdentityBalanceAndRevisionRequest_e4060c14ceaca6844d682c7393d7776113debe4287515ae60d0645da450a80a1.json similarity index 77% rename from packages/rs-sdk/tests/vectors/test_epoch_fetch_current/msg_2024-04-24T00:37:29.598966000Z_GetIdentityRequest_e4060c14ceaca6844d682c7393d7776113debe4287515ae60d0645da450a80a1.json rename to packages/rs-sdk/tests/vectors/test_identity_balance_revision_read/msg_GetIdentityBalanceAndRevisionRequest_e4060c14ceaca6844d682c7393d7776113debe4287515ae60d0645da450a80a1.json index 883396a628a..0ffb06a6acf 100644 Binary files a/packages/rs-sdk/tests/vectors/test_epoch_fetch_current/msg_2024-04-24T00:37:29.598966000Z_GetIdentityRequest_e4060c14ceaca6844d682c7393d7776113debe4287515ae60d0645da450a80a1.json and b/packages/rs-sdk/tests/vectors/test_identity_balance_revision_read/msg_GetIdentityBalanceAndRevisionRequest_e4060c14ceaca6844d682c7393d7776113debe4287515ae60d0645da450a80a1.json differ diff --git a/packages/rs-sdk/tests/vectors/test_identity_balance_revision_read/quorum_pubkey-106-32f78e1ab8f7beb1edc06a461c486e1afd90c1d4732f93cf8287fa0e9c27e35e.json b/packages/rs-sdk/tests/vectors/test_identity_balance_revision_read/quorum_pubkey-106-32f78e1ab8f7beb1edc06a461c486e1afd90c1d4732f93cf8287fa0e9c27e35e.json deleted file mode 100644 index ca9f21e7523..00000000000 --- a/packages/rs-sdk/tests/vectors/test_identity_balance_revision_read/quorum_pubkey-106-32f78e1ab8f7beb1edc06a461c486e1afd90c1d4732f93cf8287fa0e9c27e35e.json +++ /dev/null @@ -1 +0,0 @@ -[183,213,77,25,46,6,139,69,130,159,190,72,193,8,131,191,105,54,247,90,65,206,156,68,41,55,185,93,114,209,189,211,207,236,91,86,76,47,4,205,217,32,122,8,123,104,168,118] \ No newline at end of file diff --git a/packages/rs-sdk/tests/vectors/test_identity_balance_revision_read/quorum_pubkey-106-492dae0f1dd6ead4f24c870bd0c119aacf74ce5a6e2b6587fd5a1b4dd74623ae.json b/packages/rs-sdk/tests/vectors/test_identity_balance_revision_read/quorum_pubkey-106-492dae0f1dd6ead4f24c870bd0c119aacf74ce5a6e2b6587fd5a1b4dd74623ae.json new file mode 100644 index 00000000000..ccd69e38275 --- /dev/null +++ b/packages/rs-sdk/tests/vectors/test_identity_balance_revision_read/quorum_pubkey-106-492dae0f1dd6ead4f24c870bd0c119aacf74ce5a6e2b6587fd5a1b4dd74623ae.json @@ -0,0 +1 @@ +aa51132a4e62cec89b731aa8baf4043fea777c484a4856e3b7c9a13c651ff2a9057d30cd251190bde749ac8f7c0026b6 \ No newline at end of file diff --git a/packages/rs-sdk/tests/vectors/test_identity_contract_no_nonce_read/msg_2024-04-24T00:37:29.632356000Z_GetIdentityContractNonceRequest_b7c02dae0c3c762ece1f70a36f88fa69b4749b19cc1f5ef0abf37fa0c04ab2ef.json b/packages/rs-sdk/tests/vectors/test_identity_contract_no_nonce_read/msg_GetIdentityContractNonceRequest_b7c02dae0c3c762ece1f70a36f88fa69b4749b19cc1f5ef0abf37fa0c04ab2ef.json similarity index 66% rename from packages/rs-sdk/tests/vectors/test_identity_contract_no_nonce_read/msg_2024-04-24T00:37:29.632356000Z_GetIdentityContractNonceRequest_b7c02dae0c3c762ece1f70a36f88fa69b4749b19cc1f5ef0abf37fa0c04ab2ef.json rename to packages/rs-sdk/tests/vectors/test_identity_contract_no_nonce_read/msg_GetIdentityContractNonceRequest_b7c02dae0c3c762ece1f70a36f88fa69b4749b19cc1f5ef0abf37fa0c04ab2ef.json index e0e9171f38f..32495e75b42 100644 Binary files a/packages/rs-sdk/tests/vectors/test_identity_contract_no_nonce_read/msg_2024-04-24T00:37:29.632356000Z_GetIdentityContractNonceRequest_b7c02dae0c3c762ece1f70a36f88fa69b4749b19cc1f5ef0abf37fa0c04ab2ef.json and b/packages/rs-sdk/tests/vectors/test_identity_contract_no_nonce_read/msg_GetIdentityContractNonceRequest_b7c02dae0c3c762ece1f70a36f88fa69b4749b19cc1f5ef0abf37fa0c04ab2ef.json differ diff --git a/packages/rs-sdk/tests/vectors/test_identity_contract_no_nonce_read/quorum_pubkey-106-32f78e1ab8f7beb1edc06a461c486e1afd90c1d4732f93cf8287fa0e9c27e35e.json b/packages/rs-sdk/tests/vectors/test_identity_contract_no_nonce_read/quorum_pubkey-106-32f78e1ab8f7beb1edc06a461c486e1afd90c1d4732f93cf8287fa0e9c27e35e.json deleted file mode 100644 index ca9f21e7523..00000000000 --- a/packages/rs-sdk/tests/vectors/test_identity_contract_no_nonce_read/quorum_pubkey-106-32f78e1ab8f7beb1edc06a461c486e1afd90c1d4732f93cf8287fa0e9c27e35e.json +++ /dev/null @@ -1 +0,0 @@ -[183,213,77,25,46,6,139,69,130,159,190,72,193,8,131,191,105,54,247,90,65,206,156,68,41,55,185,93,114,209,189,211,207,236,91,86,76,47,4,205,217,32,122,8,123,104,168,118] \ No newline at end of file diff --git a/packages/rs-sdk/tests/vectors/test_identity_contract_no_nonce_read/quorum_pubkey-106-492dae0f1dd6ead4f24c870bd0c119aacf74ce5a6e2b6587fd5a1b4dd74623ae.json b/packages/rs-sdk/tests/vectors/test_identity_contract_no_nonce_read/quorum_pubkey-106-492dae0f1dd6ead4f24c870bd0c119aacf74ce5a6e2b6587fd5a1b4dd74623ae.json new file mode 100644 index 00000000000..ccd69e38275 --- /dev/null +++ b/packages/rs-sdk/tests/vectors/test_identity_contract_no_nonce_read/quorum_pubkey-106-492dae0f1dd6ead4f24c870bd0c119aacf74ce5a6e2b6587fd5a1b4dd74623ae.json @@ -0,0 +1 @@ +aa51132a4e62cec89b731aa8baf4043fea777c484a4856e3b7c9a13c651ff2a9057d30cd251190bde749ac8f7c0026b6 \ No newline at end of file diff --git a/packages/rs-sdk/tests/vectors/test_identity_public_keys_all_read/msg_2024-04-24T00:37:29.611949000Z_GetIdentityKeysRequest_b4ecff7acf52818aef9ed37a98d4a459dc7a67570ea6df3f8858d3fae7820ffe.json b/packages/rs-sdk/tests/vectors/test_identity_public_keys_all_read/msg_GetIdentityKeysRequest_b4ecff7acf52818aef9ed37a98d4a459dc7a67570ea6df3f8858d3fae7820ffe.json similarity index 73% rename from packages/rs-sdk/tests/vectors/test_identity_public_keys_all_read/msg_2024-04-24T00:37:29.611949000Z_GetIdentityKeysRequest_b4ecff7acf52818aef9ed37a98d4a459dc7a67570ea6df3f8858d3fae7820ffe.json rename to packages/rs-sdk/tests/vectors/test_identity_public_keys_all_read/msg_GetIdentityKeysRequest_b4ecff7acf52818aef9ed37a98d4a459dc7a67570ea6df3f8858d3fae7820ffe.json index a45f6fb1f95..e50834573b8 100644 Binary files a/packages/rs-sdk/tests/vectors/test_identity_public_keys_all_read/msg_2024-04-24T00:37:29.611949000Z_GetIdentityKeysRequest_b4ecff7acf52818aef9ed37a98d4a459dc7a67570ea6df3f8858d3fae7820ffe.json and b/packages/rs-sdk/tests/vectors/test_identity_public_keys_all_read/msg_GetIdentityKeysRequest_b4ecff7acf52818aef9ed37a98d4a459dc7a67570ea6df3f8858d3fae7820ffe.json differ diff --git a/packages/rs-sdk/tests/vectors/test_identity_public_keys_all_read/quorum_pubkey-106-32f78e1ab8f7beb1edc06a461c486e1afd90c1d4732f93cf8287fa0e9c27e35e.json b/packages/rs-sdk/tests/vectors/test_identity_public_keys_all_read/quorum_pubkey-106-32f78e1ab8f7beb1edc06a461c486e1afd90c1d4732f93cf8287fa0e9c27e35e.json deleted file mode 100644 index ca9f21e7523..00000000000 --- a/packages/rs-sdk/tests/vectors/test_identity_public_keys_all_read/quorum_pubkey-106-32f78e1ab8f7beb1edc06a461c486e1afd90c1d4732f93cf8287fa0e9c27e35e.json +++ /dev/null @@ -1 +0,0 @@ -[183,213,77,25,46,6,139,69,130,159,190,72,193,8,131,191,105,54,247,90,65,206,156,68,41,55,185,93,114,209,189,211,207,236,91,86,76,47,4,205,217,32,122,8,123,104,168,118] \ No newline at end of file diff --git a/packages/rs-sdk/tests/vectors/test_identity_public_keys_all_read/quorum_pubkey-106-492dae0f1dd6ead4f24c870bd0c119aacf74ce5a6e2b6587fd5a1b4dd74623ae.json b/packages/rs-sdk/tests/vectors/test_identity_public_keys_all_read/quorum_pubkey-106-492dae0f1dd6ead4f24c870bd0c119aacf74ce5a6e2b6587fd5a1b4dd74623ae.json new file mode 100644 index 00000000000..ccd69e38275 --- /dev/null +++ b/packages/rs-sdk/tests/vectors/test_identity_public_keys_all_read/quorum_pubkey-106-492dae0f1dd6ead4f24c870bd0c119aacf74ce5a6e2b6587fd5a1b4dd74623ae.json @@ -0,0 +1 @@ +aa51132a4e62cec89b731aa8baf4043fea777c484a4856e3b7c9a13c651ff2a9057d30cd251190bde749ac8f7c0026b6 \ No newline at end of file diff --git a/packages/rs-sdk/tests/vectors/test_identity_read/msg_2024-04-24T00:37:29.627284000Z_IdentityRequest_5789e2afa300c2ac039646d8b81c53464633a072722c5a04b15ee01f3a45de99.json b/packages/rs-sdk/tests/vectors/test_identity_read/msg_IdentityRequest_5789e2afa300c2ac039646d8b81c53464633a072722c5a04b15ee01f3a45de99.json similarity index 76% rename from packages/rs-sdk/tests/vectors/test_identity_read/msg_2024-04-24T00:37:29.627284000Z_IdentityRequest_5789e2afa300c2ac039646d8b81c53464633a072722c5a04b15ee01f3a45de99.json rename to packages/rs-sdk/tests/vectors/test_identity_read/msg_IdentityRequest_5789e2afa300c2ac039646d8b81c53464633a072722c5a04b15ee01f3a45de99.json index 2f7f45c7000..7c986440960 100644 Binary files a/packages/rs-sdk/tests/vectors/test_identity_read/msg_2024-04-24T00:37:29.627284000Z_IdentityRequest_5789e2afa300c2ac039646d8b81c53464633a072722c5a04b15ee01f3a45de99.json and b/packages/rs-sdk/tests/vectors/test_identity_read/msg_IdentityRequest_5789e2afa300c2ac039646d8b81c53464633a072722c5a04b15ee01f3a45de99.json differ diff --git a/packages/rs-sdk/tests/vectors/test_identity_read/quorum_pubkey-106-32f78e1ab8f7beb1edc06a461c486e1afd90c1d4732f93cf8287fa0e9c27e35e.json b/packages/rs-sdk/tests/vectors/test_identity_read/quorum_pubkey-106-32f78e1ab8f7beb1edc06a461c486e1afd90c1d4732f93cf8287fa0e9c27e35e.json deleted file mode 100644 index ca9f21e7523..00000000000 --- a/packages/rs-sdk/tests/vectors/test_identity_read/quorum_pubkey-106-32f78e1ab8f7beb1edc06a461c486e1afd90c1d4732f93cf8287fa0e9c27e35e.json +++ /dev/null @@ -1 +0,0 @@ -[183,213,77,25,46,6,139,69,130,159,190,72,193,8,131,191,105,54,247,90,65,206,156,68,41,55,185,93,114,209,189,211,207,236,91,86,76,47,4,205,217,32,122,8,123,104,168,118] \ No newline at end of file diff --git a/packages/rs-sdk/tests/vectors/test_identity_read/quorum_pubkey-106-492dae0f1dd6ead4f24c870bd0c119aacf74ce5a6e2b6587fd5a1b4dd74623ae.json b/packages/rs-sdk/tests/vectors/test_identity_read/quorum_pubkey-106-492dae0f1dd6ead4f24c870bd0c119aacf74ce5a6e2b6587fd5a1b4dd74623ae.json new file mode 100644 index 00000000000..ccd69e38275 --- /dev/null +++ b/packages/rs-sdk/tests/vectors/test_identity_read/quorum_pubkey-106-492dae0f1dd6ead4f24c870bd0c119aacf74ce5a6e2b6587fd5a1b4dd74623ae.json @@ -0,0 +1 @@ +aa51132a4e62cec89b731aa8baf4043fea777c484a4856e3b7c9a13c651ff2a9057d30cd251190bde749ac8f7c0026b6 \ No newline at end of file diff --git a/packages/rs-sdk/tests/vectors/test_identity_read_by_key/msg_2024-04-24T00:37:29.629157000Z_IdentityRequest_5789e2afa300c2ac039646d8b81c53464633a072722c5a04b15ee01f3a45de99.json b/packages/rs-sdk/tests/vectors/test_identity_read_by_key/msg_IdentityRequest_5789e2afa300c2ac039646d8b81c53464633a072722c5a04b15ee01f3a45de99.json similarity index 76% rename from packages/rs-sdk/tests/vectors/test_identity_read_by_key/msg_2024-04-24T00:37:29.629157000Z_IdentityRequest_5789e2afa300c2ac039646d8b81c53464633a072722c5a04b15ee01f3a45de99.json rename to packages/rs-sdk/tests/vectors/test_identity_read_by_key/msg_IdentityRequest_5789e2afa300c2ac039646d8b81c53464633a072722c5a04b15ee01f3a45de99.json index 2f7f45c7000..7c986440960 100644 Binary files a/packages/rs-sdk/tests/vectors/test_identity_read_by_key/msg_2024-04-24T00:37:29.629157000Z_IdentityRequest_5789e2afa300c2ac039646d8b81c53464633a072722c5a04b15ee01f3a45de99.json and b/packages/rs-sdk/tests/vectors/test_identity_read_by_key/msg_IdentityRequest_5789e2afa300c2ac039646d8b81c53464633a072722c5a04b15ee01f3a45de99.json differ diff --git a/packages/rs-sdk/tests/vectors/test_identity_read_by_key/msg_2024-04-24T00:37:29.651813000Z_IdentityRequest_abf7b19244827334575a04cf67f428f9b6b120d8fa853e3398e1539b8fc54d9b.json b/packages/rs-sdk/tests/vectors/test_identity_read_by_key/msg_IdentityRequest_8ae829afeac6c68fca63b5df236d5bca784f1c6a71052a503b0cc0d4007dad93.json similarity index 74% rename from packages/rs-sdk/tests/vectors/test_identity_read_by_key/msg_2024-04-24T00:37:29.651813000Z_IdentityRequest_abf7b19244827334575a04cf67f428f9b6b120d8fa853e3398e1539b8fc54d9b.json rename to packages/rs-sdk/tests/vectors/test_identity_read_by_key/msg_IdentityRequest_8ae829afeac6c68fca63b5df236d5bca784f1c6a71052a503b0cc0d4007dad93.json index de49a8398d2..7439e3fc562 100644 Binary files a/packages/rs-sdk/tests/vectors/test_identity_read_by_key/msg_2024-04-24T00:37:29.651813000Z_IdentityRequest_abf7b19244827334575a04cf67f428f9b6b120d8fa853e3398e1539b8fc54d9b.json and b/packages/rs-sdk/tests/vectors/test_identity_read_by_key/msg_IdentityRequest_8ae829afeac6c68fca63b5df236d5bca784f1c6a71052a503b0cc0d4007dad93.json differ diff --git a/packages/rs-sdk/tests/vectors/test_identity_read_by_key/quorum_pubkey-106-32f78e1ab8f7beb1edc06a461c486e1afd90c1d4732f93cf8287fa0e9c27e35e.json b/packages/rs-sdk/tests/vectors/test_identity_read_by_key/quorum_pubkey-106-32f78e1ab8f7beb1edc06a461c486e1afd90c1d4732f93cf8287fa0e9c27e35e.json deleted file mode 100644 index ca9f21e7523..00000000000 --- a/packages/rs-sdk/tests/vectors/test_identity_read_by_key/quorum_pubkey-106-32f78e1ab8f7beb1edc06a461c486e1afd90c1d4732f93cf8287fa0e9c27e35e.json +++ /dev/null @@ -1 +0,0 @@ -[183,213,77,25,46,6,139,69,130,159,190,72,193,8,131,191,105,54,247,90,65,206,156,68,41,55,185,93,114,209,189,211,207,236,91,86,76,47,4,205,217,32,122,8,123,104,168,118] \ No newline at end of file diff --git a/packages/rs-sdk/tests/vectors/test_identity_read_by_key/quorum_pubkey-106-492dae0f1dd6ead4f24c870bd0c119aacf74ce5a6e2b6587fd5a1b4dd74623ae.json b/packages/rs-sdk/tests/vectors/test_identity_read_by_key/quorum_pubkey-106-492dae0f1dd6ead4f24c870bd0c119aacf74ce5a6e2b6587fd5a1b4dd74623ae.json new file mode 100644 index 00000000000..ccd69e38275 --- /dev/null +++ b/packages/rs-sdk/tests/vectors/test_identity_read_by_key/quorum_pubkey-106-492dae0f1dd6ead4f24c870bd0c119aacf74ce5a6e2b6587fd5a1b4dd74623ae.json @@ -0,0 +1 @@ +aa51132a4e62cec89b731aa8baf4043fea777c484a4856e3b7c9a13c651ff2a9057d30cd251190bde749ac8f7c0026b6 \ No newline at end of file diff --git a/packages/rs-sdk/tests/vectors/test_prefunded_specialized_balance_not_found/.gitkeep b/packages/rs-sdk/tests/vectors/test_prefunded_specialized_balance_not_found/.gitkeep new file mode 100644 index 00000000000..e69de29bb2d diff --git a/packages/rs-sdk/tests/vectors/test_prefunded_specialized_balance_not_found/msg_GetPrefundedSpecializedBalanceRequest_1d1e53ab5e04d9ec5dce4ff9ac048c03122daf7ab2e77108f4bf44af1ad15eae.json b/packages/rs-sdk/tests/vectors/test_prefunded_specialized_balance_not_found/msg_GetPrefundedSpecializedBalanceRequest_1d1e53ab5e04d9ec5dce4ff9ac048c03122daf7ab2e77108f4bf44af1ad15eae.json new file mode 100644 index 00000000000..8fdc0c80f1d Binary files /dev/null and b/packages/rs-sdk/tests/vectors/test_prefunded_specialized_balance_not_found/msg_GetPrefundedSpecializedBalanceRequest_1d1e53ab5e04d9ec5dce4ff9ac048c03122daf7ab2e77108f4bf44af1ad15eae.json differ diff --git a/packages/rs-sdk/tests/vectors/test_prefunded_specialized_balance_not_found/quorum_pubkey-106-492dae0f1dd6ead4f24c870bd0c119aacf74ce5a6e2b6587fd5a1b4dd74623ae.json b/packages/rs-sdk/tests/vectors/test_prefunded_specialized_balance_not_found/quorum_pubkey-106-492dae0f1dd6ead4f24c870bd0c119aacf74ce5a6e2b6587fd5a1b4dd74623ae.json new file mode 100644 index 00000000000..ccd69e38275 --- /dev/null +++ b/packages/rs-sdk/tests/vectors/test_prefunded_specialized_balance_not_found/quorum_pubkey-106-492dae0f1dd6ead4f24c870bd0c119aacf74ce5a6e2b6587fd5a1b4dd74623ae.json @@ -0,0 +1 @@ +aa51132a4e62cec89b731aa8baf4043fea777c484a4856e3b7c9a13c651ff2a9057d30cd251190bde749ac8f7c0026b6 \ No newline at end of file diff --git a/packages/rs-sdk/tests/vectors/test_protocol_version_vote_count/msg_2024-04-24T00:37:29.650095000Z_GetProtocolVersionUpgradeStateRequest_bb149e1933b9dc561bbfacfb6d09550f0ea4a6af6f68037e7d50ff4e4de74509.json b/packages/rs-sdk/tests/vectors/test_protocol_version_vote_count/msg_GetProtocolVersionUpgradeStateRequest_bb149e1933b9dc561bbfacfb6d09550f0ea4a6af6f68037e7d50ff4e4de74509.json similarity index 63% rename from packages/rs-sdk/tests/vectors/test_protocol_version_vote_count/msg_2024-04-24T00:37:29.650095000Z_GetProtocolVersionUpgradeStateRequest_bb149e1933b9dc561bbfacfb6d09550f0ea4a6af6f68037e7d50ff4e4de74509.json rename to packages/rs-sdk/tests/vectors/test_protocol_version_vote_count/msg_GetProtocolVersionUpgradeStateRequest_bb149e1933b9dc561bbfacfb6d09550f0ea4a6af6f68037e7d50ff4e4de74509.json index c81cd274819..ea21f19958a 100644 Binary files a/packages/rs-sdk/tests/vectors/test_protocol_version_vote_count/msg_2024-04-24T00:37:29.650095000Z_GetProtocolVersionUpgradeStateRequest_bb149e1933b9dc561bbfacfb6d09550f0ea4a6af6f68037e7d50ff4e4de74509.json and b/packages/rs-sdk/tests/vectors/test_protocol_version_vote_count/msg_GetProtocolVersionUpgradeStateRequest_bb149e1933b9dc561bbfacfb6d09550f0ea4a6af6f68037e7d50ff4e4de74509.json differ diff --git a/packages/rs-sdk/tests/vectors/test_protocol_version_vote_count/quorum_pubkey-106-32f78e1ab8f7beb1edc06a461c486e1afd90c1d4732f93cf8287fa0e9c27e35e.json b/packages/rs-sdk/tests/vectors/test_protocol_version_vote_count/quorum_pubkey-106-32f78e1ab8f7beb1edc06a461c486e1afd90c1d4732f93cf8287fa0e9c27e35e.json deleted file mode 100644 index ca9f21e7523..00000000000 --- a/packages/rs-sdk/tests/vectors/test_protocol_version_vote_count/quorum_pubkey-106-32f78e1ab8f7beb1edc06a461c486e1afd90c1d4732f93cf8287fa0e9c27e35e.json +++ /dev/null @@ -1 +0,0 @@ -[183,213,77,25,46,6,139,69,130,159,190,72,193,8,131,191,105,54,247,90,65,206,156,68,41,55,185,93,114,209,189,211,207,236,91,86,76,47,4,205,217,32,122,8,123,104,168,118] \ No newline at end of file diff --git a/packages/rs-sdk/tests/vectors/test_protocol_version_vote_count/quorum_pubkey-106-492dae0f1dd6ead4f24c870bd0c119aacf74ce5a6e2b6587fd5a1b4dd74623ae.json b/packages/rs-sdk/tests/vectors/test_protocol_version_vote_count/quorum_pubkey-106-492dae0f1dd6ead4f24c870bd0c119aacf74ce5a6e2b6587fd5a1b4dd74623ae.json new file mode 100644 index 00000000000..ccd69e38275 --- /dev/null +++ b/packages/rs-sdk/tests/vectors/test_protocol_version_vote_count/quorum_pubkey-106-492dae0f1dd6ead4f24c870bd0c119aacf74ce5a6e2b6587fd5a1b4dd74623ae.json @@ -0,0 +1 @@ +aa51132a4e62cec89b731aa8baf4043fea777c484a4856e3b7c9a13c651ff2a9057d30cd251190bde749ac8f7c0026b6 \ No newline at end of file diff --git a/packages/rs-sdk/tests/vectors/test_protocol_version_votes_limit_2/msg_2024-04-24T00:37:29.650285000Z_GetProtocolVersionUpgradeVoteStatusRequest_ec9dca65a964669b3bc8195d5ff106e5eda740be44679cc960ea35f2134af628.json b/packages/rs-sdk/tests/vectors/test_protocol_version_votes_limit_2/msg_GetProtocolVersionUpgradeVoteStatusRequest_ec9dca65a964669b3bc8195d5ff106e5eda740be44679cc960ea35f2134af628.json similarity index 65% rename from packages/rs-sdk/tests/vectors/test_protocol_version_votes_limit_2/msg_2024-04-24T00:37:29.650285000Z_GetProtocolVersionUpgradeVoteStatusRequest_ec9dca65a964669b3bc8195d5ff106e5eda740be44679cc960ea35f2134af628.json rename to packages/rs-sdk/tests/vectors/test_protocol_version_votes_limit_2/msg_GetProtocolVersionUpgradeVoteStatusRequest_ec9dca65a964669b3bc8195d5ff106e5eda740be44679cc960ea35f2134af628.json index c82ac29784c..faa03c8d137 100644 Binary files a/packages/rs-sdk/tests/vectors/test_protocol_version_votes_limit_2/msg_2024-04-24T00:37:29.650285000Z_GetProtocolVersionUpgradeVoteStatusRequest_ec9dca65a964669b3bc8195d5ff106e5eda740be44679cc960ea35f2134af628.json and b/packages/rs-sdk/tests/vectors/test_protocol_version_votes_limit_2/msg_GetProtocolVersionUpgradeVoteStatusRequest_ec9dca65a964669b3bc8195d5ff106e5eda740be44679cc960ea35f2134af628.json differ diff --git a/packages/rs-sdk/tests/vectors/test_protocol_version_votes_limit_2/quorum_pubkey-106-32f78e1ab8f7beb1edc06a461c486e1afd90c1d4732f93cf8287fa0e9c27e35e.json b/packages/rs-sdk/tests/vectors/test_protocol_version_votes_limit_2/quorum_pubkey-106-32f78e1ab8f7beb1edc06a461c486e1afd90c1d4732f93cf8287fa0e9c27e35e.json deleted file mode 100644 index ca9f21e7523..00000000000 --- a/packages/rs-sdk/tests/vectors/test_protocol_version_votes_limit_2/quorum_pubkey-106-32f78e1ab8f7beb1edc06a461c486e1afd90c1d4732f93cf8287fa0e9c27e35e.json +++ /dev/null @@ -1 +0,0 @@ -[183,213,77,25,46,6,139,69,130,159,190,72,193,8,131,191,105,54,247,90,65,206,156,68,41,55,185,93,114,209,189,211,207,236,91,86,76,47,4,205,217,32,122,8,123,104,168,118] \ No newline at end of file diff --git a/packages/rs-sdk/tests/vectors/test_protocol_version_votes_limit_2/quorum_pubkey-106-492dae0f1dd6ead4f24c870bd0c119aacf74ce5a6e2b6587fd5a1b4dd74623ae.json b/packages/rs-sdk/tests/vectors/test_protocol_version_votes_limit_2/quorum_pubkey-106-492dae0f1dd6ead4f24c870bd0c119aacf74ce5a6e2b6587fd5a1b4dd74623ae.json new file mode 100644 index 00000000000..ccd69e38275 --- /dev/null +++ b/packages/rs-sdk/tests/vectors/test_protocol_version_votes_limit_2/quorum_pubkey-106-492dae0f1dd6ead4f24c870bd0c119aacf74ce5a6e2b6587fd5a1b4dd74623ae.json @@ -0,0 +1 @@ +aa51132a4e62cec89b731aa8baf4043fea777c484a4856e3b7c9a13c651ff2a9057d30cd251190bde749ac8f7c0026b6 \ No newline at end of file diff --git a/packages/rs-sdk/tests/vectors/test_protocol_version_votes_none/msg_2024-04-24T00:37:29.653372000Z_GetProtocolVersionUpgradeVoteStatusRequest_983670ac95678b1166deab32209bf1acc3394d29ac72f662d38e81344496631e.json b/packages/rs-sdk/tests/vectors/test_protocol_version_votes_none/msg_GetProtocolVersionUpgradeVoteStatusRequest_983670ac95678b1166deab32209bf1acc3394d29ac72f662d38e81344496631e.json similarity index 64% rename from packages/rs-sdk/tests/vectors/test_protocol_version_votes_none/msg_2024-04-24T00:37:29.653372000Z_GetProtocolVersionUpgradeVoteStatusRequest_983670ac95678b1166deab32209bf1acc3394d29ac72f662d38e81344496631e.json rename to packages/rs-sdk/tests/vectors/test_protocol_version_votes_none/msg_GetProtocolVersionUpgradeVoteStatusRequest_983670ac95678b1166deab32209bf1acc3394d29ac72f662d38e81344496631e.json index 82b4cc8cd36..82fc4337a50 100644 Binary files a/packages/rs-sdk/tests/vectors/test_protocol_version_votes_none/msg_2024-04-24T00:37:29.653372000Z_GetProtocolVersionUpgradeVoteStatusRequest_983670ac95678b1166deab32209bf1acc3394d29ac72f662d38e81344496631e.json and b/packages/rs-sdk/tests/vectors/test_protocol_version_votes_none/msg_GetProtocolVersionUpgradeVoteStatusRequest_983670ac95678b1166deab32209bf1acc3394d29ac72f662d38e81344496631e.json differ diff --git a/packages/rs-sdk/tests/vectors/test_protocol_version_votes_none/quorum_pubkey-106-32f78e1ab8f7beb1edc06a461c486e1afd90c1d4732f93cf8287fa0e9c27e35e.json b/packages/rs-sdk/tests/vectors/test_protocol_version_votes_none/quorum_pubkey-106-32f78e1ab8f7beb1edc06a461c486e1afd90c1d4732f93cf8287fa0e9c27e35e.json deleted file mode 100644 index ca9f21e7523..00000000000 --- a/packages/rs-sdk/tests/vectors/test_protocol_version_votes_none/quorum_pubkey-106-32f78e1ab8f7beb1edc06a461c486e1afd90c1d4732f93cf8287fa0e9c27e35e.json +++ /dev/null @@ -1 +0,0 @@ -[183,213,77,25,46,6,139,69,130,159,190,72,193,8,131,191,105,54,247,90,65,206,156,68,41,55,185,93,114,209,189,211,207,236,91,86,76,47,4,205,217,32,122,8,123,104,168,118] \ No newline at end of file diff --git a/packages/rs-sdk/tests/vectors/test_protocol_version_votes_none/quorum_pubkey-106-492dae0f1dd6ead4f24c870bd0c119aacf74ce5a6e2b6587fd5a1b4dd74623ae.json b/packages/rs-sdk/tests/vectors/test_protocol_version_votes_none/quorum_pubkey-106-492dae0f1dd6ead4f24c870bd0c119aacf74ce5a6e2b6587fd5a1b4dd74623ae.json new file mode 100644 index 00000000000..ccd69e38275 --- /dev/null +++ b/packages/rs-sdk/tests/vectors/test_protocol_version_votes_none/quorum_pubkey-106-492dae0f1dd6ead4f24c870bd0c119aacf74ce5a6e2b6587fd5a1b4dd74623ae.json @@ -0,0 +1 @@ +aa51132a4e62cec89b731aa8baf4043fea777c484a4856e3b7c9a13c651ff2a9057d30cd251190bde749ac8f7c0026b6 \ No newline at end of file diff --git a/packages/rs-sdk/tests/vectors/test_protocol_version_votes_nx/msg_2024-04-24T00:37:29.656446000Z_GetProtocolVersionUpgradeVoteStatusRequest_8534be7e0b4dd648520dc3a67209b1a05862cb8d40c088b193b59ca3564210bc.json b/packages/rs-sdk/tests/vectors/test_protocol_version_votes_nx/msg_GetProtocolVersionUpgradeVoteStatusRequest_8534be7e0b4dd648520dc3a67209b1a05862cb8d40c088b193b59ca3564210bc.json similarity index 67% rename from packages/rs-sdk/tests/vectors/test_protocol_version_votes_nx/msg_2024-04-24T00:37:29.656446000Z_GetProtocolVersionUpgradeVoteStatusRequest_8534be7e0b4dd648520dc3a67209b1a05862cb8d40c088b193b59ca3564210bc.json rename to packages/rs-sdk/tests/vectors/test_protocol_version_votes_nx/msg_GetProtocolVersionUpgradeVoteStatusRequest_8534be7e0b4dd648520dc3a67209b1a05862cb8d40c088b193b59ca3564210bc.json index 2d44ba66353..93e4a19e07a 100644 Binary files a/packages/rs-sdk/tests/vectors/test_protocol_version_votes_nx/msg_2024-04-24T00:37:29.656446000Z_GetProtocolVersionUpgradeVoteStatusRequest_8534be7e0b4dd648520dc3a67209b1a05862cb8d40c088b193b59ca3564210bc.json and b/packages/rs-sdk/tests/vectors/test_protocol_version_votes_nx/msg_GetProtocolVersionUpgradeVoteStatusRequest_8534be7e0b4dd648520dc3a67209b1a05862cb8d40c088b193b59ca3564210bc.json differ diff --git a/packages/rs-sdk/tests/vectors/test_protocol_version_votes_nx/quorum_pubkey-106-32f78e1ab8f7beb1edc06a461c486e1afd90c1d4732f93cf8287fa0e9c27e35e.json b/packages/rs-sdk/tests/vectors/test_protocol_version_votes_nx/quorum_pubkey-106-32f78e1ab8f7beb1edc06a461c486e1afd90c1d4732f93cf8287fa0e9c27e35e.json deleted file mode 100644 index ca9f21e7523..00000000000 --- a/packages/rs-sdk/tests/vectors/test_protocol_version_votes_nx/quorum_pubkey-106-32f78e1ab8f7beb1edc06a461c486e1afd90c1d4732f93cf8287fa0e9c27e35e.json +++ /dev/null @@ -1 +0,0 @@ -[183,213,77,25,46,6,139,69,130,159,190,72,193,8,131,191,105,54,247,90,65,206,156,68,41,55,185,93,114,209,189,211,207,236,91,86,76,47,4,205,217,32,122,8,123,104,168,118] \ No newline at end of file diff --git a/packages/rs-sdk/tests/vectors/test_protocol_version_votes_nx/quorum_pubkey-106-492dae0f1dd6ead4f24c870bd0c119aacf74ce5a6e2b6587fd5a1b4dd74623ae.json b/packages/rs-sdk/tests/vectors/test_protocol_version_votes_nx/quorum_pubkey-106-492dae0f1dd6ead4f24c870bd0c119aacf74ce5a6e2b6587fd5a1b4dd74623ae.json new file mode 100644 index 00000000000..ccd69e38275 --- /dev/null +++ b/packages/rs-sdk/tests/vectors/test_protocol_version_votes_nx/quorum_pubkey-106-492dae0f1dd6ead4f24c870bd0c119aacf74ce5a6e2b6587fd5a1b4dd74623ae.json @@ -0,0 +1 @@ +aa51132a4e62cec89b731aa8baf4043fea777c484a4856e3b7c9a13c651ff2a9057d30cd251190bde749ac8f7c0026b6 \ No newline at end of file diff --git a/packages/rs-sdk/tests/vectors/test_protocol_version_votes_zeros/msg_2024-04-24T00:37:29.661820000Z_GetProtocolVersionUpgradeVoteStatusRequest_92a45a0fe4f69d355022d2f2f7622dfc69cc7b123be24b7ad993281979b2a3a2.json b/packages/rs-sdk/tests/vectors/test_protocol_version_votes_zeros/msg_GetProtocolVersionUpgradeVoteStatusRequest_92a45a0fe4f69d355022d2f2f7622dfc69cc7b123be24b7ad993281979b2a3a2.json similarity index 65% rename from packages/rs-sdk/tests/vectors/test_protocol_version_votes_zeros/msg_2024-04-24T00:37:29.661820000Z_GetProtocolVersionUpgradeVoteStatusRequest_92a45a0fe4f69d355022d2f2f7622dfc69cc7b123be24b7ad993281979b2a3a2.json rename to packages/rs-sdk/tests/vectors/test_protocol_version_votes_zeros/msg_GetProtocolVersionUpgradeVoteStatusRequest_92a45a0fe4f69d355022d2f2f7622dfc69cc7b123be24b7ad993281979b2a3a2.json index 3b75d945a3a..fa025da8d11 100644 Binary files a/packages/rs-sdk/tests/vectors/test_protocol_version_votes_zeros/msg_2024-04-24T00:37:29.661820000Z_GetProtocolVersionUpgradeVoteStatusRequest_92a45a0fe4f69d355022d2f2f7622dfc69cc7b123be24b7ad993281979b2a3a2.json and b/packages/rs-sdk/tests/vectors/test_protocol_version_votes_zeros/msg_GetProtocolVersionUpgradeVoteStatusRequest_92a45a0fe4f69d355022d2f2f7622dfc69cc7b123be24b7ad993281979b2a3a2.json differ diff --git a/packages/rs-sdk/tests/vectors/test_protocol_version_votes_zeros/quorum_pubkey-106-32f78e1ab8f7beb1edc06a461c486e1afd90c1d4732f93cf8287fa0e9c27e35e.json b/packages/rs-sdk/tests/vectors/test_protocol_version_votes_zeros/quorum_pubkey-106-32f78e1ab8f7beb1edc06a461c486e1afd90c1d4732f93cf8287fa0e9c27e35e.json deleted file mode 100644 index ca9f21e7523..00000000000 --- a/packages/rs-sdk/tests/vectors/test_protocol_version_votes_zeros/quorum_pubkey-106-32f78e1ab8f7beb1edc06a461c486e1afd90c1d4732f93cf8287fa0e9c27e35e.json +++ /dev/null @@ -1 +0,0 @@ -[183,213,77,25,46,6,139,69,130,159,190,72,193,8,131,191,105,54,247,90,65,206,156,68,41,55,185,93,114,209,189,211,207,236,91,86,76,47,4,205,217,32,122,8,123,104,168,118] \ No newline at end of file diff --git a/packages/rs-sdk/tests/vectors/test_protocol_version_votes_zeros/quorum_pubkey-106-492dae0f1dd6ead4f24c870bd0c119aacf74ce5a6e2b6587fd5a1b4dd74623ae.json b/packages/rs-sdk/tests/vectors/test_protocol_version_votes_zeros/quorum_pubkey-106-492dae0f1dd6ead4f24c870bd0c119aacf74ce5a6e2b6587fd5a1b4dd74623ae.json new file mode 100644 index 00000000000..ccd69e38275 --- /dev/null +++ b/packages/rs-sdk/tests/vectors/test_protocol_version_votes_zeros/quorum_pubkey-106-492dae0f1dd6ead4f24c870bd0c119aacf74ce5a6e2b6587fd5a1b4dd74623ae.json @@ -0,0 +1 @@ +aa51132a4e62cec89b731aa8baf4043fea777c484a4856e3b7c9a13c651ff2a9057d30cd251190bde749ac8f7c0026b6 \ No newline at end of file diff --git a/packages/rs-sdk/tests/vectors/test_vote_polls_by_ts_ok/.gitkeep b/packages/rs-sdk/tests/vectors/test_vote_polls_by_ts_ok/.gitkeep new file mode 100644 index 00000000000..e69de29bb2d diff --git a/packages/rs-sdk/tests/vectors/test_vote_polls_by_ts_ok/msg_GetVotePollsByEndDateRequest_90f99444544de47f7e78de44bcaca1b6ba4883a92f4533995dbfdbc5875d8bef.json b/packages/rs-sdk/tests/vectors/test_vote_polls_by_ts_ok/msg_GetVotePollsByEndDateRequest_90f99444544de47f7e78de44bcaca1b6ba4883a92f4533995dbfdbc5875d8bef.json new file mode 100644 index 00000000000..3c4e23389f9 Binary files /dev/null and b/packages/rs-sdk/tests/vectors/test_vote_polls_by_ts_ok/msg_GetVotePollsByEndDateRequest_90f99444544de47f7e78de44bcaca1b6ba4883a92f4533995dbfdbc5875d8bef.json differ diff --git a/packages/rs-sdk/tests/vectors/test_vote_polls_by_ts_ok/quorum_pubkey-106-399f52014ff85abf36a169323ce01ac5667a0849e89fa3de829d3aba4306050b.json b/packages/rs-sdk/tests/vectors/test_vote_polls_by_ts_ok/quorum_pubkey-106-399f52014ff85abf36a169323ce01ac5667a0849e89fa3de829d3aba4306050b.json new file mode 100644 index 00000000000..2a4e45b5ad5 --- /dev/null +++ b/packages/rs-sdk/tests/vectors/test_vote_polls_by_ts_ok/quorum_pubkey-106-399f52014ff85abf36a169323ce01ac5667a0849e89fa3de829d3aba4306050b.json @@ -0,0 +1 @@ +980213d7bff3e7427a4fe50f78bd7a3442f12017e3aea9200b4a6d73f591796a80d73db20ec7bfd0decda3f1d57bbcee \ No newline at end of file