@@ -12,7 +12,7 @@ use pallas::ledger::traverse::MultiEraTx;
1212use super :: { DecodedMetadata , DecodedMetadataItem , DecodedMetadataValues , ValidationReport } ;
1313
1414/// CIP 36 Registration Data.
15- #[ derive( Clone , Debug , Default ) ]
15+ #[ derive( Clone , Default , Debug ) ]
1616pub struct Cip36 {
1717 pub cip36 : Cip36Registration ,
1818 pub validation : Cip36Validation ,
@@ -43,8 +43,8 @@ impl Cip36 {
4343 /// Nothing. IF CIP36 Metadata is found it will be updated in `decoded_metadata`.
4444 #[ allow( clippy:: too_many_lines) ]
4545 pub ( crate ) fn decode_and_validate (
46- decoded_metadata : & DecodedMetadata , slot : u64 , txn : & MultiEraTx ,
47- raw_aux_data : & TransactionAuxData , catalyst_strict : bool , network : Network ,
46+ decoded_metadata : & DecodedMetadata , slot : u64 , _txn : & MultiEraTx ,
47+ raw_aux_data : & TransactionAuxData , is_catalyst_strict : bool , network : Network ,
4848 ) {
4949 let Some ( k61284) = raw_aux_data. metadata ( MetadatumLabel :: CIP036_REGISTRATION ) else {
5050 return ;
@@ -58,7 +58,17 @@ impl Cip36 {
5858 let mut registration_witness = Decoder :: new ( k61285. as_ref ( ) ) ;
5959
6060 let key_registration = match Cip36KeyRegistration :: decode ( & mut key_registration, & mut ( ) ) {
61- Ok ( metadata) => metadata,
61+ Ok ( mut metadata) => {
62+ // FIXME: Don't like it here
63+ let nonce = if is_catalyst_strict && metadata. raw_nonce > slot {
64+ slot
65+ } else {
66+ metadata. raw_nonce
67+ } ;
68+
69+ metadata. nonce = nonce;
70+ metadata
71+ } ,
6272 Err ( e) => {
6373 Cip36 :: default ( ) . decoding_failed (
6474 & format ! ( "Failed to decode CIP36 Key Registration metadata: {e}" ) ,
@@ -84,13 +94,14 @@ impl Cip36 {
8494 } ,
8595 } ;
8696
97+
8798 let cip36 = Cip36Registration {
8899 key_registration,
89100 registration_witness,
90- is_catalyst_strict : catalyst_strict ,
101+ is_catalyst_strict : is_catalyst_strict ,
91102 } ;
92103
93- let validation = cip36. validate ( network, & k61284, & mut validation_report) ;
104+ let validation = cip36. validate ( network, k61284, & mut validation_report) ;
94105
95106 // Create a Cip509 struct and insert it into decoded_metadata
96107 decoded_metadata. 0 . insert (
0 commit comments