Skip to content
This repository has been archived by the owner on Feb 26, 2024. It is now read-only.

Commit

Permalink
Merge branch 'develop' into feat/detach_fuzzy_matching
Browse files Browse the repository at this point in the history
  • Loading branch information
davidmurdoch committed Aug 14, 2023
2 parents 4ce7169 + 7065916 commit f8e29a8
Show file tree
Hide file tree
Showing 702 changed files with 138,767 additions and 85,877 deletions.
4 changes: 2 additions & 2 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ docs/assets/launch.json linguist-language=JSON5
tsconfig-base.json linguist-language=JSON5
.nycrc linguist-language=JSON
.prettierrc linguist-language=JSON
src/packages/ganache/api-extractor.json linguist-language=JSON5
src/packages/ganache/tsdoc.json linguist-language=JSON5
packages/ganache/api-extractor.json linguist-language=JSON5
packages/ganache/tsdoc.json linguist-language=JSON5
18 changes: 0 additions & 18 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -1,21 +1,3 @@
# global code owner:

* @davidmurdoch

# typed transactions:

src/chains/ethereum/transaction/src/access-lists.ts @MicaiahReid
src/chains/ethereum/transaction/src/base-transaction.ts @MicaiahReid
src/chains/ethereum/transaction/src/eip1559-fee-market-transaction.ts @MicaiahReid
src/chains/ethereum/transaction/src/eip2930-access-list-transaction.ts @MicaiahReid
src/chains/ethereum/transaction/src/legacy-transaction.ts @MicaiahReid
src/chains/ethereum/transaction/src/transaction-factory.ts @MicaiahReid
src/chains/ethereum/transaction/src/transaction-types.ts @MicaiahReid

# transaction pool:

src/chains/ethereum/ethereum/src/transaction-pool.ts @MicaiahReid

# miner:

src/chains/ethereum/ethereum/src/miner @MicaiahReid
6 changes: 3 additions & 3 deletions .github/actions/docker-publish/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ runs:
# https://docs.github.com/en/actions/creating-actions/creating-a-composite-action
using: "composite"
steps:
- name: Use npm 14
- name: Use node 16
uses: actions/setup-node@v3
with:
node-version: 14
node-version: 16

- name: Run installation
run: npm ci
Expand Down Expand Up @@ -64,7 +64,7 @@ runs:
uses: docker/build-push-action@175d02bffea74695e96b351069ac938b338802f9
with:
context: .
file: ./src/packages/ganache/Dockerfile
file: ./packages/ganache/Dockerfile
push: true
tags: ${{ format('trufflesuite/ganache:{0}, trufflesuite/ganache:v{1}', inputs.TAG, inputs.VERSION) }}
labels: ${{ steps.meta.outputs.labels }}
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
strategy:
fail-fast: false
matrix:
node: [14.0.0, 14.x, 16.x, 18.x]
node: [16.0.0, 16.x, 18.x, 20.x]
os: [windows-2019, ubuntu-20.04, ubuntu-22.04, macos-12]

runs-on: ${{ matrix.os }}
Expand Down Expand Up @@ -43,7 +43,7 @@ jobs:

- name: Check bundle size
# this should match the os and version used in the release.yml
if: startsWith(matrix.os, 'ubuntu-22.04') && startsWith(matrix.node, '14.') && matrix.node != '14.0.0'
if: startsWith(matrix.os, 'ubuntu-22.04') && startsWith(matrix.node, '20.') && matrix.node != '20.0.0'
# 1. build ganache
# 2. pack it into a tarball
# 3. measure the _unpacked_ tarball's size
Expand All @@ -53,7 +53,7 @@ jobs:
run: |
npm run build &&
npm run prepublishOnly &&
cd ./src/packages/ganache &&
cd ./packages/ganache &&
npm pack &&
size="$(zcat ganache-*.tgz | wc -c)" &&
echo "Bundle size: $size" &&
Expand All @@ -65,8 +65,8 @@ jobs:
INFURA_KEY: "badc0de0deadc0debadc0de0deadc0de"
- name: Upload artifact
# this should match the os and version used in the release.yml
if: startsWith(matrix.os, 'ubuntu-22.04') && startsWith(matrix.node, '14.') && matrix.node != '14.0.0'
if: startsWith(matrix.os, 'ubuntu-22.04') && startsWith(matrix.node, '20.') && matrix.node != '20.0.0'
uses: actions/upload-artifact@v3
with:
name: Candidate
path: ./src/packages/ganache/ganache-*.tgz
path: ./packages/ganache/ganache-*.tgz
4 changes: 2 additions & 2 deletions .github/workflows/push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
strategy:
fail-fast: false
matrix:
node: [14.0.0, 14.x, 16.x, 18.x]
node: [16.0.0, 16.x, 18.x, 20.x]
os: [ubuntu-22.04]

