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

Re-define pending state in RPC #5014

Closed
tomusdrw opened this issue Mar 23, 2017 · 7 comments
Closed

Re-define pending state in RPC #5014

tomusdrw opened this issue Mar 23, 2017 · 7 comments
Labels
F8-enhancement 🎊 An additional feature request. M6-rpcapi 📣 RPC API. P7-nicetohave 🐕 Issue is worth doing eventually.
Milestone

Comments

@tomusdrw
Copy link
Collaborator

Currently our pending state definition is quite pure: It's the state of a pending block (currently mined block) or latest canonical chain block if the node is not creating the pending block (light client/no mining/no --force-sealing).

For that reason we had to implement custom parity_nextNonce method to get a next available nonce for particular sender (including transactions in the queue).

Perhaps we should create some exceptions for methods like eth_getTransactionCount(address, 'pending') by default or under some CLI flag.

Problematic stuff: pending receipts, balance, storage_at, code_at, call, estimate_gas.

@5chdn
Copy link
Contributor

5chdn commented May 9, 2017

I'm tempted to close this as stale unless someone steps up to join this discussion on the pending state.

@paritytech/core-devs Please assign this issue to someone and decide on a deadline within 7 days, thanks.

@danfinlay
Copy link

Sorry for not jumping in sooner. Getting the current number of pending transactions is currently a difficult problem for consumers of the RPC.

The parity_nextNonce method is nice, but since it isn't cross-client compatible, any code written that uses it requires Parity as the backend, so it doesn't seem ideal to me.

Adding pending as a parameter to some transaction methods, like getTransactionCount would be very powerful, and allow remote signing clients to more easily set their nonces correctly.

Since the definition of pending right now is very pure, maybe a new parameter value could be chosen for this meaning, like pending_mining, or pending_inclusion.

@5chdn 5chdn added F8-enhancement 🎊 An additional feature request. and removed Z1-question 🙋‍♀️ Issue is a question. Closer should answer. labels Jun 9, 2017
@5chdn 5chdn added the P7-nicetohave 🐕 Issue is worth doing eventually. label Sep 5, 2017
@5chdn 5chdn added this to the 1.10 & ... milestone Oct 5, 2017
@tomusdrw
Copy link
Collaborator Author

tomusdrw commented Nov 16, 2017

Related: #6942

By running with --infinite-pending-block all transactions from the queue will be there and all RPC methods with argument pending will be able to respond "properly".
NOTE this executes all transactions in the queue and may require quite beefy hardware.

@5chdn 5chdn modified the milestones: 1.10, 1.11 Jan 23, 2018
@5chdn 5chdn modified the milestones: 1.11, 1.12 Mar 1, 2018
@5chdn 5chdn modified the milestones: 1.12, 1.13 Apr 24, 2018
@folsen
Copy link
Contributor

folsen commented May 19, 2018

@danfinlay (Going through stale issues here) Does @tomusdrw comment above satisfy your requirements in any way. I agree that anything that is dependent on parity-specific RPCs isn't going to be very nice to use, have you thought about opening an EIP for adding this? I would certainly support it.

@danfinlay
Copy link

At MetaMask, we've addressed this problem by tracking pending transactions locally.

This makes sense for us because we point at a load balanced cluster, can be pointed at different clients, and keep a transaction queue.

If we were the only ones holding this open, it could be fine to close it.

@folsen folsen closed this as completed May 20, 2018
@tempofeng
Copy link

@danfinlay Can you share how you guys tracking pending transactions locally? We're having this nonce problem as well.

@danfinlay
Copy link

@tempofeng We calculate the next nonce like this:
https://github.com/MetaMask/metamask-extension/blob/develop/app/scripts/controllers/transactions/nonce-tracker.js

This thread is probably the wrong place to discuss this. If you have a question about how MetaMask works, please open an issue there.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
F8-enhancement 🎊 An additional feature request. M6-rpcapi 📣 RPC API. P7-nicetohave 🐕 Issue is worth doing eventually.
Projects
None yet
Development

No branches or pull requests

5 participants