Skip to content

Commit 216f8a4

Browse files
authored
chore: reduce build output verbosity (#1241)
Add --quiet flag to hardhat compile commands and implement smart logging in interfaces build script to minimize noise during builds. Also suppress compiler warnings from legacy dependencies using hardhat-ignore-warnings plugin.
1 parent 109e84c commit 216f8a4

File tree

13 files changed

+222
-47
lines changed

13 files changed

+222
-47
lines changed

packages/contracts/hardhat.config.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import '@typechain/hardhat'
22
import '@nomiclabs/hardhat-ethers'
33
import '@nomiclabs/hardhat-waffle'
44
import 'hardhat-contract-sizer' // for size-contracts script
5+
import 'hardhat-ignore-warnings'
56
import 'solidity-coverage' // for coverage script
67
import 'dotenv/config'
78

@@ -49,6 +50,18 @@ const config: HardhatUserConfig = {
4950
runOnCompile: false,
5051
disambiguatePaths: false,
5152
},
53+
warnings: {
54+
// Suppress warnings from legacy OpenZeppelin contracts and external dependencies
55+
'arbos-precompiles/**/*': {
56+
default: 'off',
57+
},
58+
'@openzeppelin/contracts/**/*': {
59+
default: 'off',
60+
},
61+
'contracts/staking/StakingExtension.sol': {
62+
5667: 'off', // Unused function parameter
63+
},
64+
},
5265
}
5366

5467
// Network configurations for deployment are in the deploy child package

packages/contracts/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
"clean": "rm -rf artifacts/ cache/ types/ abis/ build/ dist/ coverage/",
2323
"build": "pnpm build:self",
2424
"build:self": "pnpm compile",
25-
"compile": "hardhat compile",
25+
"compile": "hardhat compile --quiet",
2626
"test": "pnpm --filter @graphprotocol/contracts-tests test",
2727
"test:coverage": "pnpm --filter @graphprotocol/contracts-tests run test:coverage",
2828
"deploy": "pnpm predeploy && pnpm build",
@@ -86,6 +86,7 @@
8686
"hardhat-abi-exporter": "^2.11.0",
8787
"hardhat-contract-sizer": "catalog:",
8888
"hardhat-gas-reporter": "catalog:",
89+
"hardhat-ignore-warnings": "catalog:",
8990
"hardhat-storage-layout": "catalog:",
9091
"prettier": "catalog:",
9192
"prettier-plugin-solidity": "catalog:",

packages/data-edge/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
"build": "pnpm build:self",
1313
"build:self": "scripts/build",
1414
"clean": "rm -rf build/ cache/ dist/ reports/ artifacts/",
15-
"compile": "hardhat compile",
15+
"compile": "hardhat compile --quiet",
1616
"test": "pnpm build && pnpm test:self",
1717
"test:self": "scripts/test",
1818
"test:gas": "RUN_EVM=true REPORT_GAS=true scripts/test",

packages/horizon/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
"clean": "rm -rf build dist cache cache_forge typechain-types",
2929
"build": "pnpm build:dep && pnpm build:self",
3030
"build:dep": "pnpm --filter '@graphprotocol/horizon^...' run build:self",
31-
"build:self": "hardhat compile",
31+
"build:self": "hardhat compile --quiet",
3232
"test": "pnpm build && pnpm test:self",
3333
"test:self": "forge test",
3434
"test:deployment": "SECURE_ACCOUNTS_DISABLE_PROVIDER=true hardhat test test/deployment/*.ts",

packages/interfaces/hardhat.config.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import '@nomicfoundation/hardhat-toolbox'
2+
import 'hardhat-ignore-warnings'
23

