-
Notifications
You must be signed in to change notification settings - Fork 160
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
base: main
Are you sure you want to change the base?
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.
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.
hmm, this solution forces us to duplicate the trait functions and therefor doesn't solve the problem because ethcall still only supports rpccall.
the critical part is this:
let fut = client.request(method, params).map_resp(map); |
basically a transformer that takes the ethcall and converts it into a providercall, currently this is hardcoded to the rpc client, but ideally this is anything that can fn(ethcallparams) -> ProviderCall
this needs a different approach so that the ethcall and rpcwith block can be converted to any providercall.
fn call<'req>( | ||
&'req self, | ||
tx: &'req N::TransactionRequest, | ||
) -> ProviderCall<T, EthCallParams<'req, 'req, N>, Bytes, Bytes> { | ||
let call = self.call_internal(tx); | ||
call.into_provider_call() | ||
} |
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 is a breaking api change, that forces usage of call_internal if you want to use EthCall functions. I don't think this is what we want here, because this is very counter-intuitive.
let call = RpcWithBlock::new(self.weak_client(), "eth_getBalance", address); | ||
|
||
ProviderCall::from(call) |
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 does not really work, because this now erases the RpcWithBlock functions making this type a bit redundant.
/// RpcWithBlock | ||
RpcWithBlock(RpcWithBlock<Conn, Params, Resp, Output, Map>), |
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 looks like the same approach, just slightly modified.
all of this is a bit weird, because imo we need the inverse here, because rpcwithblock is just a helper type that drives something to completion. otherwise this doesn't solve the problem described in the issue. because this is restricted to rpcall:
/// Set the block id to "pending". | ||
pub fn pending(self) -> Self { | ||
self.block_id(BlockId::pending()) | ||
} |
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 leaks rpcwithblock features to provider call.
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