@@ -7,11 +7,13 @@ use bitcoin::Block;
77use moho_runtime_impl:: RuntimeInput ;
88use moho_runtime_interface:: MohoProgram ;
99use moho_types:: { ExportState , MohoState } ;
10- use strata_asm_common:: { AnchorState , AsmHistoryAccumulatorState , AuxData , ChainViewState } ;
10+ use ssz:: Encode ;
11+ use strata_asm_common:: {
12+ AnchorState , AsmHistoryAccumulatorState , AuxData , ChainViewState , HeaderVerificationState ,
13+ } ;
1114use strata_asm_params:: { AsmParams , SubprotocolInstance } ;
1215use strata_asm_spec:: StrataAsmSpec ;
1316use strata_btc_types:: { BlockHashExt , GenesisL1View } ;
14- use strata_btc_verification:: HeaderVerificationState ;
1517use strata_identifiers:: L1BlockCommitment ;
1618use strata_l1_txfmt:: MagicBytes ;
1719use strata_predicate:: PredicateKey ;
@@ -31,10 +33,7 @@ const SUBPROTOCOLS_JSON: &str = r#"[
3133/// Creates a single-step input from a fixed test Bitcoin block.
3234pub fn create_asm_step_input ( ) -> AsmStepInput {
3335 let block = BtcChainSegment :: load_full_block ( ) ;
34- AsmStepInput {
35- block : L1Block ( block) ,
36- aux_data : AuxData :: default ( ) ,
37- }
36+ AsmStepInput :: new ( L1Block ( block) , AuxData :: default ( ) )
3837}
3938
4039/// Builds a genesis L1 view whose tip is the parent of `block`.
@@ -65,7 +64,7 @@ pub fn create_genesis_anchor_state(block: &Block) -> AnchorState {
6564
6665 AnchorState {
6766 chain_view,
68- sections : Vec :: new ( ) ,
67+ sections : Vec :: new ( ) . into ( ) ,
6968 }
7069}
7170
@@ -97,19 +96,21 @@ pub fn create_moho_prestate(block: &Block) -> MohoState {
9796
9897/// Creates a runtime input for a single ASM STF step.
9998pub fn create_runtime_input ( step_input : & AsmStepInput ) -> RuntimeInput {
100- let inner_pre_state = create_genesis_anchor_state ( & step_input. block . 0 ) ;
101- let moho_pre_state = create_moho_prestate ( & step_input. block . 0 ) ;
99+ let block = step_input. block ( ) ;
100+ let inner_pre_state = create_genesis_anchor_state ( & block. 0 ) ;
101+ let moho_pre_state = create_moho_prestate ( & block. 0 ) ;
102102 RuntimeInput :: new (
103103 moho_pre_state,
104- borsh :: to_vec ( & inner_pre_state) . expect ( "borsh encode inner state" ) ,
105- borsh :: to_vec ( step_input) . expect ( "borsh encode step input" ) ,
104+ inner_pre_state. as_ssz_bytes ( ) ,
105+ step_input. as_ssz_bytes ( ) ,
106106 )
107107}
108108
109109/// Creates a matching `(RuntimeInput, StrataAsmSpec)` test pair.
110110pub fn create_runtime_input_and_spec ( ) -> ( RuntimeInput , StrataAsmSpec ) {
111111 let step_input = create_asm_step_input ( ) ;
112- let l1view = create_genesis_l1_view_to_process_block ( & step_input. block . 0 ) ;
112+ let block = step_input. block ( ) ;
113+ let l1view = create_genesis_l1_view_to_process_block ( & block. 0 ) ;
113114 let spec = create_asm_spec ( l1view) ;
114115 let runtime_input = create_runtime_input ( & step_input) ;
115116 ( runtime_input, spec)
0 commit comments