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

Asset Swaps #99

Open
wants to merge 37 commits into
base: zsa1
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
22ed1a0
Implement OrchardBundle enum
alexeykoren Oct 31, 2024
965a201
Clean up build warnings
alexeykoren Oct 31, 2024
f086799
Fix clippy warnings
alexeykoren Oct 31, 2024
7057e08
Remove OrchardZsaAuth
alexeykoren Nov 15, 2024
2b484bb
Fix zfuture
alexeykoren Nov 18, 2024
2e576ea
Fix client_backend
alexeykoren Nov 18, 2024
8b40281
Disable wasm CI target
alexeykoren Nov 19, 2024
ae6d2c2
Better handle errors
alexeykoren Dec 12, 2024
a8c8280
Re-enable CI wasm check
alexeykoren Dec 12, 2024
d3312c7
Switch to zsa1
alexeykoren Dec 12, 2024
63fedaa
Revert "Use correct Nu7 branch_id"
alexeykoren Dec 16, 2024
ffd6db0
Fmt
alexeykoren Dec 16, 2024
3f205c4
Downgrade Rust version
alexeykoren Dec 16, 2024
72b117b
Rebase to latest zsa1
alexeykoren Jan 26, 2025
fcc7c76
Implement OrchardBundle enum
alexeykoren Oct 31, 2024
0a682a0
Add swap bundle to enum
alexeykoren Nov 11, 2024
1a6e223
Add swapbundle basics
alexeykoren Jan 2, 2025
9149f73
Optimize imports
alexeykoren Jan 2, 2025
609834b
Add swap branch
alexeykoren Jan 2, 2025
a8272ae
Change swap zcash_unstable to nu6
alexeykoren Jan 2, 2025
2290253
Add SwapBundle digest
alexeykoren Jan 2, 2025
fa8d7ff
Add action groups
alexeykoren Jan 3, 2025
5c8b57d
Rework serialization (WIP)
alexeykoren Feb 3, 2025
727585c
Use updated Orchard
alexeykoren Feb 12, 2025
7581bea
Rebase
alexeykoren Feb 15, 2025
c6ece35
Add more tests
alexeykoren Feb 16, 2025
b4226a2
Add reference notes in tests
alexeykoren Feb 18, 2025
9bc3ff8
Fix lints and formatting
alexeykoren Feb 18, 2025
71994cb
Rollback dependencies
alexeykoren Feb 18, 2025
84399ba
Regenerate protobuffs
alexeykoren Feb 18, 2025
c8dac17
Update Orchard
alexeykoren Feb 18, 2025
9a5a5f8
Fix bundle type in test
alexeykoren Feb 24, 2025
dec0362
Copy dummy methods from Orchard
alexeykoren Feb 24, 2025
f0846bb
Add rust edition parameter to CI
alexeykoren Feb 27, 2025
38c4669
Remove ActionGroup structure
alexeykoren Mar 1, 2025
ed59831
Fmt
alexeykoren Mar 1, 2025
e039ec5
Move proof method to Authorization
alexeykoren Mar 1, 2025
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
Prev Previous commit
Next Next commit
Fix clippy warnings
  • Loading branch information
alexeykoren committed Feb 12, 2025
commit f0867997bcbefea337065938eb3fc514a5311828
32 changes: 17 additions & 15 deletions zcash_primitives/src/transaction/builder.rs
Original file line number Diff line number Diff line change
@@ -877,7 +877,7 @@ impl<'a, P: consensus::Parameters, U: sapling::builder::ProverProgress> Builder<
{
let (bundle, meta) = builder.build(&mut rng).map_err(Error::OrchardBuild)?;

unproven_orchard_bundle = Some(OrchardBundle::OrchardZSA(bundle));
unproven_orchard_bundle = Some(OrchardBundle::OrchardZSA(Box::new(bundle)));
orchard_meta = meta;
}
} else {
@@ -946,24 +946,26 @@ impl<'a, P: consensus::Parameters, U: sapling::builder::ProverProgress> Builder<
.map_err(Error::SaplingBuild)?;

let orchard_bundle: Option<OrchardBundle<_, _>> = match unauthed_tx.orchard_bundle {
Some(OrchardBundle::OrchardVanilla(b)) => Some(OrchardBundle::OrchardVanilla(
b.create_proof(
&orchard::circuit::ProvingKey::build::<OrchardVanilla>(),
&mut rng,
)
.and_then(|b| {
b.apply_signatures(
Some(OrchardBundle::OrchardVanilla(b)) => {
Some(OrchardBundle::OrchardVanilla(Box::new(
b.create_proof(
&orchard::circuit::ProvingKey::build::<OrchardVanilla>(),
&mut rng,
*shielded_sig_commitment.as_ref(),
&self.orchard_saks,
)
})
.unwrap(),
)),
.and_then(|b| {
b.apply_signatures(
&mut rng,
*shielded_sig_commitment.as_ref(),
&self.orchard_saks,
)
})
.unwrap(),
)))
}

#[cfg(zcash_unstable = "nu6" /* TODO nu7 */ )]
Some(OrchardBundle::OrchardZSA(b)) => Some(OrchardBundle::OrchardZSA(
b.create_proof(
Box::new(b.create_proof(
&orchard::circuit::ProvingKey::build::<OrchardZSA>(),
&mut rng,
)
@@ -975,7 +977,7 @@ impl<'a, P: consensus::Parameters, U: sapling::builder::ProverProgress> Builder<
)
})
.unwrap(),
)),
))),