runs-on: ${{ matrix.os }}
Expand All @@ -34,7 +34,7 @@ jobs:
strategy:
fail-fast: false
matrix:
node: [14.0.0, 14.x, 16.x, 18.x]
node: [16.0.0, 16.x, 18.x, 20.x]
os: [windows-2019, ubuntu-20.04, ubuntu-22.04, macos-12]

runs-on: ${{ matrix.os }}
Expand Down
5 changes: 2 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,9 @@ jobs:
fetch-depth: 0
- uses: actions/setup-node@v3
with:
# use node 14 until we can evaluate using npm 7+ and lock file version 2
# this should match the node version used by the "check bundle size"
# step in pr.yml
node-version: 14
node-version: 20

- name: Import Robot GPG key
uses: crazy-max/ghaction-import-gpg@v4
Expand Down Expand Up @@ -124,7 +123,7 @@ jobs:
- name: Set VERSION
run: |
echo "VERSION=$(node -e 'console.log(require("./src/packages/ganache/package.json").version)')" >> $GITHUB_ENV
echo "VERSION=$(node -e 'console.log(require("./packages/ganache/package.json").version)')" >> $GITHUB_ENV
- name: Set VERSION as job output variable
id: set_version_output
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ node_modules
.nyc_output
lerna-debug.log
npm-debug.log
src/**/*/lib
packages/**/*/lib
coverage
dist/
typings/
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v14.0.0
v16.0.0
2 changes: 1 addition & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
.nyc_output
lerna-debug.log
npm-debug.log
src/**/*/lib
packages/**/*/lib
coverage
npm-shrinkwrap.json
docs/assets/js/ganache/*
Expand Down
65 changes: 37 additions & 28 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,37 +2,53 @@

## Getting set up

- Use Node.js v14.0.0.
- Why v14.0.0? Because this is the first LTS release of Node.js v14 and is the earliest version Ganache supports.
- Use Node.js v16.0.0.
- Why v16.0.0? Because this is the first LTS release of Node.js v16 and is the earliest version Ganache supports.
- recommendation: use [nvm](https://github.com/nvm-sh/nvm) on Linux and macOS, and [nvm-windows](https://github.com/coreybutler/nvm-windows) on
Windows, to configure your node version.
- On Linux and macOS, if you have `nvm` installed, just run `nvm use` to switch to Node.js v14.0.0.
- On Linux and macOS, if you have `nvm` installed, just run `nvm use` to switch to Node.js v16.0.0.
- `git clone [email protected]:trufflesuite/ganache.git`
- `cd ganache`
- `npm install` (use npm v6)
- On Linux and macOS: run `source completions.sh` to enable autocomplete for npm scripts.
- `npm install` (use npm v7)

## Solving node-gyp issues

If installation fails due to a `node-gyp` issue you may need to perform some additional system configuration.

### on Linux (Ubuntu-based)

- Make sure `npm` commands are not run as `root`.
- Determine if you have Python 2.7 installed
- example: `which python2.7`
- If you do not have Python 2.7 installed, you need to install it
- example: `sudo apt update && sudo apt install python2.7`
- Run `npm config set python python2.7`
note: Ganache uses [node-gyp v7.1.2](https://github.com/nodejs/node-gyp/tree/v7.1.2) as part of its build system, which requires Python v2.7, v3.5, v3.6, v3.7, or v3.8 to be installed on the system.

### on Windows

- Install [https://www.npmjs.com/package/windows-build-tools](Windows-Build-Tools)
- `npm install --global windows-build-tools`

### on Linux (Ubuntu-based)

- Make sure `npm` commands are not run as `root`.
- If you get an error that `make` isn't installed you might need to also install the `build-essential` package
- example `sudo apt update && sudo apt install build-essential`
- Determine whether you have a compatible version of Python installed:
- example: `python --version` (and `python3 --version` if `python3` is installed)
- If you do not have a compatible version installed: (v2.7, v3.5, v3.6, v3.7, or v3.8), you will need to install it:
- example: `sudo apt update && sudo apt install python2.7`
- You may need to configure the python dependency (see [node-gyp for details on different ways to do this](https://github.com/nodejs/node-gyp/tree/v7.1.2#configuring-python-dependency)):
- example: `npm config set python <path-to-python-executable>`

### on macOS

- I have no idea.
- Attempt to install Xcode command line tools (the console will tell you if they're already installed)
- example: `xcode-select --install`
- Determine whether you have a compatible version of Python installed:
- example: `python --version` (and `python3 --version` if `python3` is installed)
- If you do not have a compatible version installed: (v2.7, v3.5, v3.6, v3.7, or v3.8), you will need to install it: (we recommend [pyenv](https://github.com/pyenv/pyenv) to manage your python installation)
1. [Install `pyenv`](https://github.com/pyenv/pyenv#homebrew-in-macos)
2. [Setup your shell environment for `pyenv`](https://github.com/pyenv/pyenv#set-up-your-shell-environment-for-pyenv)
3. Install Python: `pyenv install 2.7`
4. You may need to configure the python dependency (see [node-gyp for details on different ways to do this](https://github.com/nodejs/node-gyp/tree/v7.1.2#configuring-python-dependency)):
- example: `npm config set python <path-to-python-executable>`
- If the above steps don't fix the `node-gyp` issue and you've recently updated your OS, you may need to re-install Xcode command line tools:
1. Remove the existing, broken installation: `rm -rf /Library/Developer/CommandLineTools`
2. Install them again: `xcode-select --install`

## Clean install

Expand Down Expand Up @@ -80,20 +96,13 @@ To pass options to the cli you must separate the args with `--`, e.g.:

- `npm start -- --chain.chainId 1 --wallet.totalAccounts 5`

## To create a new chain/flavor

- `npm run create <name> --location chains`

This will create a new folder at `src/chains/<name>` where `<name>` should be the flavor name (e.g. `ethereum`), which
you then can [create packages under](#to-create-a-new-package).

## To create a new package

- `npm run create <name> --location <location> [--folder <folder>]`

This will create a new package with Ganache defaults at `src/<location>/<name>`.
This will create a new package with Ganache defaults at `<location>/<name>`.

If you provide the optional `--folder` option, the package will be created at `src/<location>/<folder>`.
If you provide the optional `--folder` option, the package will be created at `<location>/<folder>`.

## To add a module to a package:

Expand All @@ -105,10 +114,10 @@ Where `<module>` is the npm-module you want to add and `<package>` is where you
Example:

```bash
npx lerna add @ganache/options -E --scope=@ganache/filecoin
npx lerna add @ganache/options -E --scope=@ganache/ethereum
```

will add our local `@ganache/options` package to the `@ganache/filecoin` package.
will add our local `@ganache/options` package to the `@ganache/ethereum` package.

## To remove a module from another package:

Expand Down Expand Up @@ -143,8 +152,8 @@ index 2a2aa9e..57cbf21 100644
"--colors",
"--require",
"ts-node/register",
- "${workspaceFolder}/src/**/tests/**/*.test.ts"
+ "${workspaceFolder}/src/chains/ethereum/ethereum/tests/**/*.test.ts"
- "${workspaceFolder}/packages/**/tests/**/*.test.ts"
+ "${workspaceFolder}/packages/ethereum/ethereum/tests/**/*.test.ts"
],
"skipFiles": ["<node_internals>/**"],
"console": "integratedTerminal",
Expand All @@ -154,7 +163,7 @@ index 2a2aa9e..57cbf21 100644

