Skip to content

Commit e764505

Browse files
Merge pull request #297 from BitGo/otto/T1-3598-bump-zebra-chain
chore(wasm-utxo): bump zebra-chain 7→10, drop proc-macro-error2
2 parents 0fe0da2 + f354d6e commit e764505

4 files changed

Lines changed: 38 additions & 102 deletions

File tree

packages/wasm-utxo/Cargo.lock

Lines changed: 25 additions & 54 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/wasm-utxo/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ rstest = "0.26.1"
4848
pastey = "0.1"
4949

5050
[target.'cfg(not(target_arch = "wasm32"))'.dev-dependencies]
51-
zebra-chain = { version = "7.0", default-features = false }
51+
zebra-chain = { version = "10.0", default-features = false }
5252

5353
[build-dependencies]
5454
serde_json = "1.0"

packages/wasm-utxo/deny.toml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,3 @@
1-
[advisories]
2-
# core2 is unmaintained (RUSTSEC-2026-0105) but no safe upgrade is available;
3-
# it's a transitive dependency of zcash crates (zcash_encoding, zcash_primitives, zebra-chain).
4-
ignore = [{ id = "RUSTSEC-2026-0105" }]
5-
61
# Deny multiple versions of dependencies
72
[bans]
83
multiple-versions = "deny"

packages/wasm-utxo/src/zcash/mod.rs

Lines changed: 12 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -93,10 +93,7 @@ impl NetworkUpgrade {
9393
testnet_activation_height: 3536500,
9494
},
9595
// NU6.2: emergency hard fork re-enabling Orchard with the corrected circuit
96-
// after GHSA-ghc3-g8w4-whf9. Values match ZcashFoundation/zebra
97-
// `network_upgrade.rs` (CONSENSUS_BRANCH_IDS) / `constants::activation_heights`.
98-
// Not yet in the pinned zebra-chain 7.0 dependency, so the parity tests below
99-
// skip Nu6_2 and it is guarded by `test_nu6_2_constants` until the dep is bumped (T1-3519).
96+
// after GHSA-ghc3-g8w4-whf9.
10097
NetworkUpgrade::Nu6_2 => UpgradeParams {
10198
branch_id: 0x5437f330,
10299
mainnet_activation_height: 3364600,
@@ -168,22 +165,6 @@ mod tests {
168165
}
169166
}
170167

171-
/// NU6.2 is not yet in the pinned zebra-chain dependency (see T1-3519), so it is
172-
/// excluded from the parity tests below. Guard its hardcoded constants here instead.
173-
/// Source: ZcashFoundation/zebra network_upgrade.rs + constants::activation_heights.
174-
#[test]
175-
fn test_nu6_2_constants() {
176-
assert_eq!(NetworkUpgrade::Nu6_2.branch_id(), 0x5437f330);
177-
assert_eq!(NetworkUpgrade::Nu6_2.mainnet_activation_height(), 3_364_600);
178-
assert_eq!(NetworkUpgrade::Nu6_2.testnet_activation_height(), 4_052_000);
179-
// Heights at/after activation resolve to NU6.2; the block before stays NU6.1.
180-
assert_eq!(branch_id_for_height(3_364_600, true), Some(0x5437f330));
181-
assert_eq!(
182-
branch_id_for_height(3_364_599, true),
183-
Some(NetworkUpgrade::Nu6_1.branch_id())
184-
);
185-
}
186-
187168
/// Tests that verify our constants match zebra-chain crate.
188169
/// These tests are exhaustive - they verify ALL upgrades in zebra-chain
189170
/// and will fail if we're missing any.
@@ -195,11 +176,9 @@ mod tests {
195176
};
196177

