This repository has been archived by the owner on Feb 26, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 683
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
* add eth_signTypedData_v4 and call it from eth_signTypedData * error when string is sent to signTypedData
* add alternative to Error.captureStackTrace * Update readme to show how to use ganache in the browser * fix link location in readme * build after doc updates * Update src/packages/ganache/README.md Co-authored-by: David Murdoch <187813+davidmurdoch@users.noreply.github.com> * Apply suggestions from code review Co-authored-by: David Murdoch <187813+davidmurdoch@users.noreply.github.com>
* perf: add an in-memory LRU cache for forking requests * add forking tests and fix bugs * clarify comment * `hasOwn` does null/undefined checks already * hasOwn already checks for null/undefined * Update src/chains/ethereum/ethereum/tests/forking/forking.test.ts Co-authored-by: Micaiah Reid <micaiahreid@gmail.com> * Update src/chains/ethereum/ethereum/src/forking/handlers/base-handler.ts Co-authored-by: Micaiah Reid <micaiahreid@gmail.com> * remove unused imports Co-authored-by: Micaiah Reid <micaiahreid@gmail.com>
* for replacement txs, only add to pool once * fix return value for already queued tx * allow replacement of future-nonce transactions * increase nonce to fix test * some cleanup * add error for replaced txs * refactor * remove unused functions * allow origins to optionally be used in txpool constructor * remove impossible code path * transaction pool tests * fix bug with looping over empty executables * add await to assert.rejects * fix assert.reject fail case messaging
* for replacement txs, only add to pool once * fix return value for already queued tx * allow replacement of future-nonce transactions * increase nonce to fix test * some cleanup * add error for replaced txs * refactor * remove unused functions * allow origins to optionally be used in txpool constructor * remove impossible code path * transaction pool tests * fix bug with looping over empty executables * add await to assert.rejects * fix assert.reject fail case messaging * initial run at docker publish * fix action versions * hardcode version for now * allow manual workflow running * fix reference to version * change some data to temp test data * update docker publish tags * set path to dockerfile * trying to get path to Dockerfile working * test package publish * update repo to publish for test * actually pub to gh packages * update release workflow to publish to docker/gh packages * delete unused files * initial run at docker publish * fix action versions * hardcode version for now * allow manual workflow running * fix reference to version * change some data to temp test data * update docker publish tags * set path to dockerfile * trying to get path to Dockerfile working * test package publish * update repo to publish for test * actually pub to gh packages * update release workflow to publish to docker/gh packages * delete unused files
* add missed field to transaction test * add effectiveGasPrice to transaction's "extra" data * fix miscalculation in gas price tests * fix bug with overwriting data on upgraded txs * add tests persisting accurate gasPrice for db eip-1559 txs * fix bug with 0 baseFee being omitted from block * actually fix bug with base fee that I previously made worser * update eth_call to properly use eip-1559 gas tx data * add very basic tests for eth_call * remove unused import * remove console.log * change to falsey check * move initial updateEffectiveGasPrice call to api * fix resultant test issues of moving updateEffectiveGasPrice * add missed field to transaction test * add effectiveGasPrice to transaction's "extra" data * fix miscalculation in gas price tests * fix bug with overwriting data on upgraded txs * add tests persisting accurate gasPrice for db eip-1559 txs * fix bug with 0 baseFee being omitted from block * actually fix bug with base fee that I previously made worser * update eth_call to properly use eip-1559 gas tx data * add very basic tests for eth_call * remove unused import * remove console.log * change to falsey check * move initial updateEffectiveGasPrice call to api * fix resultant test issues of moving updateEffectiveGasPrice * remove unused references * move updateEffectiveGasPrice call to txpool * add common/blocks to our fake blockchain for tests. fix underpriced tx * remove unnecessary function call * move variable declaration context * Apply suggestions from code review Co-authored-by: David Murdoch <187813+davidmurdoch@users.noreply.github.com> * remove unused contract functions * rename Example contract to EthCall Co-authored-by: David Murdoch <187813+davidmurdoch@users.noreply.github.com>
* use new @trufflesuite/bigint-buffer * temporarily disable windows tools install * temporarily revert to previous bigint-buffer lib * remove msbuild tools * remove line * add basic test for bigint-buffer library * force warning to test * update warn message for test * fix tests * use sinon in test * trying to force failure in CI * unforce failed tests * npm ci to install on PR * update setup-node action version * some logging and uninstalling * correct spelling * add back msbuild * removed unnecessary installations * use trufflesuite's bigint-buffer lib * update package-lock * correct bigint-buffer import * Remove .only from test Co-authored-by: David Murdoch <187813+davidmurdoch@users.noreply.github.com> * revert to windows-2019 version for tests Co-authored-by: David Murdoch <187813+davidmurdoch@users.noreply.github.com>
Bumps [tar](https://github.com/npm/node-tar) from 4.4.16 to 4.4.19. - [Release notes](https://github.com/npm/node-tar/releases) - [Changelog](https://github.com/npm/node-tar/blob/main/CHANGELOG.md) - [Commits](isaacs/node-tar@v4.4.16...v4.4.19) --- updated-dependencies: - dependency-name: tar dependency-type: indirect ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Micaiah Reid <micaiahreid@gmail.com>
…v17 (#1519) This also normalizes package-lock.json indentation to use tabs (which was more common already)
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Highlights
Breaking Changes
Fixes
New Features
Known Issues
Future Plans
This release is the third alpha release of the new and improved Ganache v7.0.0. You'll definitely want to catch up on the previous changes, if you haven't already, before reading on!
Thanks to everyone who tried out our previous alpha releases and provided feedback! You have been immensely helpful!
And special thanks to contributors, mentors, and reviewers: @MicaiahReid, @gnidan, @cds-amal, and @haltman-at. And special thanks to our community members for reporting and commenting on issues fixed by this release: @aliveli186, @winksaville, @anvacaru, @wilwade, and @moda20!
Not: this is still an alpha release; even these 7.0.0 release notes are "alpha" and the information here is likely incomplete. There will be bugs and kinks to work out before we ship things off to
beta
,rc
, then finally tolatest
. You absolutely should use this alpha release, but only to try it out and let us know where it breaks for you!In other words: 🔥🐉 Here be dragons 🔥🐉️
To install globally run:
We've changed 131 files across 18 merged pull requests, tallying 37,511 additions and 35,611 deletions, since our last release.
These changes bring:
debug_traceTransaction
, by over 30x!back to top
We've dropped support for Node.js v10 (and added v17) (#1519)
Node.js v10 reached its end of life in April of this year, and Truffle dropped support for it in October. Ganache is following suit in the v7.0.0 release.
This will simplify Ganache development and will result in smaller bundle sizes as we no longer need to transpile features available natively in Node v12 for Node v10.
back to top
So. Many. Fixes.
server.listen
baseFeePerGas
on pre-London blocksdebug_traceTransaction
responsesFixes various issues with EIP-1559 transactions (#1307)
Previously, a transaction's
effectiveGasPrice
was not stored in Ganache's database because, before London, this value was easy to calculate. After the introduction of the London hardfork defaulting to the previousgasPrice
would cause a type-2 transaction to have a differenteffectiveGasPrice
before and after saving to Ganache's database. Now, we store theeffectiveGasPrice
in the database so the correct gas price for each transaction type can be retrieved when fetching the transaction.We also use the EIP-1559 transaction's gas fields for
eth_call
and accurately upgrade legacy type-0 transactions to type-2 transactions when certain data is omitted from the transaction.back to fixes
Prevents a replaced, future-nonce transaction from being run alongside its replacement transaction (#1237)
It is possible to send a future-nonce transaction². You may also want to replace that future-nonce transaction. Before this fix, both the original and replacement future-nonce transaction would be executed. 😬
Previously, when an immediately executable transaction was received we'd check:
We now perform all of those same checks against the future-nonce transactions in the transaction pool, not just the executable transactions.
back to fixes
Ganache now works in the browser on Firefox, Microsoft Edge, and Safari (#1247)
🎉 YAY 🎉
back to fixes
Handle initialization errors and handle fallback rejections for
server.listen
(#1227)When you run
const server = Ganache.server()
Ganache immediately begins initializing internal components, eagerly running dozens of asynchronous operations. But any one of these async operations could fail. Previously these failures would appear as an Unhandled Rejection.We now handle these by delaying the exception until the call to
server.listen
is made. If the call toGanache.server
resulted in any initialization exceptions their rejection will be deferred until the callback or fulfillment of thislisten
call.back to fixes
Stop returning
baseFeePerGas
on pre-London blocks (#1541)When forking, a user may request a fork-point block that is before the London hardfork while London is actually activated in their Ganache instance. In Ganache v7 alpha.1, we'd return the block's
baseFeePerGas
before that field actually existed on mainnet because London was technically enabled in Ganache. Now, we keep better track whether thebaseFeePerGas
should be included or not.back to fixes
Suppress annoying Windows startup warnings by using our prebuilt bigint-buffer fork (#1414)
On some platforms Ganache would issue a warning about falling back to a pure JS version of this library due to compilation not being possible. We now pre-compile the library for all supported platforms.
back to fixes
Support 1+ GB
debug_traceTransaction
responses (1339)Ganache can now run
debug_traceTransaction
on Ethereum's largest most complex transactions! Here's a shallow-dive on how we solved this:The Problem
Node.js limits the size of strings to 256MB - 1GB, depending on the Node version, and larger transaction traces often exceed 1GB in size. You may think, "Simple! Just transmit the data in an
ArrayBuffer
instead of usingJSON.stringify
". But then you'd spend a whole day writing code to convert your JavaScript object directly to a Buffer only to find out that node limits the size of Buffers to about 2 GB (depending on the node version) and you are back to where you started! A trace of the recent Cream Finance hack is over 10GB!The Solution
HTTP Packets and WebSocket Fragments! Now, whenever Ganache detects a large
debug_traceTransaction
result (currently hardcoded to 100000 steps) it will start converting the trace results directly from their JavaScript object representation to UTF-8 encoded Buffers of each individual piece of data, skipping theJSON.stringify
ication step all together.While our implementation is not yet an optimal solution, as we sometimes transmit single byte packets (over HTTP) or fragments (over WebSockets¹), and don't handle backpressure, it allows us to transmit arbitrarily large traces limited only by the memory allotted to the node process.
Of course, the receiving end of the trace needs to be able to handle the large amounts of data flowing in, and Truffle doesn't yet support this (see #4381 for work being done there).
back to fixes
back to top
eth_signTypedData_v4
Much Faster Forking Performance (#1248, #1339)
We've added two new caching layers to Ganache's forking feature that greatly improve performance, making Ganache v7 alpha.2 up to 30x times faster than Ganache v7 alpha.1!
In Ganache v7-alpha.1
debug_traceTransaction
for transaction 0xa45166af02ee01ce2817b5a60862d758b4eae9449ad3f82f44c93818ea26e003 would previously take about 2 ½ minutes to compile and send.With a warm cache this will now take about 3 ½ seconds! ~30x faster!
In-memory LRU cache
The first caching layer is an in-memory LRU cache. This cache will store previous forking request results in memory so successive calls during the same Ganache session don't have to make the expensive network request to fetch the data again.
Persistent cache
The second caching layer is the more interesting cache and utilizes @truffle/db's network algorithm to efficiently store and retrieve requests and their responses to a persistent disk-backed database.
What this enables is for Ganache to differentiate blockchain networks based not on their chainId or networkId, but the contents of historical blocks.
You can always delete this persistent cache by running Ganache with the
--fork.deleteCache
flag. To disable both caches use the--fork.disableCache
flag.back to features
Ganache Docker Images (#1318)
Our Docker image will stay up-to-date with our releases! To use them, simply run:
$ docker run --publish 8545:8545 trufflesuite/ganache
To pass options through to Ganache add the arguments to the run command:
back to features
Support for
eth_signTypedData_v4
(#1231)We now support
eth_signTypedData_v4
, which can be used to sign typed data. For more information on this signing method, see MetaMask's helpful guide.back to features
back to top
eth_call
is not behaving as it should in alpha version (#1547)eth_call
should return JSON-RPC error on revert (#1496)asyncRequestProcessing
doesn't default totrue
like it is supposed to (#1532)web_sha3
should accept a hex-encoded string (#1375)chainId
shouldn't match the remote chain. We really should use a differentchainId
than the remote, but still be able to contextualize past transactions with their originalchainId
(#628)back to top
eth_createAccessList
method.evm_mine
will return the new blocks instead of just0x0
.evm_setCode
andevm_setStorageAt
RPC methods.evm_snapshot
ids globally unique (unpredictable instead of a counter).eth_getRawTransactionByHash
RPC method.debug_accountAt
RPC method.ganache filecoin
command will look for the@ganache/filecoin
package and start up a Filecoin and IPFS server.ganache --flavor ethereum --flavor filecoin --flavor optimism
.ganache --fork mainnet
to fork mainnet via your own Infura account.Open new issues (or join our team) to influence what we gets implemented and prioritized.
back to top
1. Thanks to @alexhultman for his work on the uWebsockets.js library!
2. Meaning: a transaction that will not be immediately executable but will stay in the transaction pool until the
from
account's nonce catches up with that of the transaction💖 The Truffle Team