Skip to content

Commit f1f1ec6

Browse files
committed
fixes
1 parent 7cce878 commit f1f1ec6

File tree

84 files changed

+7120
-7947
lines changed

Some content is hidden

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

84 files changed

+7120
-7947
lines changed

.github/workflows/test.yml

Lines changed: 26 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ concurrency:
66
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
77
cancel-in-progress: true
88

9+
env:
10+
FOUNDRY_PROFILE: ci
11+
912
# Set default permissions as restrictive as possible
1013
permissions:
1114
actions: write # Required for upload-artifact
@@ -27,14 +30,12 @@ jobs:
2730
cache: 'npm'
2831
cache-dependency-path: '**/package-lock.json'
2932

30-
# Only cache node_modules, let setup-node handle npm cache
3133
- name: Cache node_modules
3234
uses: actions/cache@v4
3335
id: cache-node-modules
3436
continue-on-error: true
3537
with:
36-
path: |
37-
node_modules
38+
path: node_modules
3839
key: ${{ runner.os }}-node-modules-${{ hashFiles('**/package-lock.json') }}
3940

4041
- name: Install Dependencies
@@ -58,20 +59,21 @@ jobs:
5859
cache: 'npm'
5960
cache-dependency-path: '**/package-lock.json'
6061

61-
# Install Foundry
62-
- uses: foundry-rs/foundry-toolchain@82dee4ba654bd2146511f85f0d013af94670c4de # v1.4.0
62+
- name: Install Foundry
63+
uses: foundry-rs/foundry-toolchain@50d5a8956f2e319df19e6b57539d7e2acb9f8c1e # v1.5
6364
with:
64-
version: stable # or nightly
65+
version: stable
66+
cache: false
67+
68+
- name: Show Forge version
69+
run: forge --version
6570

66-
# Restore node_modules
6771
- name: Restore node_modules
68-
uses: actions/cache@v4
72+
uses: actions/cache/restore@v4
6973
continue-on-error: true
7074
with:
7175
path: node_modules
7276
key: ${{ runner.os }}-node-modules-${{ hashFiles('**/package-lock.json') }}
73-
restore-keys: |
74-
${{ runner.os }}-node-modules-
7577

7678
- name: Ensure Dependencies
7779
run: |
@@ -80,15 +82,14 @@ jobs:
8082
npm ci --prefer-offline --no-audit
8183
fi
8284
85+
- name: Check Solidity Formatting
86+
run: npm run sol:fmt:check
87+
8388
- name: Check Solidity Compilation
84-
run: |
85-
echo "Running Solidity compilation with cache..."
86-
npm run sol:compile
89+
run: forge build --sizes
8790

88-
- name: Check Solidity Solhint
89-
run: |
90-
echo "Running Solhint..."
91-
npm run lint-solc
91+
- name: Check Solidity Linting
92+
run: npm run lint-solc
9293

9394
# Job 2: Check ESLint
9495
eslint:
@@ -105,16 +106,12 @@ jobs:
105106
cache: 'npm'
106107
cache-dependency-path: '**/package-lock.json'
107108

108-
# Restore node_modules from setup job
109109
- name: Restore node_modules
110-
uses: actions/cache@v4
110+
uses: actions/cache/restore@v4
111111
continue-on-error: true
112112
with:
113-
path: |
114-
node_modules
113+
path: node_modules
115114
key: ${{ runner.os }}-node-modules-${{ hashFiles('**/package-lock.json') }}
116-
restore-keys: |
117-
${{ runner.os }}-node-modules-
118115

119116
- name: Ensure Dependencies
120117
run: |
@@ -148,16 +145,12 @@ jobs:
148145
cache: 'npm'
149146
cache-dependency-path: '**/package-lock.json'
150147

151-
# Restore node_modules from setup job
152148
- name: Restore node_modules
153-
uses: actions/cache@v4
149+
uses: actions/cache/restore@v4
154150
continue-on-error: true
155151
with:
156-
path: |
157-
node_modules
152+
path: node_modules
158153
key: ${{ runner.os }}-node-modules-${{ hashFiles('**/package-lock.json') }}
159-
restore-keys: |
160-
${{ runner.os }}-node-modules-
161154