None => None,
Some(_) => unreachable!(),
2 changes: 1 addition & 1 deletion zcash_primitives/src/transaction/components/orchard.rs
Original file line number Diff line number Diff line change
@@ -442,7 +442,7 @@ pub mod testing {
) -> OrchardBundle<Authorized> {
// overwrite the value balance, as we can't guarantee that the
// value doesn't exceed the MAX_MONEY bounds.
OrchardBundle::OrchardVanilla(bundle.try_map_value_balance::<_, (), _>(|_| Ok(orchard_value_balance)).unwrap())
OrchardBundle::OrchardVanilla(Box::new(bundle.try_map_value_balance::<_, (), _>(|_| Ok(orchard_value_balance)).unwrap()))
}
}

18 changes: 9 additions & 9 deletions zcash_primitives/src/transaction/mod.rs
Original file line number Diff line number Diff line change
@@ -374,9 +374,9 @@ impl PartialEq for Transaction {

#[derive(Debug, Clone)]
pub enum OrchardBundle<V: orchard::bundle::Authorization, Z: orchard::bundle::Authorization> {
OrchardVanilla(Bundle<V, Amount, OrchardVanilla>),
OrchardVanilla(Box<Bundle<V, Amount, OrchardVanilla>>),
#[cfg(zcash_unstable = "nu6" /* TODO nu7 */ )]
OrchardZSA(Bundle<Z, Amount, OrchardZSA>),
OrchardZSA(Box<Bundle<Z, Amount, OrchardZSA>>),
#[doc(hidden)]
_Phantom(PhantomData<Z>),
}
@@ -417,15 +417,15 @@ impl<V: orchard::bundle::Authorization, Z: orchard::bundle::Authorization> Orcha
#[cfg(zcash_unstable = "nu6" /* TODO nu7 */ )] step_zsa: impl FnOnce(&mut R2, Z) -> NZ,
) -> OrchardBundle<NV, NZ> {
match self {
OrchardBundle::OrchardVanilla(b) => {
OrchardBundle::OrchardVanilla(b.map_authorization(context, spend_auth, step))
}
OrchardBundle::OrchardVanilla(b) => OrchardBundle::OrchardVanilla(Box::new(
b.map_authorization(context, spend_auth, step),
)),
#[cfg(zcash_unstable = "nu6" /* TODO nu7 */ )]
OrchardBundle::OrchardZSA(b) => OrchardBundle::OrchardZSA(b.map_authorization(
OrchardBundle::OrchardZSA(b) => OrchardBundle::OrchardZSA(Box::new(b.map_authorization(
context_zsa,
spend_auth_zsa,
step_zsa,
)),
))),
_ => unreachable!(),
}
}
@@ -905,7 +905,7 @@ impl Transaction {
transparent_bundle,
sprout_bundle: None,
sapling_bundle,
orchard_bundle: orchard_bundle.map(OrchardBundle::OrchardVanilla),
orchard_bundle: orchard_bundle.map(|b| OrchardBundle::OrchardVanilla(Box::new(b))),
#[cfg(zcash_unstable = "nu6" /* TODO nu7 */ )]
issue_bundle: None,
#[cfg(zcash_unstable = "zfuture")]
@@ -960,7 +960,7 @@ impl Transaction {
transparent_bundle,
sprout_bundle: None,
sapling_bundle,
orchard_bundle: orchard_bundle.map(OrchardBundle::OrchardZSA),
orchard_bundle: orchard_bundle.map(|b| OrchardBundle::OrchardZSA(Box::new(b))),
issue_bundle,
#[cfg(zcash_unstable = "zfuture")]
tze_bundle,