These are guidelines, not rules. :-)

- Use Node.js v14.0.0 for most local development.
- Use Node.js v16.0.0 for most local development.
- Use `bigint` literals, e.g., `123n`; if the number is externally configurable and/or could exceed
`Number.MAX_SAFE_INTEGER`.
- Write tests.
Expand Down
2 changes: 1 addition & 1 deletion README.md
12 changes: 8 additions & 4 deletions UPGRADE-GUIDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ depending on how you originally installed ganache-cli or ganache-core._

#### Locally installed

A local installation makes it possible to `import` or `require` Ganache
A local installation makes it possible to `import` or `require` Ganache
programmatically from JavaScript or TypeScript. Additionally, you can run the
command line version of Ganache from your [package.json scripts](https://docs.npmjs.com/cli/v8/using-npm/scripts) or directly
from the command line using `npx ganache` ([what is npx?](https://www.npmjs.com/package/npx)).
Expand Down Expand Up @@ -113,7 +113,7 @@ and it defaulted to `true`.

Ganache now _disables_ the `vmErrorsOnRPCResponse` functionality by default.

If your code relies on these non-standard errors on transaction failure, you'll
If your code relies on these non-standard errors on transaction failure, you'll
need to _enable_ the `vmErrorsOnRpcResponse` flag to restore this behavior:

```console
Expand All @@ -140,6 +140,10 @@ As of v7.0.0 we no longer support Node v8-v10. You'll need to update to Node v12

We no longer support Node v12. You'll need to update to Node v14.0.0 or later. NOTE: Support for Node.js v14.x.x will be dropped shortly after the Node.js Foundation stops supporting it in April 2023.

#### v7.8.0+, Dropped support for Node v14

We no longer support Node v14. You'll need to update to Node v16.0.0 or later. NOTE: Support for Node.js v16.x.x will be dropped shortly after the Node.js Foundation stops supporting it in April 2024.

#### DockerHub repo has been moved to trufflesuite/ganache

You may want to remove your old Docker images and containers and then pull
Expand Down Expand Up @@ -288,7 +292,7 @@ likely enable this in the future.

Ganache's old database format is incompatible with this version. We've decided
to hold off on building migration tools for this. If you will need a migration
tool (you use the `db` flag or the `db_path` option and are unable to recreate
tool (you use the `db` flag or the `db_path` option and are unable to recreate
your initial DB state) please
[open an issue](https://github.com/trufflesuite/ganache/issues/new)
to let us know.
Expand Down Expand Up @@ -343,7 +347,7 @@ If you send a transaction with `eth_sendTransaction` and that transaction doesn'

```typescript
// send a "legacy" transaction
const hash = await provider.request("eth_sendTransaction", [{ from }]);
const hash = await provider.request("eth_sendTransaction", [{ from }]);
const tx = await provider.request("eth_getTransactionByHash", [hash]);
// The returned `type` field indicates it was updated to a type 2 transaction
assert.strictEqual(tx.type, "0x2");
Expand Down
39 changes: 0 additions & 39 deletions completions.sh

This file was deleted.

2 changes: 1 addition & 1 deletion docs/assets/css/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
--turquoise: #3fe0c5;
--medium-dark-turquoise: #1bd4b5;
--dark-turquoise: #00c3a2;
--very-dark-turquoise: #258575;
--very-dark-turquoise: #237b6d;

--light-porsche: #f7e6d5;
--porsche: #e4a663;
Expand Down
2 changes: 1 addition & 1 deletion docs/assets/js/ganache/ganache.min.js

Large diffs are not rendered by default.

10 changes: 3 additions & 7 deletions docs/assets/js/ganache/ganache.min.js.LICENSE.txt
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,6 @@
* @license MIT
*/

/*!
* @ganache/filecoin-options
*
* @author Tim Coulter
* @license MIT
*/

/*!
* @ganache/secp256k1
*
Expand Down Expand Up @@ -75,6 +68,9 @@
* @license MIT
*/

/*! Case - v1.6.2 - 2020-03-24
* Copyright (c) 2020 Nathan Bubna; Licensed MIT, GPL */

/*! crc32.js (C) 2014-present SheetJS -- http://sheetjs.com */

/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */
Expand Down
2 changes: 1 addition & 1 deletion docs/assets/js/ganache/ganache.min.js.map

Large diffs are not rendered by default.

Loading

0 comments on commit f8e29a8

Please sign in to comment.