-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
feat(provider): add block_range_with_senders #5647
feat(provider): add block_range_with_senders #5647
Conversation
@@ -1213,6 +1213,69 @@ impl<TX: DbTx> BlockReader for DatabaseProvider<TX> { | |||
} | |||
Ok(blocks) | |||
} | |||
|
|||
fn block_range_with_senders( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ptal @joshieDo
i like the direction, especially because we were recovering for every tx individually. However... There's A benchmark of |
|
@joshieDo I think this is right? @yash-atreya do you have a rough timeline for moving forward with this PR? |
Will try to get this over the line by the end of the coming week. |
checks whether senders exist in db else recovers.
feat(storage): fetches senders from db if available else recovers signer in block_range_with_senders
I was able to test on my archive node. However, this is the best case improvement without having to recover any signer as I'm an running an archive. The margin of improvement will decrease with different pruning configuration of a node.
I'd like to test and benchmark this against different pruning configurations. But need some pointers about how to navigate that. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if we can use the two existing functions here and zip the results?
block_range and get_take_block_transaction_range
senders_cursor.walk_range(tx_range)?.collect::<Result<Vec<_>, _>>()?; | ||
|
||
// This approach is similar to what is done in | ||
// `get_take_block_transaction_range`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we use the existing function here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
block_range
can be used here, but we still need the body_indices cursor to get theTxNumber
's in order to get thetx_range
to walk using the senders_cursor and also populate any missing senders after recovering them.get_take_block_transaction_range
cannot be used as it will require changing the trait bounds of theBlockReader
implementation to addDbTxMut
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moreover, since this is a read-only method and TAKE
would always be false in get_take_block_transaction_range
. I don't think it makes sense to use it.
ptal @joshieDo I don't like how this effectively duplicates the other functions, this should be easier |
friendly bump @joshieDo |
@joshieDo friendly bump here. |
Sorry for the delay, actually missed the numerous notifications. Unfortunately with #5191 , some of this code has to be transitioned to the new paradigm, where There are some examples on the usage (eg. Once again I'm sorry, I can take this PR forward with the new changes starting next week or two if you wish, given the delay and overall changes |
Let's pause on this as not P0 and Yash's on Foundry stuff, and we can revisit if you have capacity to take over post beta @joshieDo ? |
Mentioned in #5497 here
#5620 and #5630 address performance improvements in block-level tracing by retrieving
senders
of the txs from cache instead of recovering the signer from signed_transaction.This PR attempts to make a similar enhancement, however, by using the db instead of the cache.
a2a6a05 adds a new method to
BlockReader
for reading a range of blocks (likeblock_range
) along withsenders.
This method is namedblock_range_with_senders
and returnsProviderResult<Vec<BlockWithSenders>>.
5f69696 replace
block_range
withblock_range_with_senders
intrace_filter