github trufflesuite/ganache v7.4.0

latest releases: v7.9.2, ganache@7.9.2, v7.9.1...
2 years ago

 Highlights   New Features   Fixes   Miscellaneous   Changelog   Known Issues   Future Plans 


It's been a little while since you've seen a Ganache release, but trust us, we're hard at work making Ganache better. Today we've got 2 new features, 2 bug fixes, and 11 miscellaneous internal changes to prove it 💪

We've changed 44 files across 16 merged pull requests, tallying 9431 additions and 172 deletions, since our last release.

If you have some time, we encourage you to browse our issues to find anything you'd like implemented/fixed sooner. Give them a +1 and we'll use this community feedback to help prioritize what we work on! Or better yet, open a new issue, or open a PR to fix an existing issue.

And a huge thank you to all issue openers/commenters (@area, @facuspagnuolo, @saurik, @simon-jentzsch) and contributors (@jeffsmale90, @cds-amal, @davidmurdoch, @gnidan, @tenthirtyone) who were a part of making this release happen!


Highlights

We've merged 16 Pull Requests for this release, and most of them were internal facing changes or small bug fixes you probably won't notice. However, there are two new features you'll really love!

  1. Ganache joins Remix, Foundry, and Vyper in supporting Hardhat style console.log statements from directly within Solidity!

  2. We've implemented eth_getProof which opens up the possibility to use Ganache together with Layer-2 blockchains, among other possibilities.

back to top


