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

Commit e1e9aa6

Browse files
authored
Merge pull request #4139 from trufflesuite/develop
chore(release): publish v7.7.3
2 parents 5fc653d + 7de4695 commit e1e9aa6

File tree

18 files changed

+184
-140
lines changed

18 files changed

+184
-140
lines changed

.github/actions/docker-publish/action.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,34 +34,34 @@ runs:
3434
shell: bash
3535

3636
- name: Log in to Docker Hub
37-
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
37+
uses: docker/login-action@f75d088332b07a08afadf6ac53c74509b9453f12
3838
with:
3939
username: ${{ inputs.DOCKER_USERNAME }}
4040
password: ${{ inputs.DOCKER_ACCESS_TOKEN }}
4141

4242
- name: Log in to the Container registry
43-
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
43+
uses: docker/login-action@f75d088332b07a08afadf6ac53c74509b9453f12
4444
with:
4545
registry: ghcr.io
4646
username: ${{ github.actor }}
4747
password: ${{ inputs.GITHUB_TOKEN }}
4848

4949
- name: Extract metadata (tags, labels) for Docker
5050
id: meta
51-
uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38
51+
uses: docker/metadata-action@314ddf6d4a82333bf1bc7630399df41bf68eba09
5252
with:
5353
images: |
5454
trufflesuite/ganache
5555
ghcr.io/${{ github.repository}}
5656
5757
- name: Set up QEMU
58-
uses: docker/setup-qemu-action@0522dcd2bf084920c411162fde334a308be75015
58+
uses: docker/setup-qemu-action@38836d31bd1e0f8f29b8c7ad0412da32020f15b3
5959

6060
- name: Set up Docker Buildx
61-
uses: docker/setup-buildx-action@91cb32d715c128e5f0ede915cd7e196ab7799b83
61+
uses: docker/setup-buildx-action@39a1a82492fd1ad19af19d61b5f748e4cb6cd1af
6262

6363
- name: Build and push Docker image
64-
uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc
64+
uses: docker/build-push-action@175d02bffea74695e96b351069ac938b338802f9
6565
with:
6666
context: .
6767
file: ./src/packages/ganache/Dockerfile

.github/workflows/pr.yml

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,7 @@ jobs:
1111
fail-fast: false
1212
matrix:
1313
node: [14.0.0, 14.x, 16.x, 18.x]
14-
os: [windows-2019, ubuntu-18.04, ubuntu-20.04, macos-11]
15-
exclude:
16-
# Node v18 does not run on ubuntu-18.04: https://github.com/nodejs/node/issues/42351#issuecomment-1068424442
17-
- os: ubuntu-18.04
18-
node: 18.x
14+
os: [windows-2019, ubuntu-20.04, ubuntu-22.04, macos-12]
1915

2016
runs-on: ${{ matrix.os }}
2117

@@ -47,7 +43,7 @@ jobs:
4743

4844
- name: Check bundle size
4945
# this should match the os and version used in the release.yml
50-
if: startsWith(matrix.os, 'ubuntu-20.04') && startsWith(matrix.node, '14.')
46+
if: startsWith(matrix.os, 'ubuntu-22.04') && startsWith(matrix.node, '14.')
5147
# 1. build ganache
5248
# 2. pack it into a tarball
5349
# 3. measure the _unpacked_ tarball's size
@@ -69,7 +65,7 @@ jobs:
6965
INFURA_KEY: "badc0de0deadc0debadc0de0deadc0de"
7066
- name: Upload artifact
7167
# this should match the os and version used in the release.yml
72-
if: startsWith(matrix.os, 'ubuntu-20.04') && startsWith(matrix.node, '14.')
68+
if: startsWith(matrix.os, 'ubuntu-22.04') && startsWith(matrix.node, '14.')
7369
uses: actions/upload-artifact@v3
7470
with:
7571
name: Candidate

.github/workflows/push.yml

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
fail-fast: false
1212
matrix:
1313
node: [14.0.0, 14.x, 16.x, 18.x]
14-
os: [ubuntu-20.04]
14+
os: [ubuntu-22.04]
1515

1616
runs-on: ${{ matrix.os }}
1717

@@ -35,11 +35,7 @@ jobs:
3535
fail-fast: false
3636
matrix:
3737
node: [14.0.0, 14.x, 16.x, 18.x]
38-
os: [windows-2019, ubuntu-18.04, ubuntu-20.04, macos-11]
39-
exclude:
40-
# Node v18 does not run on ubuntu-18.04: https://github.com/nodejs/node/issues/42351#issuecomment-1068424442
41-
- os: ubuntu-18.04
42-
node: 18.x
38+
os: [windows-2019, ubuntu-20.04, ubuntu-22.04, macos-12]
4339

