Highlights
Breaking Changes
Fixes
New Features
Known Issues
Future Plans
This release is the third alpha release of the new and improved Ganache v7.0.0. You'll definitely want to catch up on the previous changes, if you haven't already, before reading on!
Thanks to everyone who tried out our previous alpha releases and provided feedback! You have been immensely helpful!
And special thanks to contributors, mentors, and reviewers: @MicaiahReid, @gnidan, @cds-amal, and @haltman-at. And special thanks to our community members for reporting and commenting on issues fixed by this release: @aliveli186, @winksaville, @anvacaru, @wilwade, and @moda20!
Not: this is still an alpha release; even these 7.0.0 release notes are "alpha" and the information here is likely incomplete. There will be bugs and kinks to work out before we ship things off to beta
, rc
, then finally to latest
. You absolutely should use this alpha release, but only to try it out and let us know where it breaks for you!
In other words: 🔥🐉 Here be dragons 🔥🐉️
To install globally run:
npm uninstall ganache-cli --global
npm install ganache@alpha --global
We've changed 131 files across 18 merged pull requests, tallying 37,511 additions and 35,611 deletions, since our last release.
These changes bring:
- Much faster forking performance! We've introduced two new caching layers that can reduce the run time of complex forking requests, like
debug_traceTransaction
, by over 30x! - Support for transaction traces over 1 GB in size
- Pre-built Docker containers and GitHub packages
- Dropped support for Node.js v10 (and v11)
- Added support for Node.js v17
- and more...
back to top
We've dropped support for Node.js v10 (and added v17) (#1519)
Node.js v10 reached its end of life in April of this year, and Truffle dropped support for it in October. Ganache is following suit in the v7.0.0 release.
This will simplify Ganache development and will result in smaller bundle sizes as we no longer need to transpile features available natively in Node v12 for Node v10.
back to top
So. Many. Fixes.
- Fixes various issues with EIP-1559 transactions
- Prevents a replaced, future-nonce transaction from being run alongside its replacement transaction
- Ganache now works in the browser on Firefox, Microsoft Edge, and Safari
- Handle initialization errors and handle fallback rejections for
server.listen
- Stop returning
baseFeePerGas
on pre-London blocks - Suppress annoying Windows startup warnings
- Support 1GB
debug_traceTransaction
responses
Fixes various issues with EIP-1559 transactions (#1307)
Previously, a transaction's effectiveGasPrice
was not stored in Ganache's database because, before London, this value was easy to calculate. After the introduction of the London hardfork defaulting to the previous gasPrice
would cause a type-2 transaction to have a different effectiveGasPrice
before and after saving to Ganache's database. Now, we store the effectiveGasPrice
in the database so the correct gas price for each transaction type can be retrieved when fetching the transaction.
We also use the EIP-1559 transaction's gas fields for eth_call
and accurately upgrade legacy type-0 transactions to type-2 transactions when certain data is omitted from the transaction.
back to fixes
Prevents a replaced, future-nonce transaction from being run alongside its replacement transaction (#1237)
It is possible to send a future-nonce transaction². You may also want to replace that future-nonce transaction. Before this fix, both the original and replacement future-nonce transaction would be executed. 😬
Previously, when an immediately executable transaction was received we'd check:
- do we have an executable transaction in the transaction pool from the same account?
- if so, does this new transaction have the same nonce as the one already in the pool?
- if so, is this new transaction's gas price better?
- if so, replace the previous transaction with this new one.
We now perform all of those same checks against the future-nonce transactions in the transaction pool, not just the executable transactions.
back to fixes
Ganache now works in the browser on Firefox, Microsoft Edge, and Safari (#1247)
🎉 YAY 🎉
back to fixes
Handle initialization errors and handle fallback rejections for server.listen
(#1227)
When you run const server = Ganache.server()
Ganache immediately begins initializing internal components, eagerly running dozens of asynchronous operations. But any one of these async operations could fail. Previously these failures would appear as an Unhandled Rejection.
We now handle these by delaying the exception until the call to server.listen
is made. If the call to Ganache.server
resulted in any initialization exceptions their rejection will be deferred until the callback or fulfillment of this listen
call.
back to fixes
Stop returning baseFeePerGas
on pre-London blocks (#1541)
When forking, a user may request a fork-point block that is before the London hardfork while London is actually activated in their Ganache instance. In Ganache v7 alpha.1, we'd return the block's baseFeePerGas
before that field actually existed on mainnet because London was technically enabled in Ganache. Now, we keep better track whether the baseFeePerGas
should be included or not.
back to fixes
Suppress annoying Windows startup warnings by using our prebuilt bigint-buffer fork (#1414)
On some platforms Ganache would issue a warning about falling back to a pure JS version of this library due to compilation not being possible. We now pre-compile the library for all supported platforms.
back to fixes
Support 1+ GB debug_traceTransaction
responses (#1339)
Ganache can now run debug_traceTransaction
on Ethereum's largest most complex transactions! Here's a shallow-dive on how we solved this:
The Problem
Node.js limits the size of strings to 256MB - 1GB, depending on the Node version, and larger transaction traces often exceed 1GB in size. You may think, "Simple! Just transmit the data in an ArrayBuffer
instead of using JSON.stringify
". But then you'd spend a whole day writing code to convert your JavaScript object directly to a Buffer only to find out that node limits the size of Buffers to about 2 GB (depending on the node version) and you are back to where you started! A trace of the recent Cream Finance hack is over 10GB!
The Solution
HTTP Packets and WebSocket Fragments! Now, whenever Ganache detects a large debug_traceTransaction
result (currently hardcoded to 100000 steps) it will start converting the trace results directly from their JavaScript object representation to UTF-8 encoded Buffers of each individual piece of data, skipping the JSON.stringify
ication step all together.
While our implementation is not yet an optimal solution, as we sometimes transmit single byte packets (over HTTP) or fragments (over WebSockets¹), and don't handle backpressure, it allows us to transmit arbitrarily large traces limited only by the memory allotted to the node process.
Of course, the receiving end of the trace needs to be able to handle the large amounts of data flowing in, and Truffle doesn't yet support this (see #4381 for work being done there).
back to fixes
back to top
- Much Faster Forking Performance
- Ganache Docker Images
- Support for
eth_signTypedData_v4
Much Faster Forking Performance (#1248, #1339)
We've added two new caching layers to Ganache's forking feature that greatly improve performance, making Ganache v7 alpha.2 up to 30x times faster than Ganache v7 alpha.1!
In Ganache v7-alpha.1 debug_traceTransaction
for transaction 0xa45166af02ee01ce2817b5a60862d758b4eae9449ad3f82f44c93818ea26e003 would previously take about 2 ½ minutes to compile and send.
With a warm cache this will now take about 3 ½ seconds! ~30x faster!
In-memory LRU cache
The first caching layer is an in-memory LRU cache. This cache will store previous forking request results in memory so successive calls during the same Ganache session don't have to make the expensive network request to fetch the data again.
Persistent cache
The second caching layer is the more interesting cache and utilizes @truffle/db's network algorithm to efficiently store and retrieve requests and their responses to a persistent disk-backed database.
What this enables is for Ganache to differentiate blockchain networks based not on their chainId or networkId, but the contents of historical blocks.
You can always delete this persistent cache by running Ganache with the --fork.deleteCache
flag. To disable both caches use the --fork.disableCache
flag.
back to features
Ganache Docker Images (#1318)
Our Docker image will stay up-to-date with our releases! To use them, simply run:
$ docker run --publish 8545:8545 trufflesuite/ganache:alpha
To pass options through to Ganache add the arguments to the run command:
docker run --publish 8545:8545 trufflesuite/ganache:alpha --accounts 20
^^^^^^^^^^^^^^
back to features
Support for eth_signTypedData_v4
(#1231)
We now support eth_signTypedData_v4
, which can be used to sign typed data. For more information on this signing method, see MetaMask's helpful guide.
back to features
back to top
- Ganache doesn't really lock accounts (#996)
eth_call
is not behaving as it should in alpha version (#1547)eth_call
should return JSON-RPC error on revert (#1496)asyncRequestProcessing
doesn't default totrue
like it is supposed to (#1532)web_sha3
should accept a hex-encoded string (#1375)- Our TypeScript types aren't properly exported (#1412)
- Forking's
chainId
shouldn't match the remote chain. We really should use a differentchainId
than the remote, but still be able to contextualize past transactions with their originalchainId
(#628) - We don't return a proper pending block (#772)
- Forking doesn't work in the browser
- Uncles aren't fully supported when forking
- Forking may fail in weird and unexpected ways. We need to "error better" here
- Node.js v12 outputs a µWS warning in the console
- Our bundle size is larger than ideal
back to top
- Support for enabling eligible draft EIPs before they are finalized or considered for inclusion in a hardfork.
- New hardfork support well in advance of the hardfork launch.
- Add an
eth_createAccessList
method. - Track test performance metrics over time.
- Track real world Ganache usage (opt-in and anonymized) to better tune performance and drive bug fixes and feature development.
- Track test coverage.
- Document how to use Ganache in the browser, and what limits it has.
evm_mine
will return the new blocks instead of just0x0
.- We've laid the groundwork for additional performance improvements. We expect to see an additional 2-5x speed up for typical testing work loads in the near future.
- Add new
evm_setCode
andevm_setStorageAt
RPC methods. - Make
evm_snapshot
ids globally unique (unpredictable instead of a counter). - Support
eth_getRawTransactionByHash
RPC method. - Support
debug_accountAt
RPC method. - Allow "mining" to be disabled on start up.
- Set CLI options via config file, package.json, or ENV vars.
- "Flavor" Plugins: We're building support for Layer 2 plugins into Ganache so we can start up and manage other chains. e.g., The
ganache filecoin
command will look for the@ganache/filecoin
package and start up a Filecoin and IPFS server. - Multi-chain configurations: you'll be able to start up your project's entire blockchain "ecosystem" from a single ganache command: e.g.,
ganache --flavor ethereum --flavor filecoin --flavor optimism
.- this is where defining your CLI options via JSON config will come in very handy!
- Integrate with Infura: e.g.,
ganache --fork mainnet
to fork mainnet via your own Infura account. - Create a CLI interactive/RELP mode.
- Enable a CLI daemon mode.
Open new issues (or join our team) to influence what we gets implemented and prioritized.
back to top
1. Thanks to @alexhultman for his work on the uWebsockets.js library!
2. Meaning: a transaction that will not be immediately executable but will stay in the transaction pool until the from
account's nonce catches up with that of the transaction
💖 The Truffle Team