-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
fix(op): ensure EthApiServer
helper trait method default impls, call OpEthApi
overrides
#9879
Conversation
…voked in default trait method calls
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.
This ensure that the default trait method impls kept by OpEthApi, will actually invoke the OpEthApi overrides of other trait methods.
can you please elaborate on this, not obvious to me what this pr fixes.
Adds getter trait methods for EthState and EthApiSpec, and moves impl of trait methods for EthApi, into default impl, to simplify impl for re-worked OpEthApi type
isn't the approach then implement everything that's required on opapi directly and not move more stuff to default impls or did I misunderstood this?
hope this is helpful to understand @mattsse https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=f22868e00a2b877425802be4fbbf2f65 |
gotcha, where do we have this problem rn? this sounds more like a general design problem due to the many helper traits with default impls |
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.
okay, now that I had some time to think about this, this makes perfect sense and we need to wrap the inner type as you highlighted
only have naming suggestion
pub type EthApiBuilderCtx<N> = reth_rpc_eth_types::EthApiBuilderCtx< | ||
<N as FullNodeTypes>::Provider, | ||
<N as FullNodeComponents>::Pool, | ||
<N as FullNodeComponents>::Evm, | ||
NetworkHandle, | ||
TaskExecutor, | ||
<N as FullNodeTypes>::Provider, |
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.
now your pr about the AT network type makes perfect sense to me,
perhaps we start by removing the taskexecutor generic and replace with Box<dyn>
? don't think the generic is actually useful
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.
actually, I'd like to replace both consensus trait object and task executor trait object with generics eventually. trait objects are great for things that aren't in scope for the whole program, but for consensus and task executor that isn't the case and we can make the smol perf gain by resolving them at compile time. also because we already have a great way to pass the components down to the FullNode
type, which is via the FullNodeComponents
trait.
made an issue #9872, will tackle it before continuing with #9774
6e78ab2
to
84265d2
Compare
Closes #9868
OpEthApi
withEthApiInner
. This ensure that the default trait method impls kept byOpEthApi
, will actually invoke theOpEthApi
overrides of other trait methods.EthApiServer
helper trait impls forOpEthApi
EthState
andEthApiSpec
, and moves impl of trait methods forEthApi
, into default impl, to simplify impl for re-workedOpEthApi
type