Ganache Versions Save

:warning: The Truffle Suite is being sunset. For information on ongoing support, migration options and FAQs, visit the Consensys blog. Thank you for all the support over the years.

v7.3.0

1 year ago

 Highlights   New Features   Fixes   Miscellaneous   Changelog   Known Issues   Future Plans 


This is our third feature release since Ganache v7.0.0 launched almost 5 months ago! In this release we introduce not one, but two new features, fix four bugs, perform two chores, and introduce one huge performance improvement!

If you have some time, we encourage you to browse our issues to find anything you'd like implemented/fixed sooner and give them a +1; we'll use this community feedback to help prioritize what we work on! Or better yet, open a new issue, open a PR to fix an existing issue, or apply to join our team (we're hiring!) if you really want to get involved.

Speaking of the awesome community of Ganache users, we'd like to extend our gratitude to all issue openers (@gorbak25, @benjamincburns) and contributors (@robmcl4, @AuHau, @jeffsmale90, @tenthirtyone, @MicaiahReid) who were a part of this release!

All in all, we've changed 154 files across 10 merged pull requests, tallying 4788 additions and 4251 deletions, since our last release.


Highlights

The most noteworthy change in this release is likely the new TypeScript namespace for all RPC method parameters and return types. Check out the details below for more information!

Also worth mentioning is the new --miner.timestampIncrement option. When used in combination with the existing --chain.time option it introduces a new way of ensuring deterministic block timestamps that was previously very cumbersome and tedious to accomplish. Details below.

back to top


New Features


feat: create arm64 architecture docker build at release (#3037)

We now publish a Docker build for ARM v8 (ARM64) with every new ganache release, in addition to our AMD64 build. Now when you run docker run --publish 8545:8545 trufflesuite/ganache:latest on your M1 Mac (and other ARM64-based systems) you'll run a container built specifically for your processor's architecture.

back to new features

feat: add miner.timestampIncrement option (#3131)

We've been told that you all want us to have more meme content in our release notes. This is the best I could do this time (sorry, not sorry):

By default ganache uses the system clock time for automatically mined blocks. This behavior is convenient, but results in nondeterminism, invalid block timestamps[^1], and can cause issues with relative block timestamp dependent contracts and tests. There were workarounds for all of these issues (by manually mining via evm_mine({ timestamp })) but a built in solution was clearly necessary.

Ganache now enables the use of a new --miner.timestampIncrement option which can be used to set the amount of seconds between consecutive blocks, regardless of how much system time has passed. The default value, "clock", retains the previous default behavior of using the system time for each block.

The following example will start ganache instructing it to increment each new block's timestamp forward by 60 seconds from the initial starting time of 499162860000 (October 26 1985, as a Unix timestamp with millisecond precision):

$ ganache --time 499162860000 --miner.timestampIncrement=60

[^1]: The Ethereum Yellowpaper defines: $H_{\mathrm{s}} > P(H){_\mathrm{H_s}}$ where $H{\mathrm{_s}}$ is the timestamp of block $H$ and $P(H)$ is the parent block. Or in other words: a block's timestamp must be greater than its parent block's timestamp.

back to new features

back to top


Fixes


fix: eth_getTransactionByBlockNumberAndIndex and eth_getTransactionByBlockHashAndIndex to respect non-zero transaction index (#3118)

Both eth_getTransactionByBlockNumberAndIndex and eth_getTransactionByBlockHashAndIndex accept an index parameter to indicate the which transaction within the block to return.

Previous to this fix, both functions would return the 0th (first) transaction within the block, regardless of the value passed.

back to fixes

fix: add new Ethereum types namespace to fix types (#2527)

We fixed our Ethereum RPC types and put them in a new namespace: Ethereum! Use it as follows:

import Ganache, {ProviderOptions, Ethereum} from "ganache";

async function getLatestBlock(): Promise<Ethereum.Block> {
  return await provider.request({method: "eth_getBlockByNumber", params: ["latest"]});
}
async function getAccounts(): Promise<string[]> {
  return await provider.request({method: "eth_accounts", params: []});
}
async function sendTransaction(transaction: Ethereum.Transaction): Promise<string> {
  return await provider.request({method: "eth_sendTransaction", params: [transaction]});
}

const options: ProviderOptions = {
  fork: { network: "mainnet" }
};
const provider = Ganache.provider(options);
const accounts  = await getAccounts();
const block = await getLatestBlock();
console.log(block.number); // string
const transaction: Ethereum.Transaction = { from: accounts[0], to: accounts[2], value: "0xffff" };
const hash = await sendTransaction(transaction);
console.log(hash); // string

If you find issues or can think of ways we can further improve our types please open a New Issue (you can view all existing type issues by filtering our issues by the typescript label).

fixes #2134

back to fixes

fix: save evm_mine blocks before returning (#3016)

Though it was rare, sometimes calling evm_mine would return before the mined block was actually saved. If you polled for the block that Ganache had claimed to mine directly after calling evm_mine, that block could not yet exist.
This change ensures that the block is saved before emitting the "newHeads" subscription message and before returning during an evm_mine. Fixes #3060.

Potential Side Effect

This change does have one potential side effect, though we really doubt anyone should be impacted, and we consider it a bug fix. Sometimes when a block is mined, Ganache waits until the next iteration of the event loop (using setImmediate) to emit the mined block. This is to ensure that the user has time to listen for the new block's "message" before Ganache emits it.

Previously, Ganache would delay emitting this event if --miner.instamine="eager" AND --miner.blockTime=0. These settings mean that transactions are saved before returning the transaction (as apposed to returning a hash as the transaction enters the transaction pool in "strict" mode), and the miner immediately starts mining transactions as they enter the transaction pool (as opposed to mining a block every blockTime seconds).*

Now, Ganache delays emitting this event when --miner.instamine="eager" regardless of how blockTime is set. The instamine mode affects when the transaction is returned to the user, so it should be the driving factor behind delaying the event. If in --miner.blockTime=0 mode (the default) you somehow relied on the event being emitted at a very specific event tick, this may cause issues for you. For most of us mere mortal developers, this won't make a difference.

*Note: We'll have a blog post or discussion providing a deeper dive into all of our mining modes soon that should help further clarify --miner.instamine, --miner.blockTime, and --chain.vmErrorsOnRPCResponse.

back to fixes

fix: only mine one block in interval mining (#3032)

In a real Ethereum node, blocks are committed approximately every 15 seconds. Ganache allows users to configure how often this mining takes place in this "interval" mining mode with the --miner.blockTime flag, and it allows users to "instamine" transactions by setting --miner.blockTime=0 (the default).
For each block that is made in a real Ethereum node, the transactions that are included on the block is based off of many factors including the number of transactions in the transaction pool, the gas price and gas limit of those transactions, and the block's gas limit. Regardless of the ordering, the number of transactions included on the block is limited by that block gas limit. Then, once a single block is mined, approximately 15 seconds elapses before another block is generated.

In the interval mining mode before this change, Ganache would begin mining after the blockTime elapses, but it would mine all transactions in the pool, regardless of how many blocks it would take. This change fixes Ganache's behavior to be more like a real Ethereum node. Now only one block will be mined whenever blockTime elapses, even if that means leaving some transactions in the transaction pool until the next block is generated. This change fixes #3030.

back to fixes

back to top


Miscellaneous


docs: update Node.js version recommendation in README (#3038)

We haven't supported Node.js v10 for a while now; the recommendation in our README.md to use Node.js v10 has been updated to reflect our actual support: at least Node v12 and npm v6.12.0.

back to miscellaneous

chore: throw if name arg in create script includes scope (#3108)

This may be a small change to an internal-facing script, but it is still a big deal: this is the first contribution to the newest member of the Ganache team: @tenthirtyone! Welcome to the team!

back to miscellaneous

chore: add relevant keywords to ganache's package.json (#3151)

Users reported that it was difficult to find the ganache package in the npm registry because they were used to searching for ganache-cli and ganache-core. This change adds those terms to our package.json's "keywords" list, which hopefully alleviates the problem.
Fixes #3143

back to miscellaneous

perf: speed up large transaction traces by buffering fragmented send (#2634)

We introduced the ability to return huge transaction traces in v7.0.0, but that ability came with a cost: it was about 30x slower than it needed to be!

Thanks to work started by @robmcl4 large transaction traces (traces with more than 100000 structLogs) are now consistently more than 30x faster than in previous versions in both WebSocket and HTTP transports. This means that transaction traces that used to take 8 minutes now takes less than 10 seconds!

If you don't mind reading some JavaScript and like reasoning about JavaScript Generator logic you should take a look at the PR that made this performance bump possible!

back to miscellaneous

back to top


Changelog

  • #2527 fix: add new Ethereum types namespace to fix types (@davidmurdoch)
  • #3038 docs: update Node.js version recommendation in README (@davidmurdoch)
  • #3108 chore: throw if name arg in create script includes scope (@tenthirtyone)
  • #3037 feat: create arm64 architecture docker build at release (@AuHau)
  • #3151 chore: add relevant keywords to ganache's package.json (@davidmurdoch)
  • #3016 fix: save evm_mine blocks before returning (@MicaiahReid)
  • #3032 fix: only mine one block in interval mining (@MicaiahReid)
  • #2634 perf: speed up large transaction traces by buffering fragmented send (@robmcl4)
  • #3131 feat: add miner.timestampIncrement option (@davidmurdoch)

back to top


Known Issues

Top Priority:

  • Unable to install Ganache (npm) on MacOS 10.15.7 (#2445)
  • get forking working in the browser (#1245)
  • Implement eth_getProof RPC message (#382)

Coming Soon™:

  • debug_traceTransaction may crash on Node.js v12 (#2106)
  • evm_mine and miner_start don't respect --mode.instamine=eager (#2029)
  • evm_setAccountNonce is race-conditiony (#1646)
  • Add eth_feeHistory RPC endpoint (#1470)
  • @ganache/filecoin@alpha doesn't work with ganache@alpha (#1150)
  • sort executable/pending transactions that have the same price by the time at which the transaction was submitted (#1104)
  • Add eth_createAccessList RPC method (#1056)
  • Launching ganache with fork is throwing revert errors when communicating with 3rd party contracts (#956)
  • Build a real pending block! (#772)
  • Add an upper limit to # of accounts that can be generated by ganache (#736)
  • Incorrect gas cost for SSTORE opcode when using fork feature (#625)
  • Cannot get state root with uncommitted checkpoints error when starting ganache forking with infura RPC endpoint (#618)
  • --db Option Requires Same Mnemonic and Network ID (#1030)

back to top


Future Plans

  • Reduce Bundle Size (#2096)
  • Switch to esbuild to make build times faster/reasonable (#1555)
  • Opt-in tracking (#945)
  • Mine txs in same block with provided sorting (#899)
  • Add eip-155 support (#880)
  • Add support for debug_accountAt RPC method as implemented by Turbo-Geth (#813)
  • Enhance the database to allow for better UX and determinism (#756)
  • Create Project and set Milestones for Ganache interactive docs (#680)
  • idea: add in warning to help switch over to new "pending tx" mode (#674)
  • evm_snapshot ids should be opaque (#655)
  • Support for EIP 1898- Add blockHash to JSON-RPC methods which accept a default block parameter (#973)
  • Upgrade custom rpc method evm_mine to return the new block (#536)
  • Add personal_ecRecover and personal_sign (#995)
  • Add flag for starting ganache in detached mode (#1001)
  • Implement a streaming trace capability (#381)
  • Allow mining to be completely disabled on startup (#248)
  • Add support for eth_getRawTransactionByHash (#135)
  • Log contract events (#45)
  • Support IPC endpoint (#759)
  • Accept a genesis.json file (#1042)

back to top

Open new issues (or join our team) to influence what we gets implemented and prioritized.


💖 The Truffle Team


v7.2.0

1 year ago

 Highlights   New Features   Fixes   Miscellaneous   Changelog   Known Issues   Future Plans 


Not much in this release, as we just wrapped a huge hackathon here at ConsenSys. During the hackathon we got to actually use Ganache on our own project, which is actually not something we do very often, and in doing so found lots of new ways to improve the overall experience, so you can expect some really amazing changes in the weeks to come.

Thanks to @adjisb, @RiccardoBiosas, and @davidmurdoch for their contributions to this release!

We've changed 41 files across 5 merged pull requests, tallying 714 additions and 780 deletions, since our last release.


Highlights

This release brings official Node v18 support to Ganache. Ganache was already working fine in Node v18, but because our tests harnesses were failing in CI we couldn't yet claim full support. Now we can!

back to top


New Features

feat: add __experimental_info export to core (#2529)

This is an internal and private feature for Truffle. Truffle needed a way to programmatically get the list of chains Ganache fully supports in order to enable the dry-run feature for those chains.
This introduces a new experimental and private (this will likely change in a future release!) __experimental_info export:

Readonly<{
  version: string,
  fork: Readonly<{
    /**
     * Chains Ganache is known to be compatible with. Operations performed
     * locally at historic block numbers will use the Ethereum Virtual Machine
     * OPCODEs, gas prices, and EIPs that were active at the time the historic
     * block originally took place.
     */
    knownChainIds: number[],
  }>
}>

back to top


Fixes

fix: enforce eip-2 imposed limits and secp256k1 upper bound for private keys (#2944)

Sending transactions from an impersonated account with a "large" account number, like fffffffffffffffffffffffffffffffffffffffe, would result in the error "The nonce generation function failed, or the private key was invalid" due to the way we fake transaction signing in ganache. Previously we would take the account number plus the first 12 bytes of the account number, fffffffffffffffffffffffffffffffffffffffe + ffffffffffffffffffffffff, and would use that as a fake private key. This results in an invalid key, as secp256k1, the elliptic curve used in Ethereum cryptography, has an effective maximum private key value of 0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364140n (AKA secp256k1_n - 1, or the total number of non-trivial points on the curve). This fixes #2586.

While implementing this fix it was discovered that we were not rejecting transactions with too-high s-values; i.e., s-values that are greater than (secp256k1_n - 1) / 2. This restriction was added way back in Ethereum's first hardfork, homestead, as part of EIP-2 in order to remove the possibility of "malleable" transactions. While somewhat unrelated to the core reason for this fix, it has been added as part of this PR. This fixes #2600.

back to top


Miscellaneous


chore: support node 18 (#2988)

Ganache now supports and is tested on Node versions 12.0.0, 12.x, 14.x, 16.x, and 18.x on operating systems Windows 2019, Ubuntu 18.04, Ubuntu 20.04, and macOS 11, with the exception of Node v18 on Ubuntu 18.04, as Ubuntu 18.04 is not supported by Node v18.
Happy upgrading!

back to miscellaneous

docs: add documentation of eth_call overrides (#3007)

This PR adds some documentation of the eth_call overrides object to or RPC method docs, fixing #3002.

back to miscellaneous

chore: update @ethereumjs/vm to v5.9.0, add support for sepolia (#2528)

We've updated @ethereumjs/vm to v5.9.0 and added support for forking the new "sepolia" test network.

back to miscellaneous

back to top


Changelog

  • #2944 fix: enforce eip-2 imposed limits and secp256k1 upper bound for private keys (@davidmurdoch)
  • #2529 feat: add __experimental_info export to core (@davidmurdoch)
  • #2988 chore: support node 18 (@davidmurdoch)
  • #3007 docs: add documentation of eth_call overrides (@MicaiahReid)
  • #2528 chore: update @ethereumjs/vm to v5.9.0, add support for sepolia (@davidmurdoch)

back to top


Known Issues

Top Priority:

  • Unable to install Ganache (npm) on MacOS 10.15.7 (#2445)
  • Ganache v7.0.0 - typings are broken (#2134)
  • Add option to set fork block's timestamp to the time the actual block was mined (#2122)
  • get forking working in the browser (#1245)

Coming Soon™:

  • debug_traceTransaction may crash on Node.js v12 (#2106)
  • evm_mine and miner_start don't respect --mode.instamine=eager (#2029)
  • evm_setAccountNonce is race-conditiony (#1646)
  • Add eth_feeHistory RPC endpoint (#1470)
  • @ganache/filecoin@alpha doesn't work with ganache@alpha (#1150)
  • sort executable/pending transactions that have the same price by the time at which the transaction was submitted (#1104)
  • Add eth_createAccessList RPC method (#1056)
  • Launching ganache with fork is throwing revert errors when communicating with 3rd party contracts (#956)
  • Build a real pending block! (#772)
  • Add an upper limit to # of accounts that can be generated by ganache (#736)
  • Incorrect gas cost for SSTORE opcode when using fork feature (#625)
  • Cannot get state root with uncommitted checkpoints error when starting ganache forking with infura RPC endpoint (#618)
  • --db Option Requires Same Mnemonic and Network ID (#1030)

back to top


Future Plans

  • Reduce Bundle Size (#2096)
  • Switch to esbuild to make build times faster/reasonable (#1555)
  • Opt-in tracking (#945)
  • Mine txs in same block with provided sorting (#899)
  • Add eip-155 support (#880)
  • Add support for debug_accountAt RPC method as implemented by Turbo-Geth (#813)
  • Enhance the database to allow for better UX and determinism (#756)
  • Create Project and set Milestones for Ganache interactive docs (#680)
  • idea: add in warning to help switch over to new "pending tx" mode (#674)
  • evm_snapshot ids should be opaque (#655)
  • Support for EIP 1898- Add blockHash to JSON-RPC methods which accept a default block parameter (#973)
  • Upgrade custom rpc method evm_mine to return the new block (#536)
  • Add personal_ecRecover and personal_sign (#995)
  • Add flag for starting ganache in detached mode (#1001)
  • Implement eth_getProof RPC message (#382)
  • Implement a streaming trace capability (#381)
  • Allow mining to be completely disabled on startup (#248)
  • Add support for eth_getRawTransactionByHash (#135)
  • Log contract events (#45)
  • Support IPC endpoint (#759)
  • Accept a genesis.json file (#1042)

back to top

Open new issues (or join our team) to influence what we gets implemented and prioritized.


💖 The Truffle Team

v7.1.0

2 years ago

 Highlights   New Features   Miscellaneous   Changelog   Known Issues   Future Plans 


Here comes our first feature release since Ganache v7.0.0! We've worked through a good chunk of the bugs that have been discovered since the release, so we look forward to starting to add some new features! Don't worry, we're still working through bugs as well. Feel free to give any issues that you'd like to see implemented sooner a :+1: and we'll use this community feedback to help prioritize what we work! Or better yet, open a new issue, open a PR to fix an existing issue, or apply to join our team (we're hiring!) if you really want to get involved.

Speaking of the awesome community of Ganache users, we'd like to extend our gratitude to all issue openers (@fabioberger, @szgyuszi1) and contributors (@domob1812, @dekz, @jeffsmale90, @gnidan) who were a part of this release!

We've changed 9 files across 7 merged pull requests, tallying 1235 additions and 188 deletions, since our last release.


Highlights

VM Overrides During eth_call

Ganache now has support for overriding the contract code and storage and the account balance and nonce for simulations with eth_call. This feature is similarly supported by geth.

The eth_call RPC method now accepts a third override parameter which is a map from an address to the desired state of that address. The state object has the following keys, all of which are optional:

balance: QUANTITY - The balance to set for the account before executing the call. nonce: QUANTITY - The nonce to set for the account before executing the call. code: DATA - The EVM bytecode to set for the account before executing the call. state*: OBJECT - Key-value mapping of storage slot to value that will clear all slots and then override individual slots in the account storage before executing the call. stateDiff*: OBJECT - Key-value mapping of storage slot to value that will override individual slots in the account storage before executing the call. *Note - state and stateDiff fields are mutually exclusive.

So, an example override object using all fields overriding multiple addresses could look like the following:

const overrides = {
  "0xd9c9cd5f6779558b6e0ed4e6acf6b1947e7fa1f3": { 
    "nonce": "0xa", 
    "balance": "0xffff", 
    "state": { 
      "0000000000000000000000000000000000000000000000000000000000000001": "0xbaddad42baddad42baddad42baddad42baddad42baddad42baddad42baddad42"
    } 
  },
  "0xebe8efa441b9302a0d7eaecc277c09d20d684540": { 
    "code": "0x123456", 
    "stateDiff": {
      "0000000000000000000000000000000000000000000000000000000000000002": "0xbaddad42baddad42baddad42baddad42baddad42baddad42baddad42baddad42"
    } 
  }
};
const transaction = { ... };
const result = await provider.request({ method: "eth_call", params: [ transaction, "latest", overrides ] });

Like all state changes made with eth_call, the changes are ephemeral and only last for that specific run of eth_call. Happy transaction simulating!

back to top


New Features


perf: improve performance of the persistent cache used in forking (#2811)

We've found some small adjustments that could be made to our persistent cache to slightly improve forking performance. Even more forking performance improvements are in the works now, too!

back to new features

feat: allow balance, code, nonce, and state overrides in eth_call (#2565)

This feature was demonstrated in our highlights above. We'd like to give a huge thank you to @domob1812 and @dekz for their initial contributions to this one, you both were a huge help.

The PR introducing this feature uses @dekz's #905 as a starting point, and fixes #554 and #2934.

back to new features

back to top


Miscellaneous


chore: remove outdated warning about EIP-1193 fork providers (#2856)

This PR removes the warning described in #2558 about non-EIP-1193 providers, since Web3.js appears to be sticking with this kind of provider for the foreseeable future.

back to miscellaneous

ci: automated release improvements (#2892)

This change updates the release automation process in a few ways:

  1. Adds a vX.x.x git tag to each release, in addition to the [email protected] tag that already was automatically added - Fixes #2279.
  2. After a successful "latest" release (into master), merges master back into develop to keep their commit history in sync.
  3. Signs all automation commits from @TrufBot - Fixes #2882.

back to miscellaneous

chore: wrap comment at 80 chars (#2987)

Just some cleanup - nothing to see here :smile:

back to miscellaneous

ci: fix release tagging (#2979)

Our initial attempt at this v7.1.0 release did pan out as expected because our automated release process didn't correctly handle minor version changes. This led to the accidental creation of v7.0.5 :sweat_smile:

This PR updates our automated release process to parse through a release's commits, detect feature commits, and set the new release version accordingly (and hey! It looks like it works! Way to go @davidmurdoch).

back to miscellaneous

back to top


Changelog

  • #2811 perf: improve performance of the persistent cache used in forking (@jeffsmale90)
  • #2856 chore: remove outdated warning about EIP-1193 fork providers (@gnidan)
  • #2892 ci: automated release improvements (@MicaiahReid)
  • #2565 feat: allow balance, code, nonce, and state overrides in eth_call (@domob1812 / @dekz / @MicaiahReid)
  • #2987 chore: wrap comment at 80 chars (@davidmurdoch)
  • #2979 ci: fix release tagging (@davidmurdoch)

back to top


Known Issues

Top Priority:

  • A transaction with maxFeePerGas less than the next block's baseFeePerGas should be rejected (#2176)
  • Ganache v7.0.0 - typings are broken (#2134)
  • ganache forking is not working as expected (#2122)

Coming Soon™:

  • debug_traceTransaction may crash on Node.js v12 (#2106)
  • evm_mine and miner_start don't respect --mode.instamine=eager (#2029)
  • evm_setAccountNonce is race-conditiony (#1646)
  • Add eth_feeHistory RPC endpoint (#1470)
  • @ganache/filecoin@alpha doesn't work with ganache@alpha (#1150)
  • sort executable/pending transactions that have the same price by the time at which the transaction was submitted (#1104)
  • Add eth_createAccessList RPC method (#1056)
  • Launching ganache with fork is throwing revert errors when communicating with 3rd party contracts (#956)
  • Build a real pending block! (#772)
  • Add an upper limit to # of accounts that can be generated by ganache (#736)
  • Incorrect gas cost for SSTORE opcode when using fork feature (#625)
  • Cannot get state root with uncommitted checkpoints error when starting ganache forking with infura RPC endpoint (#618)
  • System Error when sending batch request with 1 not valid item (#402)
  • --db Option Requires Same Mnemonic and Network ID (#1030)

back to top


Future Plans

  • Reduce Bundle Size (#2096)
  • Switch to esbuild to make build times faster/reasonable (#1555)
  • Opt-in tracking (#945)
  • Mine txs in same block with provided sorting (#899)
  • Add eip-155 support (#880)
  • Add support for debug_accountAt RPC method as implemented by Turbo-Geth (#813)
  • Enhance the database to allow for better UX and determinism (#756)
  • Create Project and set Milestones for Ganache interactive docs (#680)
  • idea: add in warning to help switch over to new "pending tx" mode (#674)
  • evm_snapshot ids should be opaque (#655)
  • Support for EIP 1898- Add blockHash to JSON-RPC methods which accept a default block parameter (#973)
  • Upgrade custom rpc method evm_mine to return the new block (#536)
  • Add personal_ecRecover and personal_sign (#995)
  • Add flag for starting ganache in detached mode (#1001)
  • Implement eth_getProof RPC message (#382)
  • Implement a streaming trace capability (#381)
  • Allow mining to be completely disabled on startup (#248)
  • Add support for eth_getRawTransactionByHash (#135)
  • Log contract events (#45)
  • Support IPC endpoint (#759)
  • Accept a genesis.json file (#1042)

back to top

Open new issues (or join our team) to influence what we gets implemented and prioritized.


💖 The Truffle Team

v7.0.5

2 years ago

This version should have been v7.1.0 and has been re-released as such. Release notes are here: https://github.com/trufflesuite/ganache/releases/tag/v7.1.0

v7.0.4

2 years ago

 Highlights   Fixes   Miscellaneous   Changelog   Known Issues   Future Plans 


We've got a few more fixes in this release! But much more importantly we'd like to welcome @jeffsmale90 to the Ganache team! He has hit the ground running and is responsible for three out of five bug fixes today. Welcome to the team, Jeff! We'd also like to thank our issue openers (@PeterYinusa, @robsmith11), PR contributors (@MatthieuScarset), and technical consultants (@cds-amal). Thank you for being a part of this community!

We've changed 26 files across 8 merged pull requests, tallying 584 additions and 150 deletions, since our last release.


Highlights

Disable Rage Quit; Fix Regular Shutdown

Ganache v7 was released with a lovely feature that prevented Ganache from shutting down when some applications (including MetaMask) connect to Ganache and regularly poll for data. This feature was shipped to provide our users with some much needed practice expressing negative emotions as they repeatedly attempt to shut down Ganache, and Ganache says that it recognizes the shutdown signal but fails to shutdown.

Giant panda destroying computer in a fit of rage.

We are, of course, kidding. This issue had multiple causes which are now fixed in this release. Ganache now facilitates graceful shutdown in cases where persistent HTTP connections previously held Ganache open. Thank you all for your patience in waiting for a fix on this issue. 🙏

back to top


Fixes


fix: use host param when passed in server.listen (#2397)

Ganache previously ignored the --host parameter and would always bind to host 127.0.0.1. It now binds to the given host as expected.

back to fixes

fix: correctly pad / truncate in JSON-RPC types, add tests to ethereum-address and json-rpc-data (#2716)

The internal Address class previously wasn't properly padding compressed addresses. This would cause some RPC methods, like evm_addAccount, to add invalid Ethereum addresses. The class will now pad addresses to the correct length, allowing this behavior:

const address = new Address("0x1");
console.log(address.toString()) // 0x0000000000000000000000000000000000000001

which will in turn allow:

const address = "0x1";
const passphrase = "passphrase"
const result = await provider.send("evm_addAccount", [address, passphrase] );

back to fixes

fix: parse port to number type if provided in as string (#2610)

Ganache now allows the port number passed via ganache --port to be a string or a number. This allows the use case where the port is passed directly from args without parsing.

back to fixes

fix: close http connections after http-server.close() has been called (#2667)

As stated in our highlights, Ganache now facilitates graceful shutdown in cases where persistent HTTP connections previously held Ganache open. In the worst case where no requests are received over the persistent connection, Ganache will timeout after 10 seconds.

back to fixes

fix: update @trufflesuite/uws-js-unofficial dependency to silence node12 warnings (#2807)

If you've been using Ganache with nodejs 12, you've probably been bothered by the annoying error stating:

This version of µWS is not compatible with your Node.js build:

Error: node-loader:
Error: Module did not self-register: '/home/workspace/.nvm/versions/node/v12.22.1/lib/node_modules/ganache/dist/node/3wHsIyFE.node'.
Falling back to a NodeJS implementation; performance may be degraded.

This change silences the warning to give you the uncluttered CLI you deserve.

back to fixes

back to top


Miscellaneous


ci: fix test timeouts (#2503)

Tests that used to pass in CI started failing in GitHub Actions due to timeouts. We verified there were no performance regressions on our part, and that these timeouts were caused by GitHub Action runners becoming slower over time. We bumped the test timeout default value to 5 seconds.

back to miscellaneous

refactor: rearrange miner for easier readability (#2514)

We noticed some duplicate branches in a method and simplified it. There's nothing interesting to see here... 🙂

back to miscellaneous

docs: fix example in README (#2789)

The README.md example showing programmatic usage had a bug causing it to fail. The example now works as intended. Thanks again for pointing this out, @MatthieuScarset!

back to miscellaneous

back to top


Changelog

  • #2503 ci: fix test timeouts (@MicaiahReid)
  • #2514 refactor: rearrange miner for easier readability (@davidmurdoch)
  • #2397 fix: use host param when passed in server.listen (@davidmurdoch)
  • #2610 fix: parse port to number type if provided in as string (@jeffsmale90)
  • #2716 fix: correctly pad / truncate in JSON-RPC types, add tests to ethereum-address and json-rpc-data (@jeffsmale90)
  • #2667 fix: close http connections after http-server.close() has been called (@jeffsmale90)
  • #2789 docs: fix example in README (@davidmurdoch)
  • #2807 fix: update @trufflesuite/uws-js-unofficial dependency to silence node12 warnings (@trufflesuite)

back to top


Known Issues

Top Priority:

  • A rejected transaction should possibly be added back into the pool (#2176)
  • Ganache v7.0.0 - typings are broken (#2134)
  • Ganache's provider type is not compatible with Web3 (#2125)
  • Add eth_feeHistory RPC endpoint (#1470)
  • evm_mine and miner_start don't respect --mode.instamine=eager (#2029)

Coming Soon™:

  • debug_traceTransaction may crash on Node.js v12 (#2106)
  • evm_setAccountNonce is race-conditiony (#1646)
  • @ganache/filecoin@alpha doesn't work with ganache@alpha (#1150)
  • sort executable/pending transactions that have the same price by the time at which the transaction was submitted (#1104)
  • Add eth_createAccessList RPC method (#1056)
  • --db Option Requires Same Mnemonic and Network ID (#1030)
  • Launching ganache with fork is throwing revert errors when communicating with 3rd party contracts (#956)
  • Build a real pending block! (#772)
  • Add an upper limit to # of accounts that can be generated by ganache (#736)
  • Incorrect gas cost for SSTORE opcode when using fork feature (#625)
  • Cannot get state root with uncommitted checkpoints error when starting ganache forking with infura RPC endpoint (#618)
  • System Error when sending batch request with 1 not valid item (#402)

back to top


Future Plans

  • Reduce Bundle Size (#2096)
  • Add a way to create or modify arbitrary accounts and storage (#1889)
  • Switch to esbuild to make build times faster/reasonable (#1555)
  • Accept a genesis.json file (#1042)
  • Add flag for starting ganache in detached mode (#1001)
  • Add personal_ecRecover and personal_sign (#995)
  • Support for EIP 1898- Add blockHash to JSON-RPC methods which accept a default block parameter (#973)
  • Opt-in tracking (#945)
  • Mine txs in same block with provided sorting (#899)
  • Add eip-155 support (#880)
  • Add support for debug_accountAt RPC method as implemented by Turbo-Geth (#813)
  • Support IPC endpoint (#759)
  • Enhance the database to allow for better UX and determinism (#756)
  • Create Project and set Milestones for Ganache interactive docs (#680)
  • idea: add in warning to help switch over to new "pending tx" mode (#674)
  • evm_snapshot ids should be opaque (#655)
  • Add evm_setCode and evm_setStorageAt RPC methods (#649)
  • Add support for eth_call state-overrides (#554)
  • Upgrade custom rpc method evm_mine to return the new block (#536)
  • Implement eth_getProof RPC message (#382)
  • Implement a streaming trace capability (#381)
  • Allow mining to be completely disabled on startup (#248)
  • Add support for eth_getRawTransactionByHash (#135)
  • Log contract events (#45)

back to top

Open new issues (or join our team) to influence what we gets implemented and prioritized.


💖 The Truffle Team

v7.0.3

2 years ago

 New Features   Fixes   Changelog   Known Issues   Future Plans 


We have three new RPC methods and two bug fixes in this release! Thank you to our issue reporter (@robmcl4) and contributors (@rmeissner and @anticlimactic) on this release, we really appreciate it!

We've changed 11 files across 5 merged pull requests, tallying 2874 additions and 24 deletions, since our last release.


New Features

feat: add methods to modify account (#2337)

This PR adds the evm_setAccountBalance, evm_setAccountCode, and evm_setAccountStorageAt RPC methods. Just as their names suggest, these methods let you set the balance, code, and storage (at a specified slot) for an account.

evm_setAccountBalance:

const balance = "0x3e8";
const [address] = await provider.request({ method: "eth_accounts", params: [] });
const result = await provider.send("evm_setAccountBalance", [address, balance] );
console.log(result);

evm_setAccountCode:

const data = "0xbaddad42";
const [address] = await provider.request({ method: "eth_accounts", params: [] });
const result = await provider.send("evm_setAccountCode", [address, data] );
console.log(result);

evm_setAccountStorageAt:

const slot = "0x0000000000000000000000000000000000000000000000000000000000000005";
const data = "0xbaddad42";
const [address] = await provider.request({ method: "eth_accounts", params: [] });
const result = await provider.send("evm_setAccountStorageAt", [address, slot, data] );
console.log(result);

Thanks again to @rmeissner for his awesome work on this PR!

back to top


Fixes


fix: serialize eth_subscribe log data (#2331)

A previous PR (#2331) fixed how we emit logs on eth_subscribe for EIP-1193 "message" event types, but unintentionally broke those messages for the legacy "data" event types. For those of you still using the legacy event types (cough cough Truffle), this fix should get those events working again.

back to fixes

fix: allow hex string for coinbase option in cli (#2405)

The miner.coinbase option allows you to specify the address to which mining rewards will go as a either a string representing the hex-encoded address or a number representing the index of the account returned by eth_accounts. However, a hex address sent with this option was incorrectly interpreted as a (verrrrrry large) number, causing a startup error. This fix correctly parses the argument so that the option can be used as expected.

back to fixes

back to top


Changelog

  • #2281 docs: remove rc reference from docker instructions (@MicaiahReid)
  • #2389 docs: fix typo in README.md (@anticlimactic)
  • #2337 feat: add methods to modify account (@rmeissner)
  • #2331 fix: serialize eth_subscribe log data (@MicaiahReid)
  • #2405 fix: allow hex string for coinbase option in cli (@davidmurdoch)

back to top


Known Issues

Top Priority:

  • Shutting down the Ganache Server v7.0.0 (#2185)
  • A rejected transaction should possibly be added back into the pool (#2176)
  • Ganache v7.0.0 - typings are broken (#2134)
  • Ganache's provider type is not compatible with Web3 (#2125)
  • ganache forking is not working as expected (#2122)
  • Node.js v12 outputs a µWS warning in the console (#2095)
  • evm_mine and miner_start don't respect --mode.instamine=eager (#2029)

Coming Soon™:

  • debug_traceTransaction may crash on Node.js v12 (#2106)
  • evm_setAccountNonce is race-conditiony (#1646)
  • Add eth_feeHistory RPC endpoint (#1470)
  • @ganache/filecoin@alpha doesn't work with ganache@alpha (#1150)
  • sort executable/pending transactions that have the same price by the time at which the transaction was submitted (#1104)
  • Add eth_createAccessList RPC method (#1056)
  • --db Option Requires Same Mnemonic and Network ID (#1030)
  • Launching ganache with fork is throwing revert errors when communicating with 3rd party contracts (#956)
  • Build a real pending block! (#772)
  • Add an upper limit to # of accounts that can be generated by ganache (#736)
  • Incorrect gas cost for SSTORE opcode when using fork feature (#625)
  • Cannot get state root with uncommitted checkpoints error when starting ganache forking with infura RPC endpoint (#618)
  • System Error when sending batch request with 1 not valid item (#402)

back to top


Future Plans

  • Reduce Bundle Size (#2096)
  • Add a way to create or modify arbitrary accounts and storage (#1889)
  • Switch to esbuild to make build times faster/reasonable (#1555)
  • Accept a genesis.json file (#1042)
  • Add flag for starting ganache in detached mode (#1001)
  • Add personal_ecRecover and personal_sign (#995)
  • Support for EIP 1898- Add blockHash to JSON-RPC methods which accept a default block parameter (#973)
  • Opt-in tracking (#945)
  • Mine txs in same block with provided sorting (#899)
  • Add eip-155 support (#880)
  • Add support for debug_accountAt RPC method as implemented by Turbo-Geth (#813)
  • Support IPC endpoint (#759)
  • Enhance the database to allow for better UX and determinism (#756)
  • Create Project and set Milestones for Ganache interactive docs (#680)
  • idea: add in warning to help switch over to new "pending tx" mode (#674)
  • evm_snapshot ids should be opaque (#655)
  • Add evm_setCode and evm_setStorageAt RPC methods (#649)
  • Add support for eth_call state-overrides (#554)
  • Upgrade custom rpc method evm_mine to return the new block (#536)
  • Implement eth_getProof RPC message (#382)
  • Implement a streaming trace capability (#381)
  • Allow mining to be completely disabled on startup (#248)
  • Add support for eth_getRawTransactionByHash (#135)
  • Log contract events (#45)

back to top

Open new issues (or join our team) to influence what we gets implemented and prioritized.


💖 The Truffle Team

v7.0.2

2 years ago

 Fixes   Changelog   Known Issues   Future Plans 


Two more fixes are ready in this release! Thank you to our issue reporters for these bringing these to our attention (@Ruj89 and @davidmurdoch). It means a lot to us that you use Ganache and want to be a part of making it even better.

In this release we've changed 3 files across 2 merged pull requests, tallying 151 additions and 46 deletions.

Last call for T-shirts

If you helped contribute to Ganache v7 in any way, we tagged you in our v7 release notes to let you know you're eligible to receive a limited edition Ganache T-shirt. We've had many of you claim the goods and want to get these bad boys made, but we want to be sure all of our contributors have had the chance to claim them first. If you're on the list¹ and you're interested, email us at [email protected] by Thursday, February 10th to claim.


Fixes


Fix how we return logs from eth_subscribe (#2268)

In an oversight on our end, we unintentionally had a breaking change between Ganache v6 and v7 in which we started aggregating event logs and emitting them once for every transaction that triggered them. Ganache v6 was inline with Geth's logging, which emits separately for each event.

With this release we've fixed this behavior to once again be inline with Geth. When using eth_subscribe to subscribe to logs, you can expect each emitted contract event to emit a separate log with the following structure:

{
  type: "eth_subscription",
  data: {
    result: {
        address: address,
        blockHash: blockHash,
        blockNumber: blockNumber,
        data: data,
        logIndex: logIndex,
        removed: removed,
        topics: topics,
        transactionHash: transactionHash,
        transactionIndex: transactionIndex
    },
    subscription: subscriptionId
  }
}

back to fixes

Fix type compatibility with Web3 (#2272) (#4743 in ChainSafe/web3.js)

After the initial release of Ganache v7 we found that our provider type wasn't playing nice with Web3's provider type. After a little digging, we found that both repos had bugs. Our side of the fix is available in this new release, and we've opened a PR in the web3.js repo to fix it on their end. This should be merged in their coming 1.7.1 release. Shout out to the ChainSafe team for getting this merged and for all of the sweet stuff they make.

back to fixes

back to top


Changelog

  • #2272 fix: jsonrpc types and provider compatibility with web3 (@MicaiahReid)
  • #2268 fix: eth_subscribe logs (@MicaiahReid)

back to changelog

back to top


Known Issues

Top Priority Issues:

  • evm_mine and miner_start don't respect --mode.instamine=eager (#2029)
  • Ganache forking is not working as expected (#2122)
  • Ganache v7.0.0 - typings are broken (#2134)
  • A rejected transaction should possibly be added back into the pool (#2176)
  • Shutting down the Ganache Server v7.0.2 (#2185)
  • Node.js v12 outputs a µWS warning in the console (#2095)
  • Simulating transactions on Ganache v7 fork throws insufficient funds error (#2162)
  • Ganache's provider type is not compatible with Web3 (#2125)
  • Websocket logs subscription not supported by Geth Client (#2206)

Coming Soon™:

  • evm_setAccountNonce is race-conditiony (#1646)
  • --miner.callGasLimit implementation is wrong (#1645)
  • We don't return a proper pending block (#772)
  • Forking doesn't work in the browser (#1245)
  • Uncles aren't fully supported when forking (#786)
  • Forking may fail in weird and unexpected ways. We need to "error better" here (#615)
  • Node.js v12 doesn't handle memory as well as 14+ and may crash computing very large debug_traceTransaction results (#2106)
  • Our bundle size is larger than ideal (#2096)

back to top


Future Plans

  • Update the eth_maxPriorityFeePerGas RPC method to return as Geth does, eth_gasPrice - baseFeePerGas (#2097)
  • Add support for the eth_feeHistory RPC method (#1470)
  • Support for enabling eligible draft EIPs before they are finalized or considered for inclusion in a hard fork (#1507)
  • New hard fork support well in advance of the hard fork launch (#2099)
  • Add an eth_createAccessList method (#1056)
  • Track test performance metrics over time (#2105)
  • Track real world Ganache usage (opt-in and anonymized) to better tune performance and drive bug fixes and feature development (#2100)
  • Track test coverage (#2101)
  • evm_mine will return the new blocks instead of just 0x0 (#536)
  • Add new evm_setCode and evm_setStorageAt RPC methods (#649)
  • Make evm_snapshot ids globally unique (unpredictable instead of a counter) (#655)
  • Support eth_getRawTransactionByHash RPC method (#135)
  • Support debug_accountAt RPC method (#813)
  • Allow "mining" to be disabled on start up (#248)
  • Set CLI options via config file, package.json, or ENV vars (#2102)
  • Create a CLI interactive/REPL mode (#2103)
  • Enable a CLI daemon mode (#2104)
  • "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!
  • We've laid the groundwork for additional performance improvements. We expect to see an additional 2-5x speed up for typical testing workloads in the near future.

Open new issues (or join our team) to influence what we gets implemented and prioritized.

back to top

1. Ganache v7 Contributors: @davidmurdoch @MicaiahReid @gnidan @eggplantzzz @kevinweaver @cds-amal @haltman-at @kevinbluer @seesemichaelj @tcoulter @nicholasjpaterno @eshaben @CruzMolina @honestbonsai @domob1812 @moda20 @0xGorilla @fedgiac @FFdhorkin @NicsTr @convexman @rainwater11 @aliveli186 @winksaville @anvacaru @nepoche @gas1cent @Fatorin @0xng @wilwade @MatthiasLohr @alexhultman


💖 The Truffle Team

v7.0.1

2 years ago

 Fixes   Changelog   Known Issues   Future Plans 

Since the release of Ganache v7, we've seen exiting increase in engagement and downloads and an uptick in repo star gazers. Welcome to our new users following along!

Thank you to all of those who have opened issues (@teknoxic, @PeterYinusa, @NikZak, @haseebrabbani, @gorbak25, @fabianorodrigo), you are a huge help and you keep us humble :sweat_smile:. We've got two fixes out for you today!

We've changed 13 files across 3 merged pull requests, tallying 247 additions and 86 deletions, since our last release.


Fixes


Restructure Errors on eth_call (#2186)

Before this change, errors from eth_call were formatted in our "non-standard" vmErrorsOnRPCResponse format, which uses the error's data property to store some extra helpful information (program counter, hash, etc.):

{
   "error": {
     "message": "...",
     "code": ...
     "data": {
          ... bunch of props, like `hash` and `programCounter`...
         "result": "<raw revert hex string>" <---- this moves (See below)
     }
   }
}

The problem with this approach is that it differs from how a real node handles these errors, causing our users to have to handle eth_call errors differently when using Ganache. Now, the error's data property only contains the raw revert hex string, which should more closely match real node's error handling:

{
   "error": {
     "message": "...", // <- we'll change the message
     "code": ...
     "data": "<raw revert hex string>"  <---- new home
   }
}

Our hope is that this will allow users to remove any conditionals handling errors differently between Ganache and real Ethereum nodes.

back to fixes

Keep an index to latest block in the persisted database (#2196)

Ganache wasn't saving a pointer to the "latest" block correctly, so when a persisted database (the dbPath flag) was restarted after block 255 (2^⁸-1) the "latest" block would always be set to block 255 (this pattern would occur again once blocks reached 2¹⁶ - 1, 2²⁴ - 1, 2³² - 1 and so on). Ganache now tracks the index correctly.

back to fixes

back to top


Changelog

  • #2114 docs: remove rc release reference from README (@davidmurdoch)
  • #2186 fix: gethify eth call errors (@MicaiahReid)
  • #2196 fix: keep an index to latest block in the database (@davidmurdoch)

back to changelog

back to top


Known Issues

Top Priority Issues:

  • evm_mine and miner_start don't respect --mode.instamine=eager (#2029)
  • Ganache forking is not working as expected (#2122)
  • Ganache's provider type is not compatible with Web3 (#2125)
  • Ganache v7.0.1 - typings are broken (#2134)
  • Simulating transactions on Ganache v7 fork throws insufficient funds error (#2162)
  • A rejected transaction should possibly be added back into the pool (#2176)
  • Shutting down the Ganache Server v7.0.1 (#2185)
  • Node.js v12 outputs a µWS warning in the console (#2095)

Coming Soon™:

  • evm_setAccountNonce is race-conditiony (#1646)
  • --miner.callGasLimit implementation is wrong (#1645)
  • We don't return a proper pending block (#772)
  • Forking doesn't work in the browser (#1245)
  • Uncles aren't fully supported when forking (#786)
  • Forking may fail in weird and unexpected ways. We need to "error better" here (#615)
  • Node.js v12 doesn't handle memory as well as 14+ and may crash computing very large debug_traceTransaction results (#2106)
  • Our bundle size is larger than ideal (#2096)

back to top


Future Plans

  • Update the eth_maxPriorityFeePerGas RPC method to return as Geth does, eth_gasPrice - baseFeePerGas (#2097)
  • Add support for the eth_feeHistory RPC method (#1470)
  • Support for enabling eligible draft EIPs before they are finalized or considered for inclusion in a hard fork (#1507)
  • New hard fork support well in advance of the hard fork launch (#2099)
  • Add an eth_createAccessList method (#1056)
  • Track test performance metrics over time (#2105)
  • Track real world Ganache usage (opt-in and anonymized) to better tune performance and drive bug fixes and feature development (#2100)
  • Track test coverage (#2101)
  • evm_mine will return the new blocks instead of just 0x0 (#536)
  • Add new evm_setCode and evm_setStorageAt RPC methods (#649)
  • Make evm_snapshot ids globally unique (unpredictable instead of a counter) (#655)
  • Support eth_getRawTransactionByHash RPC method (#135)
  • Support debug_accountAt RPC method (#813)
  • Allow "mining" to be disabled on start up (#248)
  • Set CLI options via config file, package.json, or ENV vars (#2102)
  • Create a CLI interactive/REPL mode (#2103)
  • Enable a CLI daemon mode (#2104)
  • "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!
  • 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.

Open new issues (or join our team) to influence what we gets implemented and prioritized.

back to top


💖 The Truffle Team

v7.0.0

2 years ago

 Highlights   Upgrade Guide and Breaking Changes   New Features   Changelog   Known Issues   Future Plans 


It's here, it's finally here! The much anticipated (well, at least by us!) Ganache v7 release has now been shipped! This release has been years in the making and we're really proud of the work we've done. We hope you love it as much as we do. If you do, or if you want to keep up with all things Ganache, be sure to give this repository a ⭐ star ⭐.


Thank you to everyone who has been a part of making this release happen — contributors, mentors, reviewers, issue reporters, and community participators have all been instrumental in making Ganache v7. We are immensely thankful to you all:

@davidmurdoch @MicaiahReid @gnidan @eggplantzzz @kevinweaver @cds-amal @haltman-at @kevinbluer @seesemichaelj @tcoulter @nicholasjpaterno @eshaben @CruzMolina @honestbonsai @domob1812 @moda20 @0xGorilla @fedgiac @FFdhorkin @NicsTr @convexman @rainwater11 @aliveli186 @winksaville @anvacaru @nepoche @gas1cent @Fatorin @0xng @wilwade @MatthiasLohr @alexhultman

As a token of our appreciation to our early contributors, we want to send you something real and tangible (sorry, no NFTs at this time 😔). Email [email protected] and we'll verify your identity to get it sent out to you (you'll just need to cover shipping if you're outside the United States). We want to keep it a little on the down-low to keep people from being jealous, but what we can tell you is that it's exclusive, brown, soft, wearable, with two arm holes (it's a t-shirt).


This is a huge release, so these release notes don't cover everything that's changed. For those gluttons for detail among us that want the comprehensive list, check out the notes from our alpha, beta, and rc releases:

Release Release Date
[email protected] 2021/08/26
[email protected] 2021/09/21
[email protected] 2021/11/12
[email protected] 2021/11/19
[email protected] 2021/11/24
[email protected] 2021/12/20
[email protected] 2022/01/12

For everyone else, we think these notes do a pretty great job of covering the features and changes that you'll care most about.


Highlights

Forking Got an Upgrade

Ganache's ancestor, Test RPC, was the first tool to introduce forking back in 2016. Ganache 7 takes forking to a new level.

Zero-Config Mainnet Forking

Truffle has partnered with Infura to provide free archive node access to Ganache users. Simply run ganache --fork and BOOM, you've forked mainnet at the latest block.

ganache --fork

But it doesn't stop there. Use ganache --fork NETWORK to fork the Ropsten, Kovan, Rinkeby and Görli networks.

SPPPPEEEEEEED

We've introduced two new caching layers that can reduce the run time of complex forking requests, like debug_traceTransaction, by over 30x!

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 highlights

Ganache is Now Ganache

Before, the Ganache UI application was just Ganache, which used ganache-core, which was also used by ganache-cli. Confused? So were we. Which is why we thought a rename was in order.

Previously, ganache-core was the core code that powered the Ganache UI and Ganache CLI applications and allowed for programmatic use of Ganache. ganache-cli was a separate application that had to be installed to use Ganache in the command line.

We've now merged ganache-core and ganache-cli into just ganache. This one tool gives you access to Ganache as a command line application, for programmatic use in Node, or for use in the browser.

Note: In case you just love typing "-cli", we've left ganache-cli as an alias to ganache, so you can continue using the ganache-cli command in your npm scripts and in your terminal.

back to highlights

Use Ganache in the Browser

Why? We don't really know!

slack-conversation-release

But we're pretty sure you, our loyal and talented users, will make something great out of it. To use this feature, add the following script to your HTML:

<script src="https://cdn.jsdelivr.net/npm/ganache@{VERSION}/dist/web/ganache.min.js"></script>

NOTE: The {VERSION} in the above path needs to be replaced with a version number or tag that is listed in npm.

From there, Ganache is available in your browser for use:

const options = {};
const provider = Ganache.provider(options);

NOTE: Currently forking does not work in the browser, but we plan to add support in the future.

back to highlights

Huge Transaction Traces

If you've got transactions, we can trace 'em.™ Ganache can now run debug_traceTransaction on Ethereum's largest and most complex transactions, even those constrained by Node's runtime limitations!

We're proud of this one and will likely have a blog post coming soon to show off our JS-fu and explain how. For now, our past release notes go into some detail on this feature.

back to highlights

back to top


Upgrade Guide and Breaking Changes

In short, you can install the new version using:

npm install ganache --global

We've also written up this handy guide on how to upgrade/install Ganache and to document all breaking changes to look out for.

back to top


New Features


Berlin, London, and Arrow Glacier Hard Fork Support

Ganache now supports the Berlin, London, and Arrow Glacier hard forks. This means that EIP-2718's Typed Transaction Envelope, EIP-2930's Access List Transaction, and EIP-1559's Fee Market Transaction are all available for use in Ganache.

The default hard fork has been set to "london". Because of this, any legacy typed transactions (those with no "type" field) that don't supply a gas price, will automatically be upgraded to a "Type 2" EIP-1559 transaction.

back to new features

Future Nonces and Queued Transactions

Ganache now allows you to send what we call "future nonce transactions". These are transactions whose nonce is ahead of that of the sender's account. The transaction isn't immediately executable, so it stays in the transaction pool as a "queued" transaction.

Once the nonce gap is filled, the queued transaction will be executed automatically. For example, if a brand new account (nonce 0) sends transactions with nonces 1, 2, and 3, all three of these transactions will sit in the "queued" pool. As soon as a transaction from that account is sent with a nonce of 0, the nonce for the account is incremented to 1, so the transaction with nonce 1 is executed. At that point, the account's nonce is 2, so the transaction with nonce 2 is executed. Finally, the account's nonce is 3, so the transaction with account 3 is executed.

back to new features

Replacement Transactions

Replacement transactions are now supported in Ganache v7. This allows any transaction that is pending or queued in the transaction pool to be replaced by another transaction if the gas price of the new transaction is high enough compared to the original.

To send a replacement transaction, simply send a transaction with the same from and nonce fields as the transaction being replaced with a gas price that is --miner.priceBump (a configurable startup option, defaulted to 10%) higher than the original. Future nonce transactions that are queued up in the transaction pool are also able to be replaced.

back to new features

New RPC Endpoints

RPC methods provide access to Ethereum nodes and to Ganache. We've added some new methods to keep in step with real-world Ethereum nodes and some new custom methods to make your testing experience easier.

evm_setAccountNonce

This custom method allows you to (re)write history by setting an account's nonce.

evm_addAccount/evm_removeAccount

The evm_addAccount method can be used to add any address to the personal namespace. Ganache will create a fake private key which will then be used for all personal namespace commands sent using that added address. Here's an example of how to use this:

const zeroAddress = "0x0000000000000000000000000000000000000000"; // let's send transactions from the zero address!
const transaction = {from: zeroAddress};
const passphrase = "this is my passphrase";
// this will fail because we don't "know" the zero address
await assert.rejects(provider.send("personal_sendTransaction", [{ from: zeroAddress }, passphrase] ));

const added = await provider.send("evm_addAccount", [zeroAddress, passphrase] );
assert.equal(added, true) // but now we do!

// so now we can send transactions from the zero address!
const txHash = await provider.send("personal_sendTransaction", [{ from: zeroAddress }, passphrase] ))

The evm_removeAccount method can be used to do just the opposite — it will remove an account from the personal namespace.

eth_signTypedData_v4

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.

eth_maxPriorityFeePerGas

Ganache now supports the eth_maxPriorityFeePerGas RPC method. Currently, this defaults to returning 1 GWEI. In the future, we may adjust the behavior so it returns the current gas price minus the latest block's baseFeePerGas.

txpool_content

The new txpool_content RPC method returns the current contents of the transaction pool. The contents of the transaction pool are grouped into "pending" and "queued" transactions. "Pending" transactions are those that are immediately executable in the transaction pool, meaning that the transaction's nonce is equal to the sender account's next nonce. A "queued" transaction is one with a future nonce that is not immediately executable. Each of the groups of "pending" and "queued" transactions is grouped by the transaction's sender address, and a group of transactions from sender address are grouped by the sender address' nonce.

Here is an example response:

{
  "pending" : {
    "0x8e89f513c2ed8eb9d915196199615e590028b727" : {
      "0" : { /* eth_getTransactionByHash */ }
    }
  },
  "queued" : {
    "0x8e89f513c2ed8eb9d915196199615e590028b727" : {
      "2" : { ... },
      "3" : { ... },
    }
  }
}

back to new features

New Startup Options

Startup options are now grouped in the chain, database, fork, logging, miner, and wallet namespaces, and should be used as such on startup. For startup options in the CLI, use:

$ ganache --namespace.option="value"

and when using Ganache programmatically, you can do:

const options = { namespace: { option: "value"}};
const provider = ganache.provider(options);

We've also added to, updated, and renamed some startup options. To get a full list of options, you can always run ganache --help in the CLI, or you can check out our documentation. Here are the changes we've made in Ganache v7.

--miner.coinbase

The --miner.coinbase option allows you to set the address where mining rewards will go. By default, this is the zero address.

--miner.instamine

The --miner.instamine option allows you to configure when in the mining process Ganache returns a transaction's hash. This may sound trivial, but it can have some huge implications, which are covered in detail in this discussion.

In short, setting --miner.instamine="eager" (the default case), Ganache returns the transaction's hash to the caller after the transaction has been included in a block. This is the same as how Ganache v6 behaved, but differs from real nodes' behavior. Setting --miner.instamine="strict" works like a real node, the transaction's hash is returned before the transaction has been included in a block.

--miner.priceBump

The new --miner.priceBump option allows you to specify the percentage increase in the gas price required to replace an existing transaction. For example, if the price bump is set to 10% using --miner.priceBump=10 and a transaction with maxFeePerGas = 100 GWEI and maxPriorityFeePerGas = 1 GWEI is waiting in the transaction pool to be mined, a transaction with maxFeePerGas >= 110 GWEI and maxPriorityFeePerGas >= 1.1 GWEI will be required to replace the existing transaction.

--server.wsBinary

The --server.wsBinary option can now be used to set whether websockets should respond with binary data (ArrayBuffers) or strings. The default for this option is set to "auto", which responds with whichever type (binary data or string) you used in the request. Setting --server.wsBinary=true will always respond with binary data and --server.wsBinary=false will always respond with a string.

--wallet.lock

The --wallet.secure option has been renamed to --wallet.lock.

--wallet.passphrase

This feature allows you to specify a passphrase that will be used for personal namespace commands (personal_unlockAccount, personal_sendTransaction, etc.) on all startup accounts. Before this feature, the default (and only) password for startup accounts was "".

NOTE: Specifying the wallet.passphrase parameter does not lock accounts by default. The wallet.lock (previously wallet.secure) parameter can be used to lock accounts by default. If wallet.passphrase parameter is used without wallet.lock, the passphrase will still be used when personal_lockAccount is used.

back to new features

TypeScript Rewrite and Type Support

In this release Ganache has been almost completely rewritten from the ground up in TypeScript. With that, we are now exporting types in the published build, though it isn't perfect yet.

While Ganache is now a TypeScript project, all internal components are shipped in a bundle to improve installation time. While there are lots of tools to bundle JavaScript, the tools to bundle (or "rollup") these types aren't very mature and result in some strange types. We are now using ApiExtractor to generate our rollup types, as it works well for most of the types we need to export with one exception — it likes to rename types:

messed-up-types

EthereumProvider_2 in the above image should be EthereumProvider.

You find many other strangely named types in this version, as well as many types that aren't exported, but should be. We will have a fix out for this in the future.

back to new features

New Event System

In addition to EIP-1193's "message" event and the legacy "data" event, Ganache emits 3 additional events: "ganache:vm:tx:before", "ganache:vm:tx:step", and "ganache:vm:tx:after".

These events can be used to observe the lifecycle of any transaction executed via eth_sendTransaction, personal_sendTransaction, eth_sendRawTransaction, eth_call, debug_traceTransaction, or debug_storageRangeAt.

These share the event paradigm that Truffle uses, but without any of the wildcard handling, i.e., no "vm:*" support (for now).

Each of these events will emit a context object which is a unique object that can be used to identify a transaction over the course of its lifecycle. For example:

interface StepEvent {
  account: {
    nonce: bigint;
    balance: bigint;
    stateRoot: Buffer;
    codeHash: Buffer;
  };
  address: Buffer;
  codeAddress: Buffer;
  depth: number;
  gasLeft: bigint;
  gasRefund: bigint;
  memory: Buffer;
  memoryWordCount: bigint;
  opcode: {
    name: string;
    fee: number;
  };
  pc: number;
  returnStack: Buffer[];
  stack: Buffer[];
}
const contexts = new Map();
provider.on("ganache:vm:tx:before", (event: { context: {} }) => {
  contexts.set(event.context, []);
});
provider.on("ganache:vm:tx:step", (event: StepEvent) => {
  contexts.get(event.context).push(event.data);
});
provider.on("ganache:vm:tx:after", (event: { context: {} }) => {
  doAThingWithThisTransactionsSteps(contexts.get(event.context));
  contexts.delete(event.context);
});

The reason this context is necessary is that Ganache may run multiple transactions simultaneously, so "ganache:vm:tx:step" events from different transactions could be intermingled.

The above events will be emitted for eth_call, eth_sendTransaction, personal_sendTransaction, eth_sendRawTransaction, debug_traceTransaction, and debug_storageRangeAt.

Currently, we do not await the event listener's return value, however, we'll likely enable this in the future.

back to new features

Dropping Node 8 & 10, Adding Node 17

We are dropping support for Node.js versions 8 and 10 in the Ganache v7 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.

We've also added support for Node versions up to v17.

back to new features

back to top


Changelog

  • #657 refactor: rewrite into a TypeScript monorepo, partial (@davidmurdoch)
  • #614 fix: add debug_traceTransaction RPC method (@tcoulter)
  • #665 fix: switch to SecureTrie (@davidmurdoch)
  • #666 fix: don't overwrite existing initial accounts (@davidmurdoch)
  • #667 test(eth_getCode): add tests for contract factories (@davidmurdoch)
  • #668 feat: add option to use gas estimate on send tx (@davidmurdoch)
  • #679 docs: update docs for GH Pages (@davidmurdoch)
  • #703 chore: move chain packages to a subfolder (@seesemichaelj)
  • #708 feat: change CLI to dynamically generate args from flavor options (@seesemichaelj)
  • #725 chore: ignore folders that are packages from another branch (@seesemichaelj)
  • #731 chore: fix windows node 10.7.0 CI by updating npm (@davidmurdoch)
  • #721 chore: polish cli (@davidmurdoch)
  • #732 feat: handle mutually exclusive args in cli (@davidmurdoch)
  • #734 chore: lighten up github ci to enhance dev experience (@seesemichaelj)
  • #737 fix: update types on wallet legacy options (@seesemichaelj)
  • #738 chore: add "push" action to "build all" on develop (@seesemichaelj)
  • #739 chore: fix readme badges and drop macos (@davidmurdoch)
  • #741 chore: update build-status badge image (@davidmurdoch)
  • #745 chore: ensure logo is centered on npm (@davidmurdoch)
  • #748 chore: add start and build info to contributing.md (@davidmurdoch)
  • #749 chore: use our "sweet treat" mnemonic in readme.md (@davidmurdoch)
  • #740 chore: rename ganache-cli to ganache in readme (@davidmurdoch)
  • #750 chore: fix launch.json example in contributing.md (@davidmurdoch)
  • #769 fix(docs): update contributing url in readme to full path (@kevinbluer)
  • #733 fix: ensure path sep is always / in link-ts-references.ts (@davidmurdoch)
  • #770 fix(ethereum): ensure randomBytes can return 0-255 (@davidmurdoch)
  • #785 fix(cli): enable SIGINT to shutdown cli on Windows (@davidmurdoch)
  • #777 chore: enabling building from root (@davidmurdoch)
  • #792 feat: allow mining many blocks via evm_mine (@davidmurdoch)
  • #793 fix(docs): fix docs for evm_mine (@davidmurdoch)
  • #794 refactor: use WEI constant in test (@davidmurdoch)
  • #779 feat: log warning on legacy-style eth_getTransactionReceipt calls (@eggplantzzz)
  • #796 docs: add request diagram to @ganache/core (@davidmurdoch)
  • #795 refactor: replace seedCounter w/ an instance prng (@davidmurdoch)
  • #771 fix: set difficulty default to 1 and add totalDifficulty (@eggplantzzz)
  • #800 chore: update marked to v2.0.0 (@davidmurdoch)
  • #789 chore: remove dead code in runtime-block.ts (@davidmurdoch)
  • #801 chore: update root dev dependencies (@davidmurdoch)
  • #790 fix: calculate block size correctly (@davidmurdoch)
  • #755 feat: add support for debug_storageRangeAt RPC (@eshaben)
  • #766 feat: throw exception when conflicting options are passed to the provider (@tcoulter)
  • #803 docs: improve usefulness of readme.md and contributing.md (@eshaben)
  • #819 chore: use consistent capitalization and punctuation in readme (@eshaben)
  • #809 perf: optimize debug_storageRangeAt (@davidmurdoch)
  • #857 fix: hex encode hash in eth_getTransactionReceipt notice (@davidmurdoch)
  • #874 chore: point community link at our discord channel (@davidmurdoch)
  • #884 chore(deps): bump y18n from 4.0.0 to 4.0.1 (dependabot[bot])
  • #877 fix: rearchitect server status and move async functions from constructors to initialize functions (@seesemichaelj)
  • #888 feat: add filecoin flavor (@seesemichaelj)
  • #893 fix: support a uws fallback if uws native binaries don't exist (win+electron) (@seesemichaelj)
  • #816 fix: make random seed actually random (@davidmurdoch)
  • #892 refactor: increase the default ether balance for created accounts to 1000 (@eggplantzzz)
  • #909 fix(docs): ensure Error object can be logged to console (@davidmurdoch)
  • #908 feat: forking (@davidmurdoch)
  • #907 chore: general clean up for publishing (@davidmurdoch)
  • #918 chore(deps): bump ws in /src/chains/ethereum/ethereum (dependabot[bot])
  • #920 chore(deps-dev): bump ws from 7.3.1 to 7.4.6 in /src/packages/core (dependabot[bot])
  • #919 chore(deps-dev): bump ws from 7.3.1 to 7.4.6 (dependabot[bot])
  • #921 chore(deps-dev): bump ws in /src/chains/filecoin/filecoin (dependabot[bot])
  • #882 feat: add dockerfile for Docker Hub container image (@kevinbluer)
  • #923 feat: change miner.gasPrice option to miner.defaultGasPrice (@davidmurdoch)
  • #925 fix(debug_traceTransaction): make sure we dont run all the txs in a block when debugging them (@davidmurdoch)
  • #817 feat: allow starting up with 0 accounts (@davidmurdoch)
  • #928 fix(cli): miner.difficulty should accept strings (@davidmurdoch)
  • #926 fix: signed raw transactions must always have a nonce (@davidmurdoch)
  • #929 fix(forking): ignore txs that fail when running the block in traceTransaction (@davidmurdoch)
  • #930 fix(forking): ensure forked receipt logs work (@davidmurdoch)
  • #932 fix: use correct RPC method for gasPrice (@davidmurdoch)
  • #934 chore: automate release (@davidmurdoch)
  • #937 fix: add Iuri Matias back to license (@davidmurdoch)
  • #895 fix: upgrade @trufflesuite/uws-js-unofficial to use better polyfill (@seesemichaelj)
  • #946 fix: remove trfl.co links (@davidmurdoch)
  • #1044 chore: rename ganache-core to ganache (@davidmurdoch)
  • #1045 fix: remove phrase from cli help messages (@davidmurdoch)
  • #1046 fix: remove extra space from CLI version string (@davidmurdoch)
  • #944 fix: support node 16 (@davidmurdoch)
  • #1058 fix: switch back to lockfileVersion: 1 (@davidmurdoch)
  • #1065 fix: increase max payload size to match geth (@davidmurdoch)
  • #1068 chore: add alpha branch to CI (@davidmurdoch)
  • #943 fix: add EIP2930 Access List Transactions (@micaiahreid)
  • #1097 fix: websocket error timeout issue by updating uws to .12 (@davidmurdoch)
  • #1117 fix: make sure zero address is always signed with the same key (@davidmurdoch)
  • #1135 feat: london (@davidmurdoch)
  • #1199 fix: verify chain id in type 1 and 2 transactions (@davidmurdoch)
  • #1226 docs: add link to ganache-cli-archive (@davidmurdoch)
  • #1227 fix: handle initialization errors on server.listen, handle fallback rejections (@davidmurdoch)
  • #1323 docs: update evm_revert documentation (@davidmurdoch)
  • #1253 fix: use new url shortener links (@davidmurdoch)
  • #1407 docs: call out ganache-cli@latest documentation loudly (@davidmurdoch)
  • #1103 chore(deps): bump tar from 4.4.16 to 4.4.19 (dependabot[bot])
  • #1339 perf: add a disk cache for forking requests (@davidmurdoch)
  • #1519 chore: update min Node.js version to 12.0.0, add support for Node.js v17 (@davidmurdoch)
  • #1551 fix: make web builds work (@davidmurdoch)
  • #1593 fix: make web3_sha encode data correctly (@davidmurdoch)
  • #1513 fix: improve account locking (@micaiahreid)
  • #1588 chore: revert to node 14 for release (@davidmurdoch)
  • #1524 feat: add support for arrowGlacier hard fork (@davidmurdoch)
  • #1587 fix: make the quiet flag actually work (@davidmurdoch)
  • #1553 chore: ensure new packages can be published (@davidmurdoch)
  • #1518 chore: update bufferutil and utf-8-validate (@davidmurdoch)
  • #1537 fix: make forking chainId aware (@davidmurdoch)
  • #1579 feat: integrate with infura (@davidmurdoch)
  • #1591 fix: remove bigint's n from cli output (@davidmurdoch)
  • #1589 fix: return error for eth_call when call errors (@davidmurdoch)
  • #1610 chore: prepare for beta release (@davidmurdoch)
  • #1650 fix: update equality checks for replacement transactions to prevent erroneous underpriced errors (@micaiahreid)
  • #1614 docs: update README badge to beta version (@davidmurdoch)
  • #1613 fix: make docker publish work (@davidmurdoch)
  • #1592 fix: async request processing (@davidmurdoch)
  • #1662 fix: don't return an error from miner_start if aleady started (@davidmurdoch)
  • #1731 fix: parse cli time option correctly (@davidmurdoch)
  • #1732 fix: don't alter metadata state during eth_estimateGas (@davidmurdoch)
  • #1661 fix: ensure eth_sendTransaction returns the correct error when the account has insufficient funds (@davidmurdoch)
  • #1740 fix: prevent DEBUG env var from crashing ganache (@davidmurdoch)
  • #1738 fix: correct bad type (@davidmurdoch)
  • #1737 fix: permit using legacy fork.provider where appropriate (@davidmurdoch)
  • #1769 chore: drop support for Node.js-unsupported odd-numbered node versions (@davidmurdoch)
  • #1780 fix: version disparity between startup/web3_clientVersion (@micaiahreid)
  • #1842 fix: reject transactions with insufficient funds (@davidmurdoch)
  • #1829 fix: update callGasLimit to match geth's (@davidmurdoch)
  • #1781 feat: export typescript types in build (@davidmurdoch)
  • #1871 fix: make Tag type usable (@davidmurdoch)
  • #1873 build: ensure filter-shrinkwrap runs at release (@davidmurdoch)
  • #1861 fix: fix typo in evm_setTime docs (@gas1cent)
  • #1973 fix: update gas limit to 30M (@davidmurdoch)
  • #1972 docs: add docs for docker to readme (@davidmurdoch)
  • #1539 feat: add txpool_content RPC method. (@domob1812)
  • #1990 fix: include impersonated accounts in eth_accounts (@davidmurdoch)
  • #1980 fix: eth_call should use the same baseFee as given block num (@davidmurdoch)
  • #1992 chore: increase test timeout for slow CI (@davidmurdoch)
  • #1989 fix: update leveldb-related packages (@davidmurdoch)
  • #2013 feat: replace legacyInstamine option with instamine=eager|strict (@davidmurdoch)
  • #2037 chore: remove canary, add rc to release branches (@micaiahreid)
  • #2041 fix: update README to be for rc (@micaiahreid)
  • #2046 chore: update create script for latest typescript (@davidmurdoch)

back to changelog

back to top


Known Issues

  • evm_setAccountNonce is race-conditiony (#1646)
  • --miner.callGasLimit implementation is wrong (#1645)
  • We don't return a proper pending block (#772)
  • Forking doesn't work in the browser (#1245)
  • Uncles aren't fully supported when forking (#786)
  • Forking may fail in weird and unexpected ways. We need to "error better" here (#615)
  • Node.js v12 outputs a µWS warning in the console (#2095)
  • Node.js v12 doesn't handle memory as well as 14+ and may crash computing very large debug_traceTransaction results (#2106)
  • Our bundle size is larger than ideal (#2096)

back to top


Future Plans

  • Update the eth_maxPriorityFeePerGas RPC method to return as Geth does, eth_gasPrice - baseFeePerGas (#2097)
  • Add support for the eth_feeHistory RPC method (#1470)
  • Support for enabling eligible draft EIPs before they are finalized or considered for inclusion in a hard fork (#1507)
  • New hard fork support well in advance of the hard fork launch (#2099)
  • Add an eth_createAccessList method (#1056)
  • Track test performance metrics over time (#2105)
  • Track real world Ganache usage (opt-in and anonymized) to better tune performance and drive bug fixes and feature development (#2100)
  • Track test coverage (#2101)
  • evm_mine will return the new blocks instead of just 0x0 (#536)
  • Add new evm_setCode and evm_setStorageAt RPC methods (#649)
  • Make evm_snapshot ids globally unique (unpredictable instead of a counter) (#655)
  • Support eth_getRawTransactionByHash RPC method (#135)
  • Support debug_accountAt RPC method (#813)
  • Allow "mining" to be disabled on start up (#248)
  • Set CLI options via config file, package.json, or ENV vars (#2102)
  • Create a CLI interactive/REPL mode (#2103)
  • Enable a CLI daemon mode (#2104)
  • "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!
  • 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.

Open new issues (or join our team) to influence what we gets implemented and prioritized.

back to top


💖 The Truffle Team

[email protected]

2 years ago

 New Features   Fixes   Miscellaneous   Known Issues   Future Plans 


This release is the first "Release Candidate" (rc) release of the new and improved Ganache v7.0.0. You'll definitely want to catch up on the previous changes from the beta releases, if you haven't already, before reading on!

Thanks to everyone who tried out our previous alpha and beta releases and provided feedback! You have been immensely helpful!

Special thanks to @domob1812, @gas1cent, and @MicaiahReid for your contributions to this release, and to @Fatorin and @0xng for reporting issues.

To install globally run:

npm uninstall ganache-cli --global
npm install ganache@rc --global


Highlights

We've changed 45 files across 12 merged pull requests, tallying 1003 additions and 383 deletions, since our last release.

This is an official release candidate for Ganache 7! :tada: This release contains two new features and a few bug fixes. If you do find any issues on this release, please report them! We'd much rather get them fixed before a stable release.

back to top


New Features


feat: add txpool_content RPC method. (#1539)

The new txpool_content RPC method returns the current contents of the transaction pool. The contents of the transaction pool are grouped into "pending" and "queued" transactions. "Pending" transactions are those that are immediately executable in the transaction pool, meaning that the transaction's nonce is equal to the sender account's next nonce. A "queued" transaction is one with a future nonce that is not immediately executable. Each of the groups of "pending" and "queued" transactions is grouped by the transaction's origin (aka sender), and a group of transactions from one origin are grouped by the origin's nonce.

Here is an example response:

{
  "pending" : {
    "0x8e89f513c2ed8eb9d915196199615e590028b727" : {
      "0" : { /* eth_getTransactionByHash */ }
    }
  },
  "queued" : {
    "0x8e89f513c2ed8eb9d915196199615e590028b727" : {
      "2" : { ... },
      "3" : { ... },
    }
  }
}

back to new features

feat: replace legacyInstamine option with instamine=eager|strict (#2013, #2043)

This feature doubles as both an unbreaking change to Ganache v6.x.x and a breaking change for alpha and beta pre-releases of Ganache v7.0.0.

Ganache v6's instamine behavior would include a submitted transaction in a block before returning the transaction hash. This allows the caller to immediately follow a call to eth_sendTransaction with a successful call to eth_getTransactionReceipt. This behavior will never occur against a real node, as it takes time for a transaction to be included in a block. This is very convenient for testing but resulted in a bit of confusion for new Ethereum developers into how eth_sendTransaction (and related RPC methods) worked.

Previously, pre-releases of Ganache v7.0.0 "fixed" this confusion by defaulting to a new strict instamine mode that more accurately recreated the behavior of a real node: it would return the transaction hash to the caller before the transaction was included in a block. This would result in calls to eth_getTransactionReceipt to sometimes return null, depending on timing, when they used to always return the receipt. This is normal real-world behavior, but because the Ethereum JavaScript Provider spec doesn't yet afford an easy and convenient way of detecting transaction changes we found this behavior to be too cumbersome to be a new default, compared to the v6 default (which we called --legacyInstamine in the v7 pre-releases).

This release reverts the previous decision to default to a strict instamine mode, and instead defaults to the v6 way, and is now referred to as "eager" instamine mode (instead of --legacyInstamine).

We still encourage users to use the new strict mode, which can be opted into by setting the --instamine flag/option to "strict":

ganache --instamine strict

or

const provider = ganache.provider({
  miner: {
    instamine: "strict"
  }
});

To upgrade from other pre-release versions of Ganache v7:

If you set --legacyInstamine flag:

Just remove the flag, as this behavior is the new default (now called "eager" instamine mode)

If you used the default (you didn't set the --legacyInstamine) flag:

The new default mode should work in nearly all instances that strict mode works, so you likely don't need to do anything. But if you do want to continue to use "strict" mode you will need to add the "strict" instamine mode flag:

ganache --instamine strict

or

const provider = ganache.provider({
  miner: {
    instamine: "strict"
  }
});

back to new features

back to top


Fixes


fix: fix typo in evm_setTime docs (#1861)

This is will result in an invalid state -> This will result in an invalid state

back to fixes

fix: update gas limit to 30M (#1973)

Ethereum's average block gas limit has been around 30,000,000, so we are updating Ganache's default to match.

As a reminder, we regularly update Ganache defaults to match that of mainnet without a breaking-change release.

back to fixes

fix: include impersonated accounts in eth_accounts (#1990)

Accounts added via the --unlock flag were not being returned in calls to eth_accounts and personal_listAccounts. This PR fixes this issue.

back to fixes

fix: eth_call should use the same baseFee as given block num (#1980)

Previously, whenever eth_call was used to execute a message call the baseFeePerGas used to run the transaction was incorrect. This would cause the BASEFEE opcode to be incorrect, which could result in invalid results for contracts that use this opcode. The fee was also used to calculate the transaction's gas cost, which can also affect the way the transaction is run within the EVM. Now, the blockNumber passed in when calling eth_call is used to fetch that block's baseFeePerGas, which is in turn used to calculate the transaction's cost.

back to fixes

Updated leveldb and related packages to the latest versions. This fix should bring native compatibility to more systems.

back to fixes

back to top


Miscellaneous

  • docs: add docs for docker to readme (#1972)
  • chore: increase test timeout for slow CI (#1992)
  • chore: remove canary, add rc to release branches (#2037)
  • fix: update README to be for rc (#2041)

back to top


Known Issues

  • evm_setAccountNonce is race-conditiony (#1646)
  • --miner.callGasLimit implementation is wrong (#1645)
  • 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
  • Node.js v12 doesn't handle memory as well as 14+ and may crash computing very large debug_traceTransaction results
  • Our bundle size is larger than ideal

back to top


Future Plans

  • Update the eth_maxPriorityFeePerGas RPC method to return as Geth does, eth_gasPrice - baseFeePerGas.
  • Add support for the eth_feeHistory RPC method.
  • 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 just 0x0.
  • 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 and evm_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!
  • 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


💖 The Truffle Team