diff --git a/Cargo.lock b/Cargo.lock index a951993e9..8bc4c86ea 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2265,7 +2265,7 @@ dependencies = [ [[package]] name = "kaspa-addresses" -version = "0.15.3" +version = "0.15.4" dependencies = [ "borsh", "criterion", @@ -2282,7 +2282,7 @@ dependencies = [ [[package]] name = "kaspa-addressmanager" -version = "0.15.3" +version = "0.15.4" dependencies = [ "borsh", "igd-next", @@ -2304,14 +2304,14 @@ dependencies = [ [[package]] name = "kaspa-alloc" -version = "0.15.3" +version = "0.15.4" dependencies = [ "mimalloc", ] [[package]] name = "kaspa-bip32" -version = "0.15.3" +version = "0.15.4" dependencies = [ "borsh", "bs58", @@ -2338,7 +2338,7 @@ dependencies = [ [[package]] name = "kaspa-cli" -version = "0.15.3" +version = "0.15.4" dependencies = [ "async-trait", "borsh", @@ -2385,7 +2385,7 @@ dependencies = [ [[package]] name = "kaspa-connectionmanager" -version = "0.15.3" +version = "0.15.4" dependencies = [ "duration-string", "futures-util", @@ -2402,7 +2402,7 @@ dependencies = [ [[package]] name = "kaspa-consensus" -version = "0.15.3" +version = "0.15.4" dependencies = [ "arc-swap", "async-channel 2.3.1", @@ -2446,7 +2446,7 @@ dependencies = [ [[package]] name = "kaspa-consensus-client" -version = "0.15.3" +version = "0.15.4" dependencies = [ "ahash", "cfg-if 1.0.0", @@ -2474,7 +2474,7 @@ dependencies = [ [[package]] name = "kaspa-consensus-core" -version = "0.15.3" +version = "0.15.4" dependencies = [ "arc-swap", "async-trait", @@ -2513,7 +2513,7 @@ dependencies = [ [[package]] name = "kaspa-consensus-notify" -version = "0.15.3" +version = "0.15.4" dependencies = [ "async-channel 2.3.1", "cfg-if 1.0.0", @@ -2532,7 +2532,7 @@ dependencies = [ [[package]] name = "kaspa-consensus-wasm" -version = "0.15.3" +version = "0.15.4" dependencies = [ "cfg-if 1.0.0", "faster-hex", @@ -2556,7 +2556,7 @@ dependencies = [ [[package]] name = "kaspa-consensusmanager" -version = "0.15.3" +version = "0.15.4" dependencies = [ "duration-string", "futures", @@ -2574,7 +2574,7 @@ dependencies = [ [[package]] name = "kaspa-core" -version = "0.15.3" +version = "0.15.4" dependencies = [ "cfg-if 1.0.0", "ctrlc", @@ -2592,7 +2592,7 @@ dependencies = [ [[package]] name = "kaspa-daemon" -version = "0.15.3" +version = "0.15.4" dependencies = [ "async-trait", "borsh", @@ -2614,7 +2614,7 @@ dependencies = [ [[package]] name = "kaspa-database" -version = "0.15.3" +version = "0.15.4" dependencies = [ "bincode", "enum-primitive-derive", @@ -2636,7 +2636,7 @@ dependencies = [ [[package]] name = "kaspa-grpc-client" -version = "0.15.3" +version = "0.15.4" dependencies = [ "async-channel 2.3.1", "async-stream", @@ -2668,7 +2668,7 @@ dependencies = [ [[package]] name = "kaspa-grpc-core" -version = "0.15.3" +version = "0.15.4" dependencies = [ "async-channel 2.3.1", "async-stream", @@ -2697,7 +2697,7 @@ dependencies = [ [[package]] name = "kaspa-grpc-server" -version = "0.15.3" +version = "0.15.4" dependencies = [ "async-channel 2.3.1", "async-stream", @@ -2733,7 +2733,7 @@ dependencies = [ [[package]] name = "kaspa-hashes" -version = "0.15.3" +version = "0.15.4" dependencies = [ "blake2b_simd", "borsh", @@ -2754,7 +2754,7 @@ dependencies = [ [[package]] name = "kaspa-index-core" -version = "0.15.3" +version = "0.15.4" dependencies = [ "async-channel 2.3.1", "async-trait", @@ -2773,7 +2773,7 @@ dependencies = [ [[package]] name = "kaspa-index-processor" -version = "0.15.3" +version = "0.15.4" dependencies = [ "async-channel 2.3.1", "async-trait", @@ -2801,7 +2801,7 @@ dependencies = [ [[package]] name = "kaspa-math" -version = "0.15.3" +version = "0.15.4" dependencies = [ "borsh", "criterion", @@ -2822,14 +2822,14 @@ dependencies = [ [[package]] name = "kaspa-merkle" -version = "0.15.3" +version = "0.15.4" dependencies = [ "kaspa-hashes", ] [[package]] name = "kaspa-metrics-core" -version = "0.15.3" +version = "0.15.4" dependencies = [ "async-trait", "borsh", @@ -2845,7 +2845,7 @@ dependencies = [ [[package]] name = "kaspa-mining" -version = "0.15.3" +version = "0.15.4" dependencies = [ "criterion", "futures-util", @@ -2872,7 +2872,7 @@ dependencies = [ [[package]] name = "kaspa-mining-errors" -version = "0.15.3" +version = "0.15.4" dependencies = [ "kaspa-consensus-core", "thiserror", @@ -2880,7 +2880,7 @@ dependencies = [ [[package]] name = "kaspa-muhash" -version = "0.15.3" +version = "0.15.4" dependencies = [ "criterion", "kaspa-hashes", @@ -2893,7 +2893,7 @@ dependencies = [ [[package]] name = "kaspa-notify" -version = "0.15.3" +version = "0.15.4" dependencies = [ "async-channel 2.3.1", "async-trait", @@ -2929,7 +2929,7 @@ dependencies = [ [[package]] name = "kaspa-p2p-flows" -version = "0.15.3" +version = "0.15.4" dependencies = [ "async-trait", "chrono", @@ -2960,7 +2960,7 @@ dependencies = [ [[package]] name = "kaspa-p2p-lib" -version = "0.15.3" +version = "0.15.4" dependencies = [ "borsh", "ctrlc", @@ -2991,7 +2991,7 @@ dependencies = [ [[package]] name = "kaspa-perf-monitor" -version = "0.15.3" +version = "0.15.4" dependencies = [ "kaspa-core", "log", @@ -3003,7 +3003,7 @@ dependencies = [ [[package]] name = "kaspa-pow" -version = "0.15.3" +version = "0.15.4" dependencies = [ "criterion", "js-sys", @@ -3019,7 +3019,7 @@ dependencies = [ [[package]] name = "kaspa-rpc-core" -version = "0.15.3" +version = "0.15.4" dependencies = [ "async-channel 2.3.1", "async-trait", @@ -3061,7 +3061,7 @@ dependencies = [ [[package]] name = "kaspa-rpc-macros" -version = "0.15.3" +version = "0.15.4" dependencies = [ "convert_case 0.6.0", "proc-macro-error", @@ -3073,7 +3073,7 @@ dependencies = [ [[package]] name = "kaspa-rpc-service" -version = "0.15.3" +version = "0.15.4" dependencies = [ "async-trait", "kaspa-addresses", @@ -3102,7 +3102,7 @@ dependencies = [ [[package]] name = "kaspa-testing-integration" -version = "0.15.3" +version = "0.15.4" dependencies = [ "async-channel 2.3.1", "async-trait", @@ -3162,7 +3162,7 @@ dependencies = [ [[package]] name = "kaspa-txscript" -version = "0.15.3" +version = "0.15.4" dependencies = [ "blake2b_simd", "borsh", @@ -3194,7 +3194,7 @@ dependencies = [ [[package]] name = "kaspa-txscript-errors" -version = "0.15.3" +version = "0.15.4" dependencies = [ "secp256k1", "thiserror", @@ -3202,7 +3202,7 @@ dependencies = [ [[package]] name = "kaspa-utils" -version = "0.15.3" +version = "0.15.4" dependencies = [ "arc-swap", "async-channel 2.3.1", @@ -3238,7 +3238,7 @@ dependencies = [ [[package]] name = "kaspa-utils-tower" -version = "0.15.3" +version = "0.15.4" dependencies = [ "bytes", "cfg-if 1.0.0", @@ -3254,7 +3254,7 @@ dependencies = [ [[package]] name = "kaspa-utxoindex" -version = "0.15.3" +version = "0.15.4" dependencies = [ "futures", "kaspa-consensus", @@ -3275,7 +3275,7 @@ dependencies = [ [[package]] name = "kaspa-wallet" -version = "0.15.3" +version = "0.15.4" dependencies = [ "async-std", "async-trait", @@ -3287,7 +3287,7 @@ dependencies = [ [[package]] name = "kaspa-wallet-cli-wasm" -version = "0.15.3" +version = "0.15.4" dependencies = [ "async-trait", "js-sys", @@ -3301,7 +3301,7 @@ dependencies = [ [[package]] name = "kaspa-wallet-core" -version = "0.15.3" +version = "0.15.4" dependencies = [ "aes", "ahash", @@ -3382,7 +3382,7 @@ dependencies = [ [[package]] name = "kaspa-wallet-keys" -version = "0.15.3" +version = "0.15.4" dependencies = [ "async-trait", "borsh", @@ -3415,7 +3415,7 @@ dependencies = [ [[package]] name = "kaspa-wallet-macros" -version = "0.15.3" +version = "0.15.4" dependencies = [ "convert_case 0.5.0", "proc-macro-error", @@ -3428,7 +3428,7 @@ dependencies = [ [[package]] name = "kaspa-wallet-pskt" -version = "0.15.3" +version = "0.15.4" dependencies = [ "bincode", "derive_builder", @@ -3455,7 +3455,7 @@ dependencies = [ [[package]] name = "kaspa-wasm" -version = "0.15.3" +version = "0.15.4" dependencies = [ "cfg-if 1.0.0", "js-sys", @@ -3483,7 +3483,7 @@ dependencies = [ [[package]] name = "kaspa-wasm-core" -version = "0.15.3" +version = "0.15.4" dependencies = [ "faster-hex", "hexplay", @@ -3494,7 +3494,7 @@ dependencies = [ [[package]] name = "kaspa-wrpc-client" -version = "0.15.3" +version = "0.15.4" dependencies = [ "async-std", "async-trait", @@ -3530,7 +3530,7 @@ dependencies = [ [[package]] name = "kaspa-wrpc-example-subscriber" -version = "0.15.3" +version = "0.15.4" dependencies = [ "ctrlc", "futures", @@ -3545,7 +3545,7 @@ dependencies = [ [[package]] name = "kaspa-wrpc-proxy" -version = "0.15.3" +version = "0.15.4" dependencies = [ "async-trait", "clap 4.5.19", @@ -3564,7 +3564,7 @@ dependencies = [ [[package]] name = "kaspa-wrpc-server" -version = "0.15.3" +version = "0.15.4" dependencies = [ "async-trait", "borsh", @@ -3592,7 +3592,7 @@ dependencies = [ [[package]] name = "kaspa-wrpc-simple-client-example" -version = "0.15.3" +version = "0.15.4" dependencies = [ "futures", "kaspa-rpc-core", @@ -3602,7 +3602,7 @@ dependencies = [ [[package]] name = "kaspa-wrpc-wasm" -version = "0.15.3" +version = "0.15.4" dependencies = [ "ahash", "async-std", @@ -3632,7 +3632,7 @@ dependencies = [ [[package]] name = "kaspad" -version = "0.15.3" +version = "0.15.4" dependencies = [ "async-channel 2.3.1", "cfg-if 1.0.0", @@ -4974,7 +4974,7 @@ dependencies = [ [[package]] name = "rothschild" -version = "0.15.3" +version = "0.15.4" dependencies = [ "async-channel 2.3.1", "clap 4.5.19", @@ -5387,7 +5387,7 @@ dependencies = [ [[package]] name = "simpa" -version = "0.15.3" +version = "0.15.4" dependencies = [ "async-channel 2.3.1", "cfg-if 1.0.0", diff --git a/Cargo.toml b/Cargo.toml index aa304d37f..4ff4b234e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -63,7 +63,7 @@ members = [ [workspace.package] rust-version = "1.82.0" -version = "0.15.3" +version = "0.15.4" authors = ["Kaspa developers"] license = "ISC" repository = "https://github.com/kaspanet/rusty-kaspa" @@ -80,61 +80,61 @@ include = [ ] [workspace.dependencies] -# kaspa-testing-integration = { version = "0.15.3", path = "testing/integration" } -kaspa-addresses = { version = "0.15.3", path = "crypto/addresses" } -kaspa-addressmanager = { version = "0.15.3", path = "components/addressmanager" } -kaspa-bip32 = { version = "0.15.3", path = "wallet/bip32" } -kaspa-cli = { version = "0.15.3", path = "cli" } -kaspa-connectionmanager = { version = "0.15.3", path = "components/connectionmanager" } -kaspa-consensus = { version = "0.15.3", path = "consensus" } -kaspa-consensus-core = { version = "0.15.3", path = "consensus/core" } -kaspa-consensus-client = { version = "0.15.3", path = "consensus/client" } -kaspa-consensus-notify = { version = "0.15.3", path = "consensus/notify" } -kaspa-consensus-wasm = { version = "0.15.3", path = "consensus/wasm" } -kaspa-consensusmanager = { version = "0.15.3", path = "components/consensusmanager" } -kaspa-core = { version = "0.15.3", path = "core" } -kaspa-daemon = { version = "0.15.3", path = "daemon" } -kaspa-database = { version = "0.15.3", path = "database" } -kaspa-grpc-client = { version = "0.15.3", path = "rpc/grpc/client" } -kaspa-grpc-core = { version = "0.15.3", path = "rpc/grpc/core" } -kaspa-grpc-server = { version = "0.15.3", path = "rpc/grpc/server" } -kaspa-hashes = { version = "0.15.3", path = "crypto/hashes" } -kaspa-index-core = { version = "0.15.3", path = "indexes/core" } -kaspa-index-processor = { version = "0.15.3", path = "indexes/processor" } -kaspa-math = { version = "0.15.3", path = "math" } -kaspa-merkle = { version = "0.15.3", path = "crypto/merkle" } -kaspa-metrics-core = { version = "0.15.3", path = "metrics/core" } -kaspa-mining = { version = "0.15.3", path = "mining" } -kaspa-mining-errors = { version = "0.15.3", path = "mining/errors" } -kaspa-muhash = { version = "0.15.3", path = "crypto/muhash" } -kaspa-notify = { version = "0.15.3", path = "notify" } -kaspa-p2p-flows = { version = "0.15.3", path = "protocol/flows" } -kaspa-p2p-lib = { version = "0.15.3", path = "protocol/p2p" } -kaspa-perf-monitor = { version = "0.15.3", path = "metrics/perf_monitor" } -kaspa-pow = { version = "0.15.3", path = "consensus/pow" } -kaspa-rpc-core = { version = "0.15.3", path = "rpc/core" } -kaspa-rpc-macros = { version = "0.15.3", path = "rpc/macros" } -kaspa-rpc-service = { version = "0.15.3", path = "rpc/service" } -kaspa-txscript = { version = "0.15.3", path = "crypto/txscript" } -kaspa-txscript-errors = { version = "0.15.3", path = "crypto/txscript/errors" } -kaspa-utils = { version = "0.15.3", path = "utils" } -kaspa-utils-tower = { version = "0.15.3", path = "utils/tower" } -kaspa-utxoindex = { version = "0.15.3", path = "indexes/utxoindex" } -kaspa-wallet = { version = "0.15.3", path = "wallet/native" } -kaspa-wallet-cli-wasm = { version = "0.15.3", path = "wallet/wasm" } -kaspa-wallet-keys = { version = "0.15.3", path = "wallet/keys" } -kaspa-wallet-pskt = { version = "0.15.3", path = "wallet/pskt" } -kaspa-wallet-core = { version = "0.15.3", path = "wallet/core" } -kaspa-wallet-macros = { version = "0.15.3", path = "wallet/macros" } -kaspa-wasm = { version = "0.15.3", path = "wasm" } -kaspa-wasm-core = { version = "0.15.3", path = "wasm/core" } -kaspa-wrpc-client = { version = "0.15.3", path = "rpc/wrpc/client" } -kaspa-wrpc-proxy = { version = "0.15.3", path = "rpc/wrpc/proxy" } -kaspa-wrpc-server = { version = "0.15.3", path = "rpc/wrpc/server" } -kaspa-wrpc-wasm = { version = "0.15.3", path = "rpc/wrpc/wasm" } -kaspa-wrpc-example-subscriber = { version = "0.15.3", path = "rpc/wrpc/examples/subscriber" } -kaspad = { version = "0.15.3", path = "kaspad" } -kaspa-alloc = { version = "0.15.3", path = "utils/alloc" } +# kaspa-testing-integration = { version = "0.15.4", path = "testing/integration" } +kaspa-addresses = { version = "0.15.4", path = "crypto/addresses" } +kaspa-addressmanager = { version = "0.15.4", path = "components/addressmanager" } +kaspa-bip32 = { version = "0.15.4", path = "wallet/bip32" } +kaspa-cli = { version = "0.15.4", path = "cli" } +kaspa-connectionmanager = { version = "0.15.4", path = "components/connectionmanager" } +kaspa-consensus = { version = "0.15.4", path = "consensus" } +kaspa-consensus-core = { version = "0.15.4", path = "consensus/core" } +kaspa-consensus-client = { version = "0.15.4", path = "consensus/client" } +kaspa-consensus-notify = { version = "0.15.4", path = "consensus/notify" } +kaspa-consensus-wasm = { version = "0.15.4", path = "consensus/wasm" } +kaspa-consensusmanager = { version = "0.15.4", path = "components/consensusmanager" } +kaspa-core = { version = "0.15.4", path = "core" } +kaspa-daemon = { version = "0.15.4", path = "daemon" } +kaspa-database = { version = "0.15.4", path = "database" } +kaspa-grpc-client = { version = "0.15.4", path = "rpc/grpc/client" } +kaspa-grpc-core = { version = "0.15.4", path = "rpc/grpc/core" } +kaspa-grpc-server = { version = "0.15.4", path = "rpc/grpc/server" } +kaspa-hashes = { version = "0.15.4", path = "crypto/hashes" } +kaspa-index-core = { version = "0.15.4", path = "indexes/core" } +kaspa-index-processor = { version = "0.15.4", path = "indexes/processor" } +kaspa-math = { version = "0.15.4", path = "math" } +kaspa-merkle = { version = "0.15.4", path = "crypto/merkle" } +kaspa-metrics-core = { version = "0.15.4", path = "metrics/core" } +kaspa-mining = { version = "0.15.4", path = "mining" } +kaspa-mining-errors = { version = "0.15.4", path = "mining/errors" } +kaspa-muhash = { version = "0.15.4", path = "crypto/muhash" } +kaspa-notify = { version = "0.15.4", path = "notify" } +kaspa-p2p-flows = { version = "0.15.4", path = "protocol/flows" } +kaspa-p2p-lib = { version = "0.15.4", path = "protocol/p2p" } +kaspa-perf-monitor = { version = "0.15.4", path = "metrics/perf_monitor" } +kaspa-pow = { version = "0.15.4", path = "consensus/pow" } +kaspa-rpc-core = { version = "0.15.4", path = "rpc/core" } +kaspa-rpc-macros = { version = "0.15.4", path = "rpc/macros" } +kaspa-rpc-service = { version = "0.15.4", path = "rpc/service" } +kaspa-txscript = { version = "0.15.4", path = "crypto/txscript" } +kaspa-txscript-errors = { version = "0.15.4", path = "crypto/txscript/errors" } +kaspa-utils = { version = "0.15.4", path = "utils" } +kaspa-utils-tower = { version = "0.15.4", path = "utils/tower" } +kaspa-utxoindex = { version = "0.15.4", path = "indexes/utxoindex" } +kaspa-wallet = { version = "0.15.4", path = "wallet/native" } +kaspa-wallet-cli-wasm = { version = "0.15.4", path = "wallet/wasm" } +kaspa-wallet-keys = { version = "0.15.4", path = "wallet/keys" } +kaspa-wallet-pskt = { version = "0.15.4", path = "wallet/pskt" } +kaspa-wallet-core = { version = "0.15.4", path = "wallet/core" } +kaspa-wallet-macros = { version = "0.15.4", path = "wallet/macros" } +kaspa-wasm = { version = "0.15.4", path = "wasm" } +kaspa-wasm-core = { version = "0.15.4", path = "wasm/core" } +kaspa-wrpc-client = { version = "0.15.4", path = "rpc/wrpc/client" } +kaspa-wrpc-proxy = { version = "0.15.4", path = "rpc/wrpc/proxy" } +kaspa-wrpc-server = { version = "0.15.4", path = "rpc/wrpc/server" } +kaspa-wrpc-wasm = { version = "0.15.4", path = "rpc/wrpc/wasm" } +kaspa-wrpc-example-subscriber = { version = "0.15.4", path = "rpc/wrpc/examples/subscriber" } +kaspad = { version = "0.15.4", path = "kaspad" } +kaspa-alloc = { version = "0.15.4", path = "utils/alloc" } # external aes = "0.8.3" diff --git a/consensus/core/src/config/constants.rs b/consensus/core/src/config/constants.rs index 899773bbf..781878933 100644 --- a/consensus/core/src/config/constants.rs +++ b/consensus/core/src/config/constants.rs @@ -116,7 +116,7 @@ pub mod perf { /// The default slack interval used by the reachability /// algorithm to encounter for blocks out of the selected chain. - pub const DEFAULT_REINDEX_SLACK: u64 = 1 << 12; + pub const DEFAULT_REINDEX_SLACK: u64 = 1 << 14; const BASELINE_HEADER_DATA_CACHE_SIZE: usize = 10_000; const BASELINE_BLOCK_DATA_CACHE_SIZE: usize = 200; diff --git a/consensus/core/src/config/params.rs b/consensus/core/src/config/params.rs index e5da18c25..68bede648 100644 --- a/consensus/core/src/config/params.rs +++ b/consensus/core/src/config/params.rs @@ -533,12 +533,12 @@ pub const TESTNET11_PARAMS: Params = Params { storage_mass_parameter: STORAGE_MASS_PARAMETER, storage_mass_activation: ForkActivation::always(), - kip10_activation: ForkActivation::never(), + // Roughly at Dec 3, 2024 1800 UTC + kip10_activation: ForkActivation::new(287238000), + payload_activation: ForkActivation::new(287238000), skip_proof_of_work: false, max_block_level: 250, - - payload_activation: ForkActivation::never(), }; pub const SIMNET_PARAMS: Params = Params { diff --git a/consensus/core/src/mass/mod.rs b/consensus/core/src/mass/mod.rs index 3a8307798..67bcc63ae 100644 --- a/consensus/core/src/mass/mod.rs +++ b/consensus/core/src/mass/mod.rs @@ -5,17 +5,6 @@ use crate::{ }; use kaspa_hashes::HASH_SIZE; -/// Temp enum for the transition phases of KIP9 -#[derive(Debug, Copy, Clone, PartialEq, Eq)] -pub enum Kip9Version { - /// Initial KIP9 mass calculation, w/o the relaxed formula and summing storage mass and compute mass - Alpha, - - /// Currently proposed KIP9 mass calculation, with the relaxed formula (for the cases `|O| = 1 OR |O| <= |I| <= 2`), - /// and using a maximum operator over storage and compute mass - Beta, -} - // transaction_estimated_serialized_size is the estimated size of a transaction in some // serialization. This has to be deterministic, but not necessarily accurate, since // it's only used as the size component in the transaction and block mass limit @@ -121,32 +110,18 @@ impl MassCalculator { /// 2. At least one input (unless coinbase) /// /// Otherwise this function should never fail. - pub fn calc_tx_storage_mass(&self, tx: &impl VerifiableTransaction, version: Kip9Version) -> Option { + pub fn calc_tx_storage_mass(&self, tx: &impl VerifiableTransaction) -> Option { calc_storage_mass( tx.is_coinbase(), tx.populated_inputs().map(|(_, entry)| entry.amount), tx.outputs().iter().map(|out| out.value), - version, self.storage_mass_parameter, ) } /// Calculates the overall mass of this transaction, combining both compute and storage masses. - /// The combination strategy depends on the version passed. - pub fn calc_tx_overall_mass( - &self, - tx: &impl VerifiableTransaction, - cached_compute_mass: Option, - version: Kip9Version, - ) -> Option { - match version { - Kip9Version::Alpha => self - .calc_tx_storage_mass(tx, version) - .and_then(|mass| mass.checked_add(cached_compute_mass.unwrap_or_else(|| self.calc_tx_compute_mass(tx.tx())))), - Kip9Version::Beta => self - .calc_tx_storage_mass(tx, version) - .map(|mass| mass.max(cached_compute_mass.unwrap_or_else(|| self.calc_tx_compute_mass(tx.tx())))), - } + pub fn calc_tx_overall_mass(&self, tx: &impl VerifiableTransaction, cached_compute_mass: Option) -> Option { + self.calc_tx_storage_mass(tx).map(|mass| mass.max(cached_compute_mass.unwrap_or_else(|| self.calc_tx_compute_mass(tx.tx())))) } } @@ -160,7 +135,6 @@ pub fn calc_storage_mass( is_coinbase: bool, input_values: impl ExactSizeIterator, output_values: impl ExactSizeIterator, - version: Kip9Version, storage_mass_parameter: u64, ) -> Option { if is_coinbase { @@ -199,7 +173,7 @@ pub fn calc_storage_mass( Note: in the case |I| = 1 both formulas are equal, yet the following code (harmonic_ins) is a bit more efficient. Hence, we transform the condition to |O| = 1 OR |I| = 1 OR |O| = |I| = 2 which is equivalent (and faster). */ - if version == Kip9Version::Beta && (outs_len == 1 || ins_len == 1 || (outs_len == 2 && ins_len == 2)) { + if outs_len == 1 || ins_len == 1 || (outs_len == 2 && ins_len == 2) { let harmonic_ins = input_values.map(|value| storage_mass_parameter / value).fold(0u64, |total, current| total.saturating_add(current)); // C·|I|/H(I) return Some(harmonic_outs.saturating_sub(harmonic_ins)); // max( 0 , C·( |O|/H(O) - |I|/H(I) ) ); @@ -230,34 +204,31 @@ mod tests { fn test_mass_storage() { // Tx with less outs than ins let mut tx = generate_tx_from_amounts(&[100, 200, 300], &[300, 300]); - let test_version = Kip9Version::Alpha; + // // Assert the formula: max( 0 , C·( |O|/H(O) - |I|/A(I) ) ) + // - let storage_mass = - MassCalculator::new(0, 0, 0, 10u64.pow(12)).calc_tx_storage_mass(&tx.as_verifiable(), test_version).unwrap(); + let storage_mass = MassCalculator::new(0, 0, 0, 10u64.pow(12)).calc_tx_storage_mass(&tx.as_verifiable()).unwrap(); assert_eq!(storage_mass, 0); // Compounds from 3 to 2, with symmetric outputs and no fee, should be zero // Create asymmetry tx.tx.outputs[0].value = 50; tx.tx.outputs[1].value = 550; let storage_mass_parameter = 10u64.pow(12); - let storage_mass = - MassCalculator::new(0, 0, 0, storage_mass_parameter).calc_tx_storage_mass(&tx.as_verifiable(), test_version).unwrap(); + let storage_mass = MassCalculator::new(0, 0, 0, storage_mass_parameter).calc_tx_storage_mass(&tx.as_verifiable()).unwrap(); assert_eq!(storage_mass, storage_mass_parameter / 50 + storage_mass_parameter / 550 - 3 * (storage_mass_parameter / 200)); // Create a tx with more outs than ins let base_value = 10_000 * SOMPI_PER_KASPA; let mut tx = generate_tx_from_amounts(&[base_value, base_value, base_value * 2], &[base_value; 4]); let storage_mass_parameter = STORAGE_MASS_PARAMETER; - let storage_mass = - MassCalculator::new(0, 0, 0, storage_mass_parameter).calc_tx_storage_mass(&tx.as_verifiable(), test_version).unwrap(); + let storage_mass = MassCalculator::new(0, 0, 0, storage_mass_parameter).calc_tx_storage_mass(&tx.as_verifiable()).unwrap(); assert_eq!(storage_mass, 4); // Inputs are above C so they don't contribute negative mass, 4 outputs exactly equal C each charge 1 let mut tx2 = tx.clone(); tx2.tx.outputs[0].value = 10 * SOMPI_PER_KASPA; - let storage_mass = - MassCalculator::new(0, 0, 0, storage_mass_parameter).calc_tx_storage_mass(&tx2.as_verifiable(), test_version).unwrap(); + let storage_mass = MassCalculator::new(0, 0, 0, storage_mass_parameter).calc_tx_storage_mass(&tx2.as_verifiable()).unwrap(); assert_eq!(storage_mass, 1003); // Increase values over the lim @@ -265,35 +236,27 @@ mod tests { out.value += 1 } tx.entries[0].as_mut().unwrap().amount += tx.tx.outputs.len() as u64; - let storage_mass = - MassCalculator::new(0, 0, 0, storage_mass_parameter).calc_tx_storage_mass(&tx.as_verifiable(), test_version).unwrap(); + let storage_mass = MassCalculator::new(0, 0, 0, storage_mass_parameter).calc_tx_storage_mass(&tx.as_verifiable()).unwrap(); assert_eq!(storage_mass, 0); - } - #[test] - fn test_mass_storage_beta() { - // 2:2 transaction + // Now create 2:2 transaction + // Assert the formula: max( 0 , C·( |O|/H(O) - |I|/H(I) ) ) let mut tx = generate_tx_from_amounts(&[100, 200], &[50, 250]); let storage_mass_parameter = 10u64.pow(12); - let test_version = Kip9Version::Beta; - // Assert the formula: max( 0 , C·( |O|/H(O) - |I|/O(I) ) ) - let storage_mass = - MassCalculator::new(0, 0, 0, storage_mass_parameter).calc_tx_storage_mass(&tx.as_verifiable(), test_version).unwrap(); + let storage_mass = MassCalculator::new(0, 0, 0, storage_mass_parameter).calc_tx_storage_mass(&tx.as_verifiable()).unwrap(); assert_eq!(storage_mass, 9000000000); // Set outputs to be equal to inputs tx.tx.outputs[0].value = 100; tx.tx.outputs[1].value = 200; - let storage_mass = - MassCalculator::new(0, 0, 0, storage_mass_parameter).calc_tx_storage_mass(&tx.as_verifiable(), test_version).unwrap(); + let storage_mass = MassCalculator::new(0, 0, 0, storage_mass_parameter).calc_tx_storage_mass(&tx.as_verifiable()).unwrap(); assert_eq!(storage_mass, 0); // Remove an output and make sure the other is small enough to make storage mass greater than zero tx.tx.outputs.pop(); tx.tx.outputs[0].value = 50; - let storage_mass = - MassCalculator::new(0, 0, 0, storage_mass_parameter).calc_tx_storage_mass(&tx.as_verifiable(), test_version).unwrap(); + let storage_mass = MassCalculator::new(0, 0, 0, storage_mass_parameter).calc_tx_storage_mass(&tx.as_verifiable()).unwrap(); assert_eq!(storage_mass, 5000000000); } diff --git a/consensus/src/consensus/storage.rs b/consensus/src/consensus/storage.rs index ad3b95d1b..5e2ff8fcd 100644 --- a/consensus/src/consensus/storage.rs +++ b/consensus/src/consensus/storage.rs @@ -88,12 +88,12 @@ impl ConsensusStorage { // Budgets in bytes. All byte budgets overall sum up to ~1GB of memory (which obviously takes more low level alloc space) let daa_excluded_budget = scaled(30_000_000); let statuses_budget = scaled(30_000_000); - let reachability_data_budget = scaled(20_000_000); - let reachability_sets_budget = scaled(20_000_000); // x 2 for tree children and future covering set + let reachability_data_budget = scaled(100_000_000); + let reachability_sets_budget = scaled(100_000_000); // x 2 for tree children and future covering set let ghostdag_compact_budget = scaled(15_000_000); let headers_compact_budget = scaled(5_000_000); - let parents_budget = scaled(40_000_000); // x 3 for reachability and levels - let children_budget = scaled(5_000_000); // x 3 for reachability and levels + let parents_budget = scaled(80_000_000); // x 3 for reachability and levels + let children_budget = scaled(20_000_000); // x 3 for reachability and levels let ghostdag_budget = scaled(80_000_000); // x 2 for levels let headers_budget = scaled(80_000_000); let transactions_budget = scaled(40_000_000); diff --git a/consensus/src/model/services/reachability.rs b/consensus/src/model/services/reachability.rs index a3aa83c7a..cf45c2ce6 100644 --- a/consensus/src/model/services/reachability.rs +++ b/consensus/src/model/services/reachability.rs @@ -13,7 +13,7 @@ pub trait ReachabilityService { /// Note that we use the graph theory convention here which defines that a block is also an ancestor of itself. fn is_chain_ancestor_of(&self, this: Hash, queried: Hash) -> bool; - /// Result version of [`is_dag_ancestor_of`] (avoids unwrapping internally) + /// Result version of [`Self::is_dag_ancestor_of`] (avoids unwrapping internally) fn is_dag_ancestor_of_result(&self, this: Hash, queried: Hash) -> Result; /// Returns true if `this` is a DAG ancestor of `queried` (i.e., `queried ∈ future(this) ∪ {this}`). @@ -21,13 +21,13 @@ pub trait ReachabilityService { /// The complexity of this method is `O(log(|future_covering_set(this)|))` fn is_dag_ancestor_of(&self, this: Hash, queried: Hash) -> bool; - /// Checks if `this` is DAG ancestor of any of the blocks in `queried`. See [`is_dag_ancestor_of`] as well. + /// Checks if `this` is DAG ancestor of any of the blocks in `queried`. See [`Self::is_dag_ancestor_of`] as well. fn is_dag_ancestor_of_any(&self, this: Hash, queried: &mut impl Iterator) -> bool; - /// Checks if any of the blocks in `list` is DAG ancestor of `queried`. See [`is_dag_ancestor_of`] as well. + /// Checks if any of the blocks in `list` is DAG ancestor of `queried`. See [`Self::is_dag_ancestor_of`] as well. fn is_any_dag_ancestor(&self, list: &mut impl Iterator, queried: Hash) -> bool; - /// Result version of [`is_any_dag_ancestor`] (avoids unwrapping internally) + /// Result version of [`Self::is_any_dag_ancestor`] (avoids unwrapping internally) fn is_any_dag_ancestor_result(&self, list: &mut impl Iterator, queried: Hash) -> Result; /// Finds the tree child of `ancestor` which is also a chain ancestor of `descendant`. diff --git a/consensus/src/pipeline/virtual_processor/processor.rs b/consensus/src/pipeline/virtual_processor/processor.rs index a8e1f7f2f..914e0a327 100644 --- a/consensus/src/pipeline/virtual_processor/processor.rs +++ b/consensus/src/pipeline/virtual_processor/processor.rs @@ -166,6 +166,7 @@ pub struct VirtualStateProcessor { // Storage mass hardfork DAA score pub(crate) storage_mass_activation: ForkActivation, + pub(crate) kip10_activation: ForkActivation, } impl VirtualStateProcessor { @@ -230,6 +231,7 @@ impl VirtualStateProcessor { notification_root, counters, storage_mass_activation: params.storage_mass_activation, + kip10_activation: params.kip10_activation, } } @@ -407,8 +409,11 @@ impl VirtualStateProcessor { for (selected_parent, current) in self.reachability_service.forward_chain_iterator(split_point, to, true).tuple_windows() { if selected_parent != diff_point { // This indicates that the selected parent is disqualified, propagate up and continue - self.statuses_store.write().set(current, StatusDisqualifiedFromChain).unwrap(); - chain_disqualified_counter += 1; + let statuses_guard = self.statuses_store.upgradable_read(); + if statuses_guard.get(current).unwrap() != StatusDisqualifiedFromChain { + RwLockUpgradableReadGuard::upgrade(statuses_guard).set(current, StatusDisqualifiedFromChain).unwrap(); + chain_disqualified_counter += 1; + } continue; } diff --git a/consensus/src/pipeline/virtual_processor/utxo_validation.rs b/consensus/src/pipeline/virtual_processor/utxo_validation.rs index 2e9c7ddb4..f0da0535e 100644 --- a/consensus/src/pipeline/virtual_processor/utxo_validation.rs +++ b/consensus/src/pipeline/virtual_processor/utxo_validation.rs @@ -14,10 +14,8 @@ use kaspa_consensus_core::{ acceptance_data::{AcceptedTxEntry, MergesetBlockAcceptanceData}, api::args::TransactionValidationArgs, coinbase::*, - config::params::ForkActivation, hashing, header::Header, - mass::Kip9Version, muhash::MuHashExtensions, tx::{MutableTransaction, PopulatedTransaction, Transaction, TransactionId, ValidatedTransaction, VerifiableTransaction}, utxo::{ @@ -327,16 +325,11 @@ impl VirtualStateProcessor { ) -> TxResult<()> { self.populate_mempool_transaction_in_utxo_context(mutable_tx, utxo_view)?; - // For non-activated nets (mainnet, TN10) we can update mempool rules to KIP9 beta asap. For - // TN11 we need to hard-fork consensus first (since the new beta rules are more permissive) - let kip9_version = - if self.storage_mass_activation == ForkActivation::never() { Kip9Version::Beta } else { Kip9Version::Alpha }; - // Calc the full contextual mass including storage mass let contextual_mass = self .transaction_validator .mass_calculator - .calc_tx_overall_mass(&mutable_tx.as_verifiable(), mutable_tx.calculated_compute_mass, kip9_version) + .calc_tx_overall_mass(&mutable_tx.as_verifiable(), mutable_tx.calculated_compute_mass) .ok_or(TxRuleError::MassIncomputable)?; // Set the inner mass field diff --git a/consensus/src/processes/transaction_validator/tx_validation_in_utxo_context.rs b/consensus/src/processes/transaction_validator/tx_validation_in_utxo_context.rs index cff13d9fb..854c46de0 100644 --- a/consensus/src/processes/transaction_validator/tx_validation_in_utxo_context.rs +++ b/consensus/src/processes/transaction_validator/tx_validation_in_utxo_context.rs @@ -1,7 +1,6 @@ use crate::constants::{MAX_SOMPI, SEQUENCE_LOCK_TIME_DISABLED, SEQUENCE_LOCK_TIME_MASK}; use kaspa_consensus_core::{ hashing::sighash::{SigHashReusedValuesSync, SigHashReusedValuesUnsync}, - mass::Kip9Version, tx::{TransactionInput, VerifiableTransaction}, }; use kaspa_core::warn; @@ -126,8 +125,7 @@ impl TransactionValidator { } fn check_mass_commitment(&self, tx: &impl VerifiableTransaction) -> TxResult<()> { - let calculated_contextual_mass = - self.mass_calculator.calc_tx_overall_mass(tx, None, Kip9Version::Alpha).ok_or(TxRuleError::MassIncomputable)?; + let calculated_contextual_mass = self.mass_calculator.calc_tx_overall_mass(tx, None).ok_or(TxRuleError::MassIncomputable)?; let committed_contextual_mass = tx.tx().mass(); if committed_contextual_mass != calculated_contextual_mass { return Err(TxRuleError::WrongMass(calculated_contextual_mass, committed_contextual_mass)); diff --git a/simpa/src/simulator/miner.rs b/simpa/src/simulator/miner.rs index 9cd985937..958b4799e 100644 --- a/simpa/src/simulator/miner.rs +++ b/simpa/src/simulator/miner.rs @@ -6,7 +6,7 @@ use kaspa_consensus::params::Params; use kaspa_consensus_core::api::ConsensusApi; use kaspa_consensus_core::block::{Block, TemplateBuildMode, TemplateTransactionSelector}; use kaspa_consensus_core::coinbase::MinerData; -use kaspa_consensus_core::mass::{Kip9Version, MassCalculator}; +use kaspa_consensus_core::mass::MassCalculator; use kaspa_consensus_core::sign::sign; use kaspa_consensus_core::subnets::SUBNETWORK_ID_NATIVE; use kaspa_consensus_core::tx::{ @@ -157,7 +157,7 @@ impl Miner { .into_par_iter() .map(|mutable_tx| { let signed_tx = sign(mutable_tx, schnorr_key); - let mass = self.mass_calculator.calc_tx_overall_mass(&signed_tx.as_verifiable(), None, Kip9Version::Alpha).unwrap(); + let mass = self.mass_calculator.calc_tx_overall_mass(&signed_tx.as_verifiable(), None).unwrap(); signed_tx.tx.set_mass(mass); let mut signed_tx = signed_tx.tx; signed_tx.finalize(); diff --git a/wallet/core/src/message.rs b/wallet/core/src/message.rs index 152bf28aa..cfc8197ed 100644 --- a/wallet/core/src/message.rs +++ b/wallet/core/src/message.rs @@ -21,7 +21,7 @@ pub struct SignMessageOptions { /// side-channel attacks. Providing it definitely improves security, but omitting it /// should not be considered dangerous, as most legacy signature schemes don't provide /// mitigations against such attacks. To read more about the relevant discussions that - /// arose in adding this randomness please see: https://github.com/sipa/bips/issues/195 + /// arose in adding this randomness please see: pub no_aux_rand: bool, } diff --git a/wallet/core/src/tx/generator/generator.rs b/wallet/core/src/tx/generator/generator.rs index 1cfd070e7..80fa7057b 100644 --- a/wallet/core/src/tx/generator/generator.rs +++ b/wallet/core/src/tx/generator/generator.rs @@ -66,7 +66,6 @@ use crate::tx::{ use crate::utxo::{NetworkParams, UtxoContext, UtxoEntryReference}; use kaspa_consensus_client::UtxoEntry; use kaspa_consensus_core::constants::UNACCEPTED_DAA_SCORE; -use kaspa_consensus_core::mass::Kip9Version; use kaspa_consensus_core::subnets::SUBNETWORK_ID_NATIVE; use kaspa_consensus_core::tx::{Transaction, TransactionInput, TransactionOutpoint, TransactionOutput}; use kaspa_txscript::pay_to_address_script; @@ -370,7 +369,7 @@ impl Generator { let network_type = NetworkType::from(network_id); let network_params = NetworkParams::from(network_id); - let mass_calculator = MassCalculator::new(&network_id.into(), network_params); + let mass_calculator = MassCalculator::new(&network_id.into()); let (final_transaction_outputs, final_transaction_amount) = match final_transaction_destination { PaymentDestination::Change => { @@ -953,10 +952,7 @@ impl Generator { // TODO - review and potentially simplify: // this profiles the storage mass with change and without change // and decides which one to use based on the fees - if storage_mass_with_change == 0 - || (self.inner.network_params.kip9_version() == Kip9Version::Beta // max(compute vs storage) - && storage_mass_with_change < compute_mass_with_change) - { + if storage_mass_with_change == 0 || (storage_mass_with_change < compute_mass_with_change) { 0 } else { let storage_mass_no_change = self.calc_storage_mass(data, self.inner.final_transaction_outputs_harmonic); diff --git a/wallet/core/src/tx/generator/test.rs b/wallet/core/src/tx/generator/test.rs index a52eaaf88..a073a0fb7 100644 --- a/wallet/core/src/tx/generator/test.rs +++ b/wallet/core/src/tx/generator/test.rs @@ -169,7 +169,7 @@ fn validate(pt: &PendingTransaction) { "[validate] aggregate input and output values can not be the same due to fees" ); - let calc = MassCalculator::new(&pt.network_type().into(), network_params); + let calc = MassCalculator::new(&pt.network_type().into()); let additional_mass = if pt.is_final() { 0 } else { network_params.additional_compound_transaction_mass() }; let compute_mass = calc.calc_compute_mass_for_unsigned_consensus_transaction(&tx, pt.minimum_signatures()); @@ -198,7 +198,7 @@ where assert_eq!(tx.outputs.len(), expected.output_count, "expected output count"); let pt_fees = pt.fees(); - let calc = MassCalculator::new(&pt.network_type().into(), network_params); + let calc = MassCalculator::new(&pt.network_type().into()); let additional_mass = if pt.is_final() { 0 } else { network_params.additional_compound_transaction_mass() }; let compute_mass = calc.calc_compute_mass_for_unsigned_consensus_transaction(&tx, pt.minimum_signatures()); diff --git a/wallet/core/src/tx/mass.rs b/wallet/core/src/tx/mass.rs index 16a489dc7..01a194f63 100644 --- a/wallet/core/src/tx/mass.rs +++ b/wallet/core/src/tx/mass.rs @@ -4,10 +4,9 @@ use crate::error::Error; use crate::result::Result; -use crate::utxo::NetworkParams; use kaspa_consensus_client as kcc; use kaspa_consensus_client::UtxoEntryReference; -use kaspa_consensus_core::mass::{calc_storage_mass as consensus_calc_storage_mass, Kip9Version}; +use kaspa_consensus_core::mass::calc_storage_mass as consensus_calc_storage_mass; use kaspa_consensus_core::tx::{Transaction, TransactionInput, TransactionOutput, SCRIPT_VECTOR_SIZE}; use kaspa_consensus_core::{config::params::Params, constants::*, subnets::SUBNETWORK_ID_SIZE}; use kaspa_hashes::HASH_SIZE; @@ -218,17 +217,15 @@ pub struct MassCalculator { mass_per_script_pub_key_byte: u64, mass_per_sig_op: u64, storage_mass_parameter: u64, - kip9_version: Kip9Version, } impl MassCalculator { - pub fn new(consensus_params: &Params, network_params: &NetworkParams) -> Self { + pub fn new(consensus_params: &Params) -> Self { Self { mass_per_tx_byte: consensus_params.mass_per_tx_byte, mass_per_script_pub_key_byte: consensus_params.mass_per_script_pub_key_byte, mass_per_sig_op: consensus_params.mass_per_sig_op, storage_mass_parameter: consensus_params.storage_mass_parameter, - kip9_version: network_params.kip9_version(), } } @@ -297,10 +294,7 @@ impl MassCalculator { } pub fn combine_mass(&self, compute_mass: u64, storage_mass: u64) -> u64 { - match self.kip9_version { - Kip9Version::Alpha => compute_mass.saturating_add(storage_mass), - Kip9Version::Beta => compute_mass.max(storage_mass), - } + compute_mass.max(storage_mass) } /// Calculates the overall mass of this transaction, combining both compute and storage masses. @@ -337,7 +331,6 @@ impl MassCalculator { false, inputs.iter().map(|entry| entry.amount()), outputs.iter().map(|out| out.value), - self.kip9_version, self.storage_mass_parameter, ) } diff --git a/wallet/core/src/utxo/settings.rs b/wallet/core/src/utxo/settings.rs index 6828d73cf..14ec7b03d 100644 --- a/wallet/core/src/utxo/settings.rs +++ b/wallet/core/src/utxo/settings.rs @@ -4,14 +4,12 @@ //! use crate::imports::*; -use kaspa_consensus_core::mass::Kip9Version; #[derive(Debug)] pub struct NetworkParams { pub coinbase_transaction_maturity_period_daa: AtomicU64, pub coinbase_transaction_stasis_period_daa: u64, pub user_transaction_maturity_period_daa: AtomicU64, - pub kip9_version: Kip9Version, pub additional_compound_transaction_mass: u64, } @@ -31,11 +29,6 @@ impl NetworkParams { self.user_transaction_maturity_period_daa.load(Ordering::Relaxed) } - #[inline] - pub fn kip9_version(&self) -> Kip9Version { - self.kip9_version - } - #[inline] pub fn additional_compound_transaction_mass(&self) -> u64 { self.additional_compound_transaction_mass @@ -54,7 +47,6 @@ static MAINNET_NETWORK_PARAMS: LazyLock = LazyLock::new(|| Networ coinbase_transaction_maturity_period_daa: AtomicU64::new(100), coinbase_transaction_stasis_period_daa: 50, user_transaction_maturity_period_daa: AtomicU64::new(10), - kip9_version: Kip9Version::Beta, additional_compound_transaction_mass: 100, }); @@ -62,7 +54,6 @@ static TESTNET10_NETWORK_PARAMS: LazyLock = LazyLock::new(|| Netw coinbase_transaction_maturity_period_daa: AtomicU64::new(100), coinbase_transaction_stasis_period_daa: 50, user_transaction_maturity_period_daa: AtomicU64::new(10), - kip9_version: Kip9Version::Beta, additional_compound_transaction_mass: 100, }); @@ -70,7 +61,6 @@ static TESTNET11_NETWORK_PARAMS: LazyLock = LazyLock::new(|| Netw coinbase_transaction_maturity_period_daa: AtomicU64::new(1_000), coinbase_transaction_stasis_period_daa: 500, user_transaction_maturity_period_daa: AtomicU64::new(100), - kip9_version: Kip9Version::Alpha, additional_compound_transaction_mass: 100, }); @@ -78,7 +68,6 @@ static SIMNET_NETWORK_PARAMS: LazyLock = LazyLock::new(|| Network coinbase_transaction_maturity_period_daa: AtomicU64::new(100), coinbase_transaction_stasis_period_daa: 50, user_transaction_maturity_period_daa: AtomicU64::new(10), - kip9_version: Kip9Version::Alpha, additional_compound_transaction_mass: 0, }); @@ -86,7 +75,6 @@ static DEVNET_NETWORK_PARAMS: LazyLock = LazyLock::new(|| Network coinbase_transaction_maturity_period_daa: AtomicU64::new(100), coinbase_transaction_stasis_period_daa: 50, user_transaction_maturity_period_daa: AtomicU64::new(10), - kip9_version: Kip9Version::Beta, additional_compound_transaction_mass: 0, }); diff --git a/wallet/core/src/wasm/tx/mass.rs b/wallet/core/src/wasm/tx/mass.rs index fe13934fc..ac843ff7f 100644 --- a/wallet/core/src/wasm/tx/mass.rs +++ b/wallet/core/src/wasm/tx/mass.rs @@ -1,4 +1,3 @@ -use crate::imports::NetworkParams; use crate::result::Result; use crate::tx::{mass, MAXIMUM_STANDARD_TRANSACTION_MASS}; use js_sys::Array; @@ -37,8 +36,7 @@ pub fn calculate_unsigned_transaction_mass(network_id: NetworkIdT, tx: &Transact let tx = Transaction::try_cast_from(tx)?; let network_id = NetworkId::try_owned_from(network_id)?; let consensus_params = Params::from(network_id); - let network_params = NetworkParams::from(network_id); - let mc = mass::MassCalculator::new(&consensus_params, network_params); + let mc = mass::MassCalculator::new(&consensus_params); mc.calc_overall_mass_for_unsigned_client_transaction(tx.as_ref(), minimum_signatures.unwrap_or(1)) } @@ -60,8 +58,7 @@ pub fn calculate_unsigned_transaction_mass(network_id: NetworkIdT, tx: &Transact pub fn update_unsigned_transaction_mass(network_id: NetworkIdT, tx: &Transaction, minimum_signatures: Option) -> Result { let network_id = NetworkId::try_owned_from(network_id)?; let consensus_params = Params::from(network_id); - let network_params = NetworkParams::from(network_id); - let mc = mass::MassCalculator::new(&consensus_params, network_params); + let mc = mass::MassCalculator::new(&consensus_params); let mass = mc.calc_overall_mass_for_unsigned_client_transaction(tx, minimum_signatures.unwrap_or(1))?; if mass > MAXIMUM_STANDARD_TRANSACTION_MASS { Ok(false) @@ -90,8 +87,7 @@ pub fn calculate_unsigned_transaction_fee( let tx = Transaction::try_cast_from(tx)?; let network_id = NetworkId::try_owned_from(network_id)?; let consensus_params = Params::from(network_id); - let network_params = NetworkParams::from(network_id); - let mc = mass::MassCalculator::new(&consensus_params, network_params); + let mc = mass::MassCalculator::new(&consensus_params); let mass = mc.calc_overall_mass_for_unsigned_client_transaction(tx.as_ref(), minimum_signatures.unwrap_or(1))?; if mass > MAXIMUM_STANDARD_TRANSACTION_MASS { Ok(None)