script/research/zkvm-metering: add CircuitCost measurements

This commit is contained in:
oars
2026-01-03 15:38:43 +03:00
parent 7c42e3020d
commit f974da8409
2 changed files with 53 additions and 0 deletions

View File

@@ -83,3 +83,52 @@ Once the `heaptrack` report is generated you can view it using `heaptrack_gui`.
| 12 | dao_auth_money_transfer | 2.6 MB | 145.6 kB | 7.6 kB |
| 13 | dao_auth_money_transfer_enc_coin | 2.5 MB | 145.6 kB | 7.6 kB |
#### Circuit Complexity Metrics
Circuit metrics highlighting the relative computational and memory
demands of each operation.
| Proof | k | max_deg | advice_columns | instance_queries | advice_queries | fixed_queries | lookups | permutation_cols | point_sets | max_rows | max_advice_rows | max_fixed_rows | num_fixed_columns | num_advice_columns | num_instance_columns | num_total_columns |
|----------------------------------|----|---------|----------------|------------------|----------------|---------------|---------|------------------|------------|----------|-----------------|----------------|-------------------|--------------------|----------------------|-------------------|
| sparse_merkle_root | 14 | 9 | 12 | 1 | 31 | 35 | 11 | 17 | 5 | 10455 | 10455 | 9434 | 35 | 12 | 1 | 48 |
| merkle_root | 11 | 9 | 12 | 1 | 31 | 35 | 11 | 17 | 5 | 1088 | 1088 | 1024 | 35 | 12 | 1 | 48 |
| poseidon_hash | 11 | 9 | 12 | 1 | 31 | 35 | 11 | 17 | 5 | 1024 | 41 | 1024 | 35 | 12 | 1 | 48 |
| base_add | 11 | 9 | 12 | 1 | 31 | 35 | 11 | 17 | 5 | 1024 | 3 | 1024 | 35 | 12 | 1 | 48 |
| base_mul | 11 | 9 | 12 | 1 | 31 | 35 | 11 | 17 | 5 | 1024 | 3 | 1024 | 35 | 12 | 1 | 48 |
| base_sub | 11 | 9 | 12 | 1 | 31 | 35 | 11 | 17 | 5 | 1024 | 3 | 1024 | 35 | 12 | 1 | 48 |
| ec_add | 11 | 9 | 12 | 1 | 31 | 35 | 11 | 17 | 5 | 1024 | 5 | 1024 | 35 | 12 | 1 | 48 |
| ec_mul | 11 | 9 | 12 | 1 | 31 | 35 | 11 | 17 | 5 | 1024 | 88 | 1024 | 35 | 12 | 1 | 48 |
| ec_mul_base | 11 | 9 | 12 | 1 | 31 | 35 | 11 | 17 | 5 | 1024 | 90 | 1024 | 35 | 12 | 1 | 48 |
| ec_mul_short | 11 | 9 | 12 | 1 | 31 | 35 | 11 | 17 | 5 | 1024 | 27 | 1024 | 35 | 12 | 1 | 48 |
| ec_mul_var_base | 11 | 9 | 12 | 1 | 31 | 35 | 11 | 17 | 5 | 1024 | 151 | 1024 | 35 | 12 | 1 | 48 |
| ec_get_x | 11 | 9 | 12 | 1 | 31 | 35 | 11 | 17 | 5 | 1024 | 2 | 1024 | 35 | 12 | 1 | 48 |
| ec_get_y | 11 | 9 | 12 | 1 | 31 | 35 | 11 | 17 | 5 | 1024 | 2 | 1024 | 35 | 12 | 1 | 48 |
| constrain_instance | 11 | 9 | 12 | 1 | 31 | 35 | 11 | 17 | 5 | 1024 | 2 | 1024 | 35 | 12 | 1 | 48 |
| constrain_equal_base | 11 | 9 | 12 | 1 | 31 | 35 | 11 | 17 | 5 | 1024 | 3 | 1024 | 35 | 12 | 1 | 48 |
| constrain_equal_point | 11 | 9 | 12 | 1 | 31 | 35 | 11 | 17 | 5 | 1024 | 3 | 1024 | 35 | 12 | 1 | 48 |
| bool_check | 11 | 9 | 12 | 1 | 31 | 35 | 11 | 17 | 5 | 1024 | 2 | 1024 | 35 | 12 | 1 | 48 |
| cond_select | 11 | 9 | 12 | 1 | 31 | 35 | 11 | 17 | 5 | 1024 | 4 | 1024 | 35 | 12 | 1 | 48 |
| zero_cond | 11 | 9 | 12 | 1 | 31 | 35 | 11 | 17 | 5 | 1024 | 3 | 1024 | 35 | 12 | 1 | 48 |
| less_than_strict | 11 | 9 | 12 | 1 | 31 | 35 | 11 | 17 | 5 | 1024 | 29 | 1024 | 35 | 12 | 1 | 48 |
| less_than_loose | 11 | 9 | 12 | 1 | 31 | 35 | 11 | 17 | 5 | 1024 | 29 | 1024 | 35 | 12 | 1 | 48 |
| range_check | 11 | 9 | 12 | 1 | 31 | 35 | 11 | 17 | 5 | 1024 | 10 | 1024 | 35 | 12 | 1 | 48 |
| witness_base | 11 | 9 | 12 | 1 | 31 | 35 | 11 | 17 | 5 | 1024 | 2 | 1024 | 35 | 12 | 1 | 48 |
| debug | 11 | 9 | 12 | 1 | 31 | 35 | 11 | 17 | 5 | 1024 | 2 | 1024 | 35 | 12 | 1 | 48 |
| Proof | k | max_deg | advice_columns | instance_queries | advice_queries | fixed_queries | lookups | permutation_cols | point_sets | max_rows | max_advice_rows | max_fixed_rows | num_fixed_columns | num_advice_columns | num_instance_columns | num_total_columns |
|----------------------------------|----|---------|----------------|------------------|----------------|---------------|---------|------------------|------------|----------|-----------------|----------------|-------------------|--------------------|----------------------|-------------------|
| money_mint_v1 | 11 | 9 | 12 | 1 | 31 | 35 | 11 | 17 | 5 | 1024 | 302 | 1024 | 35 | 12 | 1 | 48 |
| money_burn_v1 | 11 | 9 | 12 | 1 | 31 | 35 | 11 | 17 | 5 | 1448 | 1448 | 1431 | 35 | 12 | 1 | 48 |
| money_fee_v1 | 11 | 9 | 12 | 1 | 31 | 35 | 11 | 17 | 5 | 1713 | 1713 | 1696 | 35 | 12 | 1 | 48 |
| money_token_mint_v1 | 11 | 9 | 12 | 1 | 31 | 35 | 11 | 17 | 5 | 1024 | 242 | 1024 | 35 | 12 | 1 | 48 |
| money_auth_token_mint_v1 | 11 | 9 | 12 | 1 | 31 | 35 | 11 | 17 | 5 | 1024 | 202 | 1024 | 35 | 12 | 1 | 48 |
| dao_mint | 11 | 9 | 12 | 1 | 31 | 35 | 11 | 17 | 5 | 1024 | 901 | 1024 | 35 | 12 | 1 | 48 |
| dao_propose_input | 14 | 9 | 12 | 1 | 31 | 35 | 11 | 17 | 5 | 11658 | 11658 | 11328 | 35 | 12 | 1 | 48 |
| dao_propose_main | 11 | 9 | 12 | 1 | 31 | 35 | 11 | 17 | 5 | 1619 | 1619 | 1602 | 35 | 12 | 1 | 48 |
| dao_vote_input | 14 | 9 | 12 | 1 | 31 | 35 | 11 | 17 | 5 | 11739 | 11739 | 11408 | 35 | 12 | 1 | 48 |
| dao_vote_main | 11 | 9 | 12 | 1 | 31 | 35 | 11 | 17 | 5 | 1298 | 1298 | 1297 | 35 | 12 | 1 | 48 |
| dao_exec | 11 | 9 | 12 | 1 | 31 | 35 | 11 | 17 | 5 | 1024 | 888 | 1024 | 35 | 12 | 1 | 48 |
| dao_early_exec | 11 | 9 | 12 | 1 | 31 | 35 | 11 | 17 | 5 | 1024 | 976 | 1024 | 35 | 12 | 1 | 48 |
| dao_auth_money_transfer | 11 | 9 | 12 | 1 | 31 | 35 | 11 | 17 | 5 | 1182 | 1182 | 1181 | 35 | 12 | 1 | 48 |
| dao_auth_money_transfer_enc_coin | 11 | 9 | 12 | 1 | 31 | 35 | 11 | 17 | 5 | 1024 | 735 | 1024 | 35 | 12 | 1 | 48 |

View File

@@ -111,6 +111,10 @@ fn main() {
let public_inputs_export = serialize(&public_inputs);
let mut f = File::create(&public_inputs_file).unwrap();
f.write_all(&public_inputs_export).unwrap();
// Show circuit cost
let circuit_cost = CircuitCost::<Eq, ZkCircuit>::measure(zkbin.k, &circuit);
println!("{:#?}", circuit_cost);
}
}