Skip to content

Commit 5ccd9e0

Browse files
committed
Fix tests
1 parent e2cd7e5 commit 5ccd9e0

File tree

3 files changed

+17
-13
lines changed

3 files changed

+17
-13
lines changed

zebra-consensus/src/orchard_zsa/tests.rs

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@ use color_eyre::eyre::Report;
2525
use tower::ServiceExt;
2626

2727
use orchard::{
28-
asset_record::AssetRecord, issuance::IssueAction, keys::IssuanceValidatingKey, note::AssetBase,
28+
issuance::{auth::IssueValidatingKey, auth::ZSASchnorr, AssetRecord, IssueAction},
29+
note::{AssetBase, AssetId},
2930
value::NoteValue,
3031
};
3132

@@ -84,11 +85,11 @@ fn process_burns<'a, I: Iterator<Item = &'a BurnItem>>(
8485
/// Processes orchard issue actions, increasing asset supply.
8586
fn process_issue_actions<'a, I: Iterator<Item = &'a IssueAction>>(
8687
asset_records: &mut AssetRecords,
87-
ik: &IssuanceValidatingKey,
88+
ik: &IssueValidatingKey<ZSASchnorr>,
8889
actions: I,
8990
) -> Result<(), AssetRecordsError> {
9091
for action in actions {
91-
let action_asset = AssetBase::derive(ik, action.asset_desc_hash());
92+
let action_asset = AssetBase::custom(&AssetId::new_v0(ik, action.asset_desc_hash()));
9293
let reference_note = action.get_reference_note();
9394
let is_finalized = action.is_finalized();
9495

@@ -118,8 +119,13 @@ fn process_issue_actions<'a, I: Iterator<Item = &'a IssueAction>>(
118119
match asset_records.entry(action_asset) {
119120
hash_map::Entry::Occupied(mut entry) => {
120121
let asset_record = entry.get_mut();
121-
asset_record.amount =
122-
(asset_record.amount + amount).ok_or(AssetRecordsError::AmountOverflow)?;
122+
asset_record.amount = NoteValue::from_raw(
123+
asset_record
124+
.amount
125+
.inner()
126+
.checked_add(amount.inner())
127+
.ok_or(AssetRecordsError::AmountOverflow)?,
128+
);
123129
if asset_record.is_finalized {
124130
return Err(AssetRecordsError::ModifyFinalized);
125131
}
@@ -258,9 +264,7 @@ async fn check_orchard_zsa_workflow() -> Result<(), Report> {
258264

259265
assert_eq!(
260266
asset_state.total_supply,
261-
// FIXME: Fix it after chaning ValueSum to NoteValue in AssetSupply in orchard
262-
u64::try_from(i128::from(asset_record.amount))
263-
.expect("asset supply amount should be within u64 range"),
267+
asset_record.amount.inner(),
264268
"Total supply mismatch for asset {:?}.",
265269
asset_base
266270
);

zebra-consensus/src/primitives/halo2/tests.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,13 +62,13 @@ where
6262
recipient,
6363
NoteValue::from_raw(note_value),
6464
// FIXME: Use another AssetBase for OrchardZSA?
65-
AssetBase::native(),
65+
AssetBase::zatoshi(),
6666
memo,
6767
)
6868
.unwrap();
6969
}
7070

71-
let bundle: Bundle<_, i64, Flavor> = builder.build(rng).unwrap().0;
71+
let bundle: Bundle<_, i64, Flavor> = builder.build(rng).unwrap().unwrap().0;
7272

7373
let bundle = bundle
7474
.create_proof(&proving_key, rng)
@@ -103,13 +103,13 @@ where
103103
};
104104
zebra_chain::orchard::shielded_data::AuthorizedAction {
105105
action,
106-
spend_auth_sig: <[u8; 64]>::from(a.authorization()).into(),
106+
spend_auth_sig: <[u8; 64]>::from(a.authorization().sig()).into(),
107107
}
108108
})
109109
.collect::<Vec<_>>()
110110
.try_into()
111111
.unwrap(),
112-
binding_sig: <[u8; 64]>::from(bundle.authorization().binding_signature()).into(),
112+
binding_sig: <[u8; 64]>::from(bundle.authorization().binding_signature().sig()).into(),
113113
#[cfg(feature = "tx_v6")]
114114
burn: bundle.burn().as_slice().into(),
115115
}

zebra-consensus/src/transaction/tests/prop.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -345,7 +345,7 @@ fn sanitize_transaction_version(
345345
Overwinter => 3,
346346
Sapling | Blossom | Heartwood | Canopy => 4,
347347
// FIXME: Use 6 for Nu7
348-
Nu5 | Nu6 | Nu7 => 5,
348+
Nu5 | Nu6 | Nu6_1 | Nu7 => 5,
349349
}
350350
};
351351

0 commit comments

Comments
 (0)