Skip to content

Commit eaaa9a8

Browse files
committed
add more benchmarks
1 parent 036b767 commit eaaa9a8

File tree

3 files changed

+46
-6
lines changed

3 files changed

+46
-6
lines changed

ethereum/circuits/lib/benchmark.nr

Lines changed: 0 additions & 6 deletions
This file was deleted.
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
use crate::account::{AccountWithinBlock, get_account};
2+
use crate::header::{BlockHeaderPartial, get_header};
3+
use crate::log::{get_log, LogWithinBlock};
4+
use crate::misc::types::Address;
5+
use crate::receipt::{get_receipt, TxReceiptWithinBlock};
6+
use crate::transaction::{get_transaction, TransactionWithinBlock};
7+
8+
#[export]
9+
pub fn benchmark_get_account(chain_id: u32, block_no: u64, address: Address) -> AccountWithinBlock {
10+
let result = get_account(chain_id, block_no, address);
11+
result
12+
}
13+
14+
#[export]
15+
pub fn benchmark_get_header(chain_id: u32, block_no: u64) -> BlockHeaderPartial {
16+
let result = get_header(chain_id, block_no);
17+
result
18+
}
19+
20+
#[export]
21+
pub fn benchmark_get_receipt(chain_id: u32, block_no: u64, tx_idx: Field) -> TxReceiptWithinBlock {
22+
let result = get_receipt(chain_id, block_no, tx_idx);
23+
result
24+
}
25+
26+
#[export]
27+
pub fn benchmark_get_transaction(
28+
chain_id: u32,
29+
block_no: u64,
30+
tx_idx: Field,
31+
) -> TransactionWithinBlock<1000> {
32+
let result = get_transaction::<1000>(chain_id, block_no, tx_idx);
33+
result
34+
}
35+
36+
#[export]
37+
pub fn benchmark_get_log(
38+
chain_id: u32,
39+
block_no: u64,
40+
tx_idx: Field,
41+
log_idx: u32,
42+
) -> LogWithinBlock<1000> {
43+
let result = get_log::<1000, 1000>(chain_id, block_no, tx_idx, log_idx);
44+
result
45+
}

ethereum/circuits/lib/src/lib.nr

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,5 +25,6 @@ pub mod fixtures;
2525
pub(crate) mod verifiers;
2626
pub(crate) mod merkle_patricia_proofs;
2727
pub(crate) mod rlp;
28+
mod benchmark;
2829

2930
pub(crate) global HASH_LEN: u32 = 32;

0 commit comments

Comments
 (0)