162155
- name: Ensure Dependencies
163156
run: |
@@ -184,16 +177,12 @@ jobs:
184177
cache: 'npm'
185178
cache-dependency-path: '**/package-lock.json'
186179

187-
# Restore node_modules from setup job
188180
- name: Restore node_modules
189-
uses: actions/cache@v4
181+
uses: actions/cache/restore@v4
190182
continue-on-error: true
191183
with:
192-
path: |
193-
node_modules
184+
path: node_modules
194185
key: ${{ runner.os }}-node-modules-${{ hashFiles('**/package-lock.json') }}
195-
restore-keys: |
196-
${{ runner.os }}-node-modules-
197186

198187
- name: Ensure Dependencies
199188
run: |
@@ -232,16 +221,12 @@ jobs:
232221
cache: 'npm'
233222
cache-dependency-path: '**/package-lock.json'
234223

235-
# Restore node_modules from setup job
236224
- name: Restore node_modules
237-
uses: actions/cache@v4
225+
uses: actions/cache/restore@v4
238226
continue-on-error: true
239227
with:
240-
path: |
241-
node_modules
228+
path: node_modules
242229
key: ${{ runner.os }}-node-modules-${{ hashFiles('**/package-lock.json') }}
243-
restore-keys: |
244-
${{ runner.os }}-node-modules-
245230

246231
- name: Ensure Dependencies
247232
run: |

