Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

katana: parallelize commitment computations #2719

Open
kariy opened this issue Nov 25, 2024 · 3 comments
Open

katana: parallelize commitment computations #2719

kariy opened this issue Nov 25, 2024 · 3 comments

Comments

@kariy
Copy link
Member

kariy commented Nov 25, 2024

let state_root = self.compute_new_state_root();
let transactions_commitment = self.compute_transaction_commitment();
let events_commitment = self.compute_event_commitment();
let receipts_commitment = self.compute_receipt_commitment();
let state_diff_commitment = self.compute_state_diff_commitment();

fn compute_receipt_commitment(&self) -> Felt {
let receipt_hashes = self.receipts.iter().map(|r| r.compute_hash()).collect::<Vec<Felt>>();
compute_merkle_root::<hash::Poseidon>(&receipt_hashes).unwrap()
}

let mut hashes = Vec::new();
for (tx, event) in events {
let event_hash = event_hash(tx, event);
hashes.push(event_hash);
}

there are few places where we can parallelize these computations. also create a benchmark so that we can have an idea how much speed up we would get.

@Abeeujah
Copy link

Hi, Can I work on this?

@remybar
Copy link
Contributor

remybar commented Jan 13, 2025

Hey @kariy !

I can give it a try if still relevant 👍

@remybar
Copy link
Contributor

remybar commented Jan 13, 2025

I used rayon to parallelize the three code snippets and I created a basic benchmark with criterion.

But, to be able to have a rough idea of performance gain/loss, I would need some representative scenarios of UncommittedBlock to commit. At the moment, I've just put some random data to get the benchmark working.

Could you help me defining some representative UncommitedBlock ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants