Adjust the code with librustzcash/zcash_protocol nu6 related changes

This commit is contained in:
Dmitry Demin 2024-09-04 10:51:26 +02:00
parent 61f9f95899
commit 2e9c089b10
2 changed files with 31 additions and 1 deletions

View File

@ -531,7 +531,12 @@ impl From<zcash_protocol::consensus::NetworkUpgrade> for NetworkUpgrade {
zcash_protocol::consensus::NetworkUpgrade::Heartwood => Self::Heartwood, zcash_protocol::consensus::NetworkUpgrade::Heartwood => Self::Heartwood,
zcash_protocol::consensus::NetworkUpgrade::Canopy => Self::Canopy, zcash_protocol::consensus::NetworkUpgrade::Canopy => Self::Canopy,
zcash_protocol::consensus::NetworkUpgrade::Nu5 => Self::Nu5, zcash_protocol::consensus::NetworkUpgrade::Nu5 => Self::Nu5,
// FIXME: remove cfg
#[cfg(zcash_unstable = "nu6")]
zcash_protocol::consensus::NetworkUpgrade::Nu6 => Self::Nu6, zcash_protocol::consensus::NetworkUpgrade::Nu6 => Self::Nu6,
// FIXME: remove cfg and process Nu7 properly (uses Self::Nu6 for now)
#[cfg(zcash_unstable = "nu6")]
zcash_protocol::consensus::NetworkUpgrade::Nu7 => Self::Nu6,
} }
} }
} }

View File

@ -137,6 +137,16 @@ impl zp_tx::components::orchard::MapAuth<orchard::bundle::Authorized, orchard::b
} }
} }
// FIXME: is this implemetation correct?
#[cfg(zcash_unstable = "nu6")]
impl zp_tx::components::issuance::MapIssueAuth<orchard::issuance::Signed, orchard::issuance::Signed>
for IdentityMap
{
fn map_issue_authorization(&self, s: orchard::issuance::Signed) -> orchard::issuance::Signed {
s
}
}
#[derive(Debug)] #[derive(Debug)]
struct PrecomputedAuth<'a> { struct PrecomputedAuth<'a> {
_phantom: std::marker::PhantomData<&'a ()>, _phantom: std::marker::PhantomData<&'a ()>,
@ -146,6 +156,14 @@ impl<'a> zp_tx::Authorization for PrecomputedAuth<'a> {
type TransparentAuth = TransparentAuth<'a>; type TransparentAuth = TransparentAuth<'a>;
type SaplingAuth = sapling_crypto::bundle::Authorized; type SaplingAuth = sapling_crypto::bundle::Authorized;
type OrchardAuth = orchard::bundle::Authorized; type OrchardAuth = orchard::bundle::Authorized;
// FIXME: is this correct?
#[cfg(zcash_unstable = "nu6")]
type OrchardZsaAuth = orchard::bundle::Authorized;
// FIXME: is this correct?
#[cfg(zcash_unstable = "nu6")]
type IssueAuth = orchard::issuance::Signed;
} }
// End of (mostly) copied code // End of (mostly) copied code
@ -275,7 +293,14 @@ impl<'a> PrecomputedTxData<'a> {
}; };
let tx_data: zp_tx::TransactionData<PrecomputedAuth> = alt_tx let tx_data: zp_tx::TransactionData<PrecomputedAuth> = alt_tx
.into_data() .into_data()
.map_authorization(f_transparent, IdentityMap, IdentityMap); // FIXME: do we need to pass another arg values or orchard_zsa and issue instead of IdentityMap?
.map_authorization(
f_transparent,
IdentityMap,
IdentityMap,
IdentityMap,
IdentityMap,
);
PrecomputedTxData { PrecomputedTxData {
tx_data, tx_data,