.prettierrc

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,6 @@
1212
"parser": "astro"
1313
}
1414
},
15-
{
16-
"files": "*.sol",
17-
"options": {
18-
"printWidth": 80,
19-
"tabWidth": 4,
20-
"useTabs": false,
21-
"singleQuote": false,
22-
"bracketSpacing": false
23-
}
24-
},
2515
{
2616
"files": "public/samples/ChainlinkFunctions/*.js",
2717
"options": {

.solhint.json

Lines changed: 24 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,39 @@
11
{
22
"extends": "solhint:recommended",
3-
"plugins": ["prettier", "chainlink-solidity"],
3+
"plugins": ["chainlink-solidity"],
44
"rules": {
5-
"prettier/prettier": "error",
6-
"compiler-version": ["error", ">=0.4.24"],
5+
"compiler-version": ["off", "^0.8.0"],
76
"const-name-snakecase": "off",
8-
"constructor-syntax": "error",
97
"var-name-mixedcase": "off",
108
"func-named-parameters": "off",
119
"immutable-vars-naming": "off",
1210
"no-inline-assembly": "off",
11+
"contract-name-capwords": "off",
12+
"use-natspec": "off",
13+
"gas-indexed-events": "off",
14+
"function-max-lines": "off",
15+
"gas-strict-inequalities": "off",
16+
"gas-increment-by-one": "off",
17+
"gas-calldata-parameters": "off",
18+
"gas-small-strings": "off",
19+
"not-rely-on-time": "off",
20+
"no-empty-blocks": "off",
1321
"no-unused-import": "error",
14-
"func-visibility": ["error", { "ignoreConstructors": true }],
22+
"import-path-check": "off",
23+
"func-visibility": [
24+
"error",
25+
{
26+
"ignoreConstructors": true
27+
}
28+
],
1529
"quotes": ["error", "double"],
16-
"reason-string": ["warn", { "maxLength": 64 }],
1730
"chainlink-solidity/prefix-internal-functions-with-underscore": "warn",
1831
"chainlink-solidity/prefix-private-functions-with-underscore": "warn",
1932
"chainlink-solidity/prefix-storage-variables-with-s-underscore": "warn",
20-
"chainlink-solidity/prefix-immutable-variables-with-i": "warn"
33+
"chainlink-solidity/prefix-immutable-variables-with-i": "warn",
34+
"chainlink-solidity/all-caps-constant-storage-variables": "warn",
35+
"chainlink-solidity/no-hardhat-imports": "warn",
36+
"chainlink-solidity/inherited-constructor-args-not-in-contract-definition": "warn",
37+
"chainlink-solidity/explicit-returns": "warn"
2138
}
2239
}

.vscode/extensions.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22
"recommendations": [
33
"dbaeumer.vscode-eslint",
44
"esbenp.prettier-vscode",
5-
"NomicFoundation.hardhat-solidity",
5+
"JuanBlanco.solidity",
66
"astro-build.astro-vscode",
77
"unifiedjs.vscode-mdx",
88
"streetsidesoftware.code-spell-checker"
99
],
10-
"unwantedRecommendations": []
10+
"unwantedRecommendations": ["NomicFoundation.hardhat-solidity"]
1111
}

.vscode/settings.json

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,13 @@
33
"*.mdx": "mdx"
44
},
55
"editor.formatOnSave": true,
6-
"solidity.formatter": "prettier", // This is the default so it might be missing.
76
"prettier.documentSelectors": ["**/*.astro"],
7+
// Solidity settings for Foundry
8+
"solidity.formatter": "forge",
9+
"solidity.packageDefaultDependenciesContractsDirectory": "public/samples",
10+
"solidity.packageDefaultDependenciesDirectory": "node_modules",
811
"[solidity]": {
9-
"editor.defaultFormatter": "NomicFoundation.hardhat-solidity"
12+
"editor.defaultFormatter": "JuanBlanco.solidity"
1013
},
1114
"[astro]": {
1215
"editor.defaultFormatter": "esbenp.prettier-vscode"
@@ -17,7 +20,11 @@
1720
"[mdx]": {
1821
"editor.wordWrap": "on"
1922
},
20-
"cSpell.enableFiletypes": ["astro", "mdx", "solidity"],
23+
"cSpell.enabledFileTypes": {
24+
"astro": true,
25+
"mdx": true,
26+
"solidity": true
27+
},
2128
"cSpell.words": [
2229
"AGOR",
2330
"Alfajores",

foundry.toml

Lines changed: 26 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,37 @@
11
# This configuration file sets up the paths and compilers so we can test our solidity samples
22
[profile.default]
3+
# Let Forge download/choose solc per file's pragma automatically
4+
auto_detect_solc = true
5+
evm_version = 'paris'
36

47
src = "public/samples"
5-
68
out = ".test/artifacts"
79
cache_path = ".test/cache"
8-
910
libs = ["lib", "node_modules"]
1011

11-
# Let Forge download/choose solc per file's pragma automatically
12-
auto_detect_solc = true
12+
# Optimization settings
13+
optimizer = true
14+
optimizer_runs = 1_000_000
15+
16+
# Test environment defaults
17+
bytecode_hash = "none"
18+
ffi = false
19+
gas_price = 1
20+
block_timestamp = 1234567890
21+
block_number = 12345
22+
23+
[profile.ci]
24+
verbosity = 2
25+
26+
[fmt]
27+
tab_width = 2
28+
multiline_func_header = "params_first"
29+
sort_imports = true
30+
single_line_statement_blocks = "preserve"
31+
number_underscore = "thousands"
32+
wrap_comments = true
1333

1434
[lint]
1535
lint_on_build = false
16-
# If you ever want to pin a single version for all files, uncomment:
17-
# solc_version = "0.8.24"
36+
37+
# See more config options https://github.com/foundry-rs/foundry/tree/master/config

knip.json

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
"astro.config.ts",
77
"src/content.config.ts",
88
"src/integrations/**/*.ts",
9-
"hardhat.config.cts",
109
"codegen.ts",
1110
"jest.config.cjs",
1211
"src/**/__tests__/**/*.test.ts",
@@ -16,15 +15,8 @@
1615
"entry": ["src/**/__tests__/**/*.test.ts", "src/**/*.test.ts"]
1716
},
1817
"project": ["src/**/*.{ts,tsx,astro}", "!src/**/*.d.ts"],
19-
"ignore": [
20-
"src/types/**/*.d.ts",
21-
"public/**/*",
22-
"src/__mocks__/**/*",
23-
"templates/**/*",
24-
"typechain-types/**/*",
25-
"dist/**/*"
26-
],
27-
"ignoreDependencies": ["@types/*", "prettier*", "@astrojs/*", "hardhat*", "solhint*", "jest*", "@project-serum/*"],
18+
"ignore": ["src/types/**/*.d.ts", "public/**/*", "src/__mocks__/**/*", "templates/**/*", "dist/**/*"],
19+
"ignoreDependencies": ["@types/*", "prettier*", "@astrojs/*", "solhint*", "jest*", "@project-serum/*"],
2820
"ignoreExportsUsedInFile": {
2921
"interface": true,
3022
"type": true,

0 commit comments

Comments
 (0)