Skip to content

Commit 8a5582e

Browse files
committed
add more benchmarks
1 parent 036b767 commit 8a5582e

File tree

3 files changed

+34
-6
lines changed

3 files changed

+34
-6
lines changed

ethereum/circuits/lib/benchmark.nr

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

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)