Skip to content

Commit

Permalink
refactor: platform version refactoring into sub versions (#2269)
Browse files Browse the repository at this point in the history
  • Loading branch information
QuantumExplorer authored Oct 23, 2024
1 parent 93425cf commit 24de235
Show file tree
Hide file tree
Showing 89 changed files with 4,019 additions and 8,826 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 crate::version::dpp_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
281 changes: 0 additions & 281 deletions packages/rs-platform-version/src/version/dpp_versions.rs

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
use versioned_feature_core::FeatureVersionBounds;

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
@@ -0,0 +1,10 @@
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,
},
};
Loading

0 comments on commit 24de235

Please sign in to comment.