change(nu5): use new V5 transaction script verification API (#3799)

* update librustzcash; adapt to new API

* add ticket reference for removing zcash_proofs duplicated dependencies

* update to new zcash_script V5 API

* use zp_tx shorthand

* update to Zcash 4.7.0 dependencies

* update protocol versions

* feat(rpc): Implement `getblockchaininfo` RPC method (#3891)

* Implement `getblockchaininfo` RPC method

* add a test for `get_blockchain_info`

* fix tohex/fromhex

* move comment

* Update lightwalletd acceptance test for getblockchaininfo RPC (#3914)

* change(rpc): Return getblockchaininfo network upgrades in height order (#3915)

* Update lightwalletd acceptance test for getblockchaininfo RPC

* Update some doc comments for network upgrades

* List network upgrades in order in the getblockchaininfo RPC

Also:
- Use a constant for the "missing consensus branch ID" RPC value
- Simplify fetching consensus branch IDs
- Make RPC type derives consistent
- Update RPC type documentation

* Make RPC type derives consistent

* Fix a confusing test comment

* get hashand height at the same time

* fix estimated_height

* fix lint

* add extra check

Co-authored-by: Janito Vaqueiro Ferreira Filho <janito.vff@gmail.com>

* fix typo

Co-authored-by: Janito Vaqueiro Ferreira Filho <janito.vff@gmail.com>

* split test

Co-authored-by: Janito Vaqueiro Ferreira Filho <janito.vff@gmail.com>

* fix(rpc): ignore an expected error in the RPC acceptance tests (#3961)

* Add ignored regexes to test command failure regex methods

* Ignore empty chain error in getblockchaininfo

We expect this error when zebrad starts up with an empty state.

Co-authored-by: teor <teor@riseup.net>
Co-authored-by: Janito Vaqueiro Ferreira Filho <janito.vff@gmail.com>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>

* Make sync error logs more user-friendly (#3944)

- use info level, there is nothing the user needs to do,
  particularly for a single error
- explain that the errors are temporary
- hide backtraces, because they look like crashes

* Update test.patch.yml with lightwalletd job (#3970)

* Update test.patch.yml with lightwalletd job

* Remove a workflow condition that will always be false

In general, patch workflows need the
opposite conditions to the original workflow.

But in this case, we know the result of the
condition will always be true, so we can just delete it.

Co-authored-by: teor <teor@riseup.net>

* fix(doc): Fix bugs in the lightwalletd database design (#3964)

* Re-order column families in design in dependency order

* Minor RFC design tweaks and fixes

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>

* Repoint zebra image links to our new zfnd.org site for now (#3949)

* Repoint zebra image links to our new zfnd.org site for now

* Remove images/

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>

* Fix typos (#3956)

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>

* Apply suggestions from code review

Co-authored-by: teor <teor@riseup.net>

* bump database version to trigger testnet rollback

* reduce minimum protocol version for now (will be changed later)

* update dependencies

* Apply suggestions from code review

Co-authored-by: teor <teor@riseup.net>

* update versions to match zcash 4.7.0

* deny.toml: update 'darling'

Co-authored-by: Alfredo Garcia <oxarbitrage@gmail.com>
Co-authored-by: teor <teor@riseup.net>
Co-authored-by: Janito Vaqueiro Ferreira Filho <janito.vff@gmail.com>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Co-authored-by: Deirdre Connolly <durumcrustulum@gmail.com>
Co-authored-by: Dimitris Apostolou <dimitris.apostolou@icloud.com>
This commit is contained in:
Conrado Gouvea 2022-04-18 21:14:16 -03:00 committed by GitHub
parent 90a8401308
commit d79e71e969
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
42 changed files with 1740 additions and 1481 deletions

307
Cargo.lock generated
View File

@ -333,7 +333,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0944d18a9a37691b87733b39c9360c9950af9aa5f97e2455bc108d8eb64fc1c1"
dependencies = [
"bitvec",
"blake2s_simd",
"blake2s_simd 0.5.11",
"byteorder",
"crossbeam-channel",
"ff",
@ -469,6 +469,17 @@ dependencies = [
"constant_time_eq",
]
[[package]]
name = "blake2s_simd"
version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "db539cc2b5f6003621f1cd9ef92d7ded8ea5232c7de0f9faa2de251cd98730d4"
dependencies = [
"arrayref",
"arrayvec 0.7.2",
"constant_time_eq",
]
[[package]]
name = "blanket"
version = "0.2.0"
@ -490,6 +501,15 @@ dependencies = [
"generic-array",
]
[[package]]
name = "block-buffer"
version = "0.10.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0bf7fe51849ea569fd452f37822f606a5cabb684dc918707a0193fd4664ff324"
dependencies = [
"generic-array",
]
[[package]]
name = "block-modes"
version = "0.8.1"
@ -548,9 +568,9 @@ dependencies = [
[[package]]
name = "bumpalo"
version = "3.9.1"
version = "3.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a4a45a46ab1f2412e53d3a0ade76ffad2025804294569aae387231a0cd6e0899"
checksum = "8f1e260c3a9040a7c19a12468758f4c16f31a81a1fe087482be9570ec864bb6c"
[[package]]
name = "bytemuck"
@ -962,6 +982,16 @@ dependencies = [
"subtle",
]
[[package]]
name = "crypto-common"
version = "0.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "57952ca27b5e3606ff4dd79b0020231aaf9d6aa76dc05fd30137538c50bd3ce8"
dependencies = [
"generic-array",
"typenum",
]
[[package]]
name = "crypto-mac"
version = "0.11.1"
@ -1010,7 +1040,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "90f9d052967f590a76e62eb387bd0bbb1b000182c3cefe5364db6b7211651bc0"
dependencies = [
"byteorder",
"digest",
"digest 0.9.0",
"rand_core 0.5.1",
"serde",
"subtle",
@ -1205,6 +1235,16 @@ dependencies = [
"generic-array",
]
[[package]]
name = "digest"
version = "0.10.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f2fb860ca6fafa5552fb6d0e816a69c8e49f0908bf524e30a90d97c85892d506"
dependencies = [
"block-buffer 0.10.2",
"crypto-common",
]
[[package]]
name = "directories"
version = "4.0.1"
@ -1378,9 +1418,18 @@ dependencies = [
[[package]]
name = "equihash"
version = "0.1.0"
source = "git+https://github.com/ZcashFoundation/librustzcash.git?tag=0.5.1-zebra-v1.0.0-beta.4#80d5b049b8e8127671026320a1c22841035345a4"
source = "git+https://github.com/ZcashFoundation/librustzcash.git?rev=c3ff94134b472ba90af665e5454983dc12de1338#c3ff94134b472ba90af665e5454983dc12de1338"
dependencies = [
"blake2b_simd 0.5.11",
"blake2b_simd 1.0.0",
"byteorder",
]
[[package]]
name = "equihash"
version = "0.1.0"
source = "git+https://github.com/zcash/librustzcash.git?rev=d14e7a707ce01cefcbc82651dad48f002185dded#d14e7a707ce01cefcbc82651dad48f002185dded"
dependencies = [
"blake2b_simd 1.0.0",
"byteorder",
]
@ -1739,16 +1788,35 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "eabb4a44450da02c90444cf74558da904edde8fb4e9035a9a6a4e15445af0bd7"
[[package]]
name = "halo2"
version = "0.1.0-beta.1"
name = "halo2_gadgets"
version = "0.1.0-beta.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0f186b85ed81082fb1cf59d52b0111f02915e89a4ac61d292b38d075e570f3a9"
checksum = "7524b798b8b3689a198cd87ee1d22fe3ca007a51d35c4093f32d75c0efc30abe"
dependencies = [
"blake2b_simd 0.5.11",
"arrayvec 0.7.2",
"bitvec",
"ff",
"group",
"halo2_proofs",
"lazy_static",
"pasta_curves",
"rand 0.8.5",
"subtle",
"uint",
]
[[package]]
name = "halo2_proofs"
version = "0.1.0-beta.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e0240b05b791cccfd6451b010b19711280e63b87f495bd84df0103f35c9139e7"
dependencies = [
"blake2b_simd 1.0.0",
"bumpalo",
"ff",
"group",
"pasta_curves",
"rand 0.8.5",
"rand_core 0.6.3",
"rayon",
]
@ -1784,6 +1852,17 @@ dependencies = [
"num-traits",
]
[[package]]
name = "hdwallet"
version = "0.3.0"
source = "git+https://github.com/nuttycom/hdwallet?rev=9b4c1bdbe0517e3a7a8f285d6048a37d472ba3bc#9b4c1bdbe0517e3a7a8f285d6048a37d472ba3bc"
dependencies = [
"lazy_static",
"rand_core 0.6.3",
"ring",
"secp256k1",
]
[[package]]
name = "heck"
version = "0.3.3"
@ -1817,7 +1896,7 @@ version = "0.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "01706d578d5c281058480e673ae4086a9f4710d8df1ad80a5b03e39ece5f886b"
dependencies = [
"digest",
"digest 0.9.0",
"hmac",
]
@ -1828,7 +1907,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2a2a2320eb7ec0ebe8da8f744d7812d9fc4cb4d09344ac01898dbcb6a20ae69b"
dependencies = [
"crypto-mac",
"digest",
"digest 0.9.0",
]
[[package]]
@ -1948,17 +2027,9 @@ dependencies = [
[[package]]
name = "incrementalmerkletree"
version = "0.1.0"
source = "git+https://github.com/zcash/incrementalmerkletree.git?rev=b7bd6246122a6e9ace8edb51553fbf5228906cbb#b7bd6246122a6e9ace8edb51553fbf5228906cbb"
dependencies = [
"serde",
]
[[package]]
name = "incrementalmerkletree"
version = "0.2.0"
version = "0.3.0-beta.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "186fd3ab92aeac865d4b80b410de9a7b341d31ba8281373caed0b6d17b2b5e96"
checksum = "5812f2cfa06a7694b842402e9a100529d80fdc3022ead65ad98ce0af0bcd3311"
dependencies = [
"serde",
]
@ -2694,19 +2765,20 @@ dependencies = [
[[package]]
name = "orchard"
version = "0.0.0"
source = "git+https://github.com/ZcashFoundation/orchard.git?rev=568e24cd5f129158375d7ac7d98c89ebff4f982f#568e24cd5f129158375d7ac7d98c89ebff4f982f"
version = "0.1.0-beta.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c3bb8c5f5a0977683b5071650f1e7d91f296e344a796fda585086d5b4b0a74ea"
dependencies = [
"aes",
"arrayvec 0.7.2",
"bigint",
"bitvec",
"blake2b_simd 0.5.11",
"blake2b_simd 1.0.0",
"ff",
"fpe",
"group",
"halo2",
"incrementalmerkletree 0.1.0",
"halo2_gadgets",
"halo2_proofs",
"hex",
"incrementalmerkletree",
"lazy_static",
"memuse",
"nonempty",
@ -2715,7 +2787,7 @@ dependencies = [
"reddsa",
"serde",
"subtle",
"zcash_note_encryption",
"zcash_note_encryption 0.1.0 (git+https://github.com/zcash/librustzcash.git?rev=d14e7a707ce01cefcbc82651dad48f002185dded)",
]
[[package]]
@ -2828,11 +2900,11 @@ dependencies = [
[[package]]
name = "pasta_curves"
version = "0.2.1"
version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d647d91972bad78120fd61e06b225fcda117805c9bbf17676b51bd03a251278b"
checksum = "82b6fc4f73033f6aa52fdde0c38f1f570e7f2c244f22e441f62a144556891b8c"
dependencies = [
"blake2b_simd 0.5.11",
"blake2b_simd 1.0.0",
"ff",
"group",
"lazy_static",
@ -3358,12 +3430,12 @@ dependencies = [
[[package]]
name = "reddsa"
version = "0.0.0"
source = "git+https://github.com/str4d/redjubjub.git?rev=416a6a8ebf8bd42c114c938883016c04f338de72#416a6a8ebf8bd42c114c938883016c04f338de72"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5a2efaed2ccc184ca4f82ed083ec0afe700c6254acae3d7732fc50ef79d5cbe9"
dependencies = [
"blake2b_simd 0.5.11",
"blake2b_simd 1.0.0",
"byteorder",
"digest",
"group",
"jubjub",
"pasta_curves",
@ -3380,7 +3452,7 @@ source = "git+https://github.com/ZcashFoundation/redjubjub.git?rev=a32ae3fc871bc
dependencies = [
"blake2b_simd 0.5.11",
"byteorder",
"digest",
"digest 0.9.0",
"jubjub",
"rand_core 0.6.3",
"serde",
@ -3517,14 +3589,12 @@ dependencies = [
]
[[package]]
name = "ripemd160"
version = "0.9.1"
name = "ripemd"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2eca4ecc81b7f313189bf73ce724400a07da2a6dac19588b03c8bd76a2dcc251"
checksum = "1facec54cb5e0dc08553501fa740091086d0259ad0067e0d4103448e4cb22ed3"
dependencies = [
"block-buffer",
"digest",
"opaque-debug",
"digest 0.10.3",
]
[[package]]
@ -3564,7 +3634,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e05c2603e2823634ab331437001b411b9ed11660fbc4066f3908c84a9439260d"
dependencies = [
"byteorder",
"digest",
"digest 0.9.0",
"lazy_static",
"num-bigint-dig",
"num-integer",
@ -3963,10 +4033,10 @@ version = "0.9.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "99cd6713db3cf16b6c84e06321e049a9b9f699826e16096d23bbcc44d15d51a6"
dependencies = [
"block-buffer",
"block-buffer 0.9.0",
"cfg-if 1.0.0",
"cpufeatures",
"digest",
"digest 0.9.0",
"opaque-debug",
]
@ -3976,10 +4046,10 @@ version = "0.9.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4d58a1e1bf39749807d89cf2d98ac2dfa0ff1cb3faa38fbb64dd88ac8013d800"
dependencies = [
"block-buffer",
"block-buffer 0.9.0",
"cfg-if 1.0.0",
"cpufeatures",
"digest",
"digest 0.9.0",
"opaque-debug",
]
@ -3989,8 +4059,8 @@ version = "0.9.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f81199417d4e5de3f04b1e871023acea7389672c4135918f05aa9cbf2f2fa809"
dependencies = [
"block-buffer",
"digest",
"block-buffer 0.9.0",
"digest 0.9.0",
"keccak",
"opaque-debug",
]
@ -4531,7 +4601,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8e4157b94753f8a92d05c549b0d9fc3a3b504ca5fc420f867d3f4f7c45e93f2b"
dependencies = [
"caret",
"digest",
"digest 0.9.0",
"signature",
"tor-bytes",
"tor-checkable",
@ -4616,7 +4686,7 @@ version = "0.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cc7e43aaa30b9bf401f8a617fcbbbefb1632145c79277bf93836ccc50615cdca"
dependencies = [
"digest",
"digest 0.9.0",
"hex",
"thiserror",
"tor-llcrypto",
@ -4654,7 +4724,7 @@ dependencies = [
"async-trait",
"base64",
"derive_builder",
"digest",
"digest 0.9.0",
"fslock",
"futures",
"hex",
@ -4728,7 +4798,7 @@ dependencies = [
"arrayref",
"base64",
"curve25519-dalek",
"digest",
"digest 0.9.0",
"ed25519-dalek",
"getrandom 0.2.5",
"hex",
@ -4777,7 +4847,7 @@ checksum = "93d86c132e5f474e2793ab81769094b030c7363a142b91468ebe1307c8a170ce"
dependencies = [
"base64",
"bitflags",
"digest",
"digest 0.9.0",
"hex",
"once_cell",
"phf",
@ -4818,7 +4888,7 @@ dependencies = [
"cipher",
"coarsetime",
"crypto-mac",
"digest",
"digest 0.9.0",
"futures",
"generic-array",
"hkdf",
@ -5123,9 +5193,9 @@ checksum = "dcf81ac59edc17cc8697ff311e8f5ef2d99fcbd9817b34cec66f90b6c3dfd987"
[[package]]
name = "uint"
version = "0.9.3"
version = "0.9.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "12f03af7ccf01dd611cc450a0d10dbc9b745770d096473e2faf0ca6e2d66d1e0"
checksum = "6470ab50f482bde894a037a57064480a246dbfdd5960bd65a44824693f08da5f"
dependencies = [
"byteorder",
"crunchy 0.2.2",
@ -5554,7 +5624,16 @@ dependencies = [
[[package]]
name = "zcash_encoding"
version = "0.0.0"
source = "git+https://github.com/ZcashFoundation/librustzcash.git?tag=0.5.1-zebra-v1.0.0-beta.4#80d5b049b8e8127671026320a1c22841035345a4"
source = "git+https://github.com/ZcashFoundation/librustzcash.git?rev=c3ff94134b472ba90af665e5454983dc12de1338#c3ff94134b472ba90af665e5454983dc12de1338"
dependencies = [
"byteorder",
"nonempty",
]
[[package]]
name = "zcash_encoding"
version = "0.0.0"
source = "git+https://github.com/zcash/librustzcash.git?rev=d14e7a707ce01cefcbc82651dad48f002185dded#d14e7a707ce01cefcbc82651dad48f002185dded"
dependencies = [
"byteorder",
"nonempty",
@ -5572,15 +5651,22 @@ dependencies = [
[[package]]
name = "zcash_note_encryption"
version = "0.0.0"
source = "git+https://github.com/ZcashFoundation/librustzcash.git?tag=0.5.1-zebra-v1.0.0-beta.4#80d5b049b8e8127671026320a1c22841035345a4"
version = "0.1.0"
source = "git+https://github.com/ZcashFoundation/librustzcash.git?rev=c3ff94134b472ba90af665e5454983dc12de1338#c3ff94134b472ba90af665e5454983dc12de1338"
dependencies = [
"chacha20",
"chacha20poly1305",
"rand_core 0.6.3",
"subtle",
]
[[package]]
name = "zcash_note_encryption"
version = "0.1.0"
source = "git+https://github.com/zcash/librustzcash.git?rev=d14e7a707ce01cefcbc82651dad48f002185dded#d14e7a707ce01cefcbc82651dad48f002185dded"
dependencies = [
"blake2b_simd 0.5.11",
"byteorder",
"chacha20",
"chacha20poly1305",
"ff",
"group",
"rand_core 0.6.3",
"subtle",
]
@ -5588,44 +5674,78 @@ dependencies = [
[[package]]
name = "zcash_primitives"
version = "0.5.0"
source = "git+https://github.com/ZcashFoundation/librustzcash.git?tag=0.5.1-zebra-v1.0.0-beta.4#80d5b049b8e8127671026320a1c22841035345a4"
source = "git+https://github.com/ZcashFoundation/librustzcash.git?rev=c3ff94134b472ba90af665e5454983dc12de1338#c3ff94134b472ba90af665e5454983dc12de1338"
dependencies = [
"aes",
"bip0039",
"bitvec",
"blake2b_simd 0.5.11",
"blake2s_simd",
"blake2b_simd 1.0.0",
"blake2s_simd 1.0.0",
"bls12_381",
"byteorder",
"chacha20poly1305",
"equihash",
"equihash 0.1.0 (git+https://github.com/ZcashFoundation/librustzcash.git?rev=c3ff94134b472ba90af665e5454983dc12de1338)",
"ff",
"fpe",
"group",
"hex",
"incrementalmerkletree 0.1.0",
"incrementalmerkletree",
"jubjub",
"lazy_static",
"log",
"memuse",
"nonempty",
"orchard",
"pasta_curves",
"rand 0.8.5",
"rand_core 0.6.3",
"sha2",
"subtle",
"zcash_encoding",
"zcash_note_encryption",
"zcash_encoding 0.0.0 (git+https://github.com/ZcashFoundation/librustzcash.git?rev=c3ff94134b472ba90af665e5454983dc12de1338)",
"zcash_note_encryption 0.1.0 (git+https://github.com/ZcashFoundation/librustzcash.git?rev=c3ff94134b472ba90af665e5454983dc12de1338)",
]
[[package]]
name = "zcash_primitives"
version = "0.5.0"
source = "git+https://github.com/zcash/librustzcash.git?rev=d14e7a707ce01cefcbc82651dad48f002185dded#d14e7a707ce01cefcbc82651dad48f002185dded"
dependencies = [
"aes",
"bip0039",
"bitvec",
"blake2b_simd 1.0.0",
"blake2s_simd 1.0.0",
"bls12_381",
"bs58",
"byteorder",
"chacha20poly1305",
"equihash 0.1.0 (git+https://github.com/zcash/librustzcash.git?rev=d14e7a707ce01cefcbc82651dad48f002185dded)",
"ff",
"fpe",
"group",
"hdwallet",
"hex",
"incrementalmerkletree",
"jubjub",
"lazy_static",
"memuse",
"nonempty",
"orchard",
"rand 0.8.5",
"rand_core 0.6.3",
"ripemd",
"secp256k1",
"sha2",
"subtle",
"zcash_encoding 0.0.0 (git+https://github.com/zcash/librustzcash.git?rev=d14e7a707ce01cefcbc82651dad48f002185dded)",
"zcash_note_encryption 0.1.0 (git+https://github.com/zcash/librustzcash.git?rev=d14e7a707ce01cefcbc82651dad48f002185dded)",
]
[[package]]
name = "zcash_proofs"
version = "0.5.0"
source = "git+https://github.com/ZcashFoundation/librustzcash.git?tag=0.5.1-zebra-v1.0.0-beta.4#80d5b049b8e8127671026320a1c22841035345a4"
source = "git+https://github.com/ZcashFoundation/librustzcash.git?rev=c3ff94134b472ba90af665e5454983dc12de1338#c3ff94134b472ba90af665e5454983dc12de1338"
dependencies = [
"bellman",
"blake2b_simd 0.5.11",
"blake2b_simd 1.0.0",
"bls12_381",
"byteorder",
"directories",
@ -5635,26 +5755,25 @@ dependencies = [
"lazy_static",
"minreq",
"rand_core 0.6.3",
"zcash_primitives",
"zcash_primitives 0.5.0 (git+https://github.com/ZcashFoundation/librustzcash.git?rev=c3ff94134b472ba90af665e5454983dc12de1338)",
]
[[package]]
name = "zcash_script"
version = "0.1.6-alpha.0"
source = "git+https://github.com/ZcashFoundation/zcash_script.git?rev=270d32d192c5880f911acf21ef100caa128e6179#270d32d192c5880f911acf21ef100caa128e6179"
source = "git+https://github.com/ZcashFoundation/zcash_script.git?rev=98c74180ff2899898457090b95578dc4e58ce85d#98c74180ff2899898457090b95578dc4e58ce85d"
dependencies = [
"bindgen",
"blake2b_simd 0.5.11",
"blake2b_simd 1.0.0",
"cc",
"halo2",
"incrementalmerkletree 0.1.0",
"libc",
"memuse",
"orchard",
"rand_core 0.6.3",
"tracing",
"zcash_note_encryption",
"zcash_primitives",
"zcash_encoding 0.0.0 (git+https://github.com/zcash/librustzcash.git?rev=d14e7a707ce01cefcbc82651dad48f002185dded)",
"zcash_note_encryption 0.1.0 (git+https://github.com/zcash/librustzcash.git?rev=d14e7a707ce01cefcbc82651dad48f002185dded)",
"zcash_primitives 0.5.0 (git+https://github.com/zcash/librustzcash.git?rev=d14e7a707ce01cefcbc82651dad48f002185dded)",
]
[[package]]
@ -5667,7 +5786,7 @@ dependencies = [
"bitflags",
"bitvec",
"blake2b_simd 1.0.0",
"blake2s_simd",
"blake2s_simd 1.0.0",
"bls12_381",
"bs58",
"byteorder",
@ -5676,13 +5795,13 @@ dependencies = [
"criterion",
"displaydoc",
"ed25519-zebra",
"equihash",
"equihash 0.1.0 (git+https://github.com/zcash/librustzcash.git?rev=d14e7a707ce01cefcbc82651dad48f002185dded)",
"fpe",
"futures",
"group",
"halo2",
"halo2_proofs",
"hex",
"incrementalmerkletree 0.2.0",
"incrementalmerkletree",
"itertools",
"jubjub",
"lazy_static",
@ -5693,7 +5812,7 @@ dependencies = [
"rand_chacha 0.3.1",
"rand_core 0.6.3",
"redjubjub",
"ripemd160",
"ripemd",
"secp256k1",
"serde",
"serde-big-array",
@ -5708,8 +5827,8 @@ dependencies = [
"uint",
"x25519-dalek",
"zcash_history",
"zcash_note_encryption",
"zcash_primitives",
"zcash_note_encryption 0.1.0 (git+https://github.com/zcash/librustzcash.git?rev=d14e7a707ce01cefcbc82651dad48f002185dded)",
"zcash_primitives 0.5.0 (git+https://github.com/zcash/librustzcash.git?rev=d14e7a707ce01cefcbc82651dad48f002185dded)",
"zebra-test",
]
@ -5730,7 +5849,7 @@ dependencies = [
"displaydoc",
"futures",
"futures-util",
"halo2",
"halo2_proofs",
"hex",
"jubjub",
"lazy_static",
@ -5852,7 +5971,7 @@ dependencies = [
"dirs",
"displaydoc",
"futures",
"halo2",
"halo2_proofs",
"hex",
"insta",
"itertools",

View File

@ -32,7 +32,10 @@ opt-level = 3
[profile.dev.package.pasta_curves]
opt-level = 3
[profile.dev.package.halo2]
[profile.dev.package.halo2_proofs]
opt-level = 3
[profile.dev.package.halo2_gadgets]
opt-level = 3
[profile.dev.package.bls12_381]
@ -50,31 +53,17 @@ panic = "abort"
[patch.crates-io]
# TODO: replace with upstream orchard (#3056)
orchard = { git = "https://github.com/ZcashFoundation/orchard.git", rev = "568e24cd5f129158375d7ac7d98c89ebff4f982f" }
# TODO: replace with upstream librustzcash when these changes are merged (#3037)
# remove these after a new librustzcash release (#2982)
# Use the ZcashFoundation fork where possible, to avoid duplicate dependencies
equihash = { git = "https://github.com/ZcashFoundation/librustzcash.git", tag = "0.5.1-zebra-v1.0.0-beta.4" }
zcash_note_encryption = { git = "https://github.com/ZcashFoundation/librustzcash.git", tag = "0.5.1-zebra-v1.0.0-beta.4" }
zcash_primitives = { git = "https://github.com/ZcashFoundation/librustzcash.git", tag = "0.5.1-zebra-v1.0.0-beta.4" }
zcash_history = { git = "https://github.com/ZcashFoundation/librustzcash.git", tag = "0.5.1-zebra-v1.0.0-beta.4" }
# This zcash_proofs patch doesn't work, maybe because of features?
#zcash_proofs = { git = "https://github.com/ZcashFoundation/librustzcash.git", tag = "0.5.1-zebra-v1.0.0-beta.4" }
# These are librustzcash git requirements specified in its workspace Cargo.toml,
# that we must replicate here
incrementalmerkletree = { git = "https://github.com/zcash/incrementalmerkletree.git", rev = "b7bd6246122a6e9ace8edb51553fbf5228906cbb" }
# Replaced by the ZcashFoundation fork above
#orchard = { git = "https://github.com/zcash/orchard.git", rev = "2c8241f25b943aa05203eacf9905db117c69bd29" }
# These are librustzcash file requirements specified in its workspace Cargo.toml,
# that we must replace with git requirements
#
# Replaced by the ZcashFoundation fork above
#zcash_note_encryption = { git = "https://github.com/zcash/librustzcash.git", rev = "53d0a51d33a421cb76d3e3124d1e4c1c9036068e" }
equihash = { git = "https://github.com/zcash/librustzcash.git", rev = "d14e7a707ce01cefcbc82651dad48f002185dded" }
hdwallet = { git = "https://github.com/nuttycom/hdwallet", rev = "9b4c1bdbe0517e3a7a8f285d6048a37d472ba3bc" }
zcash_encoding = { git = "https://github.com/zcash/librustzcash.git", rev = "d14e7a707ce01cefcbc82651dad48f002185dded" }
zcash_note_encryption = { git = "https://github.com/zcash/librustzcash.git", rev = "d14e7a707ce01cefcbc82651dad48f002185dded" }
zcash_primitives = { git = "https://github.com/zcash/librustzcash.git", rev = "d14e7a707ce01cefcbc82651dad48f002185dded" }
# Currently pointing to `download-sprout-params-new` branch which contains the
# changes from `download-sprout-params-d14e7a70` rebased on top of d14e7a70 as
# required by `zcash/Cargo.toml`.
zcash_proofs = { git = "https://github.com/ZcashFoundation/librustzcash.git", rev = "c3ff94134b472ba90af665e5454983dc12de1338" }

View File

@ -24,7 +24,12 @@ allow = [
# Certain crates/versions that will be skipped when doing duplicate detection.
skip = [
#{ name = "ansi_term", version = "=0.11.0" },
# wait for zcash_proofs fork be merged back into upstream
# https://github.com/ZcashFoundation/zebra/issues/3831
{ name = "equihash", version = "=0.1.0" },
{ name = "zcash_encoding", version = "=0.0.0" },
{ name = "zcash_note_encryption", version = "=0.1.0" },
{ name = "zcash_primitives", version = "=0.5.0" },
]
# Similarly to `skip` allows you to skip certain crates during duplicate
# detection. Unlike skip, it also includes the entire tree of transitive
@ -37,20 +42,29 @@ skip-tree = [
# ticket #3000: tower-fallback dependencies
{ name = "pin-project", version = "=0.4.29" },
# ticket #3063: redjubjub dependencies
{ name = "redjubjub", version = "=0.4.0" },
# ticket #3315: ordered-map dependencies that should be dev-dependencies
{ name = "ordered-map", version = "=0.4.2" },
# ticket #2984: owo-colors dependencies
{ name = "color-eyre", version = "=0.5.11" },
# ticket #2980: inferno and orchard/cryptographic dependencies
{ name = "orchard", version = "=0.0.0" },
# wait for bellman to upgrade
{ name = "blake2s_simd", version = "=0.5.11" },
# upgrade orchard from deprecated `bigint` to `uint`: https://github.com/zcash/orchard/issues/219
{ name = "bigint", version = "=4.4.3" },
# wait for halo2 to upgrade
{ name = "blake2b_simd", version = "=0.5.11" },
# wait for zcash_primitives to remove duplicated dependency
{ name = "block-buffer", version = "=0.9.0" },
# wait for orchard -> bigint to upgrade
{ name = "crunchy", version = "=0.1.6" },
# wait for curve25519-dalek to upgrade
{ name = "digest", version = "=0.9.0" },
# Wait for inferno -> num-format to upgrade
{ name = "arrayvec", version = "=0.4.12" },
# upgrade sentry, metrics-exporter-prometheus, reqwest, hyper,
# which needs #2953: upgrade tracing to the latest major version
@ -60,14 +74,8 @@ skip-tree = [
{ name = "tracing-subscriber", version = "=0.1.6" },
# upgrade abscissa and arti
{ name = "darling", version = "=0.10.2" },
{ name = "darling", version = "=0.12.4" },
# recent major version bumps
# we should re-check these dependencies in February 2022
# wait for lots of crates in the cryptographic ecosystem to upgrade
{ name = "rand", version = "=0.7.3" },
{ name = "darling", version = "=0.13.4" },
]
# This section is considered when running `cargo deny check sources`.
@ -85,8 +93,7 @@ unknown-git = "deny"
allow-registry = ["https://github.com/rust-lang/crates.io-index"]
# List of URLs for allowed Git repositories
allow-git = [
# ticket #2982: librustzcash and orchard git versions
"https://github.com/str4d/redjubjub",
"https://github.com/nuttycom/hdwallet",
]
[sources.allow-org]

View File

@ -20,7 +20,7 @@ bigint = "4.4.3"
bitvec = "0.22"
bitflags = "1.3.2"
blake2b_simd = "1.0.0"
blake2s_simd = "0.5.11"
blake2s_simd = "1.0.0"
bls12_381 = "0.6.0"
bs58 = { version = "0.4.0", features = ["check"] }
byteorder = "1.4.3"
@ -29,34 +29,32 @@ displaydoc = "0.2.3"
fpe = "0.5.1"
futures = "0.3.21"
group = "0.11.0"
halo2 = "=0.1.0-beta.1"
halo2 = { package = "halo2_proofs", version = "=0.1.0-beta.4" }
hex = "0.4.3"
incrementalmerkletree = "0.2.0"
incrementalmerkletree = "0.3.0-beta.2"
itertools = "0.10.3"
jubjub = "0.8.0"
lazy_static = "1.4.0"
rand_core = "0.6.3"
ripemd160 = "0.9"
ripemd = "0.1.1"
serde = { version = "1.0.136", features = ["serde_derive", "rc"] }
serde_with = { version = "1.12.0", optional = true }
serde-big-array = "0.4.1"
# Matches version used by hdwallet
secp256k1 = { version = "0.21.3", features = ["serde"] }
sha2 = { version = "0.9.9", features=["compress"] }
static_assertions = "1.1.0"
subtle = "2.4.1"
thiserror = "1.0.30"
uint = "0.9.3"
uint = "0.9.1"
x25519-dalek = { version = "1.2.0", features = ["serde"] }
# TODO: replace with upstream orchard (#3056)
orchard = { git = "https://github.com/ZcashFoundation/orchard.git", rev = "568e24cd5f129158375d7ac7d98c89ebff4f982f" }
orchard = "=0.1.0-beta.3"
# TODO: replace with upstream librustzcash when these changes are merged (#3037)
equihash = { git = "https://github.com/ZcashFoundation/librustzcash.git", tag = "0.5.1-zebra-v1.0.0-beta.4" }
zcash_note_encryption = { git = "https://github.com/ZcashFoundation/librustzcash.git", tag = "0.5.1-zebra-v1.0.0-beta.4" }
zcash_primitives = { git = "https://github.com/ZcashFoundation/librustzcash.git", tag = "0.5.1-zebra-v1.0.0-beta.4" }
equihash = "0.1.0"
zcash_note_encryption = "0.1"
zcash_primitives = { version = "0.5", features = ["transparent-inputs"] }
zcash_history = { git = "https://github.com/ZcashFoundation/librustzcash.git", tag = "0.5.1-zebra-v1.0.0-beta.4" }
proptest = { version = "0.10.1", optional = true }

View File

@ -1,4 +1,4 @@
use group::prime::PrimeCurveAffine;
use group::{ff::PrimeField, prime::PrimeCurveAffine};
use halo2::{arithmetic::FieldExt, pasta::pallas};
use proptest::{arbitrary::any, array, collection::vec, prelude::*};
@ -46,7 +46,7 @@ impl Arbitrary for note::Nullifier {
(vec(any::<u8>(), 64))
.prop_map(|bytes| {
let bytes = bytes.try_into().expect("vec is the correct length");
Self::try_from(pallas::Scalar::from_bytes_wide(&bytes).to_bytes())
Self::try_from(pallas::Scalar::from_bytes_wide(&bytes).to_repr())
.expect("a valid generated nullifier")
})
.boxed()
@ -120,7 +120,7 @@ impl Arbitrary for tree::Root {
(vec(any::<u8>(), 64))
.prop_map(|bytes| {
let bytes = bytes.try_into().expect("vec is the correct length");
Self::try_from(pallas::Base::from_bytes_wide(&bytes).to_bytes())
Self::try_from(pallas::Base::from_bytes_wide(&bytes).to_repr())
.expect("a valid generated Orchard note commitment tree root")
})
.boxed()

View File

@ -3,7 +3,7 @@
use std::{convert::TryFrom, fmt, io};
use bitvec::prelude::*;
use group::{prime::PrimeCurveAffine, GroupEncoding};
use group::{ff::PrimeField, prime::PrimeCurveAffine, GroupEncoding};
use halo2::{
arithmetic::{Coordinates, CurveAffine, FieldExt},
pasta::pallas,
@ -65,12 +65,12 @@ impl fmt::Debug for NoteCommitment {
match option {
Some(coordinates) => d
.field("x", &hex::encode(coordinates.x().to_bytes()))
.field("y", &hex::encode(coordinates.y().to_bytes()))
.field("x", &hex::encode(coordinates.x().to_repr()))
.field("y", &hex::encode(coordinates.y().to_repr()))
.finish(),
None => d
.field("x", &hex::encode(pallas::Base::zero().to_bytes()))
.field("y", &hex::encode(pallas::Base::zero().to_bytes()))
.field("x", &hex::encode(pallas::Base::zero().to_repr()))
.field("y", &hex::encode(pallas::Base::zero().to_repr()))
.finish(),
}
}
@ -192,12 +192,12 @@ impl fmt::Debug for ValueCommitment {
match option {
Some(coordinates) => d
.field("x", &hex::encode(coordinates.x().to_bytes()))
.field("y", &hex::encode(coordinates.y().to_bytes()))
.field("x", &hex::encode(coordinates.x().to_repr()))
.field("y", &hex::encode(coordinates.y().to_repr()))
.finish(),
None => d
.field("x", &hex::encode(pallas::Base::zero().to_bytes()))
.field("y", &hex::encode(pallas::Base::zero().to_bytes()))
.field("x", &hex::encode(pallas::Base::zero().to_repr()))
.field("y", &hex::encode(pallas::Base::zero().to_repr()))
.finish(),
}
}

View File

@ -16,7 +16,7 @@ use aes::Aes256;
use bech32::{self, ToBase32, Variant};
use bitvec::prelude::*;
use fpe::ff1::{BinaryNumeralString, FF1};
use group::{prime::PrimeCurveAffine, Group, GroupEncoding};
use group::{ff::PrimeField, prime::PrimeCurveAffine, Group, GroupEncoding};
use halo2::{
arithmetic::{Coordinates, CurveAffine, FieldExt},
pasta::pallas,
@ -231,7 +231,7 @@ impl ConstantTimeEq for SpendAuthorizingKey {
/// Check whether two `SpendAuthorizingKey`s are equal, runtime independent
/// of the value of the secret.
fn ct_eq(&self, other: &Self) -> Choice {
self.0.to_bytes().ct_eq(&other.0.to_bytes())
self.0.to_repr().ct_eq(&other.0.to_repr())
}
}
@ -245,7 +245,7 @@ impl fmt::Debug for SpendAuthorizingKey {
impl From<SpendAuthorizingKey> for [u8; 32] {
fn from(sk: SpendAuthorizingKey) -> Self {
sk.0.to_bytes()
sk.0.to_repr()
}
}
@ -281,7 +281,7 @@ impl PartialEq for SpendAuthorizingKey {
impl PartialEq<[u8; 32]> for SpendAuthorizingKey {
fn eq(&self, other: &[u8; 32]) -> bool {
self.0.to_bytes().ct_eq(other).unwrap_u8() == 1u8
self.0.to_repr().ct_eq(other).unwrap_u8() == 1u8
}
}
@ -341,14 +341,14 @@ impl ConstantTimeEq for NullifierDerivingKey {
/// Check whether two `NullifierDerivingKey`s are equal, runtime independent
/// of the value of the secret.
fn ct_eq(&self, other: &Self) -> Choice {
self.0.to_bytes().ct_eq(&other.0.to_bytes())
self.0.to_repr().ct_eq(&other.0.to_repr())
}
}
impl fmt::Debug for NullifierDerivingKey {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
f.debug_tuple("NullifierDerivingKey")
.field(&hex::encode(self.0.to_bytes()))
.field(&hex::encode(self.0.to_repr()))
.finish()
}
}
@ -357,13 +357,13 @@ impl Eq for NullifierDerivingKey {}
impl From<NullifierDerivingKey> for [u8; 32] {
fn from(nk: NullifierDerivingKey) -> [u8; 32] {
nk.0.to_bytes()
nk.0.to_repr()
}
}
impl From<&NullifierDerivingKey> for [u8; 32] {
fn from(nk: &NullifierDerivingKey) -> [u8; 32] {
nk.0.to_bytes()
nk.0.to_repr()
}
}
@ -375,7 +375,7 @@ impl From<NullifierDerivingKey> for pallas::Base {
impl From<[u8; 32]> for NullifierDerivingKey {
fn from(bytes: [u8; 32]) -> Self {
Self(pallas::Base::from_bytes(&bytes).unwrap())
Self(pallas::Base::from_repr(bytes).unwrap())
}
}
@ -399,7 +399,7 @@ impl PartialEq for NullifierDerivingKey {
impl PartialEq<[u8; 32]> for NullifierDerivingKey {
fn eq(&self, other: &[u8; 32]) -> bool {
self.0.to_bytes().ct_eq(other).unwrap_u8() == 1u8
self.0.to_repr().ct_eq(other).unwrap_u8() == 1u8
}
}
@ -414,14 +414,14 @@ impl ConstantTimeEq for IvkCommitRandomness {
/// Check whether two `IvkCommitRandomness`s are equal, runtime independent
/// of the value of the secret.
fn ct_eq(&self, other: &Self) -> Choice {
self.0.to_bytes().ct_eq(&other.0.to_bytes())
self.0.to_repr().ct_eq(&other.0.to_repr())
}
}
impl fmt::Debug for IvkCommitRandomness {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
f.debug_tuple("IvkCommitRandomness")
.field(&hex::encode(self.0.to_bytes()))
.field(&hex::encode(self.0.to_repr()))
.finish()
}
}
@ -459,7 +459,7 @@ impl PartialEq for IvkCommitRandomness {
impl PartialEq<[u8; 32]> for IvkCommitRandomness {
fn eq(&self, other: &[u8; 32]) -> bool {
self.0.to_bytes().ct_eq(other).unwrap_u8() == 1u8
self.0.to_repr().ct_eq(other).unwrap_u8() == 1u8
}
}
@ -467,7 +467,7 @@ impl TryFrom<[u8; 32]> for IvkCommitRandomness {
type Error = &'static str;
fn try_from(bytes: [u8; 32]) -> Result<Self, Self::Error> {
let possible_scalar = pallas::Scalar::from_bytes(&bytes);
let possible_scalar = pallas::Scalar::from_repr(bytes);
if possible_scalar.is_some().into() {
Ok(Self(possible_scalar.unwrap()))
@ -658,7 +658,7 @@ impl From<FullViewingKey> for IncomingViewingKey {
// I2LEBSP_l^Orchard_base(ak)
let ak_bytes =
extract_p(pallas::Point::from_bytes(&fvk.spend_validating_key.into()).unwrap())
.to_bytes();
.to_repr();
M.extend_from_bitslice(&BitArray::<Lsb0, _>::from(ak_bytes)[0..255]);
// I2LEBSP_l^Orchard_base(nk)
@ -677,7 +677,7 @@ impl From<FullViewingKey> for IncomingViewingKey {
Self {
dk: fvk.into(),
// mod r_P
ivk: pallas::Scalar::from_bytes(&commit_x.into()).unwrap(),
ivk: pallas::Scalar::from_repr(commit_x.into()).unwrap(),
}
}
}
@ -931,12 +931,12 @@ impl fmt::Debug for TransmissionKey {
match option {
Some(coordinates) => d
.field("x", &hex::encode(coordinates.x().to_bytes()))
.field("y", &hex::encode(coordinates.y().to_bytes()))
.field("x", &hex::encode(coordinates.x().to_repr()))
.field("y", &hex::encode(coordinates.y().to_repr()))
.finish(),
None => d
.field("x", &hex::encode(pallas::Base::zero().to_bytes()))
.field("y", &hex::encode(pallas::Base::zero().to_bytes()))
.field("x", &hex::encode(pallas::Base::zero().to_repr()))
.field("y", &hex::encode(pallas::Base::zero().to_repr()))
.finish(),
}
}
@ -1013,7 +1013,7 @@ impl ConstantTimeEq for EphemeralPrivateKey {
/// Check whether two `EphemeralPrivateKey`s are equal, runtime independent
/// of the value of the secret.
fn ct_eq(&self, other: &Self) -> Choice {
self.0.to_bytes().ct_eq(&other.0.to_bytes())
self.0.to_repr().ct_eq(&other.0.to_repr())
}
}
@ -1021,7 +1021,7 @@ impl Eq for EphemeralPrivateKey {}
impl From<EphemeralPrivateKey> for [u8; 32] {
fn from(esk: EphemeralPrivateKey) -> Self {
esk.0.to_bytes()
esk.0.to_repr()
}
}
@ -1033,7 +1033,7 @@ impl PartialEq for EphemeralPrivateKey {
impl PartialEq<[u8; 32]> for EphemeralPrivateKey {
fn eq(&self, other: &[u8; 32]) -> bool {
self.0.to_bytes().ct_eq(other).unwrap_u8() == 1u8
self.0.to_repr().ct_eq(other).unwrap_u8() == 1u8
}
}
/// An ephemeral public key for Orchard key agreement.
@ -1051,12 +1051,12 @@ impl fmt::Debug for EphemeralPublicKey {
match option {
Some(coordinates) => d
.field("x", &hex::encode(coordinates.x().to_bytes()))
.field("y", &hex::encode(coordinates.y().to_bytes()))
.field("x", &hex::encode(coordinates.x().to_repr()))
.field("y", &hex::encode(coordinates.y().to_repr()))
.finish(),
None => d
.field("x", &hex::encode(pallas::Base::zero().to_bytes()))
.field("y", &hex::encode(pallas::Base::zero().to_bytes()))
.field("x", &hex::encode(pallas::Base::zero().to_repr()))
.field("y", &hex::encode(pallas::Base::zero().to_repr()))
.finish(),
}
}

View File

@ -3,7 +3,7 @@
#![allow(clippy::unit_arg)]
#![allow(dead_code)]
use group::GroupEncoding;
use group::{ff::PrimeField, GroupEncoding};
use halo2::{arithmetic::FieldExt, pasta::pallas};
use rand_core::{CryptoRng, RngCore};
@ -48,7 +48,7 @@ pub struct Rho(pub(crate) pallas::Base);
impl From<Rho> for [u8; 32] {
fn from(rho: Rho) -> Self {
rho.0.to_bytes()
rho.0.to_repr()
}
}
@ -78,7 +78,7 @@ pub struct Psi(pub(crate) pallas::Base);
impl From<Psi> for [u8; 32] {
fn from(psi: Psi) -> Self {
psi.0.to_bytes()
psi.0.to_repr()
}
}

View File

@ -6,7 +6,7 @@ use std::{
hash::{Hash, Hasher},
};
use halo2::{arithmetic::FieldExt, pasta::pallas};
use halo2::pasta::{group::ff::PrimeField, pallas};
use crate::serialization::{serde_helpers, SerializationError};
@ -48,7 +48,7 @@ pub struct Nullifier(#[serde(with = "serde_helpers::Base")] pub(crate) pallas::B
impl Hash for Nullifier {
fn hash<H: Hasher>(&self, state: &mut H) {
self.0.to_bytes().hash(state);
self.0.to_repr().hash(state);
}
}
@ -56,7 +56,7 @@ impl TryFrom<[u8; 32]> for Nullifier {
type Error = SerializationError;
fn try_from(bytes: [u8; 32]) -> Result<Self, Self::Error> {
let possible_point = pallas::Base::from_bytes(&bytes);
let possible_point = pallas::Base::from_repr(bytes);
if possible_point.is_some().into() {
Ok(Self(possible_point.unwrap()))
@ -94,7 +94,7 @@ impl From<(NullifierDerivingKey, Note, NoteCommitment)> for Nullifier {
//
// [ (PRF^nfOrchard_nk(ρ) + ψ) mod q_P ] K^Orchard + cm
let scalar =
pallas::Scalar::from_bytes(&(prf_nf(nk.0, note.rho.0) + psi.0).to_bytes()).unwrap();
pallas::Scalar::from_repr((prf_nf(nk.0, note.rho.0) + psi.0).to_repr()).unwrap();
// Basically a new-gen Pedersen hash?
Nullifier(extract_p((K * scalar) + cm.0))

View File

@ -1,10 +1,9 @@
//! Sinsemilla hash functions and helpers.
use bitvec::prelude::*;
use group::Group;
use halo2::{
arithmetic::{Coordinates, CurveAffine, CurveExt},
pasta::pallas,
pasta::{group::Group, pallas},
};
/// [Coordinate Extractor for Pallas][concreteextractorpallas]
@ -204,7 +203,7 @@ mod tests {
#[cfg(test)]
fn x_from_str(s: &str) -> pallas::Base {
use group::ff::PrimeField;
use halo2::pasta::group::ff::PrimeField;
pallas::Base::from_str_vartime(s).unwrap()
}
@ -212,7 +211,7 @@ mod tests {
#[test]
#[allow(non_snake_case)]
fn single_test_vector() {
use group::Curve;
use halo2::pasta::group::Curve;
let D = b"z.cash:test-Sinsemilla";
let M = bitvec![
@ -244,8 +243,7 @@ mod tests {
#[test]
#[allow(non_snake_case)]
fn hackworks_test_vectors() {
use group::GroupEncoding;
use halo2::arithmetic::FieldExt;
use halo2::pasta::group::{ff::PrimeField, GroupEncoding};
for tv in tests::vectors::SINSEMILLA.iter() {
let D = tv.domain.as_slice();
@ -258,7 +256,7 @@ mod tests {
assert_eq!(
sinsemilla_hash(D, M).expect("should not fail per Theorem 5.4.4"),
pallas::Base::from_bytes(&tv.hash).unwrap()
pallas::Base::from_repr(tv.hash).unwrap()
)
}
}
@ -270,7 +268,7 @@ mod tests {
#[test]
#[allow(non_snake_case)]
fn hackworks_group_hash_test_vectors() {
use group::GroupEncoding;
use halo2::pasta::group::GroupEncoding;
for tv in tests::vectors::GROUP_HASHES.iter() {
let D = tv.domain.as_slice();

View File

@ -1,5 +1,4 @@
use halo2::arithmetic::FieldExt;
use halo2::pasta::pallas;
use halo2::pasta::{group::ff::PrimeField, pallas};
use crate::orchard::tests::vectors;
use crate::orchard::tree::*;
@ -10,7 +9,7 @@ fn empty_roots() {
for i in 0..EMPTY_ROOTS.len() {
assert_eq!(
EMPTY_ROOTS[i].to_bytes(),
EMPTY_ROOTS[i].to_repr(),
// The test vector is in reversed order.
vectors::EMPTY_ROOTS[MERKLE_DEPTH - i]
);
@ -27,7 +26,7 @@ fn incremental_roots() {
for (i, commitment_set) in vectors::COMMITMENTS.iter().enumerate() {
for cm_x_bytes in commitment_set.iter() {
let cm_x = pallas::Base::from_bytes(cm_x_bytes).unwrap();
let cm_x = pallas::Base::from_repr(*cm_x_bytes).unwrap();
leaves.push(cm_x);

View File

@ -21,7 +21,7 @@ use std::{
};
use bitvec::prelude::*;
use halo2::{arithmetic::FieldExt, pasta::pallas};
use halo2::pasta::{group::ff::PrimeField, pallas};
use incrementalmerkletree::{bridgetree, Frontier};
use lazy_static::lazy_static;
use thiserror::Error;
@ -54,8 +54,8 @@ fn merkle_crh_orchard(layer: u8, left: pallas::Base, right: pallas::Base) -> pal
// Prefix: l = I2LEBSP_10(MerkleDepth^Orchard 1 layer)
let l = MERKLE_DEPTH - 1 - layer as usize;
s.extend_from_bitslice(&BitArray::<Lsb0, _>::from([l, 0])[0..10]);
s.extend_from_bitslice(&BitArray::<Lsb0, _>::from(left.to_bytes())[0..255]);
s.extend_from_bitslice(&BitArray::<Lsb0, _>::from(right.to_bytes())[0..255]);
s.extend_from_bitslice(&BitArray::<Lsb0, _>::from(left.to_repr())[0..255]);
s.extend_from_bitslice(&BitArray::<Lsb0, _>::from(right.to_repr())[0..255]);
match sinsemilla_hash(b"z.cash:Orchard-MerkleCRH", &s) {
Some(h) => h,
@ -99,7 +99,7 @@ pub struct Root(#[serde(with = "serde_helpers::Base")] pub(crate) pallas::Base);
impl fmt::Debug for Root {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
f.debug_tuple("Root")
.field(&hex::encode(&self.0.to_bytes()))
.field(&hex::encode(&self.0.to_repr()))
.finish()
}
}
@ -118,7 +118,7 @@ impl From<&Root> for [u8; 32] {
impl Hash for Root {
fn hash<H: Hasher>(&self, state: &mut H) {
self.0.to_bytes().hash(state)
self.0.to_repr().hash(state)
}
}
@ -126,7 +126,7 @@ impl TryFrom<[u8; 32]> for Root {
type Error = SerializationError;
fn try_from(bytes: [u8; 32]) -> Result<Self, Self::Error> {
let possible_point = pallas::Base::from_bytes(&bytes);
let possible_point = pallas::Base::from_repr(bytes);
if possible_point.is_some().into() {
Ok(Self(possible_point.unwrap()))
@ -187,7 +187,7 @@ impl serde::Serialize for Node {
where
S: serde::Serializer,
{
self.0.to_bytes().serialize(serializer)
self.0.to_repr().serialize(serializer)
}
}
@ -197,7 +197,7 @@ impl<'de> serde::Deserialize<'de> for Node {
D: serde::Deserializer<'de>,
{
let bytes = <[u8; 32]>::deserialize(deserializer)?;
Option::<pallas::Base>::from(pallas::Base::from_bytes(&bytes))
Option::<pallas::Base>::from(pallas::Base::from_repr(bytes))
.map(Node)
.ok_or_else(|| serde::de::Error::custom("invalid Pallas field element"))
}

View File

@ -102,7 +102,7 @@ pub(super) const TESTNET_ACTIVATION_HEIGHTS: &[(block::Height, NetworkUpgrade)]
(block::Height(584_000), Blossom),
(block::Height(903_800), Heartwood),
(block::Height(1_028_500), Canopy),
(block::Height(1_599_200), Nu5),
(block::Height(1_842_420), Nu5),
];
/// Fake testnet network upgrade activation heights, used in tests.
@ -190,7 +190,7 @@ pub(crate) const CONSENSUS_BRANCH_IDS: &[(NetworkUpgrade, ConsensusBranchId)] =
(Blossom, ConsensusBranchId(0x2bb40e60)),
(Heartwood, ConsensusBranchId(0xf5b9230b)),
(Canopy, ConsensusBranchId(0xe9ff75a6)),
(Nu5, ConsensusBranchId(0x37519621)),
(Nu5, ConsensusBranchId(0xc2d6d0b4)),
];
/// The target block spacing before Blossom.

View File

@ -19,8 +19,7 @@
use std::convert::TryFrom;
use group::{Group, GroupEncoding};
use halo2::arithmetic::FieldExt;
use group::{ff::PrimeField, Group, GroupEncoding};
use rand_core::{CryptoRng, RngCore};
use super::{private::Sealed, scalar_mul::VartimeMultiscalarMul, *};
@ -231,7 +230,7 @@ impl Verifier {
let s = {
// XXX-pallas: should not use CtOption here
let maybe_scalar = pallas::Scalar::from_bytes(&s_bytes);
let maybe_scalar = pallas::Scalar::from_repr(s_bytes);
if maybe_scalar.is_some().into() {
maybe_scalar.unwrap()
} else {

View File

@ -15,8 +15,8 @@
use std::{borrow::Borrow, fmt::Debug};
use group::Group;
use halo2::{arithmetic::FieldExt, pasta::pallas};
use group::{ff::PrimeField, Group};
use halo2::pasta::pallas;
/// A trait to support getting the Non-Adjacent form of a scalar.
pub trait NonAdjacentForm {
@ -81,7 +81,7 @@ impl NonAdjacentForm for pallas::Scalar {
let mut naf = [0i8; 256];
let mut x_u64 = [0u64; 5];
LittleEndian::read_u64_into(&self.to_bytes(), &mut x_u64[0..4]);
LittleEndian::read_u64_into(&self.to_repr(), &mut x_u64[0..4]);
let width = 1 << w;
let window_mask = width - 1;

View File

@ -1,7 +1,7 @@
use std::convert::{TryFrom, TryInto};
use std::marker::PhantomData;
use group::GroupEncoding;
use group::{ff::PrimeField, GroupEncoding};
use halo2::{arithmetic::FieldExt, pasta::pallas};
use rand_core::{CryptoRng, RngCore};
@ -26,7 +26,7 @@ impl<'a, T: SigType> From<&'a SigningKey<T>> for VerificationKey<T> {
impl<T: SigType> From<SigningKey<T>> for [u8; 32] {
fn from(sk: SigningKey<T>) -> [u8; 32] {
sk.sk.to_bytes()
sk.sk.to_repr()
}
}
@ -34,7 +34,7 @@ impl<T: SigType> TryFrom<[u8; 32]> for SigningKey<T> {
type Error = Error;
fn try_from(bytes: [u8; 32]) -> Result<Self, Self::Error> {
let maybe_sk = pallas::Scalar::from_bytes(&bytes);
let maybe_sk = pallas::Scalar::from_repr(bytes);
if maybe_sk.is_some().into() {
let sk = maybe_sk.unwrap();
@ -114,7 +114,7 @@ impl<T: SigType> SigningKey<T> {
.update(msg)
.finalize();
let s_bytes = (nonce + (c * self.sk)).to_bytes();
let s_bytes = (nonce + (c * self.sk)).to_repr();
Signature {
r_bytes,

View File

@ -1,7 +1,7 @@
use std::marker::PhantomData;
use group::{cofactor::CofactorGroup, GroupEncoding};
use halo2::{arithmetic::FieldExt, pasta::pallas};
use group::{cofactor::CofactorGroup, ff::PrimeField, GroupEncoding};
use halo2::pasta::pallas;
use super::*;
@ -154,7 +154,7 @@ impl<T: SigType> VerificationKey<T> {
let s = {
// XXX-pasta_curves: should not use CtOption here
let maybe_scalar = pallas::Scalar::from_bytes(&signature.s_bytes);
let maybe_scalar = pallas::Scalar::from_repr(signature.s_bytes);
if maybe_scalar.is_some().into() {
maybe_scalar.unwrap()
} else {

View File

@ -21,7 +21,7 @@ pub fn decrypts_successfully(transaction: &Transaction, network: Network, height
.expect("zcash_primitives and Zebra transaction formats must be compatible");
let alt_height = height.0.into();
let null_sapling_ovk = zcash_primitives::sapling::keys::OutgoingViewingKey([0u8; 32]);
let null_sapling_ovk = zcash_primitives::keys::OutgoingViewingKey([0u8; 32]);
if let Some(bundle) = alt_tx.sapling_bundle() {
for output in bundle.shielded_outputs.iter() {

View File

@ -7,6 +7,8 @@ use std::{
ops::Deref,
};
use zcash_primitives::transaction as zp_tx;
use crate::{
amount::{Amount, NonNegative},
parameters::{Network, NetworkUpgrade},
@ -15,7 +17,131 @@ use crate::{
transparent::{self, Script},
};
impl TryFrom<&Transaction> for zcash_primitives::transaction::Transaction {
// Used by boilerplate code below.
#[derive(Clone, Debug)]
struct TransparentAuth<'a> {
all_prev_outputs: &'a [transparent::Output],
}
impl zp_tx::components::transparent::Authorization for TransparentAuth<'_> {
type ScriptSig = zcash_primitives::legacy::Script;
}
// In this block we convert our Output to a librustzcash to TxOut.
// (We could do the serialize/deserialize route but it's simple enough to convert manually)
impl zp_tx::sighash::TransparentAuthorizingContext for TransparentAuth<'_> {
fn input_amounts(&self) -> Vec<zp_tx::components::amount::Amount> {
self.all_prev_outputs
.iter()
.map(|prevout| {
zp_tx::components::amount::Amount::from_nonnegative_i64_le_bytes(
prevout.value.to_bytes(),
)
.expect("will not fail since it was previously validated")
})
.collect()
}
fn input_scriptpubkeys(&self) -> Vec<zcash_primitives::legacy::Script> {
self.all_prev_outputs
.iter()
.map(|prevout| {
zcash_primitives::legacy::Script(prevout.lock_script.as_raw_bytes().into())
})
.collect()
}
}
// Boilerplate mostly copied from `zcash/src/rust/src/transaction_ffi.rs` which is required
// to compute sighash.
// TODO: remove/change if they improve the API to not require this.
struct MapTransparent<'a> {
auth: TransparentAuth<'a>,
}
impl<'a>
zp_tx::components::transparent::MapAuth<
zp_tx::components::transparent::Authorized,
TransparentAuth<'a>,
> for MapTransparent<'a>
{
fn map_script_sig(
&self,
s: <zp_tx::components::transparent::Authorized as zp_tx::components::transparent::Authorization>::ScriptSig,
) -> <TransparentAuth as zp_tx::components::transparent::Authorization>::ScriptSig {
s
}
fn map_authorization(
&self,
_: zp_tx::components::transparent::Authorized,
) -> TransparentAuth<'a> {
// TODO: This map should consume self, so we can move self.auth
self.auth.clone()
}
}
struct IdentityMap;
impl
zp_tx::components::sapling::MapAuth<
zp_tx::components::sapling::Authorized,
zp_tx::components::sapling::Authorized,
> for IdentityMap
{
fn map_proof(
&self,
p: <zp_tx::components::sapling::Authorized as zp_tx::components::sapling::Authorization>::Proof,
) -> <zp_tx::components::sapling::Authorized as zp_tx::components::sapling::Authorization>::Proof
{
p
}
fn map_auth_sig(
&self,
s: <zp_tx::components::sapling::Authorized as zp_tx::components::sapling::Authorization>::AuthSig,
) -> <zp_tx::components::sapling::Authorized as zp_tx::components::sapling::Authorization>::AuthSig{
s
}
fn map_authorization(
&self,
a: zp_tx::components::sapling::Authorized,
) -> zp_tx::components::sapling::Authorized {
a
}
}
impl zp_tx::components::orchard::MapAuth<orchard::bundle::Authorized, orchard::bundle::Authorized>
for IdentityMap
{
fn map_spend_auth(
&self,
s: <orchard::bundle::Authorized as orchard::bundle::Authorization>::SpendAuth,
) -> <orchard::bundle::Authorized as orchard::bundle::Authorization>::SpendAuth {
s
}
fn map_authorization(&self, a: orchard::bundle::Authorized) -> orchard::bundle::Authorized {
a
}
}
struct PrecomputedAuth<'a> {
_phantom: std::marker::PhantomData<&'a ()>,
}
impl<'a> zp_tx::Authorization for PrecomputedAuth<'a> {
type TransparentAuth = TransparentAuth<'a>;
type SaplingAuth = zp_tx::components::sapling::Authorized;
type OrchardAuth = orchard::bundle::Authorized;
}
// End of (mostly) copied code
impl TryFrom<&Transaction> for zp_tx::Transaction {
type Error = io::Error;
/// Convert a Zebra transaction into a librustzcash one.
@ -42,7 +168,7 @@ impl TryFrom<&Transaction> for zcash_primitives::transaction::Transaction {
pub(crate) fn convert_tx_to_librustzcash(
trans: &Transaction,
network_upgrade: NetworkUpgrade,
) -> Result<zcash_primitives::transaction::Transaction, io::Error> {
) -> Result<zp_tx::Transaction, io::Error> {
let serialized_tx = trans.zcash_serialize_to_vec()?;
let branch_id: u32 = network_upgrade
.branch_id()
@ -52,16 +178,16 @@ pub(crate) fn convert_tx_to_librustzcash(
let branch_id: zcash_primitives::consensus::BranchId = branch_id
.try_into()
.expect("zcash_primitives and Zebra have the same branch ids");
let alt_tx = zcash_primitives::transaction::Transaction::read(&serialized_tx[..], branch_id)?;
let alt_tx = zp_tx::Transaction::read(&serialized_tx[..], branch_id)?;
Ok(alt_tx)
}
/// Convert a Zebra Amount into a librustzcash one.
impl TryFrom<Amount<NonNegative>> for zcash_primitives::transaction::components::Amount {
impl TryFrom<Amount<NonNegative>> for zp_tx::components::Amount {
type Error = ();
fn try_from(amount: Amount<NonNegative>) -> Result<Self, Self::Error> {
zcash_primitives::transaction::components::Amount::from_u64(amount.into())
zp_tx::components::Amount::from_u64(amount.into())
}
}
@ -98,33 +224,32 @@ pub(crate) fn sighash(
Some(input_index) => {
let output = all_previous_outputs[input_index].clone();
script = (&output.lock_script).into();
zcash_primitives::transaction::sighash::SignableInput::Transparent(
zcash_primitives::transaction::sighash::TransparentInput::new(
input_index,
&script,
output
.value
.try_into()
.expect("amount was previously validated"),
),
)
zp_tx::sighash::SignableInput::Transparent {
hash_type: hash_type.bits() as _,
index: input_index,
script_code: &script,
script_pubkey: &script,
value: output
.value
.try_into()
.expect("amount was previously validated"),
}
}
None => zcash_primitives::transaction::sighash::SignableInput::Shielded,
None => zp_tx::sighash::SignableInput::Shielded,
};
let txid_parts = alt_tx
.deref()
.digest(zcash_primitives::transaction::txid::TxIdDigester);
let txid_parts = alt_tx.deref().digest(zp_tx::txid::TxIdDigester);
let f_transparent = MapTransparent {
auth: TransparentAuth {
all_prev_outputs: all_previous_outputs,
},
};
let txdata: zp_tx::TransactionData<PrecomputedAuth> =
alt_tx
.into_data()
.map_authorization(f_transparent, IdentityMap, IdentityMap);
SigHash(
*zcash_primitives::transaction::sighash::signature_hash(
alt_tx.deref(),
hash_type.bits(),
&signable_input,
&txid_parts,
)
.as_ref(),
)
SigHash(*zp_tx::sighash::signature_hash(&txdata, &signable_input, &txid_parts).as_ref())
}
/// Compute the authorizing data commitment of this transaction as specified
@ -136,7 +261,7 @@ pub(crate) fn sighash(
///
/// [ZIP-244]: https://zips.z.cash/zip-0244.
pub(crate) fn auth_digest(trans: &Transaction) -> AuthDigest {
let alt_tx: zcash_primitives::transaction::Transaction = trans
let alt_tx: zp_tx::Transaction = trans
.try_into()
.expect("zcash_primitives and Zebra transaction formats must be compatible");

View File

@ -1,5 +1,5 @@
use group::GroupEncoding;
use halo2::{arithmetic::FieldExt, pasta::pallas};
use group::{ff::PrimeField, GroupEncoding};
use halo2::pasta::pallas;
#[derive(Deserialize, Serialize)]
#[serde(remote = "jubjub::AffinePoint")]
pub struct AffinePoint {
@ -42,25 +42,25 @@ impl From<Affine> for pallas::Affine {
#[derive(Deserialize, Serialize)]
#[serde(remote = "pallas::Scalar")]
pub struct Scalar {
#[serde(getter = "pallas::Scalar::to_bytes")]
#[serde(getter = "pallas::Scalar::to_repr")]
bytes: [u8; 32],
}
impl From<Scalar> for pallas::Scalar {
fn from(local: Scalar) -> Self {
pallas::Scalar::from_bytes(&local.bytes).unwrap()
pallas::Scalar::from_repr(local.bytes).unwrap()
}
}
#[derive(Deserialize, Serialize)]
#[serde(remote = "pallas::Base")]
pub struct Base {
#[serde(getter = "pallas::Base::to_bytes")]
#[serde(getter = "pallas::Base::to_repr")]
bytes: [u8; 32],
}
impl From<Base> for pallas::Base {
fn from(local: Base) -> Self {
pallas::Base::from_bytes(&local.bytes).unwrap()
pallas::Base::from_repr(local.bytes).unwrap()
}
}

View File

@ -4,7 +4,7 @@
use std::{borrow::Borrow, convert::TryInto, io, sync::Arc};
use byteorder::{LittleEndian, ReadBytesExt, WriteBytesExt};
use halo2::{arithmetic::FieldExt, pasta::pallas};
use halo2::pasta::{group::ff::PrimeField, pallas};
use crate::{
amount,
@ -41,7 +41,7 @@ impl ZcashDeserialize for jubjub::Fq {
impl ZcashDeserialize for pallas::Scalar {
fn zcash_deserialize<R: io::Read>(mut reader: R) -> Result<Self, SerializationError> {
let possible_scalar = pallas::Scalar::from_bytes(&reader.read_32_bytes()?);
let possible_scalar = pallas::Scalar::from_repr(reader.read_32_bytes()?);
if possible_scalar.is_some().into() {
Ok(possible_scalar.unwrap())
@ -55,7 +55,7 @@ impl ZcashDeserialize for pallas::Scalar {
impl ZcashDeserialize for pallas::Base {
fn zcash_deserialize<R: io::Read>(mut reader: R) -> Result<Self, SerializationError> {
let possible_field_element = pallas::Base::from_bytes(&reader.read_32_bytes()?);
let possible_field_element = pallas::Base::from_repr(reader.read_32_bytes()?);
if possible_field_element.is_some().into() {
Ok(possible_field_element.unwrap())

View File

@ -896,36 +896,36 @@ fn zip244_sighash() -> Result<()> {
for (i, test) in zip0244::TEST_VECTORS.iter().enumerate() {
let transaction = test.tx.zcash_deserialize_into::<Transaction>()?;
let (input_index, output) = match test.amount {
Some(amount) => (
Some(
test.transparent_input
.expect("test vector must have transparent_input when it has amount")
as usize,
),
Some(transparent::Output {
value: amount.try_into()?,
lock_script: transparent::Script::new(
test.script_code
.as_ref()
.expect("test vector must have script_code when it has amount"),
),
}),
),
None => (None, None),
};
let all_previous_outputs: Vec<_> = match output {
Some(output) => mock_pre_v5_output_list(output, input_index.unwrap()),
None => vec![],
};
let all_previous_outputs: Vec<_> = test
.amounts
.iter()
.zip(test.script_pubkeys.iter())
.map(|(amount, script_pubkey)| transparent::Output {
value: (*amount).try_into().unwrap(),
lock_script: transparent::Script::new(script_pubkey.as_ref()),
})
.collect();
let result = hex::encode(transaction.sighash(
NetworkUpgrade::Nu5,
HashType::ALL,
&all_previous_outputs,
input_index,
None,
));
let expected = hex::encode(test.sighash_all);
let expected = hex::encode(test.sighash_shielded);
assert_eq!(expected, result, "test #{}: sighash does not match", i);
if let Some(sighash_all) = test.sighash_all {
let result = hex::encode(transaction.sighash(
NetworkUpgrade::Nu5,
HashType::ALL,
&all_previous_outputs,
test.transparent_input.map(|idx| idx as _),
));
let expected = hex::encode(sighash_all);
assert_eq!(expected, result, "test #{}: sighash does not match", i);
}
}
Ok(())

View File

@ -2,8 +2,9 @@
use std::{fmt, io};
use ripemd160::{Digest, Ripemd160};
use ripemd::{Digest, Ripemd160};
use secp256k1::PublicKey;
use sha2::Digest as Sha256Digest;
use sha2::Sha256;
use crate::{

View File

@ -16,7 +16,7 @@ bls12_381 = "0.6.0"
jubjub = "0.8.0"
rand = { version = "0.8.5", package = "rand" }
halo2 = "=0.1.0-beta.1"
halo2 = { package = "halo2_proofs", version = "=0.1.0-beta.4" }
chrono = "0.4.19"
dirs = "4.0.0"
@ -34,11 +34,13 @@ tower = { version = "0.4.12", features = ["timeout", "util", "buffer"] }
tracing = "0.1.31"
tracing-futures = "0.2.5"
# TODO: replace with upstream orchard (#3056)
orchard = { git = "https://github.com/ZcashFoundation/orchard.git", rev = "568e24cd5f129158375d7ac7d98c89ebff4f982f" }
orchard = "=0.1.0-beta.3"
# TODO: replace with upstream librustzcash when these changes are merged (#3037)
zcash_proofs = { git = "https://github.com/ZcashFoundation/librustzcash.git", tag = "0.5.1-zebra-v1.0.0-beta.4", features = ["local-prover", "multicore", "download-params"] }
# Currently pointing to `download-sprout-params-new` branch which contains the
# changes from `download-sprout-params-d14e7a70` rebased on top of d14e7a70 as
# required by `zcash/Cargo.toml`.
zcash_proofs = { git = "https://github.com/ZcashFoundation/librustzcash.git", rev = "c3ff94134b472ba90af665e5454983dc12de1338", features = ["local-prover", "multicore", "download-params"] }
tower-fallback = { path = "../tower-fallback/" }
tower-batch = { path = "../tower-batch/" }

View File

@ -5,12 +5,12 @@ use std::convert::TryInto;
use futures::stream::{FuturesUnordered, StreamExt};
use tower::ServiceExt;
use halo2::{arithmetic::FieldExt, pasta::pallas};
use halo2::pasta::{group::ff::PrimeField, pallas};
use orchard::{
builder::Builder,
bundle::Flags,
circuit::ProvingKey,
keys::{FullViewingKey, SpendingKey},
keys::{FullViewingKey, Scope, SpendingKey},
value::NoteValue,
Anchor, Bundle,
};
@ -30,7 +30,7 @@ fn generate_test_vectors() {
let rng = OsRng;
let sk = SpendingKey::from_bytes([7; 32]).unwrap();
let recipient = FullViewingKey::from(&sk).default_address();
let recipient = FullViewingKey::from(&sk).address_at(0u32, Scope::External);
let enable_spends = true;
let enable_outputs = true;
@ -56,7 +56,7 @@ fn generate_test_vectors() {
let bundle: Bundle<_, i64> = builder.build(rng).unwrap();
let bundle = bundle
.create_proof(&proving_key)
.create_proof(&proving_key, rng)
.unwrap()
.apply_signatures(rng, [0; 32], &[])
.unwrap();
@ -76,7 +76,7 @@ fn generate_test_vectors() {
cv: a.cv_net().to_bytes().try_into().unwrap(),
nullifier: a.nullifier().to_bytes().try_into().unwrap(),
rk: <[u8; 32]>::from(a.rk()).try_into().unwrap(),
cm_x: pallas::Base::from_bytes(&a.cmx().into()).unwrap(),
cm_x: pallas::Base::from_repr(a.cmx().into()).unwrap(),
ephemeral_key: a.encrypted_note().epk_bytes.try_into().unwrap(),
enc_ciphertext: a.encrypted_note().enc_ciphertext.into(),
out_ciphertext: a.encrypted_note().out_ciphertext.into(),
@ -134,7 +134,7 @@ where
async fn verify_generated_halo2_proofs() {
zebra_test::init();
// These test vectors are generated by `generate_text_vectors()` function.
// These test vectors are generated by `generate_test_vectors()` function.
let shielded_data = zebra_test::vectors::ORCHARD_SHIELDED_DATA
.clone()
.iter()
@ -200,7 +200,7 @@ where
async fn correctly_err_on_invalid_halo2_proofs() {
zebra_test::init();
// These test vectors are generated by `generate_text_vectors()` function.
// These test vectors are generated by `generate_test_vectors()` function.
let shielded_data = zebra_test::vectors::ORCHARD_SHIELDED_DATA
.clone()
.iter()

View File

@ -1,13 +1,12 @@
//! Tests for Zcash transaction consensus checks.
use std::{
cmp::max,
collections::HashMap,
convert::{TryFrom, TryInto},
sync::Arc,
};
use halo2::{arithmetic::FieldExt, pasta::pallas};
use halo2::pasta::{group::ff::PrimeField, pallas};
use tower::{service_fn, ServiceExt};
use zebra_chain::{
@ -306,23 +305,29 @@ async fn v5_transaction_is_accepted_after_nu5_activation_for_network(network: Ne
let state_service = service_fn(|_| async { unreachable!("Service should not be called") });
let verifier = Verifier::new(network, state_service);
let transaction = fake_v5_transactions_for_network(network, blocks)
let mut transaction = fake_v5_transactions_for_network(network, blocks)
.rev()
.next()
.expect("At least one fake V5 transaction in the test vectors");
if transaction
.expiry_height()
.expect("V5 must have expiry_height")
< nu5_activation_height
{
let expiry_height = transaction.expiry_height_mut();
*expiry_height = nu5_activation_height;
}
let expected_hash = transaction.unmined_id();
let fake_block_height = max(
nu5_activation_height,
transaction.expiry_height().unwrap_or(nu5_activation_height),
);
let expiry_height = transaction
.expiry_height()
.expect("V5 must have expiry_height");
let result = verifier
.oneshot(Request::Block {
transaction: Arc::new(transaction),
known_utxos: Arc::new(HashMap::new()),
height: fake_block_height,
height: expiry_height,
time: chrono::MAX_DATETIME,
})
.await;
@ -2166,7 +2171,7 @@ fn fill_action_with_note_encryption_test_vector(
) -> zebra_chain::orchard::Action {
let mut action = action.clone();
action.cv = v.cv_net.try_into().expect("test vector must be valid");
action.cm_x = pallas::Base::from_bytes(&v.cmx).unwrap();
action.cm_x = pallas::Base::from_repr(v.cmx).unwrap();
action.nullifier = v.rho.try_into().expect("test vector must be valid");
action.ephemeral_key = v
.ephemeral_key

View File

@ -241,7 +241,7 @@ pub const USER_AGENT: &str = "/Zebra:1.0.0-beta.7/";
///
/// The current protocol version typically changes before Mainnet and Testnet
/// network upgrades.
pub const CURRENT_NETWORK_PROTOCOL_VERSION: Version = Version(170_015);
pub const CURRENT_NETWORK_PROTOCOL_VERSION: Version = Version(170_050);
/// The default RTT estimate for peer responses.
///
@ -278,7 +278,7 @@ lazy_static! {
pub static ref INITIAL_MIN_NETWORK_PROTOCOL_VERSION: HashMap<Network, NetworkUpgrade> = {
let mut hash_map = HashMap::new();
hash_map.insert(Network::Mainnet, NetworkUpgrade::Canopy);
hash_map.insert(Network::Testnet, NetworkUpgrade::Nu5);
hash_map.insert(Network::Testnet, NetworkUpgrade::Canopy);
hash_map
};

View File

@ -116,7 +116,7 @@ impl Arbitrary for Version {
type Parameters = ();
fn arbitrary_with(_args: Self::Parameters) -> Self::Strategy {
prop_oneof![170_002_u32..=170_015, 0_u32..]
prop_oneof![170_002_u32..=170_100, 0_u32..]
.prop_map(Version)
.boxed()
}

View File

@ -113,8 +113,8 @@ impl Version {
(Mainnet, Heartwood) => 170_011,
(Testnet, Canopy) => 170_012,
(Mainnet, Canopy) => 170_013,
(Testnet, Nu5) => 170_015,
(Mainnet, Nu5) => unreachable!("Nu5 Mainnet protocol version not yet defined"),
(Testnet, Nu5) => 170_050,
(Mainnet, Nu5) => 170_100,
})
}
}

View File

@ -8,7 +8,7 @@ edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
zcash_script = { git = "https://github.com/ZcashFoundation/zcash_script.git", rev = "270d32d192c5880f911acf21ef100caa128e6179" }
zcash_script = { git = "https://github.com/ZcashFoundation/zcash_script.git", rev = "98c74180ff2899898457090b95578dc4e58ce85d" }
zebra-chain = { path = "../zebra-chain" }

View File

@ -103,9 +103,8 @@ impl CachedFfiTransaction {
let all_previous_outputs_serialized = all_previous_outputs
.zcash_serialize_to_vec()
.expect("serialization into a vec is infallible");
// TODO: pass to zcash_script after API update
let _all_previous_outputs_serialized_ptr = all_previous_outputs_serialized.as_ptr();
let _all_previous_outputs_serialized_len: u32 = all_previous_outputs_serialized
let all_previous_outputs_serialized_ptr = all_previous_outputs_serialized.as_ptr();
let all_previous_outputs_serialized_len: u32 = all_previous_outputs_serialized
.len()
.try_into()
.expect("serialized transaction lengths are much less than u32::MAX");
@ -114,11 +113,11 @@ impl CachedFfiTransaction {
// the `tx_to_*` fields are created from a valid Rust `Vec`
// the `all_previous_outputs_*` fields are created from a valid Rust `Vec`
let precomputed = unsafe {
zcash_script::zcash_script_new_precomputed_tx(
zcash_script::zcash_script_new_precomputed_tx_v5(
tx_to_serialized_ptr,
tx_to_serialized_len,
// all_previous_outputs_ptr,
// all_previous_outputs_len,
all_previous_outputs_serialized_ptr,
all_previous_outputs_serialized_len,
&mut err,
)
};
@ -279,7 +278,9 @@ mod tests {
use std::convert::TryInto;
use std::sync::Arc;
use zebra_chain::{
parameters::NetworkUpgrade::*, serialization::ZcashDeserializeInto, transparent,
parameters::{ConsensusBranchId, NetworkUpgrade::*},
serialization::ZcashDeserializeInto,
transparent,
};
use zebra_test::prelude::*;
@ -290,22 +291,19 @@ mod tests {
.expect("Block bytes are in valid hex representation");
}
#[test]
fn verify_valid_script() -> Result<()> {
zebra_test::init();
fn verify_valid_script(
branch_id: ConsensusBranchId,
tx: &[u8],
amount: u64,
pubkey: &[u8],
) -> Result<()> {
let transaction =
SCRIPT_TX.zcash_deserialize_into::<Arc<zebra_chain::transaction::Transaction>>()?;
let coin = u64::pow(10, 8);
let amount = 212 * coin;
tx.zcash_deserialize_into::<Arc<zebra_chain::transaction::Transaction>>()?;
let output = transparent::Output {
value: amount.try_into()?,
lock_script: transparent::Script::new(&SCRIPT_PUBKEY.clone()),
lock_script: transparent::Script::new(pubkey),
};
let input_index = 0;
let branch_id = Blossom
.branch_id()
.expect("Blossom has a ConsensusBranchId");
let previous_output = vec![output];
let verifier = super::CachedFfiTransaction::new(transaction, previous_output);
@ -314,6 +312,18 @@ mod tests {
Ok(())
}
#[test]
fn verify_valid_script_v4() -> Result<()> {
zebra_test::init();
verify_valid_script(
Blossom.branch_id().unwrap(),
&SCRIPT_TX,
212 * u64::pow(10, 8),
&SCRIPT_PUBKEY,
)
}
#[test]
fn count_legacy_sigops() -> Result<()> {
zebra_test::init();

View File

@ -47,7 +47,7 @@ proptest-derive = "0.3.0"
# TODO: replace w/ crate version when released: https://github.com/ZcashFoundation/zebra/issues/2083
# Note: if updating this, also update the workspace Cargo.toml to match.
halo2 = "=0.1.0-beta.1"
halo2 = { package = "halo2_proofs", version = "=0.1.0-beta.4" }
jubjub = "0.8.0"
tokio = { version = "1.17.0", features = ["full"] }

View File

@ -12,13 +12,13 @@ pub use zebra_chain::transparent::MIN_TRANSPARENT_COINBASE_MATURITY;
///
/// For the best chain, coinbase spends are only allowed from blocks at or below
/// the finalized tip. For other chains, coinbase spends can use outputs from
/// early non-finalized blocks or finalized blocks. But if that chain becomes
/// early non-finalized blocks, or finalized blocks. But if that chain becomes
/// the best chain, all non-finalized blocks past the [`MAX_BLOCK_REORG_HEIGHT`]
/// will be finalized. This includes all mature coinbase outputs.
pub const MAX_BLOCK_REORG_HEIGHT: u32 = MIN_TRANSPARENT_COINBASE_MATURITY - 1;
/// The database format version, incremented each time the database format changes.
pub const DATABASE_FORMAT_VERSION: u32 = 22;
pub const DATABASE_FORMAT_VERSION: u32 = 23;
/// The maximum number of blocks to check for NU5 transactions,
/// before we assume we are on a pre-NU5 legacy chain.

View File

@ -1,7 +1,6 @@
//! Fixed test vectors for the finalized state.
use halo2::arithmetic::FieldExt;
use halo2::pasta::pallas;
use halo2::pasta::{group::ff::PrimeField, pallas};
use hex::FromHex;
use crate::service::finalized_state::disk_format::{FromDisk, IntoDisk};
@ -72,7 +71,7 @@ fn orchard_note_commitment_tree_serialization() {
];
for (idx, cm_x_bytes) in commitments.iter().enumerate() {
let cm_x = pallas::Base::from_bytes(cm_x_bytes).unwrap();
let cm_x = pallas::Base::from_repr(*cm_x_bytes).unwrap();
incremental_tree.append(cm_x).unwrap();
if idx % 2 == 0 {
// Cache the root half of the time to make sure it works in both cases

View File

@ -1 +0,0 @@
04000000ed34eead710be6b5da373edd2e5515407a0d9f5f2b511f09f1ddabd3764e27008039c40bd3ab96700f2242b1200608d4a1c74264bc71b3f956a2339b4606957ba7d9248f4d9300eca388220a40b4e98ab8f0459af40d74dff3bb07a9691df4487e365d61a94e6d1f2a00ab6acaf882cba8e6f322ab507bf2c349664286203c6f194b1708250c0000fd40050008feecb65909d17f1120a372873dacc148305f700e82b5b34e8898135857f4a4f3cc568ad4d0bed15913e4461ed0d39e56a038737e664414b53b5db2d763666c1d99096ce943ebc9c9fb7fd665be8c049b6218178d33323a94502f1afa91eb9552f254b9796afa3f2a80dff1dc1dfae350eb733ee840512630fef7658525ad7740256720d1a469725d0b2fe8f6a8161807843933a43b83245073b4fd161c38cdce0ac57bd9629e0ce5961d33848464ee2fb1cc64529f1588820e06e62d52a476721bdf95add623872aef7cc13622b58103182b969f0d66b38f8351f20d0919e3a111e3f74f843746877d349a75eed5df74983fc3726e15fbf1bcce1054e38a2096ef4fc087f10c6fae6fb1a0fd78c4cd343bb3f52d939d36d204e3b55c3e26599ed2dcb2ee2b541195d06757a58908a536c04d83b67581bed02e3f72c584122ff27dadd6657e61b5375f092cfb4cf700785920fd8e3b92f58ba3d98be05a799257dd02945c8c9b0637a5d39bc3ac16d491f7355af88a9be77212d248bace52cab1dab316e83dfa7ae208a532d7ab16157abd0b299b377927d3db496e832db82739b9a91abeef2ea7942c2f1893b310969ff051786352f5884e8a572c8317d659efe1089f7a4e68bef3135ea9501e9b15c4ec91cfa1c875435cbbfda4421eab78f0d42439bde9230965617ef5c5b099fff24a52d139d07e07f1388f8caf6e25a7be438a487ad9b2f46e3d029d3831cb9337b6fcb3bb53c4ee9cc79d4b894ebd02d60e125f220c543ed1f5adb320cc3da5026bf41ecc9b15497a39662a66315de4f488f2cbe4f57d4b0d14e80be341a3678ccfb9aa1011c86934d8619324cea3a71768a37dd2ce37d59730484e5dccde868ee3fc2aef1befe9c117504c01a6325a5de16824c70e73f9267844666bc043d848fd72d7289a83ec15a2c1eefb08cd0085657436e2fca122681375d86109d986a6b6a1d110cc656138cd90b89422aae8a27da27b6e7abf9dcf0b21c3370cf453a9eafe12331a72a85338dddf45af34234cd3f50db21b6c5a67eea8e2e4965618bf9f3e0abeec58e91d4d55b138416743b3f179496addcb7633b9dfcacf128ff17e471368c5e7469246145e690c0b54f492d4c50cf7d40f80d36e7b25607c8d2a4bfe19073da2b82a1ce3ca6ac4fc12f6b4c9ea185ca61401cbfd34f09f1cff1ae9119c9fc09d00f07c56e01e0ce223c7b1c7066accf135917ac60e79f2a117c72e108012c5342f79c9938f32f1ca77445cca50ef81dc2a95ad681f4c6b44be22e4afc8bc7b11718b58ea3e02b4a48b4a8f90cefb4b804443b6b5e83b0af55a7a1ebb7b4409cfa2134c5e291dd2750eaac6131c0d4710bbda6d9b4ead5ce43681cd7ac8dc27c3081e76775f959f2692a1c5d3e8bd0629c54cadae408bd5149a0129e966b8091e2eba31b294ff5d47c0f91655691917ef791dc912f5c78bc373285d36d57ea68f9971ce0bb0fb4e4d1970637a8fa24dc858e914bfbfa9953320dfd474a36bcc39ffcff67becfb7122c2885a0aa605b09470e5456d349b5eb32685fdb460ce7bcaf75f13b927536de5a29530b6e27da228736cae7abe4a490b358c38424ce53ac123e419acec6aa1c28936b38d10edcb2c2790a282af0d8302fe734d58f507fec0470410fd20bb615f65f516a0921bd8ca8cc494ade81313ac0b2411e24d57d3f5ca742dd91e12ae27dfe74e07f9fc1c1b26ba7574d544095d30495efb0efe3eaf438c2e1c6b1a635f8ea4d4fd362948e20d85de15f80d22a3e8815f995f58bce5afe3cd79918dcdb25a09160a1a59d1d0d33b6535a1fe58920f06cca21d562716b2ee3a91df66639bb4921b93ff4b58bab61668ab295b49f77367d513e0c9088e55dada66fe65dc7d5601050000800a27a7262196513700000000e0661800010000000000000000000000000000000000000000000000000000000000000000ffffffff0603e066180102ffffffff0480b2e60e000000001976a9146e82b7c719334e3aac3916872a088b548c43c9fb88ac286bee000000000017a9140c0bcca02f3cba01a5d7423ac3903d40586399eb8738c94d010000000017a914221c95f83bf073cfb76724ed23af737c1ee3bb498740787d010000000017a91471e1df05024288a00802de81e08c437859586c8787000000

View File

@ -1 +0,0 @@
04000000da438160fc9c57ca00c5251e689f9c8b21e1f84fcd645b95c0a85e9948e43100f6c3f2ef2b6f542ad77967e75314f45c509033eb887b09828ff9137c2b73ef4752da86ea6380c2353ec868cba9a16edb3b1a483a2d084ae76ab4404b2d929b048f365d61149c6c1f1c007c736075333a175f237e246890a5906e0c065d4adfedcb16fecaca250000fd4005002699b2262a65cdf85c128de3aaa471314b5c2cbb0e307fbdc2046603836141116974b80890ed989b7b19890642cc641f17fd31b7a92c7d74af40cbdefda224896b818b9baad78d22e2fa0ba66f2dd7251fe241095ced9f9249c4d7955392c4a228fa6e6bfb973c6e0d632ec3bcc389eaa15bb3c3193536862f4071a3b92bb0f227c10e3120f9b42331204428d6585b1abf396dda3c47b31ef2a5887979ae9a7efc534c7c3c3cc407355da6c927245f6ea0e15f0d1d7ed13b73d48f8021b415f63d93e04fa3a4644e3c529926a4d976d81e13a7c965cfb7e1b9d812b7c01af0bff6a4aa9ad00819e92754c1d9c5c12427e4434c2670c33df93d6eb41fbc7684220ec890a62a93ec3e4c7eb5329c5cece735eebdfa670d97c50b6689b9e0fb713f8e39fdd8e4223e3aa8abe23de3e4fc94b6fcf2708930abf88aac55ca4dd5f2d80998c678285e7ad52186ffef7f229800a24f98f9d8b0995beff6e980d17f4e73f9da5b3603da84b20f876d57eb53b3eedbcf17b6cf561e9ccf2f41570f009e4131c3f983d81ef3fb65a66d70e6114255c5b46559b0fdca9c4a51fee1c146d117fb235c1150d22b2b45848bec53a5fc7bb1a98757003e0f2c49d98e949cdd69b7340be5df7ddb553668425efb6a123bd981e425cb29e96d31898f250815c644b9365d1835316d520e234ccd22c8c459488fbee8e6fcb66202c83ed96dd298933a32f251ddc96f69b788759c7d1319baada1924e137eede59400512bea082a71ad020c120aa559c72bc7690ad163b7af65a1dc7d1d635c3a78154f57a5fec9ed1327f9d2f6749a0a08d72a4e05e1e840e82b3d61e15cc3684a4847f79cfdbd1b2506a998fc018c636c6dcc74a4fc61690abd06da5be806c1a9e44184dcc0f602b340aa72716a03f435671a2230a4699d568a44cbe043261a46eff0de687852470138a4b0bd20b685bd011a1e89fc9c731ba35c2ba90f8d17a86d3069f38ef3827076a8a4553b844d5dc60289e4638707f5aecfdaf25255d62b54b4032c8d5f086306f1b34466407508012dd59d14ea80025dd0270372bce36d49e8c9db0c0224e118e2455c42cf038b0cd955cda1b15ac9964ce1132f24daf05f43d0e8c226f9fe7080187c997798136b013dbb876b4d1c314b566af314b11f5e779614b5b8a878439d8727bb45a601eeebaf58d3f6c93f77a17b5370eb199e33d698010b345f0e0649677e985e923d12b6ab7d0c3aaf48720741d65e611979edd512368ab8e6b5a5bb9777fd245079733d5e57324b2089c61f5bbf921ecebd970eb6036f56c937cba3fba4dca34c293e01aa7e7fdaf1dd127df1c17d8d7b19dad363cbfe69c79d24107840aa0bfc447158535d772b3453fa2ce7a99e87bbd8f6a5160c7538a993e9b1251c8396e8bc678a56353662b401b72494df058c6e4941f13ad05655ca34d571f93d2e175a2cb8937259668dd3dcf9e4c81edc3fd77464167affc3c39e34bff852c3c45cbde28f9b9a5f8a7e54763dc2fd970271cade79ae49d40a8706853eb116185a6eeef82745d18957e2ce01169c38bbc31c68684a47dbe3de542463771e9711de6c3476291034f5032ba18e8e924c4f30c4df96dbe15f2a5a55503a9cdd40a8f62fc5a70107df34a68cc6756c33a137be63540d2551218a248fe92dae21d922bef56a42d7bda739383ad9fd27d63c74d1d2253c752fc1f57e852e8bc912a8cb8f12d5b50d97569560d8661afdb00b7c711e23a31d1d025f13a9779343268b5233f9af589a9b2a17b7e9915dcc65c39c4a5612b3f74b6a30c8762280352b122afad7caafd1ae1883e7c5de831d539c605c21376469eb113e88abbcf5578c6b2e56445bdc6f6321b8eff24e97d43ecfcc62d1f4ebd4acfd63d4c69701050000800a27a7262196513700000000e1661800010000000000000000000000000000000000000000000000000000000000000000ffffffff0603e166180101ffffffff0480b2e60e000000001976a9146e82b7c719334e3aac3916872a088b548c43c9fb88ac286bee000000000017a9140c0bcca02f3cba01a5d7423ac3903d40586399eb8738c94d010000000017a914221c95f83bf073cfb76724ed23af737c1ee3bb498740787d010000000017a91471e1df05024288a00802de81e08c437859586c8787000000

View File

@ -224,9 +224,6 @@ lazy_static! {
(1_116_001, BLOCK_TESTNET_1116001_BYTES.as_ref()),
(1_326_100, BLOCK_TESTNET_1326100_BYTES.as_ref()),
(1_599_199, BLOCK_TESTNET_1599199_BYTES.as_ref()),
// Nu5
(1_599_200, BLOCK_TESTNET_1599200_BYTES.as_ref()),
(1_599_201, BLOCK_TESTNET_1599201_BYTES.as_ref()),
].iter().cloned().collect();
/// Testnet final Sprout roots, indexed by height.
@ -281,9 +278,6 @@ lazy_static! {
(1_116_001, SAPLING_FINAL_ROOT_TESTNET_1116001_BYTES.as_ref().try_into().unwrap()),
(1_326_100, SAPLING_FINAL_ROOT_TESTNET_1326100_BYTES.as_ref().try_into().unwrap()),
(1_599_199, SAPLING_FINAL_ROOT_TESTNET_1599199_BYTES.as_ref().try_into().unwrap()),
// Nu5
(1_599_200, SAPLING_FINAL_ROOT_TESTNET_1599200_BYTES.as_ref().try_into().unwrap()),
(1_599_201, SAPLING_FINAL_ROOT_TESTNET_1599201_BYTES.as_ref().try_into().unwrap()),
].iter().cloned().collect();
// Mainnet
@ -865,21 +859,9 @@ lazy_static! {
pub static ref BLOCK_TESTNET_1599199_BYTES: Vec<u8> =
<Vec<u8>>::from_hex(include_str!("block-test-1-599-199.txt").trim())
.expect("Block bytes are in valid hex representation");
pub static ref BLOCK_TESTNET_1599200_BYTES: Vec<u8> =
<Vec<u8>>::from_hex(include_str!("block-test-1-599-200.txt").trim())
.expect("Block bytes are in valid hex representation");
pub static ref BLOCK_TESTNET_1599201_BYTES: Vec<u8> =
<Vec<u8>>::from_hex(include_str!("block-test-1-599-201.txt").trim())
.expect("Block bytes are in valid hex representation");
pub static ref SAPLING_FINAL_ROOT_TESTNET_1599199_BYTES: [u8; 32] =
<[u8; 32]>::from_hex("4de75d10def701ad22ecc17517a3adc8789ea8c214ac5bfc917b8924377e6c89")
.expect("final root bytes are in valid hex representation").rev();
pub static ref SAPLING_FINAL_ROOT_TESTNET_1599200_BYTES: [u8; 32] =
<[u8; 32]>::from_hex("4de75d10def701ad22ecc17517a3adc8789ea8c214ac5bfc917b8924377e6c89")
.expect("final root bytes are in valid hex representation").rev();
pub static ref SAPLING_FINAL_ROOT_TESTNET_1599201_BYTES: [u8; 32] =
<[u8; 32]>::from_hex("4de75d10def701ad22ecc17517a3adc8789ea8c214ac5bfc917b8924377e6c89")
.expect("final root bytes are in valid hex representation").rev();
}
#[cfg(test)]

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff