Skip to content
This repository has been archived by the owner on Nov 6, 2020. It is now read-only.

Multi-call RPC #6195

Merged
merged 7 commits into from
Aug 4, 2017
Merged

Multi-call RPC #6195

merged 7 commits into from
Aug 4, 2017

Conversation

tomusdrw
Copy link
Collaborator

@tomusdrw tomusdrw commented Jul 31, 2017

Removes duplicated state-touching methods in miner, now client can forward all pending-block queries correctly if pending state is available and otherwise falls back to latest state.

Introduces parity_call and trace_callMany allowing to run many non-persistent, but dependent calls on a state (for instance deploy contract + query a function from that contract).

CC @kaikun213

@paritytech/core-devs Let me know if you prefer to review miner-client refactoring separetly from the feature I can split the PRs.

@tomusdrw tomusdrw added A0-pleasereview 🤓 Pull request needs code review. M4-core ⛓ Core client code / Rust. M6-rpcapi 📣 RPC API. labels Jul 31, 2017
@@ -389,4 +389,8 @@ impl Parity for ParityClient {
fn ipfs_cid(&self, content: Bytes) -> Result<String, Error> {
ipfs::cid(content)
}

fn call(&self, _requests: Vec<CallRequest>, _block: Trailing<BlockNumber>) -> BoxFuture<Vec<Bytes>, Error> {
future::err(errors::light_unimplemented(None)).boxed()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

implementation of this function will be tricky as discussed w/ @tomusdrw

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Logged #6202

@@ -907,7 +907,7 @@ impl Client {
pub fn state_at(&self, id: BlockId) -> Option<State<StateDB>> {
// fast path for latest state.
match id.clone() {
BlockId::Pending => return self.miner.pending_state().or_else(|| Some(self.state())),
BlockId::Pending => return self.miner.pending_state(self.chain.read().best_block_number()).or_else(|| Some(self.state())),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is block number required here? Does not the miner know the best pending state already?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The issue is that the pending state might be stalled, so we check that by comparing block numbers.
We had a similar thing earlier (at least for RPC), but the behaviour was very inconsistent - some stuff was going via the client and some via RPC.

@arkpar arkpar added A8-looksgood 🦄 Pull request is reviewed well. A7-looksgoodtestsfail 🤖 Pull request is reviewed well, but cannot be merged due to tests failing. and removed A0-pleasereview 🤓 Pull request needs code review. A8-looksgood 🦄 Pull request is reviewed well. labels Aug 2, 2017
@tomusdrw tomusdrw added A0-pleasereview 🤓 Pull request needs code review. and removed A7-looksgoodtestsfail 🤖 Pull request is reviewed well, but cannot be merged due to tests failing. labels Aug 3, 2017
@debris debris added A8-looksgood 🦄 Pull request is reviewed well. and removed A0-pleasereview 🤓 Pull request needs code review. labels Aug 4, 2017
@debris debris merged commit f157461 into master Aug 4, 2017
@debris debris deleted the multicall branch August 4, 2017 13:58
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
A8-looksgood 🦄 Pull request is reviewed well. M4-core ⛓ Core client code / Rust. M6-rpcapi 📣 RPC API.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants