-
Notifications
You must be signed in to change notification settings - Fork 678
There should be a way to test overwriting pending transactions #484
Comments
100% this feature is imperative for testing complicated pending and cancelling scenarios. |
upvote +1 |
1 similar comment
upvote +1 |
Pending transaction support (with geth-like tx replacement mechanisms) is slated for the next major release. |
@davidmurdoch I see that the PR for fixing some of this has been merged. Is this feature now available on the next tag? I would be glad to try this for our tests and feedback on it's compatibility with the geth dev mode behaviour. |
@monokh it's not yet released. I'm close to cutting an alpha/internal release (it won't include forking). It also won't include the ability to use the "pending" block tag. If you can't still run your tests even with those caveats let me know and I'll tag you when I create the release. |
Thanks @davidmurdoch That still covers my use case. The main feature we required was correct handling of pending nonces, such that it is possible to bump transaction fee. |
@monokh Awesome, initially the price bump % amount will be hard coded to 10%; will this hard-coded limitation work for you? |
@monokh you can try it out via This version is pretty much guaranteed to have new bugs and regressions. And here is a list of known changes and breaking changes: #657 One of the biggest problems with the cli is that I forgot to add the I'll probably cut a few more internal release this week, so you can expect lots of changes coming soon. One final caveat: don't spend much time updating your tests as this release's API is not considered stable. If you do end up trying this release let me know how it goes, even if it's a catastrophic failure! |
@davidmurdoch The fee updating tests worked seamlessly when migrating from |
@davidmurdoch Actually I think i have found a regression in the latest version. |
That is great to hear, @monokh!
For many aspects I'd like to try to align more with geth, so if it's not too hard to pin point where we differ I'd greatly appreciate if you could provide more info.
I'll try to reproduce now, please send reproduction steps if you have them! Thanks again! |
False alarm. The actual issue was that the contract was not deployed. Tx receipt was returned with But the inconsistency with
I think this has always been the issue with Ganache though. |
@monokh I was unable to reproduce myself, but on the plus side, I nearly doubled the number of
No, I don't believe it should. I'll look into why this is happening.
The default transaction gas limit is will be configurable via cli eventually. With that said, I thought this behavior was in-line with geth's. I'll have to do more digging here. Thanks! |
@monokh it seems that geth changed from using the default |
RE:
@monokh I just checked geth's response for failed contract creation and it aligns with ours. Here are the steps I took to reproduce on geth:
curl commands for reproduction (update $ curl http://localhost:8545 -H 'Content-Type: application/json' --data '{"id": 1, "method": "eth_sendTransaction", "params":[ {"from": "0xb132A8a07e9E2e286AcE35110c294220d30E1e98", "gas": "0x10000", "data": "0x6080604052348015600f57600080fd5b50603f80601d6000396000f3fe6080604052600080fdfea2646970667358221220c7bc579e8a7331a8a5ca62d82e464a95365884707bfa3344d5810466213946b864736f6c63430007040033"} ]}'
{"jsonrpc":"2.0","id":1,"result":"0xfb83518ef1f2a26cc92407a9699c91bb79fdefa426ebddf0169895c0ea8c5dc3"}
$ curl http://localhost:8545 -H 'Content-Type: application/json' --data '{"id": 1, "method": "eth_getTransactionReceipt", "params":[ "0x58b6a55a1f987950d0229b8d359468b37afecece49a88cb40c18b689c665f326" ]}'
{"jsonrpc":"2.0","id":1,"result":{"blockHash":"0x3e2c7726d464898087a4167f4e704fa72d34d52ad45aa7568852d7848d302d0b","blockNumber":"0x1","contractAddress":"0xc134e0d5e31d0c362446c76931c74c15eae4f1fb","cumulativeGasUsed":"0x10000","from":"0x6293d184b8e1c893dd6be0315d8177b4dec1434b","gasUsed":"0x10000","logs":[],"logsBloom":"0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000","status":"0x0","to":null,"transactionHash":"0xfb83518ef1f2a26cc92407a9699c91bb79fdefa426ebddf0169895c0ea8c5dc3","transactionIndex":"0x0"}} We'll talk internally if we want to change our default behavior in this next major release, I imagine the answer is "Yes!", so I'd expect this to change in the near future. |
Thinking about it more, making this change will slow down This performance difference isn't really a concern for geth, as geth needs to worry about mining a block in ~15 seconds, not running a new transaction in 20 milliseconds. But for ganache, this could theoretically double the execution time of some test suites. If we do change anything, I'm now leaning towards making this behavior opt-in. |
@davidmurdoch Not estimating gas in the client sounds right if you are worried about the performance. I would ask though in that case for the default gas limit to be configurable. At the moment I have modified the tests to supply That was the only change that was required and everything else passed! Looking forward to seeing it in prod :) |
@monokh I've released |
done in [email protected] |
With the current functionality of Ganache Core, if you try to broadcast a transaction with a higher fee that has already been broadcast with the same nonce, you will receive the following error
the tx doesn't have the correct nonce. account has nonce of: 1 tx has nonce of: 0
.This is because it verifies the nonce itself before running against the vm https://github.com/trufflesuite/ganache-core/blob/283cbeca1cf9f9c598845a00baaa331afc621596/lib/statemanager.js#L965
ganache-core
does not currently support amempool
, although this WIP refactor by @davidmurdoch does support a mempool to some degree https://github.com/trufflesuite/ganache-core/blob/a4e8989efc301b28d094082297dfbb1c4b25a744/src/ledgers/ethereum/components/transaction-pool.ts#L80-L87A feature like this is incredibly important for DApp developers. Especially ones creating time sensitive DApps that need to ensure parties can overwrite pending transactions.
The text was updated successfully, but these errors were encountered: