Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
86 changes: 30 additions & 56 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

env:
FOUNDRY_PROFILE: ci

# Set default permissions as restrictive as possible
permissions:
actions: write # Required for upload-artifact
Expand All @@ -27,14 +30,12 @@ jobs:
cache: 'npm'
cache-dependency-path: '**/package-lock.json'

# Only cache node_modules, let setup-node handle npm cache
- name: Cache node_modules
uses: actions/cache@v4
id: cache-node-modules
continue-on-error: true
with:
path: |
node_modules
path: node_modules
key: ${{ runner.os }}-node-modules-${{ hashFiles('**/package-lock.json') }}

- name: Install Dependencies
Expand All @@ -50,24 +51,29 @@ jobs:
steps:
- name: Checkout Repo
uses: actions/checkout@v5

- name: Setup Node.js
uses: actions/setup-node@v5
with:
node-version: '20'
cache: 'npm'
cache-dependency-path: '**/package-lock.json'

# Restore node_modules from setup job
- name: Install Foundry
uses: foundry-rs/foundry-toolchain@50d5a8956f2e319df19e6b57539d7e2acb9f8c1e # v1.5
with:
version: stable
cache: false

- name: Show Forge version
run: forge --version

- name: Restore node_modules
uses: actions/cache@v4
uses: actions/cache/restore@v4
continue-on-error: true
with:
path: |
node_modules
path: node_modules
key: ${{ runner.os }}-node-modules-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-modules-

- name: Ensure Dependencies
run: |
Expand All @@ -76,31 +82,15 @@ jobs:
npm ci --prefer-offline --no-audit
fi

# Cache Solidity compilation artifacts
- name: Restore compilation caches
id: cache-solidity
uses: actions/cache@v4
continue-on-error: true
with:
path: |
.test/artifacts
.test/cache
~/.cache/hardhat
typechain-types
key: ${{ runner.os }}-solidity-${{ hashFiles('public/samples/**/*.sol', 'hardhat.config.cts') }}
restore-keys: |
${{ runner.os }}-solidity-
- name: Check Solidity Formatting
run: npm run sol:fmt:check

- name: Check Solidity Compilation
run: |
echo "Running Solidity compilation with cache..."
npm run sol:compile

- name: Check Solidity Solhint
run: |
echo "Running Solhint..."
npm run lint-solc
run: forge build --sizes

- name: Check Solidity Linting
run: npm run lint-solc

# Job 2: Check ESLint
eslint:
needs: setup
Expand All @@ -116,16 +106,12 @@ jobs:
cache: 'npm'
cache-dependency-path: '**/package-lock.json'

# Restore node_modules from setup job
- name: Restore node_modules
uses: actions/cache@v4
uses: actions/cache/restore@v4
continue-on-error: true
with:
path: |
node_modules
path: node_modules
key: ${{ runner.os }}-node-modules-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-modules-

- name: Ensure Dependencies
run: |
Expand Down Expand Up @@ -159,16 +145,12 @@ jobs:
cache: 'npm'
cache-dependency-path: '**/package-lock.json'

# Restore node_modules from setup job
- name: Restore node_modules
uses: actions/cache@v4
uses: actions/cache/restore@v4
continue-on-error: true
with:
path: |
node_modules
path: node_modules
key: ${{ runner.os }}-node-modules-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-modules-

- name: Ensure Dependencies
run: |
Expand All @@ -195,16 +177,12 @@ jobs:
cache: 'npm'
cache-dependency-path: '**/package-lock.json'

# Restore node_modules from setup job
- name: Restore node_modules
uses: actions/cache@v4
uses: actions/cache/restore@v4
continue-on-error: true
with:
path: |
node_modules
path: node_modules
key: ${{ runner.os }}-node-modules-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-modules-

- name: Ensure Dependencies
run: |
Expand Down Expand Up @@ -243,16 +221,12 @@ jobs:
cache: 'npm'
cache-dependency-path: '**/package-lock.json'

# Restore node_modules from setup job
- name: Restore node_modules
uses: actions/cache@v4
uses: actions/cache/restore@v4
continue-on-error: true
with:
path: |
node_modules
path: node_modules
key: ${{ runner.os }}-node-modules-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-modules-

