diff --git a/Cargo.lock b/Cargo.lock index 72541a4a72c..2572faa0e18 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -438,7 +438,7 @@ dependencies = [ "hmac", "rand_core 0.6.4", "ripemd", - "secp256k1 0.27.0", + "secp256k1", "sha2", "subtle", "zeroize", @@ -539,11 +539,11 @@ dependencies = [ [[package]] name = "bridgetree" -version = "0.5.0" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f62227647af796dd9f1637da0392676a2e200973b817b082fc9be89bf93ddd74" +checksum = "cef977c7f8e75aa81fc589064c121ab8d32448b7939d34d58df479aa93e65ea5" dependencies = [ - "incrementalmerkletree", + "incrementalmerkletree 0.7.0", ] [[package]] @@ -1323,7 +1323,7 @@ dependencies = [ [[package]] name = "equihash" version = "0.2.0" -source = "git+https://github.com/zcash/librustzcash/#a1047adf0b6f324dad415db34762dc26f8367ce4" +source = "git+https://github.com/zcash/librustzcash.git?rev=1410f1449100a417bfbc4f6c7167aa9808e38792#1410f1449100a417bfbc4f6c7167aa9808e38792" dependencies = [ "blake2b_simd", "byteorder", @@ -1367,7 +1367,7 @@ dependencies = [ [[package]] name = "f4jumble" version = "0.1.0" -source = "git+https://github.com/zcash/librustzcash/#a1047adf0b6f324dad415db34762dc26f8367ce4" +source = "git+https://github.com/zcash/librustzcash.git?rev=1410f1449100a417bfbc4f6c7167aa9808e38792#1410f1449100a417bfbc4f6c7167aa9808e38792" dependencies = [ "blake2b_simd", ] @@ -2104,6 +2104,14 @@ dependencies = [ "either", ] +[[package]] +name = "incrementalmerkletree" +version = "0.7.0" +source = "git+https://github.com/zcash/incrementalmerkletree?rev=ffe4234788fd22662b937ba7c6ea01535fcc1293#ffe4234788fd22662b937ba7c6ea01535fcc1293" +dependencies = [ + "either", +] + [[package]] name = "indenter" version = "0.3.3" @@ -2798,9 +2806,8 @@ checksum = "04744f49eae99ab78e0d5c0b603ab218f515ea8cfe5a456d7629ad883a3b6e7d" [[package]] name = "orchard" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4dc7bde644aeb980be296cd908c6650894dc8541deb56f9f5294c52ed7ca568f" +version = "0.9.1" +source = "git+https://github.com/zcash/orchard?rev=55fb089a335bbbc1cda186c706bc037073df8eb7#55fb089a335bbbc1cda186c706bc037073df8eb7" dependencies = [ "aes", "bitvec", @@ -2811,7 +2818,7 @@ dependencies = [ "halo2_gadgets", "halo2_proofs", "hex", - "incrementalmerkletree", + "incrementalmerkletree 0.7.0", "lazy_static", "memuse", "nonempty", @@ -3789,8 +3796,7 @@ dependencies = [ [[package]] name = "sapling-crypto" version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "15e379398fffad84e49f9a45a05635fc004f66086e65942dbf4eb95332c26d2a" +source = "git+https://github.com/zcash/sapling-crypto?rev=b1ad3694ee13a2fc5d291ad04721a6252da0993c#b1ad3694ee13a2fc5d291ad04721a6252da0993c" dependencies = [ "aes", "bellman", @@ -3804,7 +3810,7 @@ dependencies = [ "fpe", "group", "hex", - "incrementalmerkletree", + "incrementalmerkletree 0.7.0", "jubjub", "lazy_static", "memuse", @@ -3834,16 +3840,6 @@ dependencies = [ "untrusted", ] -[[package]] -name = "secp256k1" -version = "0.26.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4124a35fe33ae14259c490fd70fa199a32b9ce9502f2ee6bc4f81ec06fa65894" -dependencies = [ - "secp256k1-sys", - "serde", -] - [[package]] name = "secp256k1" version = "0.27.0" @@ -3851,6 +3847,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "25996b82292a7a57ed3508f052cfff8640d38d32018784acd714758b43da9c8f" dependencies = [ "secp256k1-sys", + "serde", ] [[package]] @@ -4135,12 +4132,11 @@ dependencies = [ [[package]] name = "shardtree" version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78222845cd8bbe5eb95687407648ff17693a35de5e8abaa39a4681fb21e033f9" +source = "git+https://github.com/zcash/incrementalmerkletree?rev=ffe4234788fd22662b937ba7c6ea01535fcc1293#ffe4234788fd22662b937ba7c6ea01535fcc1293" dependencies = [ "bitflags 2.6.0", "either", - "incrementalmerkletree", + "incrementalmerkletree 0.7.0", "tracing", ] @@ -5611,81 +5607,28 @@ dependencies = [ "bech32", "bs58", "f4jumble 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "zcash_encoding 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "zcash_encoding", "zcash_protocol 0.2.0", ] [[package]] name = "zcash_address" version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14bccd6cefb76f87b6d15a9e7b02b6c0515648c6de8e806c4e2d6f0f6ae640c5" +source = "git+https://github.com/zcash/librustzcash.git?rev=1410f1449100a417bfbc4f6c7167aa9808e38792#1410f1449100a417bfbc4f6c7167aa9808e38792" dependencies = [ "bech32", "bs58", - "f4jumble 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "zcash_encoding 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "zcash_protocol 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "zcash_address" -version = "0.5.0" -source = "git+https://github.com/zcash/librustzcash/#a1047adf0b6f324dad415db34762dc26f8367ce4" -dependencies = [ - "bech32", - "bs58", - "f4jumble 0.1.0 (git+https://github.com/zcash/librustzcash/)", - "zcash_encoding 0.2.1 (git+https://github.com/zcash/librustzcash/)", - "zcash_protocol 0.3.0 (git+https://github.com/zcash/librustzcash/)", + "f4jumble 0.1.0 (git+https://github.com/zcash/librustzcash.git?rev=1410f1449100a417bfbc4f6c7167aa9808e38792)", + "zcash_encoding", + "zcash_protocol 0.3.0", ] [[package]] name = "zcash_client_backend" version = "0.13.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "80e3a0f3e5d7f299d8b7ef3237697630989c31ab1b162824c99c1cd8bc83715e" +source = "git+https://github.com/zcash/librustzcash.git?rev=1410f1449100a417bfbc4f6c7167aa9808e38792#1410f1449100a417bfbc4f6c7167aa9808e38792" dependencies = [ - "base64 0.21.7", - "bech32", - "bls12_381", - "bs58", - "crossbeam-channel", - "document-features", - "group", - "hex", - "incrementalmerkletree", - "memuse", - "nom", - "nonempty", - "percent-encoding", - "prost", - "rand_core 0.6.4", - "rayon", - "sapling-crypto", - "secrecy", - "shardtree", - "subtle", - "time", - "tonic-build", - "tracing", - "which", - "zcash_address 0.4.0", - "zcash_encoding 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "zcash_keys 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "zcash_note_encryption", - "zcash_primitives 0.16.0", - "zcash_protocol 0.2.0", - "zip32", - "zip321 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "zcash_client_backend" -version = "0.13.0" -source = "git+https://github.com/zcash/librustzcash/#a1047adf0b6f324dad415db34762dc26f8367ce4" -dependencies = [ - "base64 0.21.7", + "base64 0.22.1", "bech32", "bls12_381", "bs58", @@ -5693,7 +5636,7 @@ dependencies = [ "document-features", "group", "hex", - "incrementalmerkletree", + "incrementalmerkletree 0.7.0", "memuse", "nom", "nonempty", @@ -5709,30 +5652,20 @@ dependencies = [ "tonic-build", "tracing", "which", - "zcash_address 0.5.0 (git+https://github.com/zcash/librustzcash/)", - "zcash_encoding 0.2.1 (git+https://github.com/zcash/librustzcash/)", - "zcash_keys 0.3.0 (git+https://github.com/zcash/librustzcash/)", + "zcash_address 0.5.0", + "zcash_encoding", + "zcash_keys 0.3.0 (git+https://github.com/zcash/librustzcash.git?rev=1410f1449100a417bfbc4f6c7167aa9808e38792)", "zcash_note_encryption", - "zcash_primitives 0.17.0 (git+https://github.com/zcash/librustzcash/)", - "zcash_protocol 0.3.0 (git+https://github.com/zcash/librustzcash/)", + "zcash_primitives 0.17.0", + "zcash_protocol 0.3.0", "zip32", - "zip321 0.1.0 (git+https://github.com/zcash/librustzcash/)", + "zip321", ] [[package]] name = "zcash_encoding" version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "052d8230202f0a018cd9b5d1b56b94cd25e18eccc2d8665073bcea8261ab87fc" -dependencies = [ - "byteorder", - "nonempty", -] - -[[package]] -name = "zcash_encoding" -version = "0.2.1" -source = "git+https://github.com/zcash/librustzcash/#a1047adf0b6f324dad415db34762dc26f8367ce4" +source = "git+https://github.com/zcash/librustzcash.git?rev=1410f1449100a417bfbc4f6c7167aa9808e38792#1410f1449100a417bfbc4f6c7167aa9808e38792" dependencies = [ "byteorder", "nonempty", @@ -5741,8 +5674,7 @@ dependencies = [ [[package]] name = "zcash_history" version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2fde17bf53792f9c756b313730da14880257d7661b5bfc69d0571c3a7c11a76d" +source = "git+https://github.com/zcash/librustzcash.git?rev=1410f1449100a417bfbc4f6c7167aa9808e38792#1410f1449100a417bfbc4f6c7167aa9808e38792" dependencies = [ "blake2b_simd", "byteorder", @@ -5769,7 +5701,7 @@ dependencies = [ "subtle", "tracing", "zcash_address 0.4.0", - "zcash_encoding 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "zcash_encoding", "zcash_primitives 0.16.0", "zcash_protocol 0.2.0", "zip32", @@ -5778,7 +5710,7 @@ dependencies = [ [[package]] name = "zcash_keys" version = "0.3.0" -source = "git+https://github.com/zcash/librustzcash/#a1047adf0b6f324dad415db34762dc26f8367ce4" +source = "git+https://github.com/zcash/librustzcash.git?rev=1410f1449100a417bfbc4f6c7167aa9808e38792#1410f1449100a417bfbc4f6c7167aa9808e38792" dependencies = [ "bech32", "blake2b_simd", @@ -5793,10 +5725,10 @@ dependencies = [ "secrecy", "subtle", "tracing", - "zcash_address 0.5.0 (git+https://github.com/zcash/librustzcash/)", - "zcash_encoding 0.2.1 (git+https://github.com/zcash/librustzcash/)", - "zcash_primitives 0.17.0 (git+https://github.com/zcash/librustzcash/)", - "zcash_protocol 0.3.0 (git+https://github.com/zcash/librustzcash/)", + "zcash_address 0.5.0", + "zcash_encoding", + "zcash_primitives 0.17.0", + "zcash_protocol 0.3.0", "zip32", ] @@ -5829,7 +5761,7 @@ dependencies = [ "fpe", "group", "hex", - "incrementalmerkletree", + "incrementalmerkletree 0.6.0", "jubjub", "memuse", "nonempty", @@ -5842,7 +5774,7 @@ dependencies = [ "subtle", "tracing", "zcash_address 0.4.0", - "zcash_encoding 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "zcash_encoding", "zcash_note_encryption", "zcash_protocol 0.2.0", "zcash_spec", @@ -5852,8 +5784,7 @@ dependencies = [ [[package]] name = "zcash_primitives" version = "0.17.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4d87ab6a55591a8cf1866749fdc739ae1bbd06e6cec07ab0bbe5d57ee3390eb2" +source = "git+https://github.com/zcash/librustzcash.git?rev=1410f1449100a417bfbc4f6c7167aa9808e38792#1410f1449100a417bfbc4f6c7167aa9808e38792" dependencies = [ "aes", "bip32", @@ -5861,12 +5792,12 @@ dependencies = [ "bs58", "byteorder", "document-features", - "equihash 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "equihash 0.2.0 (git+https://github.com/zcash/librustzcash.git?rev=1410f1449100a417bfbc4f6c7167aa9808e38792)", "ff", "fpe", "group", "hex", - "incrementalmerkletree", + "incrementalmerkletree 0.7.0", "jubjub", "memuse", "nonempty", @@ -5876,49 +5807,14 @@ dependencies = [ "redjubjub", "ripemd", "sapling-crypto", - "secp256k1 0.27.0", - "sha2", - "subtle", - "tracing", - "zcash_address 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", - "zcash_encoding 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "zcash_note_encryption", - "zcash_protocol 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "zcash_spec", - "zip32", -] - -[[package]] -name = "zcash_primitives" -version = "0.17.0" -source = "git+https://github.com/zcash/librustzcash/#a1047adf0b6f324dad415db34762dc26f8367ce4" -dependencies = [ - "aes", - "blake2b_simd", - "bs58", - "byteorder", - "document-features", - "equihash 0.2.0 (git+https://github.com/zcash/librustzcash/)", - "ff", - "fpe", - "group", - "hex", - "incrementalmerkletree", - "jubjub", - "memuse", - "nonempty", - "orchard", - "rand 0.8.5", - "rand_core 0.6.4", - "redjubjub", - "sapling-crypto", + "secp256k1", "sha2", "subtle", "tracing", - "zcash_address 0.5.0 (git+https://github.com/zcash/librustzcash/)", - "zcash_encoding 0.2.1 (git+https://github.com/zcash/librustzcash/)", + "zcash_address 0.5.0", + "zcash_encoding", "zcash_note_encryption", - "zcash_protocol 0.3.0 (git+https://github.com/zcash/librustzcash/)", + "zcash_protocol 0.3.0", "zcash_spec", "zip32", ] @@ -5926,8 +5822,7 @@ dependencies = [ [[package]] name = "zcash_proofs" version = "0.17.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b9fc0032b3d90f000f50dba7a996ad6556b7dba5b5145f93ab67b6eb74d3a48" +source = "git+https://github.com/zcash/librustzcash.git?rev=1410f1449100a417bfbc4f6c7167aa9808e38792#1410f1449100a417bfbc4f6c7167aa9808e38792" dependencies = [ "bellman", "blake2b_simd", @@ -5943,7 +5838,7 @@ dependencies = [ "sapling-crypto", "tracing", "xdg", - "zcash_primitives 0.17.0 (registry+https://github.com/rust-lang/crates.io-index)", + "zcash_primitives 0.17.0", ] [[package]] @@ -5959,17 +5854,7 @@ dependencies = [ [[package]] name = "zcash_protocol" version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b1ff002bd41ba76b42d42a02ee11de06790b7fdbc904bdea4486b9a93b2a5e4" -dependencies = [ - "document-features", - "memuse", -] - -[[package]] -name = "zcash_protocol" -version = "0.3.0" -source = "git+https://github.com/zcash/librustzcash/#a1047adf0b6f324dad415db34762dc26f8367ce4" +source = "git+https://github.com/zcash/librustzcash.git?rev=1410f1449100a417bfbc4f6c7167aa9808e38792#1410f1449100a417bfbc4f6c7167aa9808e38792" dependencies = [ "document-features", "memuse", @@ -6017,7 +5902,7 @@ dependencies = [ "halo2_proofs", "hex", "humantime", - "incrementalmerkletree", + "incrementalmerkletree 0.7.0", "itertools 0.13.0", "jubjub", "lazy_static", @@ -6034,7 +5919,7 @@ dependencies = [ "redjubjub", "ripemd", "sapling-crypto", - "secp256k1 0.26.0", + "secp256k1", "serde", "serde-big-array", "serde_json", @@ -6049,13 +5934,13 @@ dependencies = [ "tracing", "uint 0.10.0", "x25519-dalek", - "zcash_address 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", - "zcash_client_backend 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)", - "zcash_encoding 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "zcash_address 0.5.0", + "zcash_client_backend", + "zcash_encoding", "zcash_history", "zcash_note_encryption", - "zcash_primitives 0.17.0 (registry+https://github.com/rust-lang/crates.io-index)", - "zcash_protocol 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "zcash_primitives 0.17.0", + "zcash_protocol 0.3.0", "zebra-test", ] @@ -6120,7 +6005,7 @@ dependencies = [ "tonic-build", "tonic-reflection", "tower", - "zcash_primitives 0.17.0 (registry+https://github.com/rust-lang/crates.io-index)", + "zcash_primitives 0.17.0", "zebra-chain", "zebra-node-services", "zebra-state", @@ -6207,8 +6092,8 @@ dependencies = [ "tonic-reflection", "tower", "tracing", - "zcash_address 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", - "zcash_primitives 0.17.0 (registry+https://github.com/rust-lang/crates.io-index)", + "zcash_address 0.5.0", + "zcash_primitives 0.17.0", "zebra-chain", "zebra-consensus", "zebra-network", @@ -6250,11 +6135,11 @@ dependencies = [ "tower", "tracing", "tracing-subscriber", - "zcash_address 0.5.0 (git+https://github.com/zcash/librustzcash/)", - "zcash_client_backend 0.13.0 (git+https://github.com/zcash/librustzcash/)", + "zcash_address 0.5.0", + "zcash_client_backend", "zcash_keys 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "zcash_note_encryption", - "zcash_primitives 0.17.0 (git+https://github.com/zcash/librustzcash/)", + "zcash_primitives 0.17.0", "zebra-chain", "zebra-grpc", "zebra-node-services", @@ -6372,9 +6257,9 @@ dependencies = [ "tokio", "tracing-error", "tracing-subscriber", - "zcash_client_backend 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)", - "zcash_primitives 0.17.0 (registry+https://github.com/rust-lang/crates.io-index)", - "zcash_protocol 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "zcash_client_backend", + "zcash_primitives 0.17.0", + "zcash_protocol 0.3.0", "zebra-chain", "zebra-node-services", "zebra-rpc", @@ -6506,24 +6391,11 @@ dependencies = [ [[package]] name = "zip321" version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8dc85f862f7be64fb0d46f9eb5b82ad54e58cde314fa979d5bae591bc0143693" +source = "git+https://github.com/zcash/librustzcash.git?rev=1410f1449100a417bfbc4f6c7167aa9808e38792#1410f1449100a417bfbc4f6c7167aa9808e38792" dependencies = [ - "base64 0.21.7", - "nom", - "percent-encoding", - "zcash_address 0.4.0", - "zcash_protocol 0.2.0", -] - -[[package]] -name = "zip321" -version = "0.1.0" -source = "git+https://github.com/zcash/librustzcash/#a1047adf0b6f324dad415db34762dc26f8367ce4" -dependencies = [ - "base64 0.21.7", + "base64 0.22.1", "nom", "percent-encoding", - "zcash_address 0.5.0 (git+https://github.com/zcash/librustzcash/)", - "zcash_protocol 0.3.0 (git+https://github.com/zcash/librustzcash/)", + "zcash_address 0.5.0", + "zcash_protocol 0.3.0", ] diff --git a/Cargo.toml b/Cargo.toml index a006d6eb8a6..976c259130d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -22,7 +22,7 @@ resolver = "2" # `cargo release` settings [workspace.dependencies] -incrementalmerkletree = "0.6.0" +incrementalmerkletree = "0.7.0" orchard = "0.9.0" sapling-crypto = "0.2.0" zcash_address = "0.5.0" @@ -102,3 +102,18 @@ panic = "abort" # - add "-flto=thin" to all C/C++ code builds # - see https://doc.rust-lang.org/rustc/linker-plugin-lto.html#cc-code-as-a-dependency-in-rust lto = "thin" + +# We can remove this patches after we get out of 2.0 release candidate and upgrade the ECC dependencies above. +# This revisions are at the commit just before setting mainnet activation heights. +[patch.crates-io] +zcash_address = { git = "https://github.com/zcash/librustzcash.git", rev = "1410f1449100a417bfbc4f6c7167aa9808e38792" } +zcash_client_backend = { git = "https://github.com/zcash/librustzcash.git", rev = "1410f1449100a417bfbc4f6c7167aa9808e38792" } +zcash_encoding = { git = "https://github.com/zcash/librustzcash.git", rev = "1410f1449100a417bfbc4f6c7167aa9808e38792" } +zcash_history = { git = "https://github.com/zcash/librustzcash.git", rev = "1410f1449100a417bfbc4f6c7167aa9808e38792" } +zcash_primitives = { git = "https://github.com/zcash/librustzcash.git", rev = "1410f1449100a417bfbc4f6c7167aa9808e38792" } +zcash_proofs = { git = "https://github.com/zcash/librustzcash.git", rev = "1410f1449100a417bfbc4f6c7167aa9808e38792" } +zcash_protocol = { git = "https://github.com/zcash/librustzcash.git", rev = "1410f1449100a417bfbc4f6c7167aa9808e38792" } +sapling-crypto = { git = "https://github.com/zcash/sapling-crypto", rev = "b1ad3694ee13a2fc5d291ad04721a6252da0993c" } +orchard = { git = "https://github.com/zcash/orchard", rev = "55fb089a335bbbc1cda186c706bc037073df8eb7" } +incrementalmerkletree = { git = "https://github.com/zcash/incrementalmerkletree", rev = "ffe4234788fd22662b937ba7c6ea01535fcc1293" } +shardtree = { git = "https://github.com/zcash/incrementalmerkletree", rev = "ffe4234788fd22662b937ba7c6ea01535fcc1293" } diff --git a/deny.toml b/deny.toml index bf51d9dcafc..b8d35b41cc4 100644 --- a/deny.toml +++ b/deny.toml @@ -84,19 +84,26 @@ skip-tree = [ { name = "http-body", version = "=0.4.6" }, { name = "hyper", version = "=0.14.30" }, - # TODO: Remove this after we upgrade ECC dependencies to a crates.io version (#8749) - { name = "equihash", version = "=0.2.0" }, - { name = "f4jumble", version = "=0.1.0" }, - { name = "secp256k1", version = "=0.26.0" }, - { name = "zcash_address", version = "=0.5.0" }, - { name = "zcash_client_backend", version = "=0.13.0" }, - - # wait for structopt-derive to update heck { name = "heck", version = "=0.3.3" }, # wait for librocksdb-sys to update bindgen to one that uses newer itertools - { name = "itertools", version = "=0.12.1" } + { name = "itertools", version = "=0.12.1" }, + + # wait for halo2_gadgets and primitive-types to update uint + { name = "uint", version = "=0.9.5" }, + + # wait for dirs-sys to update windows-sys + { name = "windows-sys", version = "=0.48.0" }, + + # Remove after release candicate period is over and the ECC crates are not patched anymore + { name = "equihash", version = "=0.2.0" }, + { name = "f4jumble", version = "=0.1.0" }, + { name = "incrementalmerkletree", version = "=0.6.0" }, + { name = "zcash_address", version = "=0.4.0" }, + { name = "zcash_keys", version = "=0.3.0" }, + { name = "zcash_primitives", version = "=0.16.0" }, + { name = "zcash_protocol", version = "=0.2.0" } ] # This section is considered when running `cargo deny check sources`. @@ -114,7 +121,10 @@ unknown-git = "deny" allow-registry = ["https://github.com/rust-lang/crates.io-index"] # List of URLs for allowed Git repositories allow-git = [ - "https://github.com/zcash/librustzcash.git" + "https://github.com/zcash/librustzcash.git", + "https://github.com/zcash/incrementalmerkletree", + "https://github.com/zcash/orchard", + "https://github.com/zcash/sapling-crypto" ] [sources.allow-org] diff --git a/supply-chain/audits.toml b/supply-chain/audits.toml index 963d1771ca3..284db15ec14 100644 --- a/supply-chain/audits.toml +++ b/supply-chain/audits.toml @@ -26,6 +26,11 @@ who = "Alfredo Garcia " criteria = "safe-to-deploy" delta = "0.4.0 -> 0.5.0" +[[audits.bridgetree]] +who = "Alfredo Garcia " +criteria = "safe-to-deploy" +delta = "0.5.0 -> 0.6.0" + [[audits.bytemuck]] who = "Alfredo Garcia " criteria = "safe-to-deploy" @@ -94,13 +99,13 @@ delta = "0.3.0 -> 0.4.0" [[audits.equihash]] who = "Alfredo Garcia " criteria = "safe-to-deploy" -delta = "0.2.0 -> 0.2.0@git:a1047adf0b6f324dad415db34762dc26f8367ce4" +delta = "0.2.0 -> 0.2.0@git:1410f1449100a417bfbc4f6c7167aa9808e38792" importable = false [[audits.f4jumble]] who = "Alfredo Garcia " criteria = "safe-to-deploy" -delta = "0.1.0 -> 0.1.0@git:a1047adf0b6f324dad415db34762dc26f8367ce4" +delta = "0.1.0 -> 0.1.0@git:1410f1449100a417bfbc4f6c7167aa9808e38792" importable = false [[audits.git2]] @@ -128,6 +133,17 @@ who = "Alfredo Garcia " criteria = "safe-to-deploy" delta = "0.5.1 -> 0.6.0" +[[audits.incrementalmerkletree]] +who = "Alfredo Garcia " +criteria = "safe-to-deploy" +delta = "0.6.0 -> 0.7.0" + +[[audits.incrementalmerkletree]] +who = "Alfredo Garcia " +criteria = "safe-to-deploy" +delta = "0.7.0 -> 0.7.0@git:ffe4234788fd22662b937ba7c6ea01535fcc1293" +importable = false + [[audits.indexmap]] who = "Alfredo Garcia " criteria = "safe-to-deploy" @@ -208,6 +224,17 @@ who = "Alfredo Garcia " criteria = "safe-to-deploy" delta = "0.8.0 -> 0.9.0" +[[audits.orchard]] +who = "Alfredo Garcia " +criteria = "safe-to-deploy" +delta = "0.9.0 -> 0.10.0" + +[[audits.orchard]] +who = "Alfredo Garcia " +criteria = "safe-to-deploy" +delta = "0.10.0 -> 0.9.1@git:55fb089a335bbbc1cda186c706bc037073df8eb7" +importable = false + [[audits.owo-colors]] who = "Alfredo Garcia " criteria = "safe-to-deploy" @@ -283,6 +310,17 @@ who = "Alfredo Garcia " criteria = "safe-to-deploy" delta = "0.1.3 -> 0.2.0" +[[audits.sapling-crypto]] +who = "Alfredo Garcia " +criteria = "safe-to-deploy" +delta = "0.2.0 -> 0.3.0" + +[[audits.sapling-crypto]] +who = "Alfredo Garcia " +criteria = "safe-to-deploy" +delta = "0.3.0 -> 0.2.0@git:b1ad3694ee13a2fc5d291ad04721a6252da0993c" +importable = false + [[audits.serde_spanned]] who = "Alfredo Garcia " criteria = "safe-to-deploy" @@ -318,6 +356,17 @@ who = "Alfredo Garcia " criteria = "safe-to-deploy" delta = "0.3.1 -> 0.4.0" +[[audits.shardtree]] +who = "Alfredo Garcia " +criteria = "safe-to-deploy" +delta = "0.4.0 -> 0.5.0" + +[[audits.shardtree]] +who = "Alfredo Garcia " +criteria = "safe-to-deploy" +delta = "0.5.0 -> 0.4.0@git:ffe4234788fd22662b937ba7c6ea01535fcc1293" +importable = false + [[audits.tempfile]] who = "Alfredo Garcia " criteria = "safe-to-deploy" @@ -541,9 +590,14 @@ delta = "0.4.0 -> 0.5.0" [[audits.zcash_address]] who = "Alfredo Garcia " criteria = "safe-to-deploy" -delta = "0.5.0 -> 0.5.0@git:a1047adf0b6f324dad415db34762dc26f8367ce4" +delta = "0.5.0 -> 0.5.0@git:1410f1449100a417bfbc4f6c7167aa9808e38792" importable = false +[[audits.zcash_address]] +who = "Alfredo Garcia " +criteria = "safe-to-deploy" +delta = "0.5.0 -> 0.6.0" + [[audits.zcash_client_backend]] who = "Alfredo Garcia " criteria = "safe-to-deploy" @@ -552,19 +606,35 @@ delta = "0.12.1 -> 0.13.0" [[audits.zcash_client_backend]] who = "Alfredo Garcia " criteria = "safe-to-deploy" -delta = "0.13.0 -> 0.13.0@git:a1047adf0b6f324dad415db34762dc26f8367ce4" +delta = "0.13.0 -> 0.14.0" + +[[audits.zcash_client_backend]] +who = "Alfredo Garcia " +criteria = "safe-to-deploy" +delta = "0.14.0 -> 0.13.0@git:1410f1449100a417bfbc4f6c7167aa9808e38792" importable = false [[audits.zcash_encoding]] who = "Alfredo Garcia " criteria = "safe-to-deploy" -delta = "0.2.1 -> 0.2.1@git:a1047adf0b6f324dad415db34762dc26f8367ce4" +delta = "0.2.1 -> 0.2.1@git:1410f1449100a417bfbc4f6c7167aa9808e38792" importable = false +[[audits.zcash_history]] +who = "Alfredo Garcia " +criteria = "safe-to-deploy" +delta = "0.4.0 -> 0.4.0@git:1410f1449100a417bfbc4f6c7167aa9808e38792" +importable = false + +[[audits.zcash_keys]] +who = "Alfredo Garcia " +criteria = "safe-to-deploy" +delta = "0.3.0 -> 0.4.0" + [[audits.zcash_keys]] who = "Alfredo Garcia " criteria = "safe-to-deploy" -delta = "0.3.0 -> 0.3.0@git:a1047adf0b6f324dad415db34762dc26f8367ce4" +delta = "0.4.0 -> 0.3.0@git:1410f1449100a417bfbc4f6c7167aa9808e38792" importable = false [[audits.zcash_primitives]] @@ -575,14 +645,30 @@ delta = "0.16.0 -> 0.17.0" [[audits.zcash_primitives]] who = "Alfredo Garcia " criteria = "safe-to-deploy" -delta = "0.17.0 -> 0.17.0@git:a1047adf0b6f324dad415db34762dc26f8367ce4" +delta = "0.17.0 -> 0.17.0@git:1410f1449100a417bfbc4f6c7167aa9808e38792" importable = false +[[audits.zcash_primitives]] +who = "Alfredo Garcia " +criteria = "safe-to-deploy" +delta = "0.17.0 -> 0.19.0" + [[audits.zcash_proofs]] who = "Alfredo Garcia " criteria = "safe-to-deploy" delta = "0.16.0 -> 0.17.0" +[[audits.zcash_proofs]] +who = "Alfredo Garcia " +criteria = "safe-to-deploy" +delta = "0.17.0 -> 0.17.0@git:1410f1449100a417bfbc4f6c7167aa9808e38792" +importable = false + +[[audits.zcash_proofs]] +who = "Alfredo Garcia " +criteria = "safe-to-deploy" +delta = "0.17.0 -> 0.19.0" + [[audits.zcash_protocol]] who = "Alfredo Garcia " criteria = "safe-to-deploy" @@ -596,7 +682,12 @@ delta = "0.1.1 -> 0.3.0" [[audits.zcash_protocol]] who = "Alfredo Garcia " criteria = "safe-to-deploy" -delta = "0.3.0 -> 0.3.0@git:a1047adf0b6f324dad415db34762dc26f8367ce4" +delta = "0.3.0 -> 0.4.0" + +[[audits.zcash_protocol]] +who = "Alfredo Garcia " +criteria = "safe-to-deploy" +delta = "0.4.0 -> 0.3.0@git:1410f1449100a417bfbc4f6c7167aa9808e38792" importable = false [[audits.zebra-chain]] @@ -662,7 +753,12 @@ version = "0.1.0" [[audits.zip321]] who = "Alfredo Garcia " criteria = "safe-to-deploy" -delta = "0.1.0 -> 0.1.0@git:a1047adf0b6f324dad415db34762dc26f8367ce4" +delta = "0.1.0 -> 0.2.0" + +[[audits.zip321]] +who = "Alfredo Garcia " +criteria = "safe-to-deploy" +delta = "0.2.0 -> 0.1.0@git:1410f1449100a417bfbc4f6c7167aa9808e38792" importable = false [[trusted.clap]] diff --git a/supply-chain/config.toml b/supply-chain/config.toml index 7a20193f958..cdbb79de93f 100644 --- a/supply-chain/config.toml +++ b/supply-chain/config.toml @@ -16,10 +16,28 @@ url = "https://raw.githubusercontent.com/zcash/rust-ecosystem/main/supply-chain/ [imports.zcashd] url = "https://raw.githubusercontent.com/zcash/zcash/master/qa/supply-chain/audits.toml" -[policy.equihash] +[policy."equihash:0.2.0"] + +[policy."equihash:0.2.0@git:1410f1449100a417bfbc4f6c7167aa9808e38792"] +audit-as-crates-io = true + +[policy."f4jumble:0.1.0"] + +[policy."f4jumble:0.1.0@git:1410f1449100a417bfbc4f6c7167aa9808e38792"] +audit-as-crates-io = true + +[policy."incrementalmerkletree:0.6.0"] + +[policy."incrementalmerkletree:0.7.0@git:ffe4234788fd22662b937ba7c6ea01535fcc1293"] audit-as-crates-io = true -[policy.f4jumble] +[policy.orchard] +audit-as-crates-io = true + +[policy.sapling-crypto] +audit-as-crates-io = true + +[policy.shardtree] audit-as-crates-io = true [policy.tower-batch-control] @@ -28,7 +46,9 @@ audit-as-crates-io = true [policy.tower-fallback] audit-as-crates-io = true -[policy.zcash_address] +[policy."zcash_address:0.4.0"] + +[policy."zcash_address:0.5.0@git:1410f1449100a417bfbc4f6c7167aa9808e38792"] audit-as-crates-io = true [policy.zcash_client_backend] @@ -37,13 +57,25 @@ audit-as-crates-io = true [policy.zcash_encoding] audit-as-crates-io = true -[policy.zcash_keys] +[policy.zcash_history] audit-as-crates-io = true -[policy.zcash_primitives] +[policy."zcash_keys:0.3.0"] + +[policy."zcash_keys:0.3.0@git:1410f1449100a417bfbc4f6c7167aa9808e38792"] audit-as-crates-io = true -[policy.zcash_protocol] +[policy."zcash_primitives:0.16.0"] + +[policy."zcash_primitives:0.17.0@git:1410f1449100a417bfbc4f6c7167aa9808e38792"] +audit-as-crates-io = true + +[policy.zcash_proofs] +audit-as-crates-io = true + +[policy."zcash_protocol:0.2.0"] + +[policy."zcash_protocol:0.3.0@git:1410f1449100a417bfbc4f6c7167aa9808e38792"] audit-as-crates-io = true [policy.zebra-chain] diff --git a/zebra-chain/Cargo.toml b/zebra-chain/Cargo.toml index 3e9b998916a..6ffb22409c3 100644 --- a/zebra-chain/Cargo.toml +++ b/zebra-chain/Cargo.toml @@ -68,7 +68,7 @@ bitflags = "2.5.0" bitflags-serde-legacy = "0.1.1" blake2b_simd = "1.0.2" blake2s_simd = "1.0.2" -bridgetree = "0.5.0" +bridgetree = "0.6.0" bs58 = { version = "0.5.1", features = ["check"] } byteorder = "1.5.0" @@ -88,7 +88,7 @@ primitive-types = "0.12.2" rand_core = "0.6.4" ripemd = "0.1.3" # Matches version used by hdwallet -secp256k1 = { version = "0.26.0", features = ["serde"] } +secp256k1 = { version = "0.27.0", features = ["serde"] } sha2 = { version = "0.10.7", features = ["compress"] } uint = "0.10.0" x25519-dalek = { version = "2.0.1", features = ["serde"] } diff --git a/zebra-chain/src/parameters/network/subsidy.rs b/zebra-chain/src/parameters/network/subsidy.rs index c7ff373f55d..cb043f6b05c 100644 --- a/zebra-chain/src/parameters/network/subsidy.rs +++ b/zebra-chain/src/parameters/network/subsidy.rs @@ -48,7 +48,10 @@ pub const POST_BLOSSOM_HALVING_INTERVAL: HeightDiff = /// as specified in [protocol specification §7.10.1][7.10.1] /// /// [7.10.1]: https://zips.z.cash/protocol/protocol.pdf#zip214fundingstreams -pub const FIRST_HALVING_TESTNET: Height = Height(1_116_000); +pub(crate) const FIRST_HALVING_TESTNET: Height = Height(1_116_000); + +/// The first halving height in the regtest is at block height `287`. +const FIRST_HALVING_REGTEST: Height = Height(287); /// The funding stream receiver categories. #[derive(Deserialize, Clone, Copy, Debug, Eq, Hash, PartialEq)] @@ -378,6 +381,20 @@ pub trait ParameterSubsidy { /// /// [7.10]: fn height_for_first_halving(&self) -> Height; + + /// Returns the halving interval after Blossom + fn post_blossom_halving_interval(&self) -> HeightDiff; + + /// Returns the halving interval before Blossom + fn pre_blossom_halving_interval(&self) -> HeightDiff; + + /// Returns the address change interval for funding streams + /// as described in [protocol specification §7.10][7.10]. + /// + /// > FSRecipientChangeInterval := PostBlossomHalvingInterval / 48 + /// + /// [7.10]: https://zips.z.cash/protocol/protocol.pdf#zip214fundingstreams + fn funding_stream_address_change_interval(&self) -> HeightDiff; } /// Network methods related to Block Subsidy and Funding Streams @@ -390,10 +407,35 @@ impl ParameterSubsidy for Network { Network::Mainnet => NetworkUpgrade::Canopy .activation_height(self) .expect("canopy activation height should be available"), - // TODO: Check what zcashd does here, consider adding a field to `testnet::Parameters` to make this configurable. - Network::Testnet(_params) => FIRST_HALVING_TESTNET, + Network::Testnet(params) => { + if params.is_regtest() { + FIRST_HALVING_REGTEST + } else if params.is_default_testnet() { + FIRST_HALVING_TESTNET + } else { + height_for_halving(1, self).expect("first halving height should be available") + } + } + } + } + + fn post_blossom_halving_interval(&self) -> HeightDiff { + match self { + Network::Mainnet => POST_BLOSSOM_HALVING_INTERVAL, + Network::Testnet(params) => params.post_blossom_halving_interval(), + } + } + + fn pre_blossom_halving_interval(&self) -> HeightDiff { + match self { + Network::Mainnet => PRE_BLOSSOM_HALVING_INTERVAL, + Network::Testnet(params) => params.pre_blossom_halving_interval(), } } + + fn funding_stream_address_change_interval(&self) -> HeightDiff { + self.post_blossom_halving_interval() / 48 + } } /// List of addresses for the Zcash Foundation funding stream in the Mainnet. @@ -514,10 +556,54 @@ pub fn funding_stream_address_period(height: Height, networ let height_after_first_halving = height - network.height_for_first_halving(); - let address_period = (height_after_first_halving + POST_BLOSSOM_HALVING_INTERVAL) - / FUNDING_STREAM_ADDRESS_CHANGE_INTERVAL; + let address_period = (height_after_first_halving + network.post_blossom_halving_interval()) + / network.funding_stream_address_change_interval(); address_period .try_into() .expect("all values are positive and smaller than the input height") } + +/// The first block height of the halving at the provided halving index for a network. +/// +/// See `Halving(height)`, as described in [protocol specification §7.8][7.8] +/// +/// [7.8]: https://zips.z.cash/protocol/protocol.pdf#subsidies +pub fn height_for_halving(halving: u32, network: &Network) -> Option { + if halving == 0 { + return Some(Height(0)); + } + + let slow_start_shift = i64::from(network.slow_start_shift().0); + let blossom_height = i64::from( + NetworkUpgrade::Blossom + .activation_height(network) + .expect("blossom activation height should be available") + .0, + ); + let pre_blossom_halving_interval = network.pre_blossom_halving_interval(); + let halving_index = i64::from(halving); + + let unscaled_height = halving_index + .checked_mul(pre_blossom_halving_interval) + .expect("Multiplication overflow: consider reducing the halving interval"); + + let pre_blossom_height = unscaled_height + .min(blossom_height) + .checked_add(slow_start_shift) + .expect("Addition overflow: consider reducing the halving interval"); + + let post_blossom_height = 0 + .max(unscaled_height - blossom_height) + .checked_mul(i64::from(BLOSSOM_POW_TARGET_SPACING_RATIO)) + .expect("Multiplication overflow: consider reducing the halving interval") + .checked_add(slow_start_shift) + .expect("Addition overflow: consider reducing the halving interval"); + + let height = pre_blossom_height + .checked_add(post_blossom_height) + .expect("Addition overflow: consider reducing the halving interval"); + + let height = u32::try_from(height).ok()?; + height.try_into().ok() +} diff --git a/zebra-chain/src/parameters/network/testnet.rs b/zebra-chain/src/parameters/network/testnet.rs index 80cb8419c77..52d5d18f74a 100644 --- a/zebra-chain/src/parameters/network/testnet.rs +++ b/zebra-chain/src/parameters/network/testnet.rs @@ -2,7 +2,7 @@ use std::{collections::BTreeMap, fmt}; use crate::{ - block::{self, Height}, + block::{self, Height, HeightDiff}, parameters::{ constants::{magics, SLOW_START_INTERVAL, SLOW_START_SHIFT}, network_upgrade::TESTNET_ACTIVATION_HEIGHTS, @@ -15,9 +15,11 @@ use crate::{ use super::{ magic::Magic, subsidy::{ - FundingStreamReceiver, FundingStreamRecipient, FundingStreams, ParameterSubsidy, - FIRST_HALVING_TESTNET, POST_NU6_FUNDING_STREAMS_MAINNET, POST_NU6_FUNDING_STREAMS_TESTNET, - PRE_NU6_FUNDING_STREAMS_MAINNET, PRE_NU6_FUNDING_STREAMS_TESTNET, + FundingStreamReceiver, FundingStreamRecipient, FundingStreams, + BLOSSOM_POW_TARGET_SPACING_RATIO, POST_BLOSSOM_HALVING_INTERVAL, + POST_NU6_FUNDING_STREAMS_MAINNET, POST_NU6_FUNDING_STREAMS_TESTNET, + PRE_BLOSSOM_HALVING_INTERVAL, PRE_NU6_FUNDING_STREAMS_MAINNET, + PRE_NU6_FUNDING_STREAMS_TESTNET, }, }; @@ -50,14 +52,9 @@ const REGTEST_GENESIS_HASH: &str = const TESTNET_GENESIS_HASH: &str = "05a60a92d99d85997cce3b87616c089f6124d7342af37106edc76126334a2c38"; -/// Used to validate number of funding stream recipient addresses on configured Testnets. -struct TestnetParameterSubsidyImpl; - -impl ParameterSubsidy for TestnetParameterSubsidyImpl { - fn height_for_first_halving(&self) -> Height { - FIRST_HALVING_TESTNET - } -} +/// The halving height interval in the regtest is 6 hours. +/// [zcashd regtest halving interval](https://github.com/zcash/zcash/blob/v5.10.0/src/consensus/params.h#L252) +const PRE_BLOSSOM_REGTEST_HALVING_INTERVAL: HeightDiff = 144; /// Configurable funding stream recipient for configured Testnets. #[derive(Deserialize, Clone, Debug)] @@ -92,9 +89,22 @@ pub struct ConfiguredFundingStreams { } impl ConfiguredFundingStreams { + /// Returns an empty [`ConfiguredFundingStreams`]. + fn empty() -> Self { + Self { + height_range: None, + recipients: Some(Vec::new()), + } + } + /// Converts a [`ConfiguredFundingStreams`] to a [`FundingStreams`], using the provided default values /// if `height_range` or `recipients` are None. - fn convert_with_default(self, default_funding_streams: FundingStreams) -> FundingStreams { + fn convert_with_default( + self, + default_funding_streams: FundingStreams, + parameters_builder: &ParametersBuilder, + ) -> FundingStreams { + let network = parameters_builder.to_network_unchecked(); let height_range = self .height_range .unwrap_or(default_funding_streams.height_range().clone()); @@ -116,43 +126,7 @@ impl ConfiguredFundingStreams { let funding_streams = FundingStreams::new(height_range.clone(), recipients); - // check that receivers have enough addresses. - - let expected_min_num_addresses = - 1u32.checked_add(funding_stream_address_period( - height_range - .end - .previous() - .expect("end height must be above start height and genesis height"), - &TestnetParameterSubsidyImpl, - )) - .expect("no overflow should happen in this sum") - .checked_sub(funding_stream_address_period( - height_range.start, - &TestnetParameterSubsidyImpl, - )) - .expect("no overflow should happen in this sub") as usize; - - for (&receiver, recipient) in funding_streams.recipients() { - if receiver == FundingStreamReceiver::Deferred { - // The `Deferred` receiver doesn't need any addresses. - continue; - } - - assert!( - recipient.addresses().len() >= expected_min_num_addresses, - "recipients must have a sufficient number of addresses for height range, \ - minimum num addresses required: {expected_min_num_addresses}" - ); - - for address in recipient.addresses() { - assert_eq!( - address.network_kind(), - NetworkKind::Testnet, - "configured funding stream addresses must be for Testnet" - ); - } - } + check_funding_stream_address_period(&funding_streams, &network); // check that sum of receiver numerators is valid. @@ -172,6 +146,44 @@ impl ConfiguredFundingStreams { } } +/// Checks that the provided [`FundingStreams`] has sufficient recipient addresses for the +/// funding stream address period of the provided [`Network`]. +fn check_funding_stream_address_period(funding_streams: &FundingStreams, network: &Network) { + let height_range = funding_streams.height_range(); + let expected_min_num_addresses = + 1u32.checked_add(funding_stream_address_period( + height_range + .end + .previous() + .expect("end height must be above start height and genesis height"), + network, + )) + .expect("no overflow should happen in this sum") + .checked_sub(funding_stream_address_period(height_range.start, network)) + .expect("no overflow should happen in this sub") as usize; + + for (&receiver, recipient) in funding_streams.recipients() { + if receiver == FundingStreamReceiver::Deferred { + // The `Deferred` receiver doesn't need any addresses. + continue; + } + + assert!( + recipient.addresses().len() >= expected_min_num_addresses, + "recipients must have a sufficient number of addresses for height range, \ + minimum num addresses required: {expected_min_num_addresses}" + ); + + for address in recipient.addresses() { + assert_eq!( + address.network_kind(), + NetworkKind::Testnet, + "configured funding stream addresses must be for Testnet" + ); + } + } +} + /// Configurable activation heights for Regtest and configured Testnets. #[derive(Deserialize, Default, Clone)] #[serde(rename_all = "PascalCase", deny_unknown_fields)] @@ -213,10 +225,17 @@ pub struct ParametersBuilder { pre_nu6_funding_streams: FundingStreams, /// Post-NU6 funding streams for this network post_nu6_funding_streams: FundingStreams, + /// A flag indicating whether to allow changes to fields that affect + /// the funding stream address period. + should_lock_funding_stream_address_period: bool, /// Target difficulty limit for this network target_difficulty_limit: ExpandedDifficulty, /// A flag for disabling proof-of-work checks when Zebra is validating blocks disable_pow: bool, + /// The pre-Blossom halving interval for this network + pre_blossom_halving_interval: HeightDiff, + /// The post-Blossom halving interval for this network + post_blossom_halving_interval: HeightDiff, } impl Default for ParametersBuilder { @@ -249,6 +268,9 @@ impl Default for ParametersBuilder { disable_pow: false, pre_nu6_funding_streams: PRE_NU6_FUNDING_STREAMS_TESTNET.clone(), post_nu6_funding_streams: POST_NU6_FUNDING_STREAMS_TESTNET.clone(), + should_lock_funding_stream_address_period: false, + pre_blossom_halving_interval: PRE_BLOSSOM_HALVING_INTERVAL, + post_blossom_halving_interval: POST_BLOSSOM_HALVING_INTERVAL, } } } @@ -318,6 +340,10 @@ impl ParametersBuilder { ) -> Self { use NetworkUpgrade::*; + if self.should_lock_funding_stream_address_period { + panic!("activation heights on ParametersBuilder must not be set after setting funding streams"); + } + // # Correctness // // These must be in order so that later network upgrades overwrite prior ones @@ -377,7 +403,8 @@ impl ParametersBuilder { funding_streams: ConfiguredFundingStreams, ) -> Self { self.pre_nu6_funding_streams = - funding_streams.convert_with_default(PRE_NU6_FUNDING_STREAMS_TESTNET.clone()); + funding_streams.convert_with_default(PRE_NU6_FUNDING_STREAMS_TESTNET.clone(), &self); + self.should_lock_funding_stream_address_period = true; self } @@ -387,7 +414,8 @@ impl ParametersBuilder { funding_streams: ConfiguredFundingStreams, ) -> Self { self.post_nu6_funding_streams = - funding_streams.convert_with_default(POST_NU6_FUNDING_STREAMS_TESTNET.clone()); + funding_streams.convert_with_default(POST_NU6_FUNDING_STREAMS_TESTNET.clone(), &self); + self.should_lock_funding_stream_address_period = true; self } @@ -411,8 +439,20 @@ impl ParametersBuilder { self } + /// Sets the pre and post Blosssom halving intervals to be used in the [`Parameters`] being built. + pub fn with_halving_interval(mut self, pre_blossom_halving_interval: HeightDiff) -> Self { + if self.should_lock_funding_stream_address_period { + panic!("halving interval on ParametersBuilder must not be set after setting funding streams"); + } + + self.pre_blossom_halving_interval = pre_blossom_halving_interval; + self.post_blossom_halving_interval = + self.pre_blossom_halving_interval * (BLOSSOM_POW_TARGET_SPACING_RATIO as HeightDiff); + self + } + /// Converts the builder to a [`Parameters`] struct - pub fn finish(self) -> Parameters { + fn finish(self) -> Parameters { let Self { network_name, network_magic, @@ -421,8 +461,11 @@ impl ParametersBuilder { slow_start_interval, pre_nu6_funding_streams, post_nu6_funding_streams, + should_lock_funding_stream_address_period: _, target_difficulty_limit, disable_pow, + pre_blossom_halving_interval, + post_blossom_halving_interval, } = self; Parameters { network_name, @@ -435,12 +478,29 @@ impl ParametersBuilder { post_nu6_funding_streams, target_difficulty_limit, disable_pow, + pre_blossom_halving_interval, + post_blossom_halving_interval, } } /// Converts the builder to a configured [`Network::Testnet`] + fn to_network_unchecked(&self) -> Network { + Network::new_configured_testnet(self.clone().finish()) + } + + /// Checks funding streams and converts the builder to a configured [`Network::Testnet`] pub fn to_network(self) -> Network { - Network::new_configured_testnet(self.finish()) + let network = self.to_network_unchecked(); + + // Final check that the configured funding streams will be valid for these Testnet parameters. + // TODO: Always check funding stream address period once the testnet parameters are being serialized (#8920). + #[cfg(not(any(test, feature = "proptest-impl")))] + { + check_funding_stream_address_period(&self.pre_nu6_funding_streams, &network); + check_funding_stream_address_period(&self.post_nu6_funding_streams, &network); + } + + network } /// Returns true if these [`Parameters`] should be compatible with the default Testnet parameters. @@ -453,8 +513,11 @@ impl ParametersBuilder { slow_start_interval, pre_nu6_funding_streams, post_nu6_funding_streams, + should_lock_funding_stream_address_period: _, target_difficulty_limit, disable_pow, + pre_blossom_halving_interval, + post_blossom_halving_interval, } = Self::default(); self.activation_heights == activation_heights @@ -465,6 +528,8 @@ impl ParametersBuilder { && self.post_nu6_funding_streams == post_nu6_funding_streams && self.target_difficulty_limit == target_difficulty_limit && self.disable_pow == disable_pow + && self.pre_blossom_halving_interval == pre_blossom_halving_interval + && self.post_blossom_halving_interval == post_blossom_halving_interval } } @@ -495,6 +560,10 @@ pub struct Parameters { target_difficulty_limit: ExpandedDifficulty, /// A flag for disabling proof-of-work checks when Zebra is validating blocks disable_pow: bool, + /// Pre-Blossom halving interval for this network + pre_blossom_halving_interval: HeightDiff, + /// Post-Blossom halving interval for this network + post_blossom_halving_interval: HeightDiff, } impl Default for Parameters { @@ -523,24 +592,32 @@ impl Parameters { #[cfg(any(test, feature = "proptest-impl"))] let nu5_activation_height = nu5_activation_height.or(Some(100)); + let parameters = Self::build() + .with_genesis_hash(REGTEST_GENESIS_HASH) + // This value is chosen to match zcashd, see: + .with_target_difficulty_limit(U256::from_big_endian(&[0x0f; 32])) + .with_disable_pow(true) + .with_slow_start_interval(Height::MIN) + // Removes default Testnet activation heights if not configured, + // most network upgrades are disabled by default for Regtest in zcashd + .with_activation_heights(ConfiguredActivationHeights { + canopy: Some(1), + nu5: nu5_activation_height, + nu6: nu6_activation_height, + ..Default::default() + }) + .with_halving_interval(PRE_BLOSSOM_REGTEST_HALVING_INTERVAL); + + // TODO: Always clear funding streams on Regtest once the testnet parameters are being serialized (#8920). + // #[cfg(not(any(test, feature = "proptest-impl")))] + let parameters = parameters + .with_pre_nu6_funding_streams(ConfiguredFundingStreams::empty()) + .with_post_nu6_funding_streams(ConfiguredFundingStreams::empty()); + Self { network_name: "Regtest".to_string(), network_magic: magics::REGTEST, - ..Self::build() - .with_genesis_hash(REGTEST_GENESIS_HASH) - // This value is chosen to match zcashd, see: - .with_target_difficulty_limit(U256::from_big_endian(&[0x0f; 32])) - .with_disable_pow(true) - .with_slow_start_interval(Height::MIN) - // Removes default Testnet activation heights if not configured, - // most network upgrades are disabled by default for Regtest in zcashd - .with_activation_heights(ConfiguredActivationHeights { - canopy: Some(1), - nu5: nu5_activation_height, - nu6: nu6_activation_height, - ..Default::default() - }) - .finish() + ..parameters.finish() } } @@ -568,6 +645,8 @@ impl Parameters { post_nu6_funding_streams, target_difficulty_limit, disable_pow, + pre_blossom_halving_interval, + post_blossom_halving_interval, } = Self::new_regtest(None, None); self.network_name == network_name @@ -578,6 +657,8 @@ impl Parameters { && self.post_nu6_funding_streams == post_nu6_funding_streams && self.target_difficulty_limit == target_difficulty_limit && self.disable_pow == disable_pow + && self.pre_blossom_halving_interval == pre_blossom_halving_interval + && self.post_blossom_halving_interval == post_blossom_halving_interval } /// Returns the network name @@ -629,6 +710,16 @@ impl Parameters { pub fn disable_pow(&self) -> bool { self.disable_pow } + + /// Returns the pre-Blossom halving interval for this network + pub fn pre_blossom_halving_interval(&self) -> HeightDiff { + self.pre_blossom_halving_interval + } + + /// Returns the post-Blossom halving interval for this network + pub fn post_blossom_halving_interval(&self) -> HeightDiff { + self.post_blossom_halving_interval + } } impl Network { diff --git a/zebra-chain/src/parameters/network/tests/vectors.rs b/zebra-chain/src/parameters/network/tests/vectors.rs index c839a26c116..4282c86844f 100644 --- a/zebra-chain/src/parameters/network/tests/vectors.rs +++ b/zebra-chain/src/parameters/network/tests/vectors.rs @@ -139,7 +139,7 @@ fn activates_network_upgrades_correctly() { let expected_default_regtest_activation_heights = &[ (Height(0), NetworkUpgrade::Genesis), (Height(1), NetworkUpgrade::Canopy), - // TODO: Remove this once the testnet parameters are being serialized. + // TODO: Remove this once the testnet parameters are being serialized (#8920). (Height(100), NetworkUpgrade::Nu5), ]; diff --git a/zebra-chain/src/parameters/network_upgrade.rs b/zebra-chain/src/parameters/network_upgrade.rs index 356ae86577f..957b96de944 100644 --- a/zebra-chain/src/parameters/network_upgrade.rs +++ b/zebra-chain/src/parameters/network_upgrade.rs @@ -59,6 +59,7 @@ pub enum NetworkUpgrade { #[serde(rename = "NU5")] Nu5, /// The Zcash protocol after the NU6 upgrade. + #[serde(rename = "NU6")] Nu6, } diff --git a/zebra-consensus/src/block/subsidy/general.rs b/zebra-consensus/src/block/subsidy/general.rs index 03ebac36d21..d871751da34 100644 --- a/zebra-consensus/src/block/subsidy/general.rs +++ b/zebra-consensus/src/block/subsidy/general.rs @@ -23,40 +23,39 @@ use crate::{block::SubsidyError, funding_stream_values}; /// /// Returns `None` if the divisor would overflow a `u64`. pub fn halving_divisor(height: Height, network: &Network) -> Option { + // Some far-future shifts can be more than 63 bits + 1u64.checked_shl(num_halvings(height, network)) +} + +/// The halving index for a block height and network. +/// +/// `Halving(height)`, as described in [protocol specification §7.8][7.8] +/// +/// [7.8]: https://zips.z.cash/protocol/protocol.pdf#subsidies +pub fn num_halvings(height: Height, network: &Network) -> u32 { + let slow_start_shift = network.slow_start_shift(); let blossom_height = Blossom .activation_height(network) .expect("blossom activation height should be available"); - if height < blossom_height { - let pre_blossom_height = height - network.slow_start_shift(); - let halving_shift = pre_blossom_height / PRE_BLOSSOM_HALVING_INTERVAL; - - let halving_div = 1u64 - .checked_shl( - halving_shift - .try_into() - .expect("already checked for negatives"), - ) - .expect("pre-blossom heights produce small shifts"); - - Some(halving_div) + let halving_index = if height < slow_start_shift { + 0 + } else if height < blossom_height { + let pre_blossom_height = height - slow_start_shift; + pre_blossom_height / network.pre_blossom_halving_interval() } else { - let pre_blossom_height = blossom_height - network.slow_start_shift(); + let pre_blossom_height = blossom_height - slow_start_shift; let scaled_pre_blossom_height = pre_blossom_height * HeightDiff::from(BLOSSOM_POW_TARGET_SPACING_RATIO); let post_blossom_height = height - blossom_height; - let halving_shift = - (scaled_pre_blossom_height + post_blossom_height) / POST_BLOSSOM_HALVING_INTERVAL; + (scaled_pre_blossom_height + post_blossom_height) / network.post_blossom_halving_interval() + }; - // Some far-future shifts can be more than 63 bits - 1u64.checked_shl( - halving_shift - .try_into() - .expect("already checked for negatives"), - ) - } + halving_index + .try_into() + .expect("already checked for negatives") } /// `BlockSubsidy(height)` as described in [protocol specification §7.8][7.8] @@ -503,4 +502,33 @@ mod test { Ok(()) } + + #[test] + fn check_height_for_num_halvings() { + for network in Network::iter() { + for halving in 1..1000 { + let Some(height_for_halving) = + zebra_chain::parameters::subsidy::height_for_halving(halving, &network) + else { + panic!("could not find height for halving {halving}"); + }; + + let prev_height = height_for_halving + .previous() + .expect("there should be a previous height"); + + assert_eq!( + halving, + num_halvings(height_for_halving, &network), + "num_halvings should match the halving index" + ); + + assert_eq!( + halving - 1, + num_halvings(prev_height, &network), + "num_halvings for the prev height should be 1 less than the halving index" + ); + } + } + } } diff --git a/zebra-consensus/src/checkpoint/main-checkpoints.txt b/zebra-consensus/src/checkpoint/main-checkpoints.txt index 4c9a9c0d44d..aff5d444225 100644 --- a/zebra-consensus/src/checkpoint/main-checkpoints.txt +++ b/zebra-consensus/src/checkpoint/main-checkpoints.txt @@ -12177,3 +12177,129 @@ 2624406 0000000000d8c3a66ac5a0a8c3938f27537b734c7f35a5b6c4c9f3e9ef029cd8 2624806 00000000014e4268c9a2190fd52e4da77f6a887b966846d8f25aa6948a64d7a8 2625206 0000000000e70fb2297446280d68e7263e155c548ce47c9eafa2ebb55ec35a98 +2625606 00000000014f4e3c63d4a271f4ab19beffb6c680a98ab5d5265c6ed7224e96d7 +2626006 00000000004be1b5b382402702ecd413d60deb1b8f3519e49ead6c187eeb5edd +2626406 00000000001425180f380fb03df0b0cdcf682a2d46dab03aca2eddcae4145c46 +2626806 00000000008624d7b6d78cf1062a126645c403059e07a83550fa3346cac37664 +2627206 000000000015f6d6e1795b16bd9bee7dc7b4cee491eb3c71f7e8da9be00a60b0 +2627606 000000000101e9cdadd025d74ac82de012ed067913138ab8b86c515057a18cbd +2628006 0000000000249f3277f5bfef73fbb67debc2bdffb67ae844236b941421e35321 +2628406 00000000003d20ba5ed506854cfbb9eae39c9e57f0d6fb9e632691b3a051eac5 +2628806 0000000000d3d6f596e37413c3bad56e4c31baaf0627d9f73b6dbdc595f7880e +2629206 000000000075a542fec59d5d0b020b154e43aab3169da1b4a8425b7269bd653e +2629606 0000000000eeb9713c5e03aefa95696c038ba0ffde7e6ad9772c44a9a470e4b4 +2630006 0000000000133e359d6e60fbc2d568959ed56b17123ccfbdd159f1aa4951ad22 +2630406 0000000002245d9d2741a7892d64d6e9b4044e7d7f71560a8201595e298860a0 +2630806 0000000001c1a365c6a07dc5d99ac874cc8595590a7fd4dd62dcb3bc246e1b5c +2631206 00000000002570be7f316695395d552040d1c82c89b8c5dde859b683c2a9d6af +2631606 00000000007773e7e3eebef9300a01cc9b620f17f31c0b92139155be50fb2c6e +2632006 0000000000c54ddff6249bbd5dd90055660e427f01449a52e744b6b35a966b1e +2632406 0000000001abf33764a6d32b88e07936ccdabca43d482c8be63d38d17b8464dc +2632806 0000000001b57c8c4f7b60458fb596d8a86ae771f1a335950673af77f3e80c06 +2633206 0000000001a1202491a9ca9099b3e94c66028ff7ad0f1fbbb8100e27e41049f9 +2633606 0000000001e75b12f152437b13a079fb8f4b8ce5a95bc439d8b67a02a73f4c9d +2634006 000000000176f27d9ab309ae3a64d289020005744b7aee4f65b7d5cf16280b47 +2634406 00000000018c027107de01e1d3f1b9af5abb3ab52f53063c4d26ab7a4a9b7a2a +2634806 00000000007a9e53b36faecd9f411e1bd69ac9f48c18d7ad6b02074352cd639c +2635206 00000000011a33012b9ec50e0eac0495819531251d9f902b2c905387f238592d +2635606 0000000000358d644665a7adb57d890fe29cf4e0f9bc8108ab76df8b7b6ec65e +2636006 000000000070c7b0c258add3088d8d950f9f0165c0457efd219177ac5b032c8a +2636406 00000000014162f4bdca385858793e0cc0597ad9fedd7bfbdd1fe0ffae0e7a84 +2636806 00000000009e8387c54398809453d6489cd673d6ef0d33040a706a1876e488a1 +2637206 0000000001b6eb252c6fe78c7ad9c24559abb42cf7d34616c2ca2b5da3273fa2 +2637606 000000000173649f52e37ea5d1fa8de0538875b645d74db4bb98bc8ff23c6659 +2638006 0000000000538f7b7dfd18e5dc5dfed46a5c09a8de595838d82d9e965cdf4b36 +2638406 00000000012dee8d0b2433cc06d1f9820c28d076864cd8ce5a602dfc9b477c80 +2638806 000000000197ce6b2ba05b715e836f1a0a3e9b11eda2f14803987cfaff7bd9fc +2639206 0000000001c68825a4959681d07f64305f17b1d504d37423a86684d5cf5187b9 +2639606 00000000009f7e8b638a6e8ca8ed85434c42ac1fb280806a9a6f7e335d8e973b +2640006 00000000001558caa2ccb0e9ae27aae0c286268b5f722898e8301f79ef7aea78 +2640406 00000000013260c881a0711070837af189836627ce9998aeda0b82203db24ae4 +2640806 000000000082fe2a1061bc6c1b323f5444b932b81fab63c97dd440adee66a752 +2641206 0000000000d8e4eb37e7cb549112928b420d468b408c5aadb0a12f2f08108db8 +2641606 0000000000a1d5ac6e3d8b0f498537f8722bb02ad02ec289330d89f897cad312 +2642006 00000000025ab840bddbbb2caeb864889c099548f8be8744e4d743cbf7994a9e +2642406 0000000001bde94e940f10ef00990633eac776bee7ecd9752ddcace1b3e7f60b +2642806 00000000017b1aa7d94ff71496ef48fedd89eaa8816cc368e0c39ec989cb9b55 +2643206 000000000131af29cba7406cac833d67538b5b70f76891a76277cfe873e26455 +2643606 00000000008f42389bde6acd102d38510e7f9fed47b9e8410631a4c1e7b6e73a +2644006 0000000000f318f41fec3fb21e85eb25cab31d3cca14c78f09be15c7eb932c65 +2644406 0000000000060ed5eaca03b133c7830e1235fdfb70ac30de8c6e91902216a734 +2644806 000000000105ae213f8efaba6c882610a70741102399c493b3257c49ed3349ee +2645206 00000000000f1adce304a1b234f858301717be9782649e2212e3c0b820e6b12e +2645606 000000000005388844935f1ae0d1b1437832396a6a0ea1d7ca2aee2d2fb4fb2e +2646006 00000000018f5afcb6c97e0a9fae2ae4daff69147b52320344009d3a37beb220 +2646406 0000000001671aafb84735f971ab5d0b6f6419de6279444d03f5be7e35456c73 +2646806 000000000055de6c58155329b8e807c6c16ed6655e1a15a7a39b6e0d898ea548 +2647206 000000000176b93f66fa7190a14f63764aa2320ae1167a31d25c2c2bc10836d9 +2647606 00000000018032e1ecd0260c40ec9ce723cc32fab394162954a24ec9997cf6b5 +2648006 000000000140e67c12607105f2fdb7da6782e2dd09052f9dc7ce6ac77cec2c5a +2648406 0000000000e0e92a1c15b010583334198671bdae6d65bc50d7f7d701334bc1ad +2648806 00000000011cb84c9074707c73648a7d8e9e2823e3110d20d083fde9113ce796 +2649206 0000000000784bb776439b174c508282af2898bd876d11e595f3c1e59bca026a +2649606 0000000000f8d05e0633826998972f85be111c6d2520eebaadf15a3c44769725 +2650006 000000000005ff8fc9d62923fcffd38b58ca30345a009a3ae0d44b1da5f7d5b1 +2650406 00000000002054af7959069600f29b3845dcd1f5f27de2b3fd7bcd1a2f43838b +2650806 0000000001b50e2b3eb69094af355b1225e1c2a9962b3a0162e069459a6b9ed8 +2651206 000000000169c5a4db126a40a68e4a50d61f85579e702c50123b2ad2122bafda +2651606 0000000000b41cc2ca140869c3215437a1c09a408bd0dc72b5effdbefb962e67 +2652006 000000000124555a8e903be04bda53070b923f43cb2024aa22992775f2653f0e +2652406 0000000001558002fe04eaf473124328278d9fe2bf18dc813c8f5a8b050363c8 +2652806 0000000001c3557aed4416d9c14a6d698b40c8e16226444fdabdf41aa1526d0d +2653206 0000000001b74f14c79d9de792a9a0dd1df2ce35f1b13055c7d430aff1822a2e +2653606 0000000001a2785cb10a797523e7cdbb88bca211256ebd946d71111e1a86472c +2654006 0000000000deac02824ca6591e0d1b66bf2891fb09c57bf3858d62aae27cb46c +2654406 0000000001666379a4b4c66263fb56c2f317bae2951bc7d35dc6bcf721303968 +2654806 00000000007e593bbc26925ad6e56481bd1cb64c051c4deeddb89f9188760d9e +2655206 000000000172fa70e819f750f963651ed564c6ed719afd7415efd83268e670b8 +2655606 00000000017d51fd805e1181026cfe89ae19c8f092b01e1ff352ceebd3f2428b +2656006 000000000185810960c4295874601ad1eaeaec7f90562500d6c6f2bc309552d2 +2656406 000000000205514fd4d2202516ab6060b2d3a79a20bb50eda855e9efe921f461 +2656806 0000000001dbf4b39d66c6e0b766aa11a1ef0896421180e0d4b6415ec5c2056a +2657206 000000000141640da893de1c2f2fe10f9990993e1c0ae04f2199f4a25c0c06f9 +2657606 000000000111b1c350c3beb6c16e628b7da8e4e897fec0c2318be1a0a1e8b445 +2658006 00000000019faefa1417f4a13ff0cd6e865af4ee3c262eb294325fe5f0c96383 +2658406 000000000126e89df37808b0443aa804ee65e143158929f357b7071d6fa2fb70 +2658806 0000000001a27d45f3892a3ff3ba3d559dc4cf3a7d6cf3606149e547fbf3e1a4 +2659206 0000000001d42a455ff283dfdb2bb66083473b63a36c3ee440806de2dbe40846 +2659606 00000000008842d5742bf1224a521b38fbecaf5b4162fba26f9f8739cbb59c0f +2660006 00000000012e8baef3d981f90eb6a74940b3fe222010278ed3e2cf67a3306459 +2660406 0000000001b0a045708ee6d89c0d9444e23c48854a525146072b1dc73706f6b2 +2660806 000000000154dec42b8febdd350b5b925b8cb25db43525382b087fe1dba292f5 +2661206 0000000001ce18bddb0c49d2fb905a4d16ecb60b316b7041cd6554242c2f0205 +2661606 0000000000f9b5b25d9c6e6908e40174e18eda6367c682c97d036419b33745a4 +2662006 00000000014d6372cbbeeb054f20834e5faaddec3413c16f9e2c0ef996e1a9c4 +2662406 0000000000ea0f41591f19d0b7d615a421fb17b7538b0494eea9d1c993ef237a +2662806 0000000001611c661c32ffff2b681d3ce612695b5b89bed1bc71633d5a8cc2db +2663206 00000000008018fb5e984d384041ac864676a7c53970777b0409afb2ad2920b7 +2663606 00000000010805c3d6854f43bcfb3c17d6c018fd41b6a6d78f7d468b59fd94e7 +2664006 00000000013c678433f116eaa67b98e6198c374cc3cdd172d73a9f6c602bc957 +2664406 00000000004d34e909abea6990a5571207304d8d9d1799a9cdd4f2d15b7e3988 +2664806 000000000174bf5fd65181b56a308a3e3d564f8277842e82f6c188249e07fec7 +2665206 0000000001ec8c45ce6ee60b1921f6f72cba031ae7e51518bb4db5281101eca0 +2665606 000000000043a7bb25e301a8f6880fad235d9a29ead7e3aa1ed4a5362a837891 +2666006 00000000016416ec8c24b492b4f9a16b15f2bf1aedce1d90e875998cb577edba +2666406 00000000009f1c02edd6339af8e216f620ed32a6cb6ce4fb284d7bdf82305ee0 +2666806 00000000013b50bb104f73cfaa00fd652e67b4a89588baa27dd95aab2a59a452 +2667206 00000000003f0ae07948979983175156a732bb79610096dfbc0fa7a29eaf48ed +2667606 00000000001a94fdb7d9dd3eb37b3783ebc30864a304dd8ddad6802f94b7a3d9 +2668006 0000000000d5d7aab1d70e2fdfa27586d2760d4d4ee234ffcf5136be94ced6bd +2668406 000000000156144469688a7399c479d1d80cb0ff30f49326bcfee27c372823a4 +2668806 0000000000ab2254331ff5f51112bf8e08f7fc9bbadb3836e6dd070ab2d96718 +2669206 00000000010496c02ac9094f9647c92d7be9b8fa18e8d73a82203009b52d3ac7 +2669606 0000000000f8c1992cc04a608c8716748134e2b8d095ec03bd8d79e6935532c3 +2670006 0000000000312d25ce5cd017d41bf3cdc26deafc073f11237b1df7c7c47f566f +2670406 00000000010d11aa21b44f48f6d44b5045128c3b36c3a05a5438776680615abe +2670806 00000000017f15485570574b715a2bafb80d35df6b9bcfc15f0a901ac806c47e +2671206 0000000000812c9f41ad666bca5d9d41bd37bf14c638940f983fb3960331c04a +2671606 00000000005d4d7d6a403a2a064b7ff117af665ded46f592cafed26aaf9b8ca4 +2672006 00000000003f61a2bfc7715db9d7ac1720b98b504e504764a609e5ef1e02e9f0 +2672406 000000000136c4e46ed63f4eb6409af4024952861ba95f372882c5251e0a249f +2672806 000000000173052e6bcc30a2af8792343bcf75b207cbcc2a9bcc2611b5c551f4 +2673206 000000000146c90abab2bb4919cad89f10e198562a0e5c7a543ad8357facb667 +2673606 00000000009364e3ec0954c9090a2db6b2be08ad1b679dfc0d429ed9e57bd972 +2674006 000000000191a821de364efb3ca613dc20c2e1377734a841f2e88bfc825d5e3f +2674406 0000000001535fb080dea37cf6d973178f6a3014851ab26d1914456742163ef3 +2674806 00000000014f2059c0d91a8ed6023b08294593de773268abb0b4ad79d9d20581 +2675206 00000000003ebb8baab4ceaf73fde6753d4281edfa07c897458ce9a1c5ff57ee +2675606 0000000000065afdce346665ab6ca463930733149eaaf1e79033b08232f7a363 diff --git a/zebra-consensus/src/checkpoint/test-checkpoints.txt b/zebra-consensus/src/checkpoint/test-checkpoints.txt index 0b6cde440d3..484621f8a1f 100644 --- a/zebra-consensus/src/checkpoint/test-checkpoints.txt +++ b/zebra-consensus/src/checkpoint/test-checkpoints.txt @@ -7434,3 +7434,102 @@ 2973200 0032c83ee743bcfd5795caaa601d0275f6b54fb75574750a51e5d22c24b14ea8 2973600 0012655ae0ade4590af7c05dd609415b422d33f7ceb1dbb15d2c381bf0576dd2 2974000 004a2810cfe2a2bd83c202a0311cff47c80364ee2a874a93bae34404380e2b98 +2974400 0022bbb634b3c87ba01cf9e88637eaf43cfa81641b82d33d9b362add0fd8c41b +2974800 00458fbb5c826bcda26fc5936915353df569091b51b335480b12031692a6d5a6 +2975200 002c923c7ea37b4fdc0a4ae792ddf9b5087288512702891335c539c1910cd10c +2975600 00179853d41830957b6e4dada1d1bb709f4460497b7ae49e080d933efa201744 +2976000 0017d56ed80077f45eb88f11d50f4306ee1fbf95892c9a9cb7a9538e72ceabc1 +2976400 00584d9303c8817a82d09e2797b2cf488ed6c4efef322b915bdcfd230a42de2f +2976800 00160f1ba661be6e2d48099e3ff72345f6051a571b1d363df1382c8a6c422102 +2977200 0022accee852fc0d84ac932773bc7b71d53f8ff8d4c439bd982cd6ff4747ac60 +2977600 004554ac744c87257595f32dfa77e0446a0dad1e9193c12de3f14a4a29fb2045 +2978000 0022e4822a5b6749d6dfc7fa90845e8d185d0fe04197c6fd4f0e18066006fa6f +2978400 0052824498a9414802d98e56ab3e48919f9397e3c0bc573283a4e4d471bf12bc +2978800 0046d673c6d74676bdcadc63a868c0886b16a4538f0d7045d6d61399b4292c4e +2979200 00dead16ec073ce4a919eff239f21508997232a9c598de0b6b10c8e00fd4e413 +2979600 0031ee45acf915c0d36441583aedd05c36c10a3cf03ac090f6994f46bb359ace +2980000 00074a97178ddee1c90add32065c3dcba94026ed94a7abbad74d95754e4bca63 +2980400 005f3be21f2c324b5c0f3014e8621e31ad9dbb146393208b0597191827bb8ed3 +2980800 001eabd1939746320b0322a8e853ead97ff31537e167336dab15ffc3e5a76e25 +2981200 00699b9d0952eb987e6a3907c56bd218401756b982d5adf5103f755176c09838 +2981600 002a23f230985a0a6b5708837b21e930ee54f62c394b6fbb704ba5a7a8e48177 +2982000 00d030142777ac5f04a38153b83ccc72a5bd4b1ef6a449b5acb5c86b64792e73 +2982400 00264619ba50c766d638ed99b5b167edadfc3588bbfd3da7c63cf7a6f5048c97 +2982800 00486d6ecfc4b9c13fe5c30275298308aa8344f33e37e5aaa9a80b97f2a815d1 +2983200 002de3fea65b06c40080240a21d664b0dea224b146c6c2c00c3c6306a7297fab +2983600 06d4fffdd467139d9d2f80ed0a670a0eb27e2dddf863600d157b4d872aec469a +2984000 0009b56289a49bfca3c0fe9ed50d1f7eaeca7ba34258f73006f1420a41a32fc5 +2984400 000532dfb34a7f7937eef7dd4bd87a9543057efea82506c42c9ac8f5a3454537 +2984800 00323df998c2bc31631cf76cf832e577bc0d804ccdcc8680dfcd74c0953a866f +2985200 001be73a9c3c041da1bd6a2bfc26cfbd2cbde992e11b64c7b8e53c711d36ceab +2985600 0019d10c111c6031c24bf5381327731d3701da501f092e636f3a3f2c1be0eb93 +2986000 0014687fc704f084257ccd48be14f4f8147aa5c8c1d6e518b041e5763dbb463c +2986400 0010521021fd245c6d4d0b5881c72d73cc9c7232bfb9648636af35519999e444 +2986800 000ac5b70875bccf25fcdbbf7690c0d0c5f39133b3bc4c5a5489a4628e976bb0 +2987200 006f4c27c6de76acf6942c0c6771679b23a983c27935aeb4b4db068400a6747c +2987600 001cf3cd65806efc218dca11184be3e34fbfdb9d9c66eecf79b451306fb08e42 +2988000 00385974ef8716fe45a001bac4b9ba70e98e36e6d733f85842001d8361fb6ad1 +2988400 00aa453bb6feebc5ca98e23cc3e50dde6b1bd9d2cb50cc07f10f1c2ab64eed1e +2988800 006456c1419697679b5fab7c75e540cdb4a3b55a244af57eede27f48ef37bbe1 +2989200 00e183f9b91d77afb1fdddf6617ff015933b32b38632ff704bdbafcf0969abe3 +2989600 008e8aec2cdfcd038a8124828bd1c7be65ae2927b520800a37e22f11c0c6c5c0 +2990000 00af170515d9182896b815fd8fa7067ec32e7ae2d1013655203aab9035482cd5 +2990400 00903b7b501a8a36fc381412b98ea7935075d5d36ad3412b3de70370bb835e26 +2990800 002eabb0e34c2f5911ce9472b8a97a3591ba5fb9b5d699bad5ca7e8e7dff29ec +2991200 00e2e4839d4781d8b654791382ad762aca8fa2a9337a551aeaf65ff8469f949e +2991600 005a44c5e8d1ea2268df01d49f964c13c2b6c415e64a92982be877a51b9367f3 +2992000 0048db0454853598652ea3e7975ae0678e3ab4f80b24d2d8eab5f4491aeae341 +2992400 00604fa9e6e883419e67793510d61fd07c0c566a4357e5f236db4863909bca4c +2992800 009bc0379eb615cfa73a14252fe60e06ca8d677a850ffb216111a03a51f3d2ba +2993200 00262af418a3f14f6fd704eed3cbedb6feedab7ed1d336149ba60190dd8d5627 +2993600 004c9599e33c92fcbff384f46dd2d32acfe67535bb7585c1e6aa20a45b0d9437 +2994000 0035d3cd6c8fe730067378073189eb4d39b978664da0a227148d973ce4a2769d +2994400 005b3851f75804e4775f27a44775b09e1acd42d6f84a4b352f2ff9ee4d7445f5 +2994800 001a326e8ab266490db69bad4b603fca01ec6c4014347c3ccabc8b470dc55fa7 +2995200 000ddfb141559989861252d06883e6f85e882f344d49d39405c1a8b5da8a6973 +2995600 0045c05ff5d9c2800762636813acf05d227a350c061d6ab9ed84b763c51ab443 +2996000 007de7332473a328a114d2a1ea1760d133e6d7afc45d12fbcea5e060b5c0e0ad +2996400 0070f19bebf84c4d115999b02d30a792ffa234ccb49b4c3144beedbaffcdb35a +2996800 005c06bca5b702ddd66537882a1a960b140d72072f60d078b575d2d46af634fe +2997200 0055708e62124e1dabb01e2e6b808e8454774c0c358defcf896100c84e80a254 +2997600 01cf554f19e2c3b3baf645ba0fed77029c74286f4361eaf401e6822d28a127e3 +2998000 0006dc2e8b057c43a1b3aa9e565b3912b71614ccd83b96c64c7af7604bfc2afb +2998400 0013966207316fbb6c91606c32afbb937daac81a7927299d2697cf1e6dd52b2c +2998800 001147a0eaff7ece55c60087187767ef19a1c2c6e833cf8a8b84f4c457a8db4a +2999200 001ed62bd7508d0d529ab2bb129784eebb9e93ae920e7cf95b4952330e960dab +2999600 00975335c00f798a2a7e04707f763443d5644cd65d82de99ac076b679f3c2417 +3000000 0031432018aa59e440804fa87974ec791ae174fa2909470f3c3a8a93842a659f +3000400 00b7d239d9ca1f3c12ab873fb8481bb1b2dbb217c9184c20d6bfed56bddc3e73 +3000800 00fe4dcad3cede4648dc0145ef4739eafdd7ee5a917eebdb3039f939414909be +3001200 00156bd2823f54d74d16619385f784908f550cbd251a9e26eba7b75c008672dc +3001600 068d6954e2d9c83a16895c96b152c07d18e9ff9a72ae34da00d9ecf708d91843 +3002000 0000e8a565bc879836b498a045bdfdd889c119ddc074233281db25fa5405c1dd +3002400 07031d3ff01c5bf5bdf488ec327a0912c667cfd6c65adb53df5d9c29ebeb77b2 +3002800 07aaa1a5f9efe3b10b7d06f5cc6547d5086889b11c0403926a1506fd20f72d6d +3003200 00062726eecd4bde3da20713575797eeb6c131270114a5e4f478256997f91386 +3003600 000b56fe1770444f38cfe6ab206351b012e6b2aef48bd97d7a1c9e9915f35c2c +3004000 0038d09a6031912f36207f8e14020e12989e9fa5c7405ee69f792ac07af04e38 +3004400 009ef06fb016e582b0d286adb72f2b39b118f3193eb883733e5020fc4cc995eb +3004800 00508822b2e469b412628a7da879d4b302c867a7fbfb6c142776b2b30ea1f811 +3005200 001ab12b2a505bedfcf9fa3d64480dbb977efe71940d7a8b0a738d2f97e6cb00 +3005600 001257424eb2683058899922d185a8a8b955c217f10dc106f91cdeb38c3d1c66 +3006000 000ee0de408e16df398189b18c5bd9fd3c6ee55fb28b7afaf0304627c5f13267 +3006400 006d417c0a56b9a2aaf686360aa3c111671017a8dc493ef9e50f65768102a2d4 +3006800 00561d7b3a8bcc57e2069996890f0074d7f0b3601a27688f44c24a83d3c6b4e8 +3007200 010cb5a8e3e9ba661dd7ab7b087f5f55dc243bcd13481034ddf56efd8b643ed2 +3007600 0037e87b458d6faf64750c8556b329eb11308d9a5cc921bec15053bf43985245 +3008000 0010a31899ab3650a999a3eb98786ee59f2ed890d93f338f36194cd0c73511e6 +3008400 003b99ec2366bdedb6811fcbaab13393a436eac72e68194acb725729984331d3 +3008800 000659dfa07df7883d44fc58b2ddbcd930ee950698ee5d27b8f6faeea8a8382a +3009200 000f96accb21165fb5ea8c7da816f007116d3309412acad32fe28c269f652357 +3009600 00533daa091bbcd0008035ddaa56f684be41d7fe66fea665ae8f4fd85cf4ea9d +3010000 00bf309a67faef45356683ee7aa30ec167854515b6aba1b05592385e5caf4652 +3010400 00959a4d4f653186485b260ed851999f695a039f1ddf39e02b93adcb592fe812 +3010800 00637c7b49f3d9a1bdc05c14939855d40c1de1f8273070be9f9c2518d5c3607e +3011200 005b320c531b36611ea3b718eb09a622a602a50a1bec93f475eac598ff8726d1 +3011600 0020653b72946047c7afbfa3c74b28deff29c55627a862d8437ee7038b2ea92f +3012000 001717262f28c5ca078cffc7d8c1887a4c98a44f9e93eb841975294fcb3b3d65 +3012400 0014b2b3692aade71cf14910d91181cd238a5ecd14f6344c69817c4349e8766c +3012800 00a5a4c7aa1e5120b05358100083165fdae6d3da4932391f806dc70b17de43b0 +3013200 005816e627c296c77a1088915b359185349a4b4b345a325a889a4854c6598f71 +3013600 0067f8576378bcfa73c91f734526234125ab0cc306bcbfc415359000f54908fe diff --git a/zebra-network/src/config.rs b/zebra-network/src/config.rs index 7936ea0e787..8619507fa0d 100644 --- a/zebra-network/src/config.rs +++ b/zebra-network/src/config.rs @@ -597,6 +597,7 @@ impl<'de> Deserialize<'de> for Config { activation_heights: Option, pre_nu6_funding_streams: Option, post_nu6_funding_streams: Option, + pre_blossom_halving_interval: Option, } #[derive(Deserialize)] @@ -686,6 +687,7 @@ impl<'de> Deserialize<'de> for Config { activation_heights, pre_nu6_funding_streams, post_nu6_funding_streams, + pre_blossom_halving_interval, }), ) => { let mut params_builder = testnet::Parameters::build(); @@ -708,14 +710,6 @@ impl<'de> Deserialize<'de> for Config { ); } - if let Some(funding_streams) = pre_nu6_funding_streams { - params_builder = params_builder.with_pre_nu6_funding_streams(funding_streams); - } - - if let Some(funding_streams) = post_nu6_funding_streams { - params_builder = params_builder.with_post_nu6_funding_streams(funding_streams); - } - if let Some(target_difficulty_limit) = target_difficulty_limit.clone() { params_builder = params_builder.with_target_difficulty_limit( target_difficulty_limit @@ -733,6 +727,20 @@ impl<'de> Deserialize<'de> for Config { params_builder = params_builder.with_activation_heights(activation_heights) } + if let Some(halving_interval) = pre_blossom_halving_interval { + params_builder = params_builder.with_halving_interval(halving_interval.into()) + } + + // Set configured funding streams after setting any parameters that affect the funding stream address period. + + if let Some(funding_streams) = pre_nu6_funding_streams { + params_builder = params_builder.with_pre_nu6_funding_streams(funding_streams); + } + + if let Some(funding_streams) = post_nu6_funding_streams { + params_builder = params_builder.with_post_nu6_funding_streams(funding_streams); + } + // Return an error if the initial testnet peers includes any of the default initial Mainnet or Testnet // peers and the configured network parameters are incompatible with the default public Testnet. if !params_builder.is_compatible_with_default_parameters() diff --git a/zebra-rpc/qa/base_config.toml b/zebra-rpc/qa/base_config.toml index 502a2a75b1d..c0cc5391f4b 100644 --- a/zebra-rpc/qa/base_config.toml +++ b/zebra-rpc/qa/base_config.toml @@ -10,3 +10,7 @@ listen_addr = "127.0.0.1:0" [state] cache_dir = "" + +[network.testnet_parameters.activation_heights] +NU5 = 290 +NU6 = 291 diff --git a/zebra-rpc/qa/pull-tester/rpc-tests.py b/zebra-rpc/qa/pull-tester/rpc-tests.py index 00194f0aa53..e8f48ac9861 100755 --- a/zebra-rpc/qa/pull-tester/rpc-tests.py +++ b/zebra-rpc/qa/pull-tester/rpc-tests.py @@ -39,7 +39,8 @@ # Scripts that are run by the travis build process # Longest test should go first, to favor running tests in parallel 'reindex.py', - 'getmininginfo.py'] + 'getmininginfo.py', + 'nuparams.py'] ZMQ_SCRIPTS = [ # ZMQ test can only be run if bitcoin was built with zmq-enabled. diff --git a/zebra-rpc/qa/rpc-tests/nuparams.py b/zebra-rpc/qa/rpc-tests/nuparams.py new file mode 100755 index 00000000000..5ed74e4ac34 --- /dev/null +++ b/zebra-rpc/qa/rpc-tests/nuparams.py @@ -0,0 +1,266 @@ +#!/usr/bin/env python3 +# Copyright (c) 2021 The Zcash developers +# Distributed under the MIT software license, see the accompanying +# file COPYING or https://www.opensource.org/licenses/mit-license.php . + +from test_framework.test_framework import BitcoinTestFramework +from test_framework.util import ( + assert_equal, + start_nodes, + nuparams, + nustr, + OVERWINTER_BRANCH_ID, + SAPLING_BRANCH_ID, + BLOSSOM_BRANCH_ID, + HEARTWOOD_BRANCH_ID, + CANOPY_BRANCH_ID, + NU5_BRANCH_ID, + NU6_BRANCH_ID, +) +from decimal import Decimal + + +class NuparamsTest(BitcoinTestFramework): + ''' + Test that unspecified network upgrades are activated automatically; + this is really more of a test of the test framework. + ''' + + def __init__(self): + super().__init__() + self.num_nodes = 1 + self.cache_behavior = 'clean' + + def setup_network(self, split=False): + args = [[] * self.num_nodes] + + self.nodes = start_nodes(self.num_nodes, self.options.tmpdir, args) + self.is_network_split = False + self.sync_all() + + def run_test(self): + node = self.nodes[0] + # No blocks have been created, only the genesis block exists (height 0) + bci = node.getblockchaininfo() + print(bci) + assert_equal(bci['blocks'], 0) + upgrades = bci['upgrades'] + + overwinter = upgrades[nustr(OVERWINTER_BRANCH_ID)] + assert_equal(overwinter['name'], 'Overwinter') + assert_equal(overwinter['activationheight'], 1) + assert_equal(overwinter['status'], 'pending') + + sapling = upgrades[nustr(SAPLING_BRANCH_ID)] + assert_equal(sapling['name'], 'Sapling') + assert_equal(sapling['activationheight'], 1) + assert_equal(sapling['status'], 'pending') + + blossom = upgrades[nustr(BLOSSOM_BRANCH_ID)] + assert_equal(blossom['name'], 'Blossom') + assert_equal(blossom['activationheight'], 1) + assert_equal(blossom['status'], 'pending') + + heartwood = upgrades[nustr(HEARTWOOD_BRANCH_ID)] + assert_equal(heartwood['name'], 'Heartwood') + assert_equal(heartwood['activationheight'], 1) + assert_equal(heartwood['status'], 'pending') + + canopy = upgrades[nustr(CANOPY_BRANCH_ID)] + assert_equal(canopy['name'], 'Canopy') + assert_equal(canopy['activationheight'], 1) + assert_equal(canopy['status'], 'pending') + + nu5 = upgrades[nustr(NU5_BRANCH_ID)] + assert_equal(nu5['name'], 'NU5') + assert_equal(nu5['activationheight'], 290) + assert_equal(nu5['status'], 'pending') + + nu6 = upgrades[nustr(NU6_BRANCH_ID)] + assert_equal(nu6['name'], 'NU6') + assert_equal(nu6['activationheight'], 291) + assert_equal(nu6['status'], 'pending') + + # Zebra can't call `getblocksubsidy` before the first halving. + + # Zebra regtest mode hardcodes Canopy, Heartwood, Blossom, Sapling and Overwinter + # to activate at height 1. + node.generate(1) + + bci = node.getblockchaininfo() + assert_equal(bci['blocks'], 1) + upgrades = bci['upgrades'] + + overwinter = upgrades[nustr(OVERWINTER_BRANCH_ID)] + assert_equal(overwinter['name'], 'Overwinter') + assert_equal(overwinter['activationheight'], 1) + assert_equal(overwinter['status'], 'active') + + sapling = upgrades[nustr(SAPLING_BRANCH_ID)] + assert_equal(sapling['name'], 'Sapling') + assert_equal(sapling['activationheight'], 1) + assert_equal(sapling['status'], 'active') + + blossom = upgrades[nustr(BLOSSOM_BRANCH_ID)] + assert_equal(blossom['name'], 'Blossom') + assert_equal(blossom['activationheight'], 1) + assert_equal(blossom['status'], 'active') + + heartwood = upgrades[nustr(HEARTWOOD_BRANCH_ID)] + assert_equal(heartwood['name'], 'Heartwood') + assert_equal(heartwood['activationheight'], 1) + assert_equal(heartwood['status'], 'active') + + canopy = upgrades[nustr(CANOPY_BRANCH_ID)] + assert_equal(canopy['name'], 'Canopy') + assert_equal(canopy['activationheight'], 1) + assert_equal(canopy['status'], 'active') + + nu5 = upgrades[nustr(NU5_BRANCH_ID)] + assert_equal(nu5['name'], 'NU5') + assert_equal(nu5['activationheight'], 290) + assert_equal(nu5['status'], 'pending') + + nu6 = upgrades[nustr(NU6_BRANCH_ID)] + assert_equal(nu6['name'], 'NU6') + assert_equal(nu6['activationheight'], 291) + assert_equal(nu6['status'], 'pending') + + # Zebra can't call `getblocksubsidy` before the first halving. + + # Activate First Halving + node.generate(287) + bci = node.getblockchaininfo() + assert_equal(bci['blocks'], 288) + upgrades = bci['upgrades'] + + overwinter = upgrades[nustr(OVERWINTER_BRANCH_ID)] + assert_equal(overwinter['name'], 'Overwinter') + assert_equal(overwinter['activationheight'], 1) + assert_equal(overwinter['status'], 'active') + + sapling = upgrades[nustr(SAPLING_BRANCH_ID)] + assert_equal(sapling['name'], 'Sapling') + assert_equal(sapling['activationheight'], 1) + assert_equal(sapling['status'], 'active') + + blossom = upgrades[nustr(BLOSSOM_BRANCH_ID)] + assert_equal(blossom['name'], 'Blossom') + assert_equal(blossom['activationheight'], 1) + assert_equal(blossom['status'], 'active') + + heartwood = upgrades[nustr(HEARTWOOD_BRANCH_ID)] + assert_equal(heartwood['name'], 'Heartwood') + assert_equal(heartwood['activationheight'], 1) + assert_equal(heartwood['status'], 'active') + + canopy = upgrades[nustr(CANOPY_BRANCH_ID)] + assert_equal(canopy['name'], 'Canopy') + assert_equal(canopy['activationheight'], 1) + assert_equal(canopy['status'], 'active') + + nu5 = upgrades[nustr(NU5_BRANCH_ID)] + assert_equal(nu5['name'], 'NU5') + assert_equal(nu5['activationheight'], 290) + assert_equal(nu5['status'], 'pending') + + nu6 = upgrades[nustr(NU6_BRANCH_ID)] + assert_equal(nu6['name'], 'NU6') + assert_equal(nu6['activationheight'], 291) + assert_equal(nu6['status'], 'pending') + + # The founders' reward ends at Canopy and there are no funding streams + # configured by default for regtest. + assert_equal(node.getblocksubsidy()["miner"], Decimal("3.125")) + + # Activate NU5 + node.generate(2) + bci = node.getblockchaininfo() + assert_equal(bci['blocks'], 290) + upgrades = bci['upgrades'] + + overwinter = upgrades[nustr(OVERWINTER_BRANCH_ID)] + assert_equal(overwinter['name'], 'Overwinter') + assert_equal(overwinter['activationheight'], 1) + assert_equal(overwinter['status'], 'active') + + sapling = upgrades[nustr(SAPLING_BRANCH_ID)] + assert_equal(sapling['name'], 'Sapling') + assert_equal(sapling['activationheight'], 1) + assert_equal(sapling['status'], 'active') + + blossom = upgrades[nustr(BLOSSOM_BRANCH_ID)] + assert_equal(blossom['name'], 'Blossom') + assert_equal(blossom['activationheight'], 1) + assert_equal(blossom['status'], 'active') + + heartwood = upgrades[nustr(HEARTWOOD_BRANCH_ID)] + assert_equal(heartwood['name'], 'Heartwood') + assert_equal(heartwood['activationheight'], 1) + assert_equal(heartwood['status'], 'active') + + canopy = upgrades[nustr(CANOPY_BRANCH_ID)] + assert_equal(canopy['name'], 'Canopy') + assert_equal(canopy['activationheight'], 1) + assert_equal(canopy['status'], 'active') + + nu5 = upgrades[nustr(NU5_BRANCH_ID)] + assert_equal(nu5['name'], 'NU5') + assert_equal(nu5['activationheight'], 290) + assert_equal(nu5['status'], 'active') + + nu6 = upgrades[nustr(NU6_BRANCH_ID)] + assert_equal(nu6['name'], 'NU6') + assert_equal(nu6['activationheight'], 291) + assert_equal(nu6['status'], 'pending') + + # Block subsidy remains the same after NU5 + assert_equal(node.getblocksubsidy()["miner"], Decimal("3.125")) + + # Activate NU6 + node.generate(1) + bci = node.getblockchaininfo() + assert_equal(bci['blocks'], 291) + upgrades = bci['upgrades'] + + overwinter = upgrades[nustr(OVERWINTER_BRANCH_ID)] + assert_equal(overwinter['name'], 'Overwinter') + assert_equal(overwinter['activationheight'], 1) + assert_equal(overwinter['status'], 'active') + + sapling = upgrades[nustr(SAPLING_BRANCH_ID)] + assert_equal(sapling['name'], 'Sapling') + assert_equal(sapling['activationheight'], 1) + assert_equal(sapling['status'], 'active') + + blossom = upgrades[nustr(BLOSSOM_BRANCH_ID)] + assert_equal(blossom['name'], 'Blossom') + assert_equal(blossom['activationheight'], 1) + assert_equal(blossom['status'], 'active') + + heartwood = upgrades[nustr(HEARTWOOD_BRANCH_ID)] + assert_equal(heartwood['name'], 'Heartwood') + assert_equal(heartwood['activationheight'], 1) + assert_equal(heartwood['status'], 'active') + + canopy = upgrades[nustr(CANOPY_BRANCH_ID)] + assert_equal(canopy['name'], 'Canopy') + assert_equal(canopy['activationheight'], 1) + assert_equal(canopy['status'], 'active') + + nu5 = upgrades[nustr(NU5_BRANCH_ID)] + assert_equal(nu5['name'], 'NU5') + assert_equal(nu5['activationheight'], 290) + assert_equal(nu5['status'], 'active') + + nu6 = upgrades[nustr(NU6_BRANCH_ID)] + assert_equal(nu6['name'], 'NU6') + assert_equal(nu6['activationheight'], 291) + assert_equal(nu6['status'], 'active') + + # Block subsidy remains the same after NU6 as there are not funding streams + # nor lockbox configured by default for regtest. + assert_equal(node.getblocksubsidy()["miner"], Decimal("3.125")) + +if __name__ == '__main__': + NuparamsTest().main() \ No newline at end of file diff --git a/zebra-rpc/src/methods/tests/snapshots/get_blockchain_info@testnet_10.snap b/zebra-rpc/src/methods/tests/snapshots/get_blockchain_info@testnet_10.snap index 0460bb7420f..3bea6c01509 100644 --- a/zebra-rpc/src/methods/tests/snapshots/get_blockchain_info@testnet_10.snap +++ b/zebra-rpc/src/methods/tests/snapshots/get_blockchain_info@testnet_10.snap @@ -66,7 +66,7 @@ expression: info "status": "pending" }, "c8e71055": { - "name": "Nu6", + "name": "NU6", "activationheight": 2976000, "status": "pending" } diff --git a/zebra-rpc/src/methods/tests/snapshots/get_blockchain_info_future_nu6_height@nu6testnet_10.snap b/zebra-rpc/src/methods/tests/snapshots/get_blockchain_info_future_nu6_height@nu6testnet_10.snap index 78e70ab5e26..0f4f6fe26a6 100644 --- a/zebra-rpc/src/methods/tests/snapshots/get_blockchain_info_future_nu6_height@nu6testnet_10.snap +++ b/zebra-rpc/src/methods/tests/snapshots/get_blockchain_info_future_nu6_height@nu6testnet_10.snap @@ -66,7 +66,7 @@ expression: info "status": "pending" }, "c8e71055": { - "name": "Nu6", + "name": "NU6", "activationheight": 2976000, "status": "pending" } diff --git a/zebra-scan/Cargo.toml b/zebra-scan/Cargo.toml index 6a5bd10e203..c81c749632f 100644 --- a/zebra-scan/Cargo.toml +++ b/zebra-scan/Cargo.toml @@ -71,11 +71,10 @@ tracing = "0.1.39" futures = "0.3.30" # ECC dependencies. -# TODO: we can't use the workspace version for all ECC dependencies in this crate yet (#8809) -zcash_client_backend = { git = "https://github.com/zcash/librustzcash/", commit = "40ca428c6081c61d5a2bf3f2053eb9e18219ca95" } +zcash_client_backend.workspace = true zcash_keys = { workspace = true, features = ["sapling"] } -zcash_primitives = { git = "https://github.com/zcash/librustzcash/", commit = "40ca428c6081c61d5a2bf3f2053eb9e18219ca95" } -zcash_address = { git = "https://github.com/zcash/librustzcash/", commit = "40ca428c6081c61d5a2bf3f2053eb9e18219ca95" } +zcash_primitives.workspace = true +zcash_address.workspace = true sapling-crypto.workspace = true zebra-chain = { path = "../zebra-chain", version = "1.0.0-beta.39", features = ["shielded-scan"] }