Skip to content

Commit 3eb7126

Browse files
update decode_revocation_list
1 parent aa1aaec commit 3eb7126

File tree

1 file changed

+7
-7
lines changed
  • rust/rbac-registration/src/cardano/cip509/rbac

1 file changed

+7
-7
lines changed

rust/rbac-registration/src/cardano/cip509/rbac/metadata.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -132,8 +132,8 @@ impl Decode<'_, DecodeContext<'_, '_>> for Cip509RbacMetadata {
132132
},
133133
Cip509RbacMetadataInt::RevocationList => {
134134
match decode_revocation_list(d, decode_context.report) {
135-
Ok(v) => revocation_list = v,
136-
Err(()) => break,
135+
Some(v) => revocation_list = v,
136+
None => break,
137137
}
138138
},
139139
Cip509RbacMetadataInt::RoleSet => {
@@ -212,20 +212,20 @@ where T: Decode<'b, ProblemReport> {
212212
}
213213

214214
/// Decode an array of revocation list.
215-
fn decode_revocation_list(d: &mut Decoder, report: &ProblemReport) -> Result<Vec<CertKeyHash>, ()> {
215+
fn decode_revocation_list(d: &mut Decoder, report: &ProblemReport) -> Option<Vec<CertKeyHash>> {
216216
let context = "Cip509RbacMetadata revocation list";
217217
let len = match decode_array_len(d, context) {
218218
Ok(v) => v,
219219
Err(e) => {
220220
report.other(&format!("Unable to decode array length: {e:?}"), context);
221-
return Err(());
221+
return None;
222222
},
223223
};
224224
let len = match usize::try_from(len) {
225225
Ok(v) => v,
226226
Err(e) => {
227227
report.other(&format!("Invalid array length: {e:?}"), context);
228-
return Ok(Vec::new());
228+
return Some(Vec::new());
229229
},
230230
};
231231

@@ -238,7 +238,7 @@ fn decode_revocation_list(d: &mut Decoder, report: &ProblemReport) -> Result<Vec
238238
&format!("Unable to decode certificate hash bytes: {e:?}"),
239239
context,
240240
);
241-
return Err(());
241+
return None;
242242
},
243243
};
244244
match CertKeyHash::try_from(bytes) {
@@ -251,7 +251,7 @@ fn decode_revocation_list(d: &mut Decoder, report: &ProblemReport) -> Result<Vec
251251
},
252252
}
253253
}
254-
Ok(result)
254+
Some(result)
255255
}
256256

257257
/// Adds report entries if duplicated roles are found.

0 commit comments

Comments
 (0)