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

Commit 908722a

Browse files
committed
Merge branch 'develop' into nh/web3-4x-upgrade
2 parents 5420765 + cca7f78 commit 908722a

File tree

182 files changed

+4207
-4304
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

182 files changed

+4207
-4304
lines changed

.eslintrc.truffle.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"overrides": [
33
{
4-
"files": ["./test/**/*.js"],
4+
"files": ["./test/**/*.js", "./test/**/*.ts"],
55
"env": {
66
"mocha": true
77
},
@@ -17,7 +17,7 @@
1717
}
1818
},
1919
{
20-
"files": ["./migrations/**/*.js"],
20+
"files": ["./migrations/**/*.js", "./migrations/**/*.ts"],
2121
"globals": {
2222
"artifacts": "readonly",
2323
"config": "readonly"

.github/workflows/nodejs.yml

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,18 @@ jobs:
2121
- run: npm install -g yarn
2222
- run: yarn install --ignore-scripts --ignore-engines
2323
- run: test -z "$(git diff)" || (echo 'Please run yarn and commit all changes to yarn.lock'; false)
24-
24+
- uses: 8398a7/action-slack@v3
25+
with:
26+
channel: '#truffle-ci-notifications'
27+
status: ${{ job.status }}
28+
fields: job,commit,author,pullRequest
29+
env:
30+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
31+
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
32+
if: failure()
2533

2634
build:
35+
needs: yarncheck
2736
strategy:
2837
matrix:
2938
platform: [ubuntu-latest]
@@ -44,29 +53,33 @@ jobs:
4453
run: npm -g install npm@6
4554

4655
- run: npm install -g yarn
56+
4757
- run: yarn bootstrap
58+
59+
- run: yarn depcheck
60+
4861
- run: ${{ matrix.env }} yarn ci
4962
env:
5063
CI: true
51-
- uses: 8398a7/action-slack@v1.1.1
64+
- uses: 8398a7/action-slack@v3
5265
with:
53-
type: failure
54-
failedMenthon: ""
66+
channel: '#truffle-ci-notifications'
67+
status: ${{ job.status }}
68+
fields: job,commit,author,pullRequest
5569
env:
5670
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
71+
MATRIX_CONTEXT: ${{ toJson(matrix) }} # required for matrix field: job
5772
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
5873
if: failure()
5974

6075
slack_notification:
6176
needs: [yarncheck, build]
6277
runs-on: ubuntu-latest
63-
continue-on-error: true
6478
steps:
6579
- uses: 8398a7/action-slack@v3
66-
continue-on-error: true
6780
with:
6881
channel: '#truffle-ci-notifications'
69-
status: ${{ job.status }}
82+
status: success
7083
fields: commit,author,pullRequest
7184
env:
7285
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.prettierrc.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{
22
"arrowParens": "avoid",
33
"trailingComma": "none",
4-
"bracketSpacing": true
4+
"bracketSpacing": true,
5+
"quoteProps": "consistent"
56
}

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
[![npm](https://img.shields.io/npm/dm/truffle.svg)](https://www.npmjs.com/package/truffle)
55
[![GitHub Discussions](https://img.shields.io/static/v1?label=Join&message=Discussions&color=3fe0c5)](https://github.com/trufflesuite/truffle/discussions)
66
[![Coverage Status](https://coveralls.io/repos/github/trufflesuite/truffle/badge.svg)](https://coveralls.io/github/trufflesuite/truffle)
7+
[![gitpoap badge](https://public-api.gitpoap.io/v1/repo/trufflesuite/truffle/badge)](https://www.gitpoap.io/gh/trufflesuite/truffle)
78

89
---
910

package.json

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
{
22
"private": true,
33
"scripts": {
4-
"bootstrap": "npx lerna bootstrap",
5-
"build": "npx lerna run build --stream",
4+
"bootstrap": "yarn exec lerna bootstrap",
5+
"build": "yarn exec lerna run build --stream",
66
"prepare": "lerna run prepare --stream --concurrency=1 && husky install",
77
"publish-release": "./scripts/publish-release.sh",
88
"publish-dist-tag": "./scripts/publish-dist-tag.sh",
@@ -13,7 +13,8 @@
1313
"dependency-graph": "lerna-dependency-graph -f pdf -o dependency-graph.pdf",
1414
"solc-bump": "node ./scripts/solc-bump.js",
1515
"update": "lernaupdate",
16-
"depcheck": "lerna exec --stream --no-bail dependency-check --ignore @truffle/contract-tests --ignore @truffle/dashboard-message-bus-e2e-test -- --missing ."
16+
"depcheck": "lerna exec --stream --no-bail dependency-check --ignore @truffle/contract-tests --ignore @truffle/dashboard-message-bus-e2e-test -- --missing .",
17+
"check-truffle-namespace-dependency-versions": "node ./scripts/check-truffle-namespace-dependency-versions.js"
1718
},
1819
"devDependencies": {
1920
"@typescript-eslint/eslint-plugin": "^5.6.0",
@@ -38,7 +39,8 @@
3839
},
3940
"lint-staged": {
4041
"*.{js,ts,jsx,tsx}": "eslint --fix",
41-
"*.{js,ts,jsx,tsx,css,md}": "prettier --write"
42+
"*.{js,ts,jsx,tsx,css,md}": "prettier --write",
43+
"packages/*/package.json": "node ./scripts/check-truffle-namespace-dependency-versions.js"
4244
},
4345
"resolutions": {
4446
"web3-core": "^4.0.0-alpha.0"

packages/abi-utils/package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@truffle/abi-utils",
3-
"version": "0.2.14",
3+
"version": "0.2.15",
44
"description": "Utilities for working with ABIs",
55
"license": "MIT",
66
"author": "g. nicholas d'andrea <[email protected]>",
@@ -26,18 +26,18 @@
2626
"dependencies": {
2727
"change-case": "3.0.2",
2828
"faker": "5.5.3",
29-
"fast-check": "^2.12.1"
29+
"fast-check": "2.15.1"
3030
},
3131
"devDependencies": {
3232
"@truffle/contract-schema": "^3.4.8",
3333
"@types/faker": "^5.1.2",
3434
"@types/jest": "27.4.1",
3535
"@types/jest-json-schema": "^2.1.2",
36-
"jest": "27.5.1",
36+
"jest": "28.1.3",
3737
"jest-extended": "^0.11.5",
38-
"jest-fast-check": "^1.0.1",
38+
"jest-fast-check": "2.0.0",
3939
"jest-json-schema": "^2.1.0",
40-
"ts-jest": "27.1.4",
40+
"ts-jest": "28.0.6",
4141
"ts-node": "10.7.0",
4242
"typescript": "^4.1.4"
4343
},

packages/artifactor/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
"bugs": {
1414
"url": "https://github.com/trufflesuite/truffle/issues"
1515
},
16-
"version": "4.0.159",
16+
"version": "4.0.163",
1717
"main": "dist/index.js",
1818
"scripts": {
1919
"build": "tsc",
@@ -27,13 +27,13 @@
2727
"lodash": "^4.17.21"
2828
},
2929
"devDependencies": {
30-
"@truffle/contract": "^4.5.15",
30+
"@truffle/contract": "^4.5.19",
3131
"@types/fs-extra": "^8.1.0",
3232
"@types/lodash": "^4.14.179",
3333
"@types/node": "12.12.21",
3434
"chai": "^4.2.0",
3535
"debug": "^4.3.1",
36-
"ganache": "7.2.0",
36+
"ganache": "7.4.0",
3737
"mocha": "9.2.2",
3838
"require-nocache": "^1.0.0",
3939
"sinon": "^9.0.2",

packages/box/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
"bugs": {
1313
"url": "https://github.com/trufflesuite/truffle/issues"
1414
},
15-
"version": "2.1.51",
15+
"version": "2.1.54",
1616
"main": "dist/box.js",
1717
"scripts": {
1818
"build": "tsc",
@@ -21,8 +21,8 @@
2121
},
2222
"types": "./typings/index.d.ts",
2323
"dependencies": {
24-
"@truffle/config": "^1.3.31",
25-
"axios": "0.26.1",
24+
"@truffle/config": "^1.3.34",
25+
"axios": "0.27.2",
2626
"debug": "^4.3.1",
2727
"download-git-repo": "^3.0.2",
2828
"fs-extra": "^9.1.0",

packages/codec/lib/wrap/bool.ts

Lines changed: 63 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ const boolCasesBasic: Case<
1414
Format.Values.BoolValue,
1515
never
1616
>[] = [
17+
boolFromBoolean, //needed due to strictBooleans mode
1718
boolFromString,
1819
boolFromBoxedPrimitive,
1920
boolFromCodecBoolValue,
@@ -27,10 +28,30 @@ export const boolCases: Case<
2728
Format.Types.BoolType,
2829
Format.Values.BoolValue,
2930
never
30-
>[] = [
31-
boolFromTypeValueInput,
32-
...boolCasesBasic
33-
];
31+
>[] = [boolFromTypeValueInput, ...boolCasesBasic];
32+
33+
function* boolFromBoolean(
34+
dataType: Format.Types.BoolType,
35+
input: unknown,
36+
wrapOptions: WrapOptions
37+
): Generator<never, Format.Values.BoolValue, WrapResponse> {
38+
if (typeof input !== "boolean") {
39+
throw new TypeMismatchError(
40+
dataType,
41+
input,
42+
wrapOptions.name,
43+
1,
44+
"Input was not a boolean"
45+
);
46+
}
47+
return {
48+
type: dataType,
49+
kind: "value" as const,
50+
value: {
51+
asBoolean: input
52+
}
53+
};
54+
}
3455

3556
function* boolFromString(
3657
dataType: Format.Types.BoolType,
@@ -46,8 +67,21 @@ function* boolFromString(
4667
"Input was not a string"
4768
);
4869
}
49-
//strings are true unless they're falsy or the case-insensitive string "false"
50-
const asBoolean = Boolean(input) && input.toLowerCase() !== "false";
70+
const lowerCasedInput = input.toLowerCase();
71+
if (
72+
wrapOptions.strictBooleans &&
73+
!["true", "false", "1", "0"].includes(lowerCasedInput)
74+
) {
75+
throw new TypeMismatchError(
76+
dataType,
77+
input,
78+
wrapOptions.name,
79+
5,
80+
"Input was not 'true', 'false', '1', or '0'"
81+
);
82+
}
83+
//strings are true unless they're falsy or the case-insensitive strings "false" or "0"
84+
const asBoolean = Boolean(input) && !["false", "0"].includes(lowerCasedInput);
5185
return {
5286
type: dataType,
5387
kind: "value" as const,
@@ -72,7 +106,12 @@ function* boolFromBoxedPrimitive(
72106
);
73107
}
74108
//unbox and try again
75-
return yield* wrapWithCases(dataType, input.valueOf(), wrapOptions, boolCases);
109+
return yield* wrapWithCases(
110+
dataType,
111+
input.valueOf(),
112+
wrapOptions,
113+
boolCases
114+
);
76115
}
77116

78117
function* boolFromCodecBoolValue(
@@ -215,9 +254,7 @@ function* boolFromCodecUdvtValue(
215254
"Input was not a wrapped result"
216255
);
217256
}
218-
if (
219-
input.type.typeClass !== "userDefinedValueType"
220-
) {
257+
if (input.type.typeClass !== "userDefinedValueType") {
221258
throw new TypeMismatchError(
222259
dataType,
223260
input,
@@ -252,9 +289,7 @@ function* boolFromCodecUdvtError(
252289
"Input was not a wrapped result"
253290
);
254291
}
255-
if (
256-
input.type.typeClass !== "userDefinedValueType"
257-
) {
292+
if (input.type.typeClass !== "userDefinedValueType") {
258293
throw new TypeMismatchError(
259294
dataType,
260295
input,
@@ -282,7 +317,11 @@ function* boolFromCodecUdvtError(
282317
Messages.errorResultMessage
283318
);
284319
}
285-
return yield* boolFromCodecBoolError(dataType, input.error.error, wrapOptions);
320+
return yield* boolFromCodecBoolError(
321+
dataType,
322+
input.error.error,
323+
wrapOptions
324+
);
286325
}
287326

288327
function* boolFromOther(
@@ -315,6 +354,16 @@ function* boolFromOther(
315354
"Input was a type/value pair"
316355
);
317356
}
357+
//...and also we don't do this case if strictBooleans is turned on
358+
if (wrapOptions.strictBooleans) {
359+
throw new TypeMismatchError(
360+
dataType,
361+
input,
362+
wrapOptions.name,
363+
2,
364+
"Input was neither a boolean nor a boolean string"
365+
);
366+
}
318367
const asBoolean = Boolean(input);
319368
return {
320369
type: dataType,

0 commit comments

Comments
 (0)