From fe794be1f0c41f29b832649eaacdef4448dc63c1 Mon Sep 17 00:00:00 2001 From: Stan Bondi Date: Wed, 27 Nov 2024 08:54:03 +0400 Subject: [PATCH] machete, license, test fix --- Cargo.lock | 1 - base_layer/common_types/Cargo.toml | 2 -- .../core/src/consensus/consensus_constants.rs | 21 ++++++++++++------- .../core/src/validation/block_body/test.rs | 14 +++++-------- base_layer/sidechain/src/lib.rs | 2 ++ 5 files changed, 20 insertions(+), 20 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index edc4d05336..e58ff1d262 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -6478,7 +6478,6 @@ dependencies = [ "strum_macros", "tari_common", "tari_crypto", - "tari_hashing", "tari_utilities", "thiserror 1.0.69", ] diff --git a/base_layer/common_types/Cargo.toml b/base_layer/common_types/Cargo.toml index 02af2b8b95..2c2443ad36 100644 --- a/base_layer/common_types/Cargo.toml +++ b/base_layer/common_types/Cargo.toml @@ -11,7 +11,6 @@ tari_crypto = { version = "0.21.0" } tari_utilities = { version = "0.8" } tari_common = { path = "../../common", version = "1.7.0-pre.3" } minotari_ledger_wallet_common = { path = "../../applications/minotari_ledger_wallet/common" } -tari_hashing = { path = "../../hashing", version = "1.7.0-pre.3" } chacha20poly1305 = "0.10.1" bitflags = { version = "2.4", features = ["serde"] } @@ -35,5 +34,4 @@ default = [] [package.metadata.cargo-machete] ignored = [ "strum", - "strum_macros", ] # this is so we can run cargo machete without getting false positive about macro dependancies diff --git a/base_layer/core/src/consensus/consensus_constants.rs b/base_layer/core/src/consensus/consensus_constants.rs index 11129ad16d..af2cf5e04b 100644 --- a/base_layer/core/src/consensus/consensus_constants.rs +++ b/base_layer/core/src/consensus/consensus_constants.rs @@ -108,7 +108,7 @@ pub struct ConsensusConstants { /// An allowlist of output types permitted_output_types: &'static [OutputType], /// The allowlist of range proof types - permitted_range_proof_types: [(OutputType, &'static [RangeProofType]); 5], + permitted_range_proof_types: &'static [(OutputType, &'static [RangeProofType])], /// Coinbase outputs are allowed to have metadata, but it has the following length limit coinbase_output_features_extra_max_length: u32, /// Maximum number of token elements permitted in covenants @@ -336,7 +336,7 @@ impl ConsensusConstants { } /// Returns the permitted range proof types - pub fn permitted_range_proof_types(&self) -> [(OutputType, &[RangeProofType]); 5] { + pub fn permitted_range_proof_types(&self) -> &'static [(OutputType, &'static [RangeProofType])] { self.permitted_range_proof_types } @@ -725,8 +725,8 @@ impl ConsensusConstants { &[OutputType::Coinbase, OutputType::Standard, OutputType::Burn] } - const fn current_permitted_range_proof_types() -> [(OutputType, &'static [RangeProofType]); 5] { - [ + const fn current_permitted_range_proof_types() -> &'static [(OutputType, &'static [RangeProofType])] { + &[ (OutputType::Standard, &[RangeProofType::BulletProofPlus]), (OutputType::Coinbase, &[ RangeProofType::BulletProofPlus, @@ -737,17 +737,22 @@ impl ConsensusConstants { RangeProofType::BulletProofPlus, ]), (OutputType::CodeTemplateRegistration, &[RangeProofType::BulletProofPlus]), + (OutputType::SidechainCheckpoint, &[RangeProofType::BulletProofPlus]), + (OutputType::SidechainProof, &[RangeProofType::BulletProofPlus]), ] } - const fn all_range_proof_types() -> [(OutputType, &'static [RangeProofType]); 5] { - [ + const fn all_range_proof_types() -> &'static [(OutputType, &'static [RangeProofType])] { + const RP_TYPES: &[(OutputType, &[RangeProofType])] = &[ (OutputType::Standard, RangeProofType::all()), (OutputType::Coinbase, RangeProofType::all()), (OutputType::Burn, RangeProofType::all()), (OutputType::ValidatorNodeRegistration, RangeProofType::all()), (OutputType::CodeTemplateRegistration, RangeProofType::all()), - ] + (OutputType::SidechainCheckpoint, RangeProofType::all()), + (OutputType::SidechainProof, RangeProofType::all()), + ]; + RP_TYPES } } @@ -894,7 +899,7 @@ impl ConsensusConstantsBuilder { pub fn with_permitted_range_proof_types( mut self, - permitted_range_proof_types: [(OutputType, &'static [RangeProofType]); 5], + permitted_range_proof_types: &'static [(OutputType, &'static [RangeProofType])], ) -> Self { self.consensus.permitted_range_proof_types = permitted_range_proof_types; self diff --git a/base_layer/core/src/validation/block_body/test.rs b/base_layer/core/src/validation/block_body/test.rs index fede6a9984..fa4171b125 100644 --- a/base_layer/core/src/validation/block_body/test.rs +++ b/base_layer/core/src/validation/block_body/test.rs @@ -618,7 +618,7 @@ mod orphan_validator { let rules = ConsensusManager::builder(Network::LocalNet) .add_consensus_constants( ConsensusConstantsBuilder::new(Network::LocalNet) - .with_permitted_range_proof_types([ + .with_permitted_range_proof_types(&[ (OutputType::Standard, &[RangeProofType::RevealedValue]), (OutputType::Coinbase, &[RangeProofType::RevealedValue]), (OutputType::Burn, &[RangeProofType::RevealedValue]), @@ -652,7 +652,7 @@ mod orphan_validator { let rules = ConsensusManager::builder(Network::LocalNet) .add_consensus_constants( ConsensusConstantsBuilder::new(Network::LocalNet) - .with_permitted_range_proof_types([ + .with_permitted_range_proof_types(&[ (OutputType::Standard, &[RangeProofType::BulletProofPlus]), (OutputType::Coinbase, &[RangeProofType::BulletProofPlus]), (OutputType::Burn, &[RangeProofType::BulletProofPlus]), @@ -686,13 +686,9 @@ mod orphan_validator { let rules = ConsensusManager::builder(Network::LocalNet) .add_consensus_constants( ConsensusConstantsBuilder::new(Network::LocalNet) - .with_permitted_range_proof_types([ - (OutputType::CodeTemplateRegistration, &[RangeProofType::BulletProofPlus]), - (OutputType::CodeTemplateRegistration, &[RangeProofType::BulletProofPlus]), - (OutputType::CodeTemplateRegistration, &[RangeProofType::BulletProofPlus]), - (OutputType::CodeTemplateRegistration, &[RangeProofType::BulletProofPlus]), - (OutputType::CodeTemplateRegistration, &[RangeProofType::BulletProofPlus]), - ]) + .with_permitted_range_proof_types(&[(OutputType::CodeTemplateRegistration, &[ + RangeProofType::BulletProofPlus, + ])]) .with_coinbase_lockheight(0) .build(), ) diff --git a/base_layer/sidechain/src/lib.rs b/base_layer/sidechain/src/lib.rs index c45c0a2269..070bb4cd44 100644 --- a/base_layer/sidechain/src/lib.rs +++ b/base_layer/sidechain/src/lib.rs @@ -1,3 +1,5 @@ +// Copyright 2024 The Tari Project +// SPDX-License-Identifier: BSD-3-Clause mod command; mod commit_proof; mod error;