4440
runs-on: ${{ matrix.os }}
4541

@@ -66,7 +62,7 @@ jobs:
6662
# resources it downloads no longer exist, and windows-build-tools@5
6763
# fails to install Python (it will wait on the python installer forever)
6864
if: startsWith(matrix.os, 'windows-')
69-
uses: actions/setup-python@v2
65+
uses: actions/setup-python@5ccb29d8773c3f3f653e1705f474dfaa8a06a912 #v4.4.0
7066
with:
7167
python-version: "2.7"
7268

.github/workflows/release.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
release:
1212
# this should match the os version used by the "check bundle size" step in
1313
# pr.yml
14-
runs-on: ubuntu-20.04
14+
runs-on: ubuntu-22.04
1515
outputs:
1616
TAG: ${{ steps.set_tag_output.outputs.TAG }}
1717
VERSION: ${{ steps.set_version_output.outputs.VERSION }}
@@ -169,14 +169,18 @@ jobs:
169169
170170
publish-docker:
171171
needs: release
172-
runs-on: ubuntu-20.04
172+
runs-on: ubuntu-22.04
173173
steps:
174174
# because the docker publish action is an action we made, we have to
175175
# check out the repo
176176
- name: Checkout repository
177177
uses: actions/checkout@v3
178178
with:
179179
token: ${{ secrets.GITHUB_TOKEN }}
180+
# by specifying the tag of this version as the ref to checkout, we're
181+
# making sure the version we just released to npm is being released to
182+
# Docker.
183+
ref: v${{ needs.release.outputs.VERSION }}
180184
- name: Run Ganache's docker publish action
181185
# we are running our local action, so point directly to a folder
182186
# containing an `action.yml` file

CONTRIBUTING.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,12 @@ If installation fails due to a `node-gyp` issue you may need to perform some add
1818

1919
### on Linux (Ubuntu-based)
2020

21+
- Make sure `npm` commands are not run as `root`.
2122
- Determine if you have Python 2.7 installed
2223
- example: `which python2.7`
2324
- If you do not have Python 2.7 installed, you need to install it
2425
- example: `sudo apt update && sudo apt install python2.7`
25-
- Finally, run `npm config set python python2.7`
26+
- Run `npm config set python python2.7`
2627

2728
### on Windows
2829

src/chains/ethereum/block/src/block.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ export class Block {
9393
// get the maxFeePerGas and maxPriorityFeePerGas, use those to calculate
9494
// the effectiveGasPrice and add it to `extra` above, or we can just
9595
// leave it out of extra and update the effectiveGasPrice after like this
96-
tx.updateEffectiveGasPrice(header.baseFeePerGas);
96+
tx.updateEffectiveGasPrice(header.baseFeePerGas?.toBigInt());
9797
return txFn(tx);
9898
}) as IncludeTransactions extends true ? TypedTransactionJSON[] : Data[];
9999

