Skip to content

Commit

Permalink
extra clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
QuantumExplorer committed Oct 22, 2024
1 parent 47c61ba commit 5fd84cc
Show file tree
Hide file tree
Showing 84 changed files with 1,198 additions and 1,064 deletions.
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
use crate::data_contract::document_type::property::DocumentProperty;
use crate::data_contract::document_type::v0::DocumentTypeV0;
use crate::data_contract::document_type::DocumentType;
use platform_version::version::dpp_versions::dpp_contract_versions::DocumentTypeVersions;
use crate::ProtocolError;
use indexmap::IndexMap;
use platform_version::version::dpp_versions::dpp_contract_versions::DocumentTypeVersions;
use std::collections::BTreeSet;

mod v0;
Expand Down
3 changes: 2 additions & 1 deletion packages/rs-dpp/src/data_contract/factory/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ impl DataContractFactory {
pub fn new(protocol_version: u32) -> Result<Self, ProtocolError> {
let platform_version = PlatformVersion::get(protocol_version)?;
match platform_version
.platform_architecture
.dpp
.factory_versions
.data_contract_factory_structure_version
{
0 => Ok(DataContractFactoryV0::new(protocol_version).into()),
Expand Down
6 changes: 4 additions & 2 deletions packages/rs-dpp/src/document/document_factory/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ impl DocumentFactory {
pub fn new(protocol_version: u32) -> Result<Self, ProtocolError> {
let platform_version = PlatformVersion::get(protocol_version)?;
match platform_version
.platform_architecture
.dpp
.factory_versions
.document_factory_structure_version
{
0 => Ok(DocumentFactoryV0::new(protocol_version).into()),
Expand All @@ -60,7 +61,8 @@ impl DocumentFactory {
) -> Result<Self, ProtocolError> {
let platform_version = PlatformVersion::get(protocol_version)?;
match platform_version
.platform_architecture
.dpp
.factory_versions
.document_factory_structure_version
{
0 => Ok(DocumentFactoryV0::new_with_entropy_generator(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ impl SpecializedDocumentFactory {
pub fn new(protocol_version: u32, data_contract: DataContract) -> Result<Self, ProtocolError> {
let platform_version = PlatformVersion::get(protocol_version)?;
match platform_version
.platform_architecture
.dpp
.factory_versions
.document_factory_structure_version
{
0 => Ok(SpecializedDocumentFactoryV0::new(protocol_version, data_contract).into()),
Expand All @@ -61,7 +62,8 @@ impl SpecializedDocumentFactory {
) -> Result<Self, ProtocolError> {
let platform_version = PlatformVersion::get(protocol_version)?;
match platform_version
.platform_architecture
.dpp
.factory_versions
.document_factory_structure_version
{
0 => Ok(SpecializedDocumentFactoryV0::new_with_entropy_generator(
Expand Down
3 changes: 0 additions & 3 deletions packages/rs-platform-serialization-derive/src/attribute.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ use virtue::utils::{parse_tagged_attribute, ParsedAttribute};
pub struct ContainerAttributes {
pub crate_name: String,
pub untagged: bool,
pub unversioned: bool,
pub bounds: Option<(String, Literal)>,
pub decode_bounds: Option<(String, Literal)>,
pub borrow_decode_bounds: Option<(String, Literal)>,
Expand All @@ -16,7 +15,6 @@ impl Default for ContainerAttributes {
fn default() -> Self {
Self {
crate_name: "::platform_serialization".to_string(),
unversioned: false,
untagged: false,
bounds: None,
decode_bounds: None,
Expand Down Expand Up @@ -111,7 +109,6 @@ impl FromAttribute for ContainerAttributes {
pub struct FieldAttributes {
pub with_serde: bool,
pub with_platform_version: bool,
pub platform_version_path_bounds: String,
}

impl FromAttribute for FieldAttributes {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ pub mod v1;
#[derive(Clone, Debug, Default)]
pub struct DPPAssetLockVersions {
pub reduced_asset_lock_value: FeatureVersionBounds,
}
}
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
use versioned_feature_core::FeatureVersionBounds;
use crate::version::dpp_versions::dpp_asset_lock_versions::DPPAssetLockVersions;
use versioned_feature_core::FeatureVersionBounds;

pub const DPP_ASSET_LOCK_VERSIONS_V1: DPPAssetLockVersions = DPPAssetLockVersions {
reduced_asset_lock_value: FeatureVersionBounds {
min_version: 0,
max_version: 0,
default_current_version: 0,
},
};
};
Original file line number Diff line number Diff line change
Expand Up @@ -71,4 +71,4 @@ pub struct DocumentTypeSchemaVersions {
#[derive(Clone, Debug, Default)]
pub struct RecursiveSchemaValidatorVersions {
pub traversal_validator: FeatureVersion,
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
use crate::version::dpp_versions::dpp_contract_versions::{
DPPContractVersions, DataContractMethodVersions, DocumentTypeClassMethodVersions,
DocumentTypeIndexVersions, DocumentTypeMethodVersions, DocumentTypeSchemaVersions,
DocumentTypeVersions, RecursiveSchemaValidatorVersions,
};
use versioned_feature_core::FeatureVersionBounds;
use crate::version::dpp_versions::dpp_contract_versions::{DPPContractVersions, DataContractMethodVersions, DocumentTypeClassMethodVersions, DocumentTypeIndexVersions, DocumentTypeMethodVersions, DocumentTypeSchemaVersions, DocumentTypeVersions, RecursiveSchemaValidatorVersions};

pub const CONTRACT_VERSIONS_V1: DPPContractVersions = DPPContractVersions {
max_serialized_size: 65000,
Expand Down Expand Up @@ -47,4 +51,4 @@ pub const CONTRACT_VERSIONS_V1: DPPContractVersions = DPPContractVersions {
deserialize_value_for_key: 0,
},
},
};
};
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ pub mod v1;
#[derive(Clone, Debug, Default)]
pub struct DPPCostsVersions {
pub signature_verify: FeatureVersion,
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ use crate::version::dpp_versions::dpp_costs_versions::DPPCostsVersions;

pub const DPP_COSTS_VERSIONS_V1: DPPCostsVersions = DPPCostsVersions {
signature_verify: 0,
};
};
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ pub struct DocumentMethodVersions {
pub get_raw_for_contract: FeatureVersion,
pub get_raw_for_document_type: FeatureVersion,
pub try_into_asset_unlock_base_transaction_info: FeatureVersion,
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
use crate::version::dpp_versions::dpp_document_versions::{
DPPDocumentVersions, DocumentMethodVersions,
};
use versioned_feature_core::FeatureVersionBounds;
use crate::version::dpp_versions::dpp_document_versions::{DocumentMethodVersions, DPPDocumentVersions};

pub const DOCUMENT_VERSIONS_V1: DPPDocumentVersions = DPPDocumentVersions {
document_structure_version: 0,
Expand All @@ -26,4 +28,4 @@ pub const DOCUMENT_VERSIONS_V1: DPPDocumentVersions = DPPDocumentVersions {
get_raw_for_document_type: 0,
try_into_asset_unlock_base_transaction_info: 0,
},
};
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
pub mod v1;

use versioned_feature_core::FeatureVersion;

#[derive(Clone, Debug, Default)]
pub struct DPPFactoryVersions {
pub data_contract_factory_structure_version: FeatureVersion,
pub document_factory_structure_version: FeatureVersion,
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
use crate::version::dpp_versions::dpp_factory_versions::DPPFactoryVersions;

pub const DPP_FACTORY_VERSIONS_V1: DPPFactoryVersions = DPPFactoryVersions {
data_contract_factory_structure_version: 0,
document_factory_structure_version: 0,
};
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ pub struct DPPIdentityVersions {
pub struct IdentityKeyTypeMethodVersions {
pub random_public_key_data: FeatureVersion,
pub random_public_and_private_key_data: FeatureVersion,
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
use crate::version::dpp_versions::dpp_identity_versions::{IdentityKeyTypeMethodVersions, DPPIdentityVersions};
use crate::version::dpp_versions::dpp_identity_versions::{
DPPIdentityVersions, IdentityKeyTypeMethodVersions,
};

pub const IDENTITY_VERSIONS_V1: DPPIdentityVersions = DPPIdentityVersions {
identity_structure_version: 0,
Expand All @@ -7,4 +9,4 @@ pub const IDENTITY_VERSIONS_V1: DPPIdentityVersions = DPPIdentityVersions {
random_public_key_data: 0,
random_public_and_private_key_data: 0,
},
};
};
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ pub mod v1;
pub struct DPPMethodVersions {
pub epoch_core_reward_credits_for_distribution: FeatureVersion,
pub daily_withdrawal_limit: FeatureVersion,
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use crate::version::dpp_versions::dpp_method_versions::DPPMethodVersions;
pub const DPP_METHOD_VERSIONS_V1 : DPPMethodVersions = DPPMethodVersions {
epoch_core_reward_credits_for_distribution: 0,
daily_withdrawal_limit: 0,
};
pub const DPP_METHOD_VERSIONS_V1: DPPMethodVersions = DPPMethodVersions {
epoch_core_reward_credits_for_distribution: 0,
daily_withdrawal_limit: 0,
};
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ pub struct DPPStateTransitionConversionVersions {
pub identity_to_identity_top_up_transition: FeatureVersion,
pub identity_to_identity_withdrawal_transition: FeatureVersion,
pub identity_to_identity_create_transition_with_signer: FeatureVersion,
}
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
use crate::version::dpp_versions::dpp_state_transition_conversion_versions::DPPStateTransitionConversionVersions;

pub const STATE_TRANSITION_CONVERSION_VERSIONS_V1: DPPStateTransitionConversionVersions = DPPStateTransitionConversionVersions {
identity_to_identity_create_transition: 0,
identity_to_identity_top_up_transition: 0,
identity_to_identity_withdrawal_transition: 0,
identity_to_identity_create_transition_with_signer: 0,
};
pub const STATE_TRANSITION_CONVERSION_VERSIONS_V1: DPPStateTransitionConversionVersions =
DPPStateTransitionConversionVersions {
identity_to_identity_create_transition: 0,
identity_to_identity_top_up_transition: 0,
identity_to_identity_withdrawal_transition: 0,
identity_to_identity_create_transition_with_signer: 0,
};
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
use crate::version::dpp_versions::dpp_state_transition_conversion_versions::DPPStateTransitionConversionVersions;

pub const STATE_TRANSITION_CONVERSION_VERSIONS_V2: DPPStateTransitionConversionVersions = DPPStateTransitionConversionVersions {
identity_to_identity_create_transition: 0,
identity_to_identity_top_up_transition: 0,
identity_to_identity_withdrawal_transition: 1,
identity_to_identity_create_transition_with_signer: 0,
};
pub const STATE_TRANSITION_CONVERSION_VERSIONS_V2: DPPStateTransitionConversionVersions =
DPPStateTransitionConversionVersions {
identity_to_identity_create_transition: 0,
identity_to_identity_top_up_transition: 0,
identity_to_identity_withdrawal_transition: 1,
identity_to_identity_create_transition_with_signer: 0,
};
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ pub struct PublicKeyInCreationMethodVersions {
pub duplicated_key_ids_witness: FeatureVersion,
pub duplicated_keys_witness: FeatureVersion,
pub validate_identity_public_keys_structure: FeatureVersion,
}
}
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
use crate::version::dpp_versions::dpp_state_transition_method_versions::{PublicKeyInCreationMethodVersions, DPPStateTransitionMethodVersions};
use crate::version::dpp_versions::dpp_state_transition_method_versions::{
DPPStateTransitionMethodVersions, PublicKeyInCreationMethodVersions,
};

pub const STATE_TRANSITION_METHOD_VERSIONS_V1: DPPStateTransitionMethodVersions = DPPStateTransitionMethodVersions {
public_key_in_creation_methods: PublicKeyInCreationMethodVersions {
from_public_key_signed_with_private_key: 0,
from_public_key_signed_external: 0,
hash: 0,
duplicated_key_ids_witness: 0,
duplicated_keys_witness: 0,
validate_identity_public_keys_structure: 0,
},
};
pub const STATE_TRANSITION_METHOD_VERSIONS_V1: DPPStateTransitionMethodVersions =
DPPStateTransitionMethodVersions {
public_key_in_creation_methods: PublicKeyInCreationMethodVersions {
from_public_key_signed_with_private_key: 0,
from_public_key_signed_external: 0,
hash: 0,
duplicated_key_ids_witness: 0,
duplicated_keys_witness: 0,
validate_identity_public_keys_structure: 0,
},
};
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,4 @@ pub struct DPPStateTransitionSerializationVersions {
#[derive(Clone, Debug, Default)]
pub struct DocumentFeatureVersionBounds {
pub bounds: FeatureVersionBounds,
}
}
Loading

0 comments on commit 5fd84cc

Please sign in to comment.