@@ -25,7 +25,8 @@ use color_eyre::eyre::Report;
2525use tower:: ServiceExt ;
2626
2727use 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.
8586fn 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 ) ;
0 commit comments