New Features

  • feat: add the ability to use console.log from Solidity (#3327, #3421)
  • feat: add eth_getProof RPC method (#3199)

feat: add the ability to use console.log from Solidity (#3327, #3421)

Ganache now supports console.log in Solidity!

Ganache now understands the output of Vyper's print statement and Hardhat's console.sol library contract.

Details and how-tos will be written up in Truffle's upcoming console.log release. So stay tuned for that!

If you want to try it out in your Truffle projects today you don't have to wait! Install our new package @ganache/console.log (npm install @ganache/console.log) then use it in your Solidity contracts as follows:

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.13;

import "@ganache/console.log/console.sol";

contract GanacheCoin {
    mapping (address => uint) balances;
    constructor() {
        balances[tx.origin] = 10000;
    }

    function sendCoin(address receiver, uint256 amount) public returns(bool sufficient) {
        if (balances[msg.sender] >= amount) {
            balances[msg.sender] -= amount;
            balances[receiver] += amount;
            console.log("send: %o coins to %o", amount, receiver);
            return true;
        } else {
            return false;
        }
    }
}

Make sure you are using the latest version of Ganache (v7.4.0 or later) and you should then see console.log output alongside the usual Ganache output! Example:

back to new features

feat: add eth_getProof RPC method (#3199)

EIP-1186 proposes a new eth_getProof RPC method, which returns a number of useful values, including hashes and proofs associated with the given address and storage keys.

You can call this new RPC method with something like:

const result = provider.request({
  "method": "eth_getProof",
  "params": [
    // the address to query and generate proof for
    "0x7F0d15C7FAae65896648C8273B6d7E43f58Fa842", 
    // optional storage keys to generate proofs for
    ["0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421"], 
    // the block at which to generate the proof
    "latest" 
  ]
});

And it will return something like this:

{
  "accountProof": [
    "0xf90211a...0701bc80",
    "0xf90211a...0d832380",
    "0xf90211a...5fb20c80",
    "0xf90211a...0675b80",
    "0xf90151a0...ca08080"
  ],
  "balance": "0x0",
  "codeHash": "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470",
  "nonce": "0x0",
  "storageHash": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
  "storageProof": [
    {
      "key": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
      "proof": [
        "0xf90211a...0701bc80",
        "0xf90211a...0d832380"
      ],
      "value": "0x1"
    }
  ]
}

A great big thanks to the team at EthereumJS, and specifically to @jochem-brouwer, whose implementation of eth_getProof does all of the heavy lifting for us. 🎉

Fixes: #3076 and #382.

back to new features

back to top


Fixes

  • fix: issue where Quantity.toNumber() returns incorrect value with leading 00 bytes, and meaningful byte length > 6 (#3328)
  • fix: set up the chain correctly to ensure a consistent start time (#3389)

fix: issue where Quantity.toNumber() returns incorrect value with leading 00 bytes, and meaningful byte length > 6 (#3328)

A regression in v7.3.1 introduced an issue where (in a fairly narrow edge case) an incorrect value was returned from an internal RPC data representation.

The return value of Quantity.toNumber() was incorrect in the case where the input buffer contained at least one leading 00 byte, and the significant byte length was greater than 6.

The result was a significantly lower value – the correct value right shifted by the number of leading 00 bytes.

e.g., [0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00] would have been converted to [0x10, 0x00, 0x00, 0x00, 0x00, 0x00]
resulting in: 17_592_186_044_416 instead of 4_503_599_627_370_496.

back to fixes

fix: set up the chain correctly to ensure a consistent start time (#3389)

Previously, when initializing Ganache, slightly different start times could be used in different places. This caused calls to evm_increaseTime to return a value 1 second less than expected.

With this change, Ganache uses a single call to Date.now() for calculating the internal time offset.

Fixes: #3271.

back to fixes

back to top


Miscellaneous

  • chore: add "Pull Requests" section to CONTRIBUTING.md (#3289)
  • ci: avoid timeouts in mac-os github actions (#3356)
  • docs: update --verbose cli help text (#3354)
  • test: fix intermittent test failure (#3357)
  • build(deps): bump parse-url from 6.0.0 to 6.0.2 (#3334)
  • chore: create CODEOWNERS (#3188)
  • docs: correct callGasLimit default value in README (#3322)
  • chore: enforce concurrency: production in Release workflow (#3355)
  • chore: update internal hasOwn JSDoc so it is correct (#3379)
  • docs: add callGasLimit default change to breaking changes list in UPGRADE-GUIDE.md (#3320)
  • chore: remove unused build file (#3274)

chore: add "Pull Requests" section to CONTRIBUTING.md (#3289)

You may have guessed it, but this change adds a "Pull Requests" section to our CONTRIBUTING.md! But while we're here talking about how you can contribute to Ganache, why not check out our help wanted and good first time contributor issues to start contributing yourself!

back to miscellaneous

ci: avoid timeouts in mac-os github actions (#3356)

A recently introduced test borders on the edge of "just fast enough" and "too slow" and was causing intermittent test timeouts in the our GitHub Actions macOS runner. We've increased the timeout of this test to give it plenty of overhead.

back to miscellaneous

docs: update --verbose cli help text (#3354)

The documentation for the --verbose CLI flag was inaccurate. Now it isn't.

back to miscellaneous

test: fix intermittent test failure (#3357)

A recent change improved the accuracy of internal types and caused a test to become flaky. Whenever the from or to values in the test contained leading 00s (like 0x00C7656EC7ab88b098defB751B7401B5f6d8976F) the test would fail.

Before the change in #2983 Quantity.from("0x0011223344").toBuffer() would return Buffer< 00 11 22 33 44 >; after #2983 leading 00 bytes are stripped off, returning Buffer< 11 22 33 44 >. This change would cause the test to fail because the Ethereum JS Address class validates the length of the input buffer, and throws if it is not exactly 20 bytes.

We now use an Address class to handle the addresses in this test.

back to miscellaneous

build(deps): bump parse-url from 6.0.0 to 6.0.2 (#3334)

Thanks, @dependabot!

back to miscellaneous

chore: create CODEOWNERS (#3188)

This just sets up an initial CODEOWNERS file so we can improve our code review process in the near future.

back to miscellaneous

docs: correct callGasLimit default value in README (#3322)

This goes along with #3320 to correct some documentation on a previous release that changed our default callGasLimit value.

back to miscellaneous

chore: enforce concurrency: production in Release workflow (#3355)

This ensures we don't trigger multiple Releases at once. See https://docs.github.com/en/actions/deployment/about-deployments/deploying-with-github-actions#using-concurrency for details on how this works.

back to miscellaneous

chore: update internal hasOwn JSDoc so it is correct (#3379)

The JSDoc comment for our internal hasOwn helper was out of date with the implementation. Now it's not.

back to miscellaneous

docs: add callGasLimit default change to breaking changes list in UPGRADE-GUIDE.md (#3320)

A known change in default start up options in Ganache v7 was left undocumented. This change adds a note about this change to our UPGRADE-GUIDE.md.

back to miscellaneous

chore: remove unused build file (#3274)

Just removing some totally unused code. Nothing to see here!

back to miscellaneous

back to top


Changelog

back to top


Known Issues

Top Priority:

  • debug_storageRangeAt fails to find storage when the slot was created earlier in the same block (#3338)
  • calling evm_mine with a timestamp does not persist time offset (#3265)
  • Architecture not supported (#2256)
  • Add eth_feeHistory RPC endpoint (#1470)
  • Add eth_createAccessList RPC method (#1056)

Coming Soon™:

  • Implications failed: fork.headers -> url (#2627)
  • In Geth chain-mode, logic to accept/reject transactions based on gas price/limit should match Geth (#2176)
  • evm_mine and miner_start don't respect --mode.instamine=eager (#2029)
  • evm_setAccountNonce is race-conditiony (#1646)
  • @ganache/filecoin@alpha doesn't work with ganache@alpha (#1150)
  • Launching ganache with fork is throwing revert errors when communicating with 3rd party contracts (#956)
  • Build a real pending block! (#772)
  • VM Exception when interfacing with Kyber contract (#606)
  • After calling evm_mine, eth_getLogs returns same logs for all blocks (#533)
  • personal_unlockAccount works with any password (#165)
  • --db Option Requires Same Mnemonic and Network ID (#1030)

back to top


Future Plans

Top Priority:

  • Add flag for starting ganache in detached mode (#1001)
  • Accept a genesis.json file (#1042)

Coming Soon™:

  • Switch to esbuild to make build times faster/reasonable (#1555)
  • Add eip-155 support (#880)
  • Allow to sync forked chain to the latest blcok (#643)
  • Implement a streaming trace capability (#381)
  • Improve log performance when forking (#145)
  • 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

Don't miss a new ganache release

NewReleases is sending notifications on new releases.