-
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
chore(rpc): default trait methods EthTransactions
#8639
Conversation
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 think this is very useful,
this pushes a lot of commonly used operations to traits and stacks them so functionality can be reused easily
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 like this a lot because this pushes lots of logic behind proper traits which should make reusing this a lot easier
TransactionSource, | ||
}; | ||
use std::sync::Arc; | ||
|
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.
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.
removing the whitespace makes fmt
order the std
deps alphabetically with the other deps. I think it's very helpful to see which std
deps are used easily by having it up top. kind of, in order of generality, since std
lib is dep of most other deps.
use std::*;
use reth_dep::*;
use crate::*;
use super::*;
/// Returns a handle for reading evm config. | ||
/// | ||
/// Data access in default (L1) trait method implementations. | ||
fn evm_config(&self) -> &impl ConfigureEvm; |
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'd also like to auto_impl for & if possible
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.
it's not possible, but not because atuo_impl
fails (which is the case for SpawnBlocking
, which has methods taking a closure with Self
as arg). I get this error, which I have a hunch is related to this rust-lang/rust#100013, since ConfigureEvm
trait uses GAT of specific lifetime.
error: lifetime may not live long enough
--> crates/rpc/rpc/src/eth/api/transactions.rs:80:9
|
79 | fn evm_config(&self) -> impl ConfigureEvm + '_ {
| - let's call the lifetime of this reference `'1`
80 | self.inner.evm_config()
| ^^^^^^^^^^^^^^^^^^^^^^^ returning this value requires that `'1` must outlive `'static`
Co-authored-by: Matthias Seitz <[email protected]>
… emhane/ethapi-txns
EthTransactions
impl involving state to default trait methodsEthState
for rpc methods related to stateLoadState
used inEthTransactions
,EthState
, debug, trace and call rpc methodsLeaves methods in
EthTransactions
impl, that are yet to be moved to default trait method impls so that they are ported to any network by default: