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/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..61407bd44 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, } } @@ -905,6 +907,23 @@ impl VirtualStateProcessor { virtual_state.daa_score, virtual_state.past_median_time, )?; + // Temp TN11 HF logic: + // Switching from kip9 alpha to beta requires making sure that mass is calculated by the actual virtual DAA score of this block template + if self.storage_mass_activation.is_active(virtual_state.daa_score) { + use kaspa_consensus_core::mass::Kip9Version; + let kip9_version = + if self.kip10_activation.is_active(virtual_state.daa_score) { Kip9Version::Beta } else { Kip9Version::Alpha }; + // Skip mass check since we will recalculate it correctly in a moment + let vtx = + self.validate_transaction_in_utxo_context(tx, utxo_view, virtual_state.daa_score, TxValidationFlags::SkipMassCheck)?; + let contextual_mass = self + .transaction_validator + .mass_calculator + .calc_tx_overall_mass(&vtx, None, kip9_version) + .ok_or(kaspa_consensus_core::errors::tx::TxRuleError::MassIncomputable)?; + tx.set_mass(contextual_mass); + return Ok(vtx.calculated_fee); + } let ValidatedTransaction { calculated_fee, .. } = self.validate_transaction_in_utxo_context(tx, utxo_view, virtual_state.daa_score, TxValidationFlags::Full)?; Ok(calculated_fee) @@ -979,6 +998,18 @@ impl VirtualStateProcessor { // At this point we can safely drop the read lock drop(virtual_read); + // Temp TN11 HF logic: + // In the very unlikely event where virtual DAA score decreased and total mass increased, remove some txs + if self.storage_mass_activation.is_active(virtual_state.daa_score) { + let mut total_mass = 0; + if let Some(pos) = txs.iter().position(|tx| { + total_mass += tx.mass(); + total_mass > 500_000 + }) { + txs.truncate(pos); + } + } + // Build the template self.build_block_template_from_virtual_state(virtual_state, miner_data, txs, calculated_fees) } diff --git a/consensus/src/pipeline/virtual_processor/utxo_validation.rs b/consensus/src/pipeline/virtual_processor/utxo_validation.rs index 2e9c7ddb4..b28d3f93c 100644 --- a/consensus/src/pipeline/virtual_processor/utxo_validation.rs +++ b/consensus/src/pipeline/virtual_processor/utxo_validation.rs @@ -329,8 +329,13 @@ impl VirtualStateProcessor { // 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 }; + // Also for TN11, we switch to KIP9 beta upon KIP10 activation + let kip9_version = if self.storage_mass_activation == ForkActivation::never() || self.kip10_activation.is_active(pov_daa_score) + { + Kip9Version::Beta + } else { + Kip9Version::Alpha + }; // Calc the full contextual mass including storage mass let contextual_mass = self 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..f256f9a6f 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 @@ -46,7 +46,7 @@ impl TransactionValidator { let fee = total_in - total_out; if flags != TxValidationFlags::SkipMassCheck && self.storage_mass_activation.is_active(pov_daa_score) { // Storage mass hardfork was activated - self.check_mass_commitment(tx)?; + self.check_mass_commitment(tx, pov_daa_score)?; if self.storage_mass_activation.is_within_range_from_activation(pov_daa_score, 10) { warn!("--------- Storage mass hardfork was activated successfully!!! --------- (DAA score: {})", pov_daa_score); @@ -125,9 +125,11 @@ impl TransactionValidator { Ok(total_out) } - fn check_mass_commitment(&self, tx: &impl VerifiableTransaction) -> TxResult<()> { + fn check_mass_commitment(&self, tx: &impl VerifiableTransaction, pov_daa_score: u64) -> TxResult<()> { + // HF to use the beta version in consensus if KIP10 is activated + let kip9_version = if self.kip10_activation.is_active(pov_daa_score) { Kip9Version::Beta } else { Kip9Version::Alpha }; let calculated_contextual_mass = - self.mass_calculator.calc_tx_overall_mass(tx, None, Kip9Version::Alpha).ok_or(TxRuleError::MassIncomputable)?; + self.mass_calculator.calc_tx_overall_mass(tx, None, kip9_version).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/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, }