Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

V6/Nu7 implementation #73

Merged
merged 85 commits into from
Oct 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
85 commits
Select commit Hold shift + click to select a range
d58ac5b
minor update
PaulLaux Jan 10, 2023
f34dd02
updated version
PaulLaux Jan 12, 2023
b890183
commented out test code
PaulLaux Jan 12, 2023
f62a230
updated test and cleanup
PaulLaux Jan 23, 2023
a56c5da
New orchard version
alexeykoren Dec 18, 2022
d670033
Add TODO for burn reading/writing
alexeykoren Dec 18, 2022
c6175b8
fixed zcash_client_backend and simplified cargo.toml
PaulLaux Jan 24, 2023
af4d4bb
updated Cargo.toml
PaulLaux Jan 31, 2023
fbbd655
Fix post-rebase problems
alexeykoren May 13, 2024
424bf1a
Make BlockHeader from_data public
alexeykoren Jan 10, 2024
b0b0f65
Make txid bytes public
alexeykoren Jan 10, 2024
dac8d1f
Note serialization
alexeykoren Jan 10, 2024
cd8524b
Update zcash_primitives to use the generalised version of orchard cra…
dmidem Feb 29, 2024
3c83b72
Fix tests accordingly to modifications in orchard
dmidem Mar 4, 2024
aac4840
Minor fix or Rust code format (because of cargo fmt error)
dmidem Mar 5, 2024
6da0474
Fix post-rebase problems
alexeykoren May 13, 2024
0049a3b
Note serialization
alexeykoren Jan 10, 2024
98f4747
Update zcash_primitives to use the generalised version of orchard cra…
dmidem Feb 29, 2024
2365c2b
Introduce issue bundle
alexeykoren Mar 6, 2024
7e87fa5
Orchard domain interface update
alexeykoren Mar 29, 2024
2bd5e45
Work in progress
alexeykoren Apr 1, 2024
2704c8a
Add ZSA
alexeykoren Apr 15, 2024
5eec964
Add issuance
alexeykoren Apr 15, 2024
3a18a4d
Fix fmt
alexeykoren Apr 15, 2024
35f02fb
Fix clippy
alexeykoren Apr 15, 2024
2ab8e16
Fix transparent-inputs
alexeykoren Apr 15, 2024
c841df1
Remove unproven enum
alexeykoren Apr 22, 2024
fb2b73a
Change methods visibility
alexeykoren Apr 22, 2024
cdd8afa
Fix post-rebase compilation errors
alexeykoren May 19, 2024
5733e8d
Revert test vector changes for Nu5
alexeykoren May 19, 2024
008f35e
Change Nu6 activation heights
alexeykoren May 19, 2024
cbd3b38
Use updated sapling-crypto
alexeykoren May 20, 2024
307d025
Add into_transaction method
alexeykoren May 27, 2024
ce0a391
Use nu7 zcash_unstable flag
alexeykoren Jun 10, 2024
b7d4833
Fix transparent builder
alexeykoren Jun 11, 2024
aad64db
Exclude zcash_client crates
alexeykoren Jun 18, 2024
c0d551d
Fix formatting
alexeykoren Jun 18, 2024
944377d
Fix clippy
alexeykoren Jun 18, 2024
5856713
Fix merge issues
alexeykoren Jun 26, 2024
9ddc1a7
Adjust versions
alexeykoren Jun 26, 2024
c0fbc44
Add cargo vet exemption for half
alexeykoren Jun 26, 2024
1ffcf4e
Fix CI
alexeykoren Jun 26, 2024
beb1d8d
Fix tze build
alexeykoren Jun 26, 2024
fee70aa
Fix tze fmt
alexeykoren Jun 26, 2024
2c11d9a
Fix note_encryption version
alexeykoren Jun 26, 2024
918beb9
Disable wasm target
alexeykoren Jun 26, 2024
46ac12c
Replace nu7 with nu6 temporarily
alexeykoren Jun 27, 2024
6b743b8
Fix fmt
alexeykoren Jun 27, 2024
9b9e525
Update librustzcash to align with orchard crate (#67)
dmidem Jul 16, 2024
cac470f
Corrections to V7 transaction format and using updated test vectors (…
vivek-arte Jul 24, 2024
f160f25
Remove duplicate import
alexeykoren Jul 24, 2024
4dbee84
Reformat feature flag
alexeykoren Jul 25, 2024
8b9672d
Address PR comments
alexeykoren Jul 25, 2024
1860f1d
Address PR comments
alexeykoren Jul 25, 2024
f4cf872
Fmt
alexeykoren Jul 26, 2024
aec1879
Clippy
alexeykoren Jul 26, 2024
830260f
Use ZSA BundleType
alexeykoren Jul 26, 2024
acb8f97
Use bundle check instead of has_orchard_zsa
alexeykoren Jul 26, 2024
4f6ec46
Fix upper bound calculation
alexeykoren Jul 26, 2024
3d20879
Fmt
alexeykoren Jul 26, 2024
7f045e7
Add finalization
alexeykoren Jul 29, 2024
f411948
Add issuance builder tests
alexeykoren Jul 30, 2024
3ac2618
Fmt
alexeykoren Jul 30, 2024
ea1770e
Fix double import
alexeykoren Jul 30, 2024
fe88163
Use updated zsa1
alexeykoren Jul 31, 2024
fc38730
Fmt
alexeykoren Jul 31, 2024
6652222
Update zcash_primitives to sync with latest sapling-crypto changes (#70)
dmidem Aug 20, 2024
dc0a815
Minor changes
alexeykoren Aug 14, 2024
a434849
Change V7 to v6
alexeykoren Aug 19, 2024
9f52b1b
Make ciphertext reading generic
alexeykoren Aug 19, 2024
10ff1e0
Updated test vectors (#71)
vivek-arte Sep 3, 2024
f79962b
PR fixes
alexeykoren Sep 4, 2024
738ed17
PR fixes
alexeykoren Sep 4, 2024
25c6cd1
Uncomment CI
alexeykoren Sep 25, 2024
655d961
Add PR fixes
alexeykoren Sep 25, 2024
fc12237
PR Fixes
alexeykoren Sep 30, 2024
8a40922
Check build config in issuance
alexeykoren Sep 30, 2024
12a39c2
Add tx building to tests
alexeykoren Sep 30, 2024
9c51a46
Add test for burn
alexeykoren Oct 1, 2024
6283d33
Fmt
alexeykoren Oct 1, 2024
75e3b46
Simplify upper_bound calculation
alexeykoren Oct 1, 2024
4101a96
Fix clippy and missing lines
alexeykoren Oct 1, 2024
a0a7d38
Simplify imports
alexeykoren Oct 1, 2024
b2d7b18
PR fixes
alexeykoren Oct 8, 2024
798630a
updated syntax
PaulLaux Oct 10, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -193,9 +193,9 @@ jobs:
- name: Add zcash_proofs as a dependency of the synthetic crate
working-directory: ./ci-build
run: cargo add --no-default-features --path ../crates/zcash_proofs
- name: Add zcash_client_backend as a dependency of the synthetic crate
working-directory: ./ci-build
run: cargo add --features lightwalletd-tonic --path ../crates/zcash_client_backend
# - name: Add zcash_client_backend as a dependency of the synthetic crate
# working-directory: ./ci-build
# run: cargo add --features lightwalletd-tonic --path ../crates/zcash_client_backend
PaulLaux marked this conversation as resolved.
Show resolved Hide resolved
- name: Copy pinned dependencies into synthetic crate
run: cp crates/Cargo.lock ci-build/
- name: Add target
Expand Down
42 changes: 19 additions & 23 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ sapling = { package = "sapling-crypto", version = "0.1.3" }

# - Orchard
nonempty = "0.7"
orchard = { version = "0.8.0", default-features = false }
orchard = { version = "0.8.0", default-features = false, git = "https://github.com/QED-it/orchard", branch = "zsa1" }
pasta_curves = "0.5"

# - Transparent
Expand Down Expand Up @@ -124,4 +124,5 @@ panic = 'abort'
codegen-units = 1

[patch.crates-io]
orchard = { version = "0.8.0", git = "https://github.com/QED-it/orchard", branch = "zsa1" }
zcash_note_encryption = { version = "0.4", git = "https://github.com/QED-it/zcash_note_encryption", branch = "zsa1" }
sapling = { package = "sapling-crypto", version = "0.1.3", git = "https://github.com/QED-it/sapling-crypto", branch = "zsa1" }
81 changes: 70 additions & 11 deletions components/zcash_protocol/src/consensus.rs
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,9 @@ impl Parameters for MainNetwork {
NetworkUpgrade::Canopy => Some(BlockHeight(1_046_400)),
NetworkUpgrade::Nu5 => Some(BlockHeight(1_687_104)),
#[cfg(zcash_unstable = "nu6")]
NetworkUpgrade::Nu6 => None,
NetworkUpgrade::Nu6 => Some(BlockHeight(1_687_106)),
#[cfg(zcash_unstable = "nu6" /* TODO nu7 */ )]
NetworkUpgrade::Nu7 => Some(BlockHeight(1_687_107)),
#[cfg(zcash_unstable = "zfuture")]
NetworkUpgrade::ZFuture => None,
}
Expand Down Expand Up @@ -386,6 +388,8 @@ impl Parameters for TestNetwork {
NetworkUpgrade::Nu5 => Some(BlockHeight(1_842_420)),
#[cfg(zcash_unstable = "nu6")]
NetworkUpgrade::Nu6 => None,
#[cfg(zcash_unstable = "nu6" /* TODO nu7 */ )]
NetworkUpgrade::Nu7 => Some(BlockHeight(1_842_421)),
#[cfg(zcash_unstable = "zfuture")]
NetworkUpgrade::ZFuture => None,
}
Expand Down Expand Up @@ -454,6 +458,11 @@ pub enum NetworkUpgrade {
/// [Nu6]: https://z.cash/upgrade/nu6/
#[cfg(zcash_unstable = "nu6")]
Nu6,
/// The [Nu7] network upgrade.
///
/// [Nu7]: https://z.cash/upgrade/nu7/
#[cfg(zcash_unstable = "nu6" /* TODO nu7 */ )]
Nu7,
/// The ZFUTURE network upgrade.
///
/// This upgrade is expected never to activate on mainnet;
Expand All @@ -476,6 +485,8 @@ impl fmt::Display for NetworkUpgrade {
NetworkUpgrade::Nu5 => write!(f, "Nu5"),
#[cfg(zcash_unstable = "nu6")]
NetworkUpgrade::Nu6 => write!(f, "Nu6"),
#[cfg(zcash_unstable = "nu6" /* TODO nu7 */ )]
NetworkUpgrade::Nu7 => write!(f, "Nu7"),
#[cfg(zcash_unstable = "zfuture")]
NetworkUpgrade::ZFuture => write!(f, "ZFUTURE"),
}
Expand All @@ -493,6 +504,8 @@ impl NetworkUpgrade {
NetworkUpgrade::Nu5 => BranchId::Nu5,
#[cfg(zcash_unstable = "nu6")]
NetworkUpgrade::Nu6 => BranchId::Nu6,
#[cfg(zcash_unstable = "nu6" /* TODO nu7 */ )]
NetworkUpgrade::Nu7 => BranchId::Nu7,
#[cfg(zcash_unstable = "zfuture")]
NetworkUpgrade::ZFuture => BranchId::ZFuture,
}
Expand All @@ -512,6 +525,8 @@ const UPGRADES_IN_ORDER: &[NetworkUpgrade] = &[
NetworkUpgrade::Nu5,
#[cfg(zcash_unstable = "nu6")]
NetworkUpgrade::Nu6,
#[cfg(zcash_unstable = "nu6" /* TODO nu7 */ )]
NetworkUpgrade::Nu7,
];

/// The "grace period" defined in [ZIP 212].
Expand Down Expand Up @@ -551,6 +566,9 @@ pub enum BranchId {
/// The consensus rules deployed by [`NetworkUpgrade::Nu6`].
#[cfg(zcash_unstable = "nu6")]
Nu6,
/// The consensus rules deployed by [`NetworkUpgrade::Nu7`].
#[cfg(zcash_unstable = "nu6" /* TODO nu7 */ )]
Nu7,
/// Candidates for future consensus rules; this branch will never
/// activate on mainnet.
#[cfg(zcash_unstable = "zfuture")]
Expand All @@ -573,6 +591,8 @@ impl TryFrom<u32> for BranchId {
0xc2d6_d0b4 => Ok(BranchId::Nu5),
#[cfg(zcash_unstable = "nu6")]
0xc8e7_1055 => Ok(BranchId::Nu6),
#[cfg(zcash_unstable = "nu6" /* TODO nu7 */ )]
0x7777_7777 => Ok(BranchId::Nu7),
#[cfg(zcash_unstable = "zfuture")]
0xffff_ffff => Ok(BranchId::ZFuture),
_ => Err("Unknown consensus branch ID"),
Expand All @@ -592,6 +612,8 @@ impl From<BranchId> for u32 {
BranchId::Nu5 => 0xc2d6_d0b4,
#[cfg(zcash_unstable = "nu6")]
BranchId::Nu6 => 0xc8e7_1055,
#[cfg(zcash_unstable = "nu6" /* TODO nu7 */ )]
BranchId::Nu7 => 0x7777_7777,
#[cfg(zcash_unstable = "zfuture")]
BranchId::ZFuture => 0xffff_ffff,
}
Expand Down Expand Up @@ -657,15 +679,17 @@ impl BranchId {
BranchId::Canopy => params
.activation_height(NetworkUpgrade::Canopy)
.map(|lower| (lower, params.activation_height(NetworkUpgrade::Nu5))),
BranchId::Nu5 => params.activation_height(NetworkUpgrade::Nu5).map(|lower| {
#[cfg(zcash_unstable = "zfuture")]
let upper = params.activation_height(NetworkUpgrade::ZFuture);
#[cfg(not(zcash_unstable = "zfuture"))]
let upper = None;
(lower, upper)
}),
BranchId::Nu5 => params
.activation_height(NetworkUpgrade::Nu5)
.map(|lower| (lower, upper_bound(lower, params))),
#[cfg(zcash_unstable = "nu6")]
BranchId::Nu6 => None,
BranchId::Nu6 => params
.activation_height(NetworkUpgrade::Nu6)
.map(|lower| (lower, upper_bound(lower, params))),
#[cfg(zcash_unstable = "nu6" /* TODO nu7 */ )]
BranchId::Nu7 => params
.activation_height(NetworkUpgrade::Nu7)
.map(|lower| (lower, upper_bound(lower, params))),
#[cfg(zcash_unstable = "zfuture")]
BranchId::ZFuture => params
.activation_height(NetworkUpgrade::ZFuture)
Expand All @@ -677,6 +701,33 @@ impl BranchId {
!matches!(self, BranchId::Sprout | BranchId::Overwinter)
}
}
#[allow(unused_variables)]
fn upper_bound<P: Parameters>(target_height: BlockHeight, params: &P) -> Option<BlockHeight> {
#[allow(unused_mut)]
let mut upper = None;
#[cfg(zcash_unstable = "nu6")]
{
upper = params
.activation_height(NetworkUpgrade::Nu6)
.filter(|&nu_height| nu_height > target_height)
.or(upper);
}
#[cfg(zcash_unstable = "nu6" /* TODO nu7 */ )]
{
upper = params
.activation_height(NetworkUpgrade::Nu7)
.filter(|&nu_height| nu_height > target_height)
.or(upper);
}
#[cfg(zcash_unstable = "zfuture")]
{
upper = params
.activation_height(NetworkUpgrade::ZFuture)
.filter(|&nu_height| nu_height > target_height)
.or(upper);
}
upper
}
PaulLaux marked this conversation as resolved.
Show resolved Hide resolved

#[cfg(any(test, feature = "test-dependencies"))]
pub mod testing {
Expand All @@ -696,6 +747,8 @@ pub mod testing {
BranchId::Nu5,
#[cfg(zcash_unstable = "nu6")]
BranchId::Nu6,
#[cfg(zcash_unstable = "nu6" /* TODO nu7 */ )]
BranchId::Nu7,
#[cfg(zcash_unstable = "zfuture")]
BranchId::ZFuture,
])
Expand Down Expand Up @@ -789,9 +842,15 @@ mod tests {
BranchId::for_height(&MAIN_NETWORK, BlockHeight(1_687_104)),
BranchId::Nu5,
);
#[cfg(zcash_unstable = "nu6")]
assert_eq!(
BranchId::for_height(&MAIN_NETWORK, BlockHeight(5_000_000)),
BranchId::Nu5,
BranchId::for_height(&MAIN_NETWORK, BlockHeight(1_687_106)),
BranchId::Nu6,
);
#[cfg(zcash_unstable = "nu6" /* TODO nu7 */ )]
assert_eq!(
BranchId::for_height(&MAIN_NETWORK, BlockHeight(1_842_421)),
BranchId::Nu7,
);
}
}
Loading
Loading