- name: Ensure Dependencies
run: |
Expand Down
10 changes: 0 additions & 10 deletions .prettierrc
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,6 @@
"parser": "astro"
}
},
{
"files": "*.sol",
"options": {
"printWidth": 80,
"tabWidth": 4,
"useTabs": false,
"singleQuote": false,
"bracketSpacing": false
}
},
{
"files": "public/samples/ChainlinkFunctions/*.js",
"options": {
Expand Down
31 changes: 24 additions & 7 deletions .solhint.json
Original file line number Diff line number Diff line change
@@ -1,22 +1,39 @@
{
"extends": "solhint:recommended",
"plugins": ["prettier", "chainlink-solidity"],
"plugins": ["chainlink-solidity"],
"rules": {
"prettier/prettier": "error",
"compiler-version": ["error", ">=0.4.24"],
"compiler-version": ["off", "^0.8.0"],
"const-name-snakecase": "off",
"constructor-syntax": "error",
"var-name-mixedcase": "off",
"func-named-parameters": "off",
"immutable-vars-naming": "off",
"no-inline-assembly": "off",
"contract-name-capwords": "off",
"use-natspec": "off",
"gas-indexed-events": "off",
"function-max-lines": "off",
"gas-strict-inequalities": "off",
"gas-increment-by-one": "off",
"gas-calldata-parameters": "off",
"gas-small-strings": "off",
"not-rely-on-time": "off",
"no-empty-blocks": "off",
"no-unused-import": "error",
"func-visibility": ["error", { "ignoreConstructors": true }],
"import-path-check": "off",
"func-visibility": [
"error",
{
"ignoreConstructors": true
}
],
"quotes": ["error", "double"],
"reason-string": ["warn", { "maxLength": 64 }],
"chainlink-solidity/prefix-internal-functions-with-underscore": "warn",
"chainlink-solidity/prefix-private-functions-with-underscore": "warn",
"chainlink-solidity/prefix-storage-variables-with-s-underscore": "warn",
"chainlink-solidity/prefix-immutable-variables-with-i": "warn"
"chainlink-solidity/prefix-immutable-variables-with-i": "warn",
"chainlink-solidity/all-caps-constant-storage-variables": "warn",
"chainlink-solidity/no-hardhat-imports": "warn",
"chainlink-solidity/inherited-constructor-args-not-in-contract-definition": "warn",
"chainlink-solidity/explicit-returns": "warn"
}
}
4 changes: 2 additions & 2 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
"recommendations": [
"dbaeumer.vscode-eslint",
"esbenp.prettier-vscode",
"NomicFoundation.hardhat-solidity",
"JuanBlanco.solidity",
"astro-build.astro-vscode",
"unifiedjs.vscode-mdx",
"streetsidesoftware.code-spell-checker"
],
"unwantedRecommendations": []
"unwantedRecommendations": ["NomicFoundation.hardhat-solidity"]
}
13 changes: 10 additions & 3 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,13 @@
"*.mdx": "mdx"
},
"editor.formatOnSave": true,
"solidity.formatter": "prettier", // This is the default so it might be missing.
"prettier.documentSelectors": ["**/*.astro"],
// Solidity settings for Foundry
"solidity.formatter": "forge",
"solidity.packageDefaultDependenciesContractsDirectory": "public/samples",
"solidity.packageDefaultDependenciesDirectory": "node_modules",
"[solidity]": {
"editor.defaultFormatter": "NomicFoundation.hardhat-solidity"
"editor.defaultFormatter": "JuanBlanco.solidity"
},
"[astro]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
Expand All @@ -17,7 +20,11 @@
"[mdx]": {
"editor.wordWrap": "on"
},
"cSpell.enableFiletypes": ["astro", "mdx", "solidity"],
"cSpell.enabledFileTypes": {
"astro": true,
"mdx": true,
"solidity": true
},
"cSpell.words": [
"AGOR",
"Alfajores",
Expand Down
37 changes: 37 additions & 0 deletions foundry.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# This configuration file sets up the paths and compilers so we can test our solidity samples
[profile.default]
# Let Forge download/choose solc per file's pragma automatically
auto_detect_solc = true
evm_version = 'paris'

src = "public/samples"
out = ".test/artifacts"
cache_path = ".test/cache"
libs = ["lib", "node_modules"]

# Optimization settings
optimizer = true
optimizer_runs = 1_000_000

# Test environment defaults
bytecode_hash = "none"
ffi = false
gas_price = 1
block_timestamp = 1234567890
block_number = 12345

[profile.ci]
verbosity = 2

[fmt]
tab_width = 2
multiline_func_header = "params_first"
sort_imports = true
single_line_statement_blocks = "preserve"
number_underscore = "thousands"
wrap_comments = true

[lint]
lint_on_build = false

# See more config options https://github.com/foundry-rs/foundry/tree/master/config
29 changes: 0 additions & 29 deletions hardhat.config.cts

This file was deleted.

12 changes: 2 additions & 10 deletions knip.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
"astro.config.ts",
"src/content.config.ts",
"src/integrations/**/*.ts",
"hardhat.config.cts",
"codegen.ts",
"jest.config.cjs",
"src/**/__tests__/**/*.test.ts",
Expand All @@ -16,15 +15,8 @@
"entry": ["src/**/__tests__/**/*.test.ts", "src/**/*.test.ts"]
},
"project": ["src/**/*.{ts,tsx,astro}", "!src/**/*.d.ts"],
"ignore": [
"src/types/**/*.d.ts",
"public/**/*",
"src/__mocks__/**/*",
"templates/**/*",
"typechain-types/**/*",
"dist/**/*"
],
"ignoreDependencies": ["@types/*", "prettier*", "@astrojs/*", "hardhat*", "solhint*", "jest*", "@project-serum/*"],
"ignore": ["src/types/**/*.d.ts", "public/**/*", "src/__mocks__/**/*", "templates/**/*", "dist/**/*"],
"ignoreDependencies": ["@types/*", "prettier*", "@astrojs/*", "solhint*", "jest*", "@project-serum/*"],
"ignoreExportsUsedInFile": {
"interface": true,
"type": true,
Expand Down
Loading
Loading