@@ -4,7 +4,7 @@ use crate::instruction_encoder::field_representation;
44use crate :: {
55 COL_INDEX_FP , COL_INDEX_MEM_ADDRESS_A , COL_INDEX_MEM_ADDRESS_B , COL_INDEX_MEM_ADDRESS_C ,
66 COL_INDEX_MEM_VALUE_A , COL_INDEX_MEM_VALUE_B , COL_INDEX_MEM_VALUE_C , COL_INDEX_PC ,
7- LOG_MIN_POSEIDONS_16 , LOG_MIN_POSEIDONS_24 , N_TOTAL_COLUMNS ,
7+ LOG_MIN_DOT_PRODUCT_ROWS , LOG_MIN_POSEIDONS_16 , LOG_MIN_POSEIDONS_24 , N_TOTAL_COLUMNS ,
88} ;
99use lean_vm:: * ;
1010use p3_field:: Field ;
@@ -29,9 +29,21 @@ pub struct ExecutionTrace {
2929
3030pub fn get_execution_trace (
3131 bytecode : & Bytecode ,
32- execution_result : ExecutionResult ,
32+ mut execution_result : ExecutionResult ,
3333) -> ExecutionTrace {
3434 assert_eq ! ( execution_result. pcs. len( ) , execution_result. fps. len( ) ) ;
35+
36+ // padding to make proof work even on small programs (TODO make this more elegant)
37+ let min_cycles = 32 << LOG_MIN_DOT_PRODUCT_ROWS ;
38+ if execution_result. pcs . len ( ) < min_cycles {
39+ execution_result
40+ . pcs
41+ . resize ( min_cycles, * execution_result. pcs . last ( ) . unwrap ( ) ) ;
42+ execution_result
43+ . fps
44+ . resize ( min_cycles, * execution_result. fps . last ( ) . unwrap ( ) ) ;
45+ }
46+
3547 let n_cycles = execution_result. pcs . len ( ) ;
3648 let memory = & execution_result. memory ;
3749 let log_n_cycles_rounded_up = n_cycles. next_power_of_two ( ) . ilog2 ( ) as usize ;
0 commit comments