-
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: implement Optimism builder DA limits #13757
base: main
Are you sure you want to change the base?
Conversation
/// Returns the estimated compressed size of a transaction. | ||
pub fn da_usage(&self) -> u64 { | ||
let mut tx_ser: Vec<u8> = Vec::new(); | ||
// TODO: check handling of deposit/blob txs - I think they're treated as 0 usage | ||
self.transaction.legacy().unwrap().eip2718_encode(&self.signature, &mut tx_ser); | ||
|
||
estimate_tx_compressed_size(&tx_ser) |
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.
kind of unfortunate perf wise if we need to serialize every tx, right? should this be memoized somehow?
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.
agreed - is there a standard way to memoize serialized values? I added a simple memoized property to the struct here, but there might be a better way to do it. d41de90
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.
we can do this if we change the OpTransactionSigned
type and a lazy field for this there, however this wouldn't enough for the building use case because this operates on OpPooledTx mostly, though luckily we can already provide different types for this.
I need to think about this a bit, because I had some ideas how we can improve the builder interface.
and ideally also solve the issue with repeated 2718 encoding as well.
Tested end-to-end using Kurtosis and setting block limits manually. I'm planning to add automated tests soon as well, but should be ready to review! |
Addresses #13131
This PR adds:
BestTransactionsAttributes
that will let us request all transactions under a certain DA sizeOpen question:
revm
currently isn't updated, so I'm referencing the needed crate using a git spec. We could also just clone the function into a reth crate and remove it once we updaterevm
if we want to avoid the git crate reference.