34
const config = {
45
solidity: {
@@ -7,6 +8,14 @@ const config = {
78
typechain: {
89
outDir: 'types',
910
},
11+
warnings: {
12+
'contracts/token-distribution/IGraphTokenLockWallet.sol': {
13+
default: 'off',
14+
},
15+
'contracts/toolshed/IGraphTokenLockWalletToolshed.sol': {
16+
default: 'off',
17+
},
18+
},
1019
}
1120

1221
module.exports = config

packages/interfaces/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@
5757
"@ethersproject/abi": "5.7.0",
5858
"@ethersproject/providers": "5.7.2",
5959
"hardhat": "catalog:",
60+
"hardhat-ignore-warnings": "catalog:",
6061
"markdownlint-cli": "catalog:",
6162
"prettier": "catalog:",
6263
"prettier-plugin-solidity": "catalog:",

packages/interfaces/scripts/build.sh

Lines changed: 43 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,33 @@
55
# 1. Hardhat compilation (generates artifacts and ethers-v6 types)
66
# 2. Type generation (WAGMI and ethers-v5 types)
77
# 3. TypeScript compilation (both v6 and v5 types)
8+
#
9+
# Usage:
10+
# build.sh - Minimal output (only shows actions taken, not skipped)
11+
# build.sh --verbose - Full output (shows all details)
812

913
set -e # Exit on any error
1014

11-
echo "🔨 Starting build process..."
15+
# Parse flags
16+
VERBOSE=false
17+
if [[ "$1" == "--verbose" ]]; then
18+
VERBOSE=true
19+
fi
20+
21+
# Logging helpers
22+
log_info() {
23+
# Only show in verbose mode (headers, status, skipped items)
24+
if [[ "$VERBOSE" == "true" ]]; then
25+
echo "$@"
26+
fi
27+
}
28+
29+
log_action() {
30+
# Always show actions being taken
31+
echo "$@"
32+
}
33+
34+
log_info "🔨 Starting build process..."
1235

1336
# Helper function to check if target is newer than sources
1437
is_newer() {
@@ -38,42 +61,42 @@ find_files() {
3861
}
3962

4063
# Step 1: Hardhat compilation
41-
echo "📦 Compiling contracts with Hardhat..."
42-
pnpm hardhat compile
64+
log_info "📦 Compiling contracts with Hardhat..."
65+
pnpm hardhat compile $([[ "$VERBOSE" != "true" ]] && echo "--quiet")
4366

4467
# Step 1.5: Generate interface IDs
4568
node scripts/generateInterfaceIds.js
4669

4770
# Step 2: Generate types (only if needed)
48-
echo "🏗️ Checking type definitions..."
71+
log_info "🏗️ Checking type definitions..."
4972

5073
# Check if WAGMI types need regeneration
5174
wagmi_sources=(
5275
"wagmi.config.mts"
5376
$(find_files "./artifacts/contracts/**/!(*.dbg).json")
5477
)
5578
if ! is_newer "wagmi/generated.ts" "${wagmi_sources[@]}"; then
56-
echo " - Generating WAGMI types..."
79+
log_action " - Generating WAGMI types..."
5780
pnpm wagmi generate
5881
else
59-
echo " - WAGMI types are up to date"
82+
log_info " - WAGMI types are up to date"
6083
fi
6184

6285
# Check if ethers-v5 types need regeneration
6386
v5_artifacts=($(find_files "./artifacts/contracts/**/!(*.dbg).json") $(find_files "./artifacts/@openzeppelin/**/!(*.dbg).json"))
6487
if ! is_newer "types-v5/index.ts" "${v5_artifacts[@]}"; then
65-
echo " - Generating ethers-v5 types..."
88+
log_action " - Generating ethers-v5 types..."
6689
pnpm typechain \
6790
--target ethers-v5 \
6891
--out-dir types-v5 \
6992
'artifacts/contracts/**/!(*.dbg).json' \
7093
'artifacts/@openzeppelin/**/!(*.dbg).json'
7194
else
72-
echo " - ethers-v5 types are up to date"
95+
log_info " - ethers-v5 types are up to date"
7396
fi
7497

7598
# Step 3: TypeScript compilation (only if needed)
76-
echo "🔧 Checking TypeScript compilation..."
99+
log_info "🔧 Checking TypeScript compilation..."
77100

78101
# Check if v6 types need compilation
79102
v6_sources=(
@@ -83,21 +106,21 @@ v6_sources=(
83106
$(find_files "./wagmi/**/*.ts")
84107
)
85108
if ! is_newer "dist/tsconfig.tsbuildinfo" "${v6_sources[@]}"; then
86-
echo " - Compiling ethers-v6 types..."
109+
log_action " - Compiling ethers-v6 types..."
87110
pnpm tsc
88111
touch dist/tsconfig.tsbuildinfo
89112
else
90-
echo " - ethers-v6 types are up to date"
113+
log_info " - ethers-v6 types are up to date"
91114
fi
92115

93116
# Check if v5 types need compilation
94117
v5_sources=($(find_files "./types-v5/**/*.ts"))
95118
if ! is_newer "dist-v5/tsconfig.v5.tsbuildinfo" "${v5_sources[@]}"; then
96-
echo " - Compiling ethers-v5 types..."
119+
log_action " - Compiling ethers-v5 types..."
97120
pnpm tsc -p tsconfig.v5.json
98121
touch dist-v5/tsconfig.v5.tsbuildinfo
99122
else
100-
echo " - ethers-v5 types are up to date"
123+
log_info " - ethers-v5 types are up to date"
101124
fi
102125

103126
# Step 4: Merge v5 types into dist directory (only if needed)
@@ -119,15 +142,15 @@ if [[ -d "dist-v5" ]]; then
119142
fi
120143

121144
if [[ "$needs_copy" == "true" ]]; then
122-
echo "📁 Organizing compiled types..."
145+
log_action "📁 Organizing compiled types..."
123146
mkdir -p dist/types-v5
124147
cp -r dist-v5/* dist/types-v5/
125148
else
126-
echo "📁 Compiled types organization is up to date"
149+
log_info "📁 Compiled types organization is up to date"
127150
fi
128151

129-
echo "✅ Build completed successfully!"
130-
echo "📄 Generated types:"
131-
echo " - ethers-v6: dist/types/"
132-
echo " - ethers-v5: dist/types-v5/"
133-
echo " - wagmi: dist/wagmi/"
152+
log_info "✅ Build completed successfully!"
153+
log_info "📄 Generated types:"
154+
log_info " - ethers-v6: dist/types/"
155+
log_info " - ethers-v5: dist/types-v5/"
156+
log_info " - wagmi: dist/wagmi/"

packages/subgraph-service/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
"clean": "rm -rf build dist cache cache_forge typechain-types",
2727
"build": "pnpm build:dep && pnpm build:self",
2828
"build:dep": "pnpm --filter '@graphprotocol/subgraph-service^...' run build:self",
29-
"build:self": "hardhat compile",
29+
"build:self": "hardhat compile --quiet",
3030
"test": "pnpm build && pnpm test:self",
3131
"test:self": "forge test",
3232
"test:deployment": "SECURE_ACCOUNTS_DISABLE_PROVIDER=true hardhat test test/deployment/*.ts",

packages/token-distribution/hardhat.config.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import 'hardhat-deploy'
1212
import 'hardhat-abi-exporter'
1313
import '@typechain/hardhat'
1414
import 'hardhat-gas-reporter'
15+
import 'hardhat-ignore-warnings'
1516
import '@openzeppelin/hardhat-upgrades'
1617
import 'solidity-coverage'
1718
// Tasks
@@ -188,6 +189,12 @@ const config = {
188189
mocha: {
189190
timeout: 120000,
190191
},
192+
warnings: {
193+
// Suppress warnings from legacy OpenZeppelin contracts
194+
'@openzeppelin/contracts/**/*': {
195+
default: 'off',
196+
},
197+
},
191198
}
192199

193200
setupNetworkConfig(config)

packages/token-distribution/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
"clean": "rm -rf build/ cache/ dist/ .graphclient/ reports/ types/",
1717
"clean:extracted": "rm -rf .graphclient-extracted/",
1818
"clean:all": "rm -rf build/ cache/ dist/ .graphclient/ .graphclient-extracted/",
19-
"compile": "hardhat compile --show-stack-traces",
19+
"compile": "hardhat compile --quiet",
2020
"deploy": "pnpm run build && hardhat deploy",
2121
"test": "pnpm build && pnpm test:self",
2222
"test:self": "scripts/test",
@@ -72,6 +72,7 @@
7272
"hardhat-contract-sizer": "^2.0.1",
7373
"hardhat-deploy": "^0.7.0-beta.9",
7474
"hardhat-gas-reporter": "^1.0.1",
75+
"hardhat-ignore-warnings": "catalog:",
7576
"inquirer": "8.0.0",
7677
"lodash": "^4.17.21",
7778
"markdownlint-cli": "0.45.0",

0 commit comments

Comments
 (0)