src/chains/ethereum/ethereum/src/api.ts

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1885,16 +1885,12 @@ export default class EthereumApi implements Api {
18851885

18861886
const transactionPromise = transactions.get(txHash);
18871887
const receiptPromise = transactionReceipts.get(txHash);
1888-
const blockPromise = transactionPromise.then(t =>
1889-
t ? blocks.get(t.blockNumber.toBuffer()) : null
1890-
);
1891-
const [transaction, receipt, block] = await Promise.all([
1888+
const [transaction, receipt] = await Promise.all([
18921889
transactionPromise,
1893-
receiptPromise,
1894-
blockPromise
1890+
receiptPromise
18951891
]);
18961892
if (transaction) {
1897-
return receipt.toJSON(block, transaction, common);
1893+
return receipt.toJSON(transaction, common);
18981894
}
18991895

19001896
// if we are performing "strict" instamining, then check to see if the

src/chains/ethereum/ethereum/src/forking/trie.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,14 +89,14 @@ export class ForkTrie extends GanacheTrie {
8989
endBlockNumber: Quantity
9090
) {
9191
const db = this.metadataDB;
92-
const stream = db.createReadStream({
92+
const stream = db.createKeyStream({
9393
gte: lexico.encode([startBlockNumber.toBuffer()]),
9494
lt: lexico.encode([
9595
Quantity.from(endBlockNumber.toBigInt() + 1n).toBuffer()
9696
])
9797
});
9898
const batch = db.batch();
99-
for await (const [key] of stream) {
99+
for await (const key of stream) {
100100
batch.del(key);
101101
}
102102
await batch.write();

src/chains/ethereum/ethereum/src/miner/miner.ts

Lines changed: 5 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ const updateBloom = (blockBloom: Buffer, bloom: Buffer) => {
7171
const sortByPrice = (values: TypedTransaction[], a: number, b: number) =>
7272
values[a].effectiveGasPrice > values[b].effectiveGasPrice;
7373

74-
const refresher = (item: TypedTransaction, context: Quantity) =>
74+
const refresher = (item: TypedTransaction, context: bigint) =>
7575
item.updateEffectiveGasPrice(context);
7676

7777
export default class Miner extends Emittery<{
@@ -93,7 +93,7 @@ export default class Miner extends Emittery<{
9393
#isBusy: boolean = false;
9494
#paused: boolean = false;
9595
#resumer: Promise<void>;
96-
#currentBlockBaseFeePerGas: Quantity;
96+
#currentBlockBaseFeePerGas: bigint;
9797
#resolver: (value: void) => void;
9898

9999
/**
@@ -127,10 +127,7 @@ export default class Miner extends Emittery<{
127127
}
128128

129129
// create a Heap that sorts by gasPrice
130-
readonly #priced = new Heap<TypedTransaction, Quantity>(
131-
sortByPrice,
132-
refresher
133-
);
130+
readonly #priced = new Heap<TypedTransaction, bigint>(sortByPrice, refresher);
134131
/*
135132
* @param executables - A live Map of pending transactions from the transaction
136133
* pool. The miner will update this Map by removing the best transactions
@@ -149,7 +146,7 @@ export default class Miner extends Emittery<{
149146
this.#executables = executables;
150147
this.#createBlock = (previousBlock: Block) => {
151148
const newBlock = createBlock(previousBlock);
152-
this.#setCurrentBlockBaseFeePerGas(newBlock);
149+
this.#currentBlockBaseFeePerGas = newBlock.header.baseFeePerGas;
153150
return newBlock;
154151
};
155152

@@ -182,7 +179,7 @@ export default class Miner extends Emittery<{
182179
this.#updatePricedHeap();
183180
return;
184181
} else {
185-
this.#setCurrentBlockBaseFeePerGas(block);
182+
this.#currentBlockBaseFeePerGas = block.header.baseFeePerGas;
186183
this.#setPricedHeap();
187184
const result = await this.#mine(block, maxTransactions, onlyOneBlock);
188185
this.emit("idle");
@@ -584,15 +581,4 @@ export default class Miner extends Emittery<{
584581
public toggleStepEvent(enable: boolean) {
585582
this.#emitStepEvent = enable;
586583
}
587-
588-
/**
589-
* Sets the #currentBlockBaseFeePerGas property if the current block
590-
* has a baseFeePerGas property
591-
*/
592-
#setCurrentBlockBaseFeePerGas = (block: RuntimeBlock) => {
593-
const baseFeePerGas = block.header.baseFeePerGas;
594-
// before london hard fork, there will be no baseFeePerGas on the block
595-
this.#currentBlockBaseFeePerGas =
596-
baseFeePerGas === undefined ? undefined : Quantity.from(baseFeePerGas);
597-
};
598584
}

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import {
1414
import { EthereumInternalOptions } from "@ganache/ethereum-options";
1515
import { Executables } from "./miner/executables";
1616
import { TypedTransaction } from "@ganache/ethereum-transaction";
17+
import { Block } from "@ganache/ethereum-block";
1718

1819
/**
1920
* Checks if the `replacer` is eligible to replace the `replacee` transaction
@@ -188,7 +189,10 @@ export default class TransactionPool extends Emittery<{ drain: undefined }> {
188189
!transaction.effectiveGasPrice &&
189190
this.#blockchain.common.isActivatedEIP(1559)
190191
) {
191-
const baseFeePerGas = this.#blockchain.blocks.latest.header.baseFeePerGas;
192+
const baseFeePerGas = Block.calcNextBaseFee(
193+
this.#blockchain.blocks.latest
194+
);
195+
192196
transaction.updateEffectiveGasPrice(baseFeePerGas);
193197
}
194198

0 commit comments

Comments
 (0)