github kaspanet/rusty-kaspa v2.1.0
Rusty Kaspa v2.1.0

3 hours ago

Kaspa v2.1.0 is a feature, security, and maintenance release introducing P2P Protocol Version 11 with chunked Initial Block Download (IBD), network and P2P transport hardening, Stratum bridge hardening and performance enhancements, extraction of the standalone ZK SDK crate (kaspa-txscript-zk-sdk), an extensive workspace-wide arithmetic safety audit, and post-Toccata consensus streamlining.


Highlights

  • P2P Protocol Version 11 & Chunked IBD: Large IBD payloads (Pruning Point Proofs, headers, and trusted data) are now streamed in 20 MiB chunks, avoiding message-framing bottlenecks and timeouts during node sync. Protocol 11 maintains full backwards compatibility with Protocol 10 peers.
  • P2P & Transport Hardening: Lowered P2P_MAX_MESSAGE_SIZE from 1 GB to 256 MB, enforced wire-level transaction and block limits (2 MB maximum block size), added immediate rejection of banned inbound peers, and bounded compressed parent counts (MAX_UNCOMPRESSED_PARENTS) against hashing DoS vectors.
  • Stratum Bridge Hardening: Patched a static asset path-traversal vulnerability in the web dashboard, eliminated CLOSE_WAIT socket leaks with per-connection worker tasks and explicit Connection: close headers, and bounded Prometheus metric cardinality on /metrics.
  • Standalone ZK SDK (kaspa-txscript-zk-sdk): Extracted RISC Zero Groth16 and STARK proof script-generation logic into a dedicated crate with dynamic/static image ID support, control proof length bounds, and Windows build fixes.
  • Workspace-Wide Arithmetic Overflow Audit: Enforced clippy::arithmetic_side_effects across production crates under a formal policy documented in docs/ARITH-SAFETY.md, hardening counters, retry loops, and arithmetic operations across the node.
  • Node & Library Bug Fixes: Added safe Borsh address decoding without panicking on invalid payload lengths, corrected output count reporting in txscript errors, and fixed constant-time private key equality in kaspa-bip32.

Detailed Changes

P2P Protocol & Sync (Protocol v11)

  • Chunked IBD Streaming (#1136):
    • Introduced Protocol Version 11 while negotiating Protocol 10 with older peers.
    • Large IBD payloads are split into 20 MiB chunks:
      • Pruning Point Proof chunks via PruningPointProofChunkMessage and PruningPointProofChunksEndMessage.
      • Headers chunking during sync.
      • Trusted data chunks via TrustedDataChunkMessage and TrustedDataChunksEndMessage.
    • Added an overall 1 GiB safety limit and total transfer timeouts with progress logging.
  • P2P Wire Limits & Safety (#1138):
    • Lowered P2P_MAX_MESSAGE_SIZE in the connection handler from 1 GB to 256 MB.
    • Enforced pre-validation P2P size limits on transaction messages and block messages (wire block capped at 2 MB).
    • Banned inbound connections are now rejected immediately during initial connection setup.
    • Verified that relay blocks triggering IBD are not processed as trusted data.

Consensus & Pruning Proofs

  • Tightened Parent Bounds:
    • Bounded cumulative uncompressed parent count across all levels in CompressedParents to MAX_UNCOMPRESSED_PARENTS = 255 * 2048, returning CompressedParentsError::SizeExceeded on malformed headers.
  • Pruning Proof Invariants:
    • Strictly enforce during pruning proof validation that proof headers without parents must be genesis; non-genesis parentless headers return PruningImportError::NonGenesisParentlessHeader.
  • Post-Toccata Consensus Streamlining (#1082, #1083, #1084, #1086, #1087, #1089, #1101):
    • Collapsed activation branches into unconditional post-Toccata logic across consensus, mempool, and P2P layers.
    • Consolidated BLOCK_VERSION to 2 (removed TOCCATA_BLOCK_VERSION and transitional params).
    • Replaced legacy sigops accounting with script units, making covenant script verification unconditional.
    • Bound PSKT extraction by input committed script units.
    • Activated Toccata on devnet and refreshed DAG fixtures.

Stratum Bridge

  • Web Dashboard Security & Concurrency (#1079, #1138):
    • Fixed path traversal in web dashboard static asset serving by rejecting non-normal path components and asserting canonicalized paths stay within the static root directory.
    • Handled incoming HTTP requests in dedicated worker tasks with a 10-second read timeout and explicit Connection: close headers to prevent socket exhaustion and CLOSE_WAIT accumulation.
    • Bounded Prometheus cardinality on /metrics by stripping ephemeral ports from client IPs, unifying worker/miner labels, and introducing an eviction ring (512 blocks) for the mined blocks gauge.

ZK SDK & Covenants

  • Standalone ZK SDK (#953):
    • Extracted ZK-to-script and proof tooling into the dedicated kaspa-txscript-zk-sdk crate.
    • Added support for Groth16 verifier generation with static or dynamic image IDs via append_r0_groth16_verifier and append_r0_groth16_verifier_with_image_id (#1067).
    • Bounded Poseidon2 control inclusion proofs to guard against oversized proof verification.
    • Pinned risc0-zkvm-platform and resolved Windows link issues via risc0-export-syscall (#1064, #1071).

Mempool & Mining

  • Coinbase Mempool Rejection (#1137):
    • Explicitly reject coinbase transactions submitted to the mempool with RuleError::RejectCoinbase during validation, even if non-standard transactions are enabled.
  • Relay Fee Calculation:
    • Used saturating_mul in minimum required transaction relay fee calculations to prevent integer overflow on extreme mass transactions.

Workspace Arithmetic Safety Audit

  • Overflow Prevention Policy (docs/ARITH-SAFETY.md):
    • Enabled clippy::arithmetic_side_effects across production crates and standardized invariant annotations.
    • Fixed connection handler retry loop counter overflow.
    • Hardened registration rollbacks and widened reference counting to u64 in the notification address tracker.
    • Applied saturating_sub to peer handshake timestamp offset calculations.
    • Used proper integer types and bounds in mempool topological sorting routines.
    • Corrected file descriptor subtraction casting during node startup.

Wallets, RPC & SDK Fixes

  • BIP-32 Key Equality (#1072):
    • In kaspa-bip32, fixed ExtendedPrivateKey::ct_eq where private key byte comparison was incorrectly checking self against self rather than other.
  • Txscript Error Reporting (#1096):
    • Corrected TxScriptError::InvalidOutputIndex in output inspection opcodes to report output counts rather than input counts.
  • RPC Conversions (#1056, #1138):
    • Preserved the covenant field when converting optional transaction outputs in vspcv2 RPC flows.
    • Enforced checked integer conversions in gRPC optional header and transaction decoders (RpcOptionalHeader, RpcOptionalTransaction).
  • Wasm SDK (#1085):
    • Corrected sighash type mapping for SighashType::AllAnyOneCanPay to set both SIG_HASH_ALL and SIG_HASH_ANY_ONE_CAN_PAY.

Upgrade Recommendation

All node, mining, and infrastructure operators across mainnet and testnets are strongly encouraged to upgrade to Kaspa v2.1.0.

This release reflects ongoing focus on proactive defense-in-depth, introducing systematic security hardening and stricter validation bounds across the P2P transport layer, synchronization flows, and node
subsystem boundaries. Together with a comprehensive audit enforcing strict arithmetic safety invariants and the rollout of Protocol Version 11 chunked sync, these structural safeguards significantly
strengthen node resilience and provide higher confidence in the overall security.

Don't miss a new rusty-kaspa release

NewReleases is sending notifications on new releases.