@@ -120,7 +120,7 @@ pub struct ExtendedHeader {
120
120
#[ wasm_bindgen( skip) ]
121
121
pub validator_set : ValidatorSet ,
122
122
/// Header of the block data availability.
123
- #[ wasm_bindgen( skip ) ]
123
+ #[ wasm_bindgen( getter_with_clone ) ]
124
124
pub dah : DataAvailabilityHeader ,
125
125
}
126
126
@@ -464,28 +464,43 @@ impl ExtendedHeader {
464
464
to_value ( & self . validator_set )
465
465
}
466
466
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
-
473
467
/// Decode protobuf encoded header and then validate it.
474
468
#[ wasm_bindgen( js_name = validate) ]
475
469
pub fn js_validate ( & self ) -> Result < ( ) , JsValue > {
476
470
Ok ( self . validate ( ) ?)
477
471
}
478
472
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
479
480
#[ wasm_bindgen( js_name = verify) ]
480
481
pub fn js_verify ( & self , untrusted : & ExtendedHeader ) -> Result < ( ) , JsValue > {
481
482
Ok ( self . verify ( untrusted) ?)
482
483
}
483
484
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.
484
492
#[ wasm_bindgen( js_name = verify_range) ]
485
493
pub fn js_verify_range ( & self , untrusted : Vec < ExtendedHeader > ) -> Result < ( ) , JsValue > {
486
494
Ok ( self . verify_range ( & untrusted) ?)
487
495
}
488
496
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
489
504
#[ wasm_bindgen( js_name = verify_adjacent_range) ]
490
505
pub fn js_verify_adjacent_range ( & self , untrusted : Vec < ExtendedHeader > ) -> Result < ( ) , JsValue > {
491
506
Ok ( self . verify_adjacent_range ( & untrusted) ?)
0 commit comments