197178
/// Map our NetworkUpgrade to zebra-chain's NetworkUpgrade.
198-
/// Returns `None` for upgrades not yet present in the pinned zebra-chain
199-
/// dependency (currently NU6.2 — see T1-3519). The match is otherwise exhaustive,
200-
/// so a new upgrade added here without a mapping will fail to compile.
201-
fn to_zebra_upgrade(upgrade: NetworkUpgrade) -> Option<ZebraNetworkUpgrade> {
202-
Some(match upgrade {
179+
/// This match is exhaustive — a new upgrade added here without a mapping will fail to compile.
180+
fn to_zebra_upgrade(upgrade: NetworkUpgrade) -> ZebraNetworkUpgrade {
181+
match upgrade {
203182
NetworkUpgrade::Overwinter => ZebraNetworkUpgrade::Overwinter,
204183
NetworkUpgrade::Sapling => ZebraNetworkUpgrade::Sapling,
205184
NetworkUpgrade::Blossom => ZebraNetworkUpgrade::Blossom,
@@ -208,9 +187,8 @@ mod tests {
208187
NetworkUpgrade::Nu5 => ZebraNetworkUpgrade::Nu5,
209188
NetworkUpgrade::Nu6 => ZebraNetworkUpgrade::Nu6,
210189
NetworkUpgrade::Nu6_1 => ZebraNetworkUpgrade::Nu6_1,
211-
// NU6.2 is not in pinned zebra-chain 7.0; validated by test_nu6_2_constants.
212-
NetworkUpgrade::Nu6_2 => return None,
213-
})
190+
NetworkUpgrade::Nu6_2 => ZebraNetworkUpgrade::Nu6_2,
191+
}
214192
}
215193

216194
/// Map zebra-chain's NetworkUpgrade to ours.
@@ -227,6 +205,7 @@ mod tests {
227205
ZebraNetworkUpgrade::Nu5 => Some(NetworkUpgrade::Nu5),
228206
ZebraNetworkUpgrade::Nu6 => Some(NetworkUpgrade::Nu6),
229207
ZebraNetworkUpgrade::Nu6_1 => Some(NetworkUpgrade::Nu6_1),
208+
ZebraNetworkUpgrade::Nu6_2 => Some(NetworkUpgrade::Nu6_2),
230209
#[cfg(any(test, feature = "zebra-test"))]
231210
ZebraNetworkUpgrade::Nu7 => None,
232211
#[cfg(zcash_unstable = "zfuture")]
@@ -263,18 +242,15 @@ mod tests {
263242
// Verify round-trip (zebra-known upgrades always map back to Some)
264243
assert_eq!(
265244
to_zebra_upgrade(our_upgrade),
266-
Some(zebra_upgrade),
245+
zebra_upgrade,
267246
"Round-trip failed for {:?}",
268247
zebra_upgrade
269248
);
270249
}
271250

272251
// Verify every upgrade in our ALL list maps to zebra.
273-
// NU6.2 is not yet in the pinned zebra-chain (T1-3519), so it is skipped here.
274252
for &our_upgrade in NetworkUpgrade::ALL {
275-
let Some(zebra_upgrade) = to_zebra_upgrade(our_upgrade) else {
276-
continue;
277-
};
253+
let zebra_upgrade = to_zebra_upgrade(our_upgrade);
278254
assert!(
279255
zebra_upgrade.branch_id().is_some(),
280256
"{:?} should have a branch ID",
@@ -286,9 +262,7 @@ mod tests {
286262
#[test]
287263
fn test_branch_ids_match_zebra() {
288264
for &upgrade in NetworkUpgrade::ALL {
289-
let Some(zebra_upgrade) = to_zebra_upgrade(upgrade) else {
290-
continue; // NU6.2 not in pinned zebra-chain (T1-3519)
291-
};
265+
let zebra_upgrade = to_zebra_upgrade(upgrade);
292266
let expected = zebra_upgrade
293267
.branch_id()
294268
.map(u32::from)
@@ -309,9 +283,7 @@ mod tests {
309283
fn test_mainnet_heights_match_zebra() {
310284
let network = ZebraNetwork::Mainnet;
311285
for &upgrade in NetworkUpgrade::ALL {
312-
let Some(zebra_upgrade) = to_zebra_upgrade(upgrade) else {
313-
continue; // NU6.2 not in pinned zebra-chain (T1-3519)
314-
};
286+
let zebra_upgrade = to_zebra_upgrade(upgrade);
315287
let expected = zebra_upgrade
316288
.activation_height(&network)
317289
.map(|h| h.0)
@@ -332,9 +304,7 @@ mod tests {
332304
fn test_testnet_heights_match_zebra() {
333305
let network = ZebraNetwork::new_default_testnet();
334306
for &upgrade in NetworkUpgrade::ALL {
335-
let Some(zebra_upgrade) = to_zebra_upgrade(upgrade) else {
336-
continue; // NU6.2 not in pinned zebra-chain (T1-3519)
337-
};
307+
let zebra_upgrade = to_zebra_upgrade(upgrade);
338308
let expected = zebra_upgrade
339309
.activation_height(&network)
340310
.map(|h| h.0)

0 commit comments

Comments
 (0)