Skip to content

Commit 2abc466

Browse files
committed
switch to getter, fix CI
1 parent b86fa7a commit 2abc466

File tree

1 file changed

+22
-7
lines changed

1 file changed

+22
-7
lines changed

types/src/extended_header.rs

Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ pub struct ExtendedHeader {
120120
#[wasm_bindgen(skip)]
121121
pub validator_set: ValidatorSet,
122122
/// Header of the block data availability.
123-
#[wasm_bindgen(skip)]
123+
#[wasm_bindgen(getter_with_clone)]
124124
pub dah: DataAvailabilityHeader,
125125
}
126126

@@ -464,28 +464,43 @@ impl ExtendedHeader {
464464
to_value(&self.validator_set)
465465
}
466466

467-
/// Header of the block data availability.
468-
#[wasm_bindgen(getter)]
469-
pub fn dah(&self) -> Result<JsValue, serde_wasm_bindgen::Error> {
470-
to_value(&self.validator_set)
471-
}
472-
473467
/// Decode protobuf encoded header and then validate it.
474468
#[wasm_bindgen(js_name = validate)]
475469
pub fn js_validate(&self) -> Result<(), JsValue> {
476470
Ok(self.validate()?)
477471
}
478472

473+
/// Verify a chain of adjacent untrusted headers and make sure
474+
/// they are adjacent to `self`.
475+
///
476+
/// # Errors
477+
///
478+
/// If verification fails, this function will return an error with a reason of failure.
479+
/// This function will also return an error if untrusted headers and `self` don't form contiguous range
479480
#[wasm_bindgen(js_name = verify)]
480481
pub fn js_verify(&self, untrusted: &ExtendedHeader) -> Result<(), JsValue> {
481482
Ok(self.verify(untrusted)?)
482483
}
483484

485+
/// Verify a chain of adjacent untrusted headers.
486+
///
487+
/// # Errors
488+
///
489+
/// If verification fails, this function will return an error with a reason of failure.
490+
/// This function will also return an error if untrusted headers are not adjacent
491+
/// to each other.
484492
#[wasm_bindgen(js_name = verify_range)]
485493
pub fn js_verify_range(&self, untrusted: Vec<ExtendedHeader>) -> Result<(), JsValue> {
486494
Ok(self.verify_range(&untrusted)?)
487495
}
488496

497+
/// Verify a chain of adjacent untrusted headers and make sure
498+
/// they are adjacent to `self`.
499+
///
500+
/// # Errors
501+
///
502+
/// If verification fails, this function will return an error with a reason of failure.
503+
/// This function will also return an error if untrusted headers and `self` don't form contiguous range
489504
#[wasm_bindgen(js_name = verify_adjacent_range)]
490505
pub fn js_verify_adjacent_range(&self, untrusted: Vec<ExtendedHeader>) -> Result<(), JsValue> {
491506
Ok(self.verify_adjacent_range(&untrusted)?)

0 commit comments

Comments
 (0)