-
-
Notifications
You must be signed in to change notification settings - Fork 38
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
eth_newPendingTransactionFilter
doesn't seem to work
#81
Labels
Comments
mcmire
added a commit
to MetaMask/test-dapp
that referenced
this issue
Dec 16, 2022
We have a PR in the extension repo which touches code around RPC middleware for filter- and subscription-based RPC methods, and we want to be able to test these methods manually to ensure they are still working as designed. In order to accomplish this, I've added new cards which allow the user to: * Create and remove a filter. * Currently there is support for creating a generic log filter via `eth_newFilter` as well as a block filter via `eth_newBlockFilter`. Once a filter is created, `eth_getFilterChanges` is then polled every 2 seconds. Filters are removed via `eth_uninstallFilter`. * I tried to add a button which created a pending transaction filter via `eth_newPendingTransactionFilter`, but it appears that `eth-json-rpc-filters` has a [bug](MetaMask/eth-json-rpc-filters#81) which prohibits this RPC method from working fully. * Start and stop a subscription. * As with filters, currently there is support for subscribing to new blocks via the `newHeads` parameter to `eth_subscribe` as well as new logs via the `logs` parameter. Subscriptions are stopped via `eth_unsubscribe`. * I also tried to add a button for subscribing to pending transactions, but [this doesn't seem to be supported outright by `eth-json-rpc-filters`](https://github.com/MetaMask/eth-json-rpc-filters/blob/5cbea3037b0655aa2c188d85b8ffe559a263dc0d/subscriptionManager.js#L50).
mcmire
added a commit
to MetaMask/test-dapp
that referenced
this issue
Dec 16, 2022
We have a PR in the extension repo which touches code around RPC middleware for filter- and subscription-based RPC methods, and we want to be able to test these methods manually to ensure they are still working as designed. In order to accomplish this, I've added new cards which allow the user to: * Create and remove a filter. * Currently there is support for creating a generic log filter via `eth_newFilter` as well as a block filter via `eth_newBlockFilter`. Once a filter is created, `eth_getFilterChanges` is then polled every 2 seconds. Filters are removed via `eth_uninstallFilter`. * I tried to add a button which created a pending transaction filter via `eth_newPendingTransactionFilter`, but it appears that `eth-json-rpc-filters` has a [bug](MetaMask/eth-json-rpc-filters#81) which prohibits this RPC method from working fully. * Start and stop a subscription. * As with filters, currently there is support for subscribing to new blocks via the `newHeads` parameter to `eth_subscribe` as well as new logs via the `logs` parameter. Subscriptions are stopped via `eth_unsubscribe`. * I also tried to add a button for subscribing to pending transactions, but [this doesn't seem to be supported outright by `eth-json-rpc-filters`](https://github.com/MetaMask/eth-json-rpc-filters/blob/5cbea3037b0655aa2c188d85b8ffe559a263dc0d/subscriptionManager.js#L50).
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
According to the Ethereum docs, this method will create a filter that tracks pending transactions. The results of this filter (and thus the transaction hashes) are available by calling
eth_getFilterChanges
with the filter id.However, the RPC method as implemented by this middleware doesn't seem to put anything in the filter changes. I believe this is happening because in TxFilter,
fromBlock
is always set to one block later thantoBlock
. This is opposition to BlockFilter, wherefromBlock
is merely set to one later thanoldBlock
buttoBlock
remains as the same asnewBlock
.Not only this, but the implementation also seems to be wrong. The docs seem to indicate that only pending transactions should show up in the filter changes. However, I am not seeing where the set of transactions is being filtered to just the pending ones. It seems that any time a new block arrives, then the hashes of the transactions in that block will show up in the pending transactions filter changes. As there is no unit test for this implementation, I cannot confirm this behavior, but that's what it looks like to me.
The text was updated successfully, but these errors were encountered: