Candy Apple 🍎 - Beta 1
Pre-releaseNote: since this release no longer comes with breaking changes, we're republishing as a patch release, and unpublishing v3.0.0-beta.0 from the npm repository to avoid undue confusion.
Changes made since previous beta release:
- Fixed crash due to
Cannot read property 'gasPrice' of undefined
, #293 - Checks number of arguments in request matches required number of arguments for each method, fixes #255
- Makes
threads
argument tomining_start
optional, fixes #383 - Reverts default value of vmErrorsOnRPCResponse to
true
to avoid breaking change
Release highlights
- Introduces support for websockets, along with pub/sub support via
eth_subscribe
andeth_unsubscribe
- This finally makes it possible to use web3 1.0 with Ganache!
- Special thanks to @perissology and @MicahZoltu for their contributions on this!
- Fixes an incredibly annoying race condition, responsible for the vast majority of Ganache 1.0.0 and 1.0.1 crashes reported
- Contract runtime error reporting is now consistent with geth, Parity, and other clients
- Introduces
vmErrorsOnRPCResponse
option, which if set tofalse
will make runtime errors in contract code no longer causeweb3.eth.sendTransaction
to return promises which revert or to pass an error to the callback function. - When this option is enabled, you must check the
status
field of the transaction receipt to determine whether your transaction succeeded. Astatus
value of0x1
means success, and0x0
means failure. - Important:
- This is now
true
by default in this beta build, however we will likely enable it by default in a future, major release. - For discussion on why this change was made, please see "Important note about contract runtime error reporting" below.
- This is now
- Introduces
Note: This release is a beta, meaning we think it's going to be great, but we haven't put it through rigorous manual testing just yet. Please ping us in the truffle gitter channel or on twitter with your feedback, and raise issues for any problems which you discover!
Important note about contract runtime error reporting
One of the benefits of TestRPC early on (back before we called it ganache) was that when running a transaction that triggered a runtime error in your contract code, it would pass that runtime error object from the EVM back to your client application. This was achieved via the JSON RPC error
field in the response object.
Prior to the Byzantium hard fork, Ethereum RPC endpoints other than TestRPC couldn't reliably tell you whether or not your transaction succeeded or failed. The only way to tell if your transaction failed was to check whether the gasUsed
field in your transaction receipt matched the gas limit you specified on your transaction. But what if you set your gas limit perfectly? What does gasUsed == gasLimit
mean then? Fortunately, in the post Byzantium world the transaction receipt now includes a status
field, with a value of 0x1
for success, and 0x0
for failure.
The trade-off that we made in TestRPC in our pre-Byzantium days was that we'd fail fast and fail loudly (good), but if people wanted to write portable tests that ran against TestRPC and against other test networks they'd have to include network-specific branches in their transaction failure checks (bad). Further, over time we've come to observe that people new to Ethereum Dapp development may lean too heavily on ganache and not realize that they need to implement transaction failure checks which check their transaction receipt. This would mean that their tests might not fail on other test networks when they otherwise should be (ugly).
tl;dr: Now that Byzantium is here to stay, we've introduced the vmErrorsOnRPCResponse
option, which when set to false
, makes ganache-core
behave more like other clients. In this mode of operation, contract runtime errors encountered during transaction processing will no longer trigger a response object with the error
field set. You must now check the status
field of the transaction receipt to determine whether or not your transaction succeeded, as ganache will no longer cause web3.eth.sendTransaction
to populate the first argument (error) of the callback, or to reject the returned promise on contract runtime errors.
If you're used to determining why things failed by reading the message
on this error object, you can find the error in the logger output.
But keep in mind that error messages only go so far. It's nice to know that something failed, but I want to know why it failed. To answer that question, please check out truffle debug
- it'll change your life for the better!
Installation instructions
Since this is a beta release, you'll still get 2.0.2
if you follow the usual install instructions. Instead you need to install the beta
tag by doing the following:
npm install [email protected]
Other noteworthy changes
- No longer hangs on quit when clients connected (#365)
- Runs
eth_call
with correct block metadata (#205) - Adds the missing
logsBloom
field to the transaction receipt (#440) - Adds a
--defaultBalanceEther
flag so that you can specify the starting balance of auto-generated accounts. - Actually uses source maps when generating stack traces this time!
status
field of transaction receipt is now hex (#451)- adds
pesonal_importRawKey
(#31) - Various corrections to hex string encoding (more will be necessary, however - keep those issues coming!)
- Logs opcode operands on
debug_traceTransaction
(#10) - Doesn't crash on bad tx parameters, and accepts empty string in
to
field as null (#257)- Makes contract deployment from MEW work better
- Only reports error message in JSON RPC
error.message
field - useerror.data
for the stack trace- Makes logged error output more readable