-
Notifications
You must be signed in to change notification settings - Fork 236
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
feature: ProviderCall #788
Conversation
b465c20
to
b1496cb
Compare
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.
makes sense,
this is still easy to follow imo
b1496cb
to
21b11f1
Compare
fix: rename to prov_call for disambiguation
068c2e4
to
f14aa77
Compare
the main problem right now is figuring out how to integrate it into |
hey @prestwich Taking this over, need it for #954 |
Would appreciate it if you have any pointers on how to move forward from here. I think only integrating |
* use `ClientRef` in EthCall instead of `WeakClient` * change lifetimes * add *_internal methods that return `EthCall`
This reverts commit 569d168.
|
@yash-atreya one thing I find a bit confusing here is that by design of I think one valid usecase for this PR is for example changing I think what we want for |
…1159) * feat: RpcCall:map_params * WithBlockInner * Ready variant * fmt * use ProviderCall * clippy + fmt * add From<F> * make ProviderCall::Ready return a result * add docs * Update request.rs Co-authored-by: DaniPopes <57450786+DaniPopes@users.noreply.github.com> * fmt --------- Co-authored-by: DaniPopes <57450786+DaniPopes@users.noreply.github.com>
@mattsse I believe this can be merged now |
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 should work now,
mind giving this another close look @klkvr ?
@yash-atreya wondering how do we decide which |
Sorry for the delayed response.
I believe subscribe/watch methods should be Also, any RPC method where we accept a parameter by reference, should be Rest can be made to return Should extension traits such as @mattsse wdyt? |
Lifetimes should be fine, we already have them in e.g.
We are already using |
We want to avoid introducing lifetimes in the trait as much as possible,
+1 |
use std::borrow::Cow; | ||
|
||
/// A caller that helper convert `RpcWithBlock` and `EthCall` into a `ProviderCall`. | ||
pub trait Caller<T, Params, Resp>: Send + Sync |
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.
given we're now wonly using this for EthCall
, I think we should make it more call-specific, eg make it accept TransactionRequest
, block and overrides directly to allow implementations to directly call underlying evm with them.
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.
lgtm overall, just a note on Caller
trait, we can address this in a follow-up
* feature: ProviderCall fix: rename to prov_call for disambiguation * refactor: replace output types * doc: add note about fn pointers * feat: convert `EthCall` to `ProviderCall` * use `ClientRef` in EthCall instead of `WeakClient` * change lifetimes * add *_internal methods that return `EthCall` * doc nits * use `ClientRef` instead of `WeakClient` in `RpcWithBlock` * Revert "use `ClientRef` instead of `WeakClient` in `RpcWithBlock`" This reverts commit 569d168. * feat: RpcCallWithBlock enum val in provider call * nits * feat: integrate `RpcWithBlock` into `ProviderCall` * rm `RpcWithBlock` val from ProviderCall * feat(provider): caller trait for with_block calls * rm `WeakClient` from `RpcWithBlock` * introduce `Caller` into `RpcWithBlock` * use `WithBlockCall` in `RpcWithBlock`. polling doesn't work. * nit * feat(provider): add `WithBlockFut` - polls `ProviderCall` and maps response. * nit * revert 2ff402 * Revert "feat: convert `EthCall` to `ProviderCall`" This reverts commit 1cb1579. * doc nits * feat(provider): introduce `Caller` to `EthCall`. Arc it so that its cloneable * feat(provider): add `EthCaller` - converts EthCall into ProviderCall and strengthen test * update `EthCallFut` * holds `ProviderCall` * removes Clone * impl poll_preparing and poll_running on `EthCallFut` instead of `EthCallFutInner` * poll `ProviderCall` in `EthCall`using `EthCaller` * removes WeakClient from `EthCall` * updates `EthCallFutInner::Running` to store map * nit * wrap Caller in Arc to make `RpcWithBlock` cloneable * store in `ProvideCall` fut instance in `States` * store `ProviderCall` fut in `EthCallFutInner` * feat(provider): add `ParamsWithBlock` for `RpcWithBlock` * rm `block_id` from `Caller` trait * impl `Caller` for `WeakClient` * refactor(`ProviderCall`): don't rely on `Caller` in `RpcWithBlock` (alloy-rs#1159) * feat: RpcCall:map_params * WithBlockInner * Ready variant * fmt * use ProviderCall * clippy + fmt * add From<F> * make ProviderCall::Ready return a result * add docs * Update request.rs Co-authored-by: DaniPopes <57450786+DaniPopes@users.noreply.github.com> * fmt --------- Co-authored-by: DaniPopes <57450786+DaniPopes@users.noreply.github.com> * refac(provider): use `ProviderCall` as return in trait * nit * doc nits * fix --------- Co-authored-by: Yash Atreya <44857776+yash-atreya@users.noreply.github.com> Co-authored-by: Arsenii Kulikov <klkvrr@gmail.com> Co-authored-by: DaniPopes <57450786+DaniPopes@users.noreply.github.com>
Closes #736
Motivation
Allow providers to get outputs from arbitrary sources, including synchronous
Solution
ProviderCall
future that wraps 4 data sources (rpc, batch rpc, other future, ready)drive-by:
into_owned_params
PR Checklist