@@ -225,14 +225,15 @@ impl RawRegistration {
225
225
& self ,
226
226
cddl_config : & CddlConfig ,
227
227
network_id : NetworkId ,
228
+ slot_no : SlotNo
228
229
) -> Result < SignedRegistration , Box < dyn Error > > {
229
230
// validate cddl: 61284
230
231
validate_reg_cddl ( & self . bin_reg , cddl_config) ?;
231
232
232
233
// validate cddl: 61285
233
234
validate_sig_cddl ( & self . bin_sig , cddl_config) ?;
234
235
235
- let registration = self . raw_reg_conversion ( network_id) ?;
236
+ let registration = self . raw_reg_conversion ( network_id, slot_no ) ?;
236
237
237
238
let signature = self . raw_sig_conversion ( ) ?;
238
239
@@ -245,7 +246,7 @@ impl RawRegistration {
245
246
} )
246
247
}
247
248
248
- fn raw_reg_conversion ( & self , network_id : NetworkId ) -> Result < Registration , Box < dyn Error > > {
249
+ fn raw_reg_conversion ( & self , network_id : NetworkId , slot_no : SlotNo ) -> Result < Registration , Box < dyn Error > > {
249
250
let decoded: ciborium:: value:: Value =
250
251
ciborium:: de:: from_reader ( Cursor :: new ( & self . bin_reg ) ) ?;
251
252
@@ -283,7 +284,11 @@ impl RawRegistration {
283
284
284
285
// A nonce that identifies that most recent delegation
285
286
let nonce = match inspect_nonce ( metamap) {
286
- Ok ( value) => value,
287
+ Ok ( value) => if value. 0 < slot_no. 0 { // Don't allow nonce > slot number
288
+ value
289
+ } else {
290
+ Nonce ( slot_no. 0 )
291
+ } ,
287
292
Err ( value) => return value,
288
293
} ;
289
294
0 commit comments