fix: use alloy-trie for eth_getProof#7546
Conversation
alloy-trie for eth_getProofalloy-trie for eth_getProof
mattsse
left a comment
There was a problem hiding this comment.
amazing!
testing these is a bit hard...
I think we should get rid of all the tests/it/proof.rs helper code, and instead perhaps get some test vecs from somewhere else.
ptal @rkrasiuk @DaniPopes
| ] | ||
|
|
||
| [[package]] | ||
| name = "parity-util-mem" |
There was a problem hiding this comment.
this should allow enabling jemalloc for anvil
alloy-trie for eth_getProofalloy-trie for eth_getProof
mattsse
left a comment
There was a problem hiding this comment.
so much work for one endpoint -.-
last dep nit, lgtm
|
Tested on #7039 repro and don't see any differences, TPS is still drops significantly for low number of transactions in block |
|
Can you share a samply profile if you have it? Anyway can be in a follow up |
|
looking forward to this fix! |
|
@DaniPopes yeah, the overhead is definitely coming from state root calculation. It is negligible while the state is small but becomes much higher when it grows. https://share.firefox.dev/3VMJ8QM - this is a profile for a run which mined 1000 blocks with 10 simple CREATE transactions each, thus state at the end of execution contained 10.000 addresses |
|
You absolute hero. I owe you a beer - or several - @klkvr. |
Motivation
Closes #5004
Closes #5577
Solution
Changes eth_getProof logic to use alloy-trie crate. Changes
MaybeHashDatabasetrait toMaybeFullDatabaseas currently the only scenario in which we can obtain proofs is when using in-memory database and building trie from full state available in it.I've been testing proofs manually and they seem correct, however, the tests for them won't pass because they are still using parity libraries which seem to rely on different encoding making it impossible to decode correct eth_getProof outputs out-of-the box (ref #5004 (comment))
I'll probably change tests to concrete fixtures as it's done in Reth: https://github.com/paradigmxyz/reth/blob/112c8a3f1e1bcab1a1418e6150400012bc195548/crates/trie/src/proof.rs#L165