Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build!: create final package for @lukso/lsp-smart-contracts #896

Merged
merged 21 commits into from
Mar 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
a4b696a
chore!: move `@lukso/lsp-smart-contracts` in its own package
CJ42 Feb 28, 2024
404cfb5
build: move all the build and config files into `packages/lsp-smart-c…
CJ42 Feb 28, 2024
c77f9e9
test: move all the tests/ under `packages/lsp-smart-contracts`
CJ42 Feb 28, 2024
ef0f2dc
build: organise `package.json` for root and `@lukso/lsp-smart-contracts`
CJ42 Feb 28, 2024
b2aa934
build: cleanup test and scripts commands from root to package
CJ42 Feb 28, 2024
88b4022
ci: adjust CI for build lint test for all packages
CJ42 Feb 28, 2024
7cddd0f
chore: remap import paths for `LSP0ERC725Account` to `@lukso/lsp0-con…
CJ42 Feb 28, 2024
47cb8f8
ci: update CI job path runner for `solc_version`
CJ42 Feb 28, 2024
9ec83ce
build: tmp turn off global import disallowed in `.sol` file for `lsp-…
CJ42 Feb 28, 2024
82b2dda
chore: remap import paths
b00ste Feb 28, 2024
947a424
test: fix Benchmark tests for ethers v6 syntax
CJ42 Feb 28, 2024
b39b2b4
chore: fix some Solidity import path compiler errors
CJ42 Feb 28, 2024
6faa012
build: update `package-lock.json`
CJ42 Feb 28, 2024
bddec41
test: update foundry tests setting for `@lukso/lsp-smart-contracts`
CJ42 Feb 28, 2024
fc2781c
chore: add missing environnement variable in `turbo.json`
CJ42 Feb 28, 2024
8dcc06b
test: repair tests that import helpers from root
b00ste Feb 28, 2024
e8765a0
chore: fix types imports in tests
b00ste Feb 28, 2024
81f0e0f
build: adjust foundry build settings to prevent race condition when i…
CJ42 Feb 28, 2024
b1c42e6
chore: ignore temporarily lsp16 package for foundry tests
CJ42 Feb 29, 2024
892c2d1
ci: disable temporarily foundry gas report in CI
CJ42 Feb 29, 2024
f352892
ci: specify working directory for gas benchmark CI
CJ42 Feb 29, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
9 changes: 0 additions & 9 deletions .eslintrc.js

This file was deleted.

5 changes: 4 additions & 1 deletion .github/workflows/benchmark.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ on:

# compare gas diff only when editing Solidity smart contract code
paths:
- "contracts/**/*.sol"
- "packages/**/contracts/**/*.sol"

# do not run on releases (merging to main)
branches-ignore:
Expand All @@ -22,6 +22,9 @@ on:
jobs:
benchmark:
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./packages/lsp-smart-contracts

steps:
- name: Checkout base branch
Expand Down
108 changes: 14 additions & 94 deletions .github/workflows/build-lint-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ name: Node.js CI - Build + Lint + Test
on: pull_request

jobs:
build:
build-lint-test:
runs-on: ubuntu-latest

steps:
Expand All @@ -22,107 +22,27 @@ jobs:
run: npm ci

- name: 🔍 Run Solidity Linter
run: |
npm run lint:solidity
npm run lint:turbo:solidity
run: npm run lint:solidity

- name: 🎨 Run ESLint on JS/TS files
run: |
npm run lint
npm run lint:turbo
run: npm run lint

# This will also generate the Typechain types used by the Chai tests
- name: 🏗️ Build contract artifacts
run: |
npm run build
npm run build:turbo
npm run build:js
npm run build:js:turbo

- name: 📤 cache dependencies + build
uses: actions/cache@v4
with:
path: |
artifacts
node_modules
dist
types
contracts.ts
packages/**/types
packages/**/dist
key: ${{ github.run_id }}

- name: 📚 generate ABI docs
run: npm run build:docs

- name: 🔍 check if ABI auto-generated docs need to be updated
run: |-
if [[ $(git diff --name-only) != "" ]];
then
echo "Error: Please generate ABI docs after making changes to Solidity code and Natspec comments!"
exit 1
fi

- name: 🧪 Run Turbo tests
run: npm run test:turbo

test-suites:
strategy:
matrix:
lsp: [
"up",
"upinit",
"lsp1",
"lsp6",
"lsp6init",
"lsp7",
"lsp7init",
"lsp8",
"lsp8init",
"lsp9",
"lsp9init",
"lsp11",
"lsp11init",
"lsp17",
# Deploying NickFactory currently fails with latest Hardhat version. Commenting out temporarily until resolved
# See following issue: https://github.com/NomicFoundation/hardhat/issues/4939
# "lsp17extensions",
"lsp20",
"lsp20init",
"lsp23",
"reentrancy",
"reentrancyinit",
"mocks",
]

runs-on: ubuntu-latest
needs: [build]
steps:
- uses: actions/checkout@v3

- name: 📥 restore cache
uses: actions/cache@v4
id: "build-cache"
with:
path: |
artifacts
node_modules
dist
types
contracts.ts
packages/**/types
packages/**/dist
key: ${{ github.run_id }}

- name: Use Node.js v20
uses: actions/setup-node@v3
with:
node-version: "20.x"
cache: "npm"
# - name: 📚 generate ABI docs
# run: npm run build:docs

- name: Install dependencies
if: steps.build-cache.outputs.cache-hit != 'true'
run: npm ci
# - name: 🔍 check if ABI auto-generated docs need to be updated
# run: |-
# if [[ $(git diff --name-only) != "" ]];
# then
# echo "Error: Please generate ABI docs after making changes to Solidity code and Natspec comments!"
# exit 1
# fi

- name: 🧪 run tests
run: npm run test:${{ matrix.lsp }}
- name: 🧪 Run tests for each package
run: npm run test
38 changes: 20 additions & 18 deletions .github/workflows/foundry-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ on:
pull_request:
# compare gas diff only when editing Solidity smart contract code
paths:
- "contracts/**/*.sol"
- "tests/foundry/**/*.sol"
- "packages/**/*.sol"
- "packages/lsp-smart-contracts/tests/foundry/**/*.sol"

jobs:
foundry-tests:
Expand All @@ -24,7 +24,9 @@ jobs:
run: npm ci

- name: NPM build
run: npx hardhat compile
run: |
npm run build
npm run build:foundry

- name: Run Foundry tests
run: npm run test:foundry
Expand All @@ -34,18 +36,18 @@ jobs:
# due to non-deterministic fuzzing (but still use pseudo-random fuzzing seeds)
FOUNDRY_FUZZ_SEED: 0x${{ github.event.pull_request.base.sha || github.sha }}

- name: Compare gas reports
uses: Rubilmax/foundry-gas-diff@v3.13.1
with:
summaryQuantile: 0.9 # only display the 10% most significant gas diffs in the summary (defaults to 20%)
sortCriteria: avg,max # sort diff rows by criteria
sortOrders: desc,asc # and directions
id: gas_diff

- name: Add gas diff to sticky comment
if: github.event_name == 'pull_request' || github.event_name == 'pull_request_target'
uses: marocchino/sticky-pull-request-comment@v2
with:
# delete the comment in case changes no longer impact gas costs
delete: ${{ !steps.gas_diff.outputs.markdown }}
message: ${{ steps.gas_diff.outputs.markdown }}
# - name: Compare gas reports
# uses: Rubilmax/foundry-gas-diff@v3.13.1
# with:
# summaryQuantile: 0.9 # only display the 10% most significant gas diffs in the summary (defaults to 20%)
# sortCriteria: avg,max # sort diff rows by criteria
# sortOrders: desc,asc # and directions
# id: gas_diff

# - name: Add gas diff to sticky comment
# if: github.event_name == 'pull_request' || github.event_name == 'pull_request_target'
# uses: marocchino/sticky-pull-request-comment@v2
# with:
# # delete the comment in case changes no longer impact gas costs
# delete: ${{ !steps.gas_diff.outputs.markdown }}
# message: ${{ steps.gas_diff.outputs.markdown }}
7 changes: 5 additions & 2 deletions .github/workflows/solc_version.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,18 @@ on:
- "develop"
# Only run when `.sol` files have been changed
paths:
- "contracts/**/*.sol"
- "*.sol"

pull_request:
paths:
- "contracts/**/*.sol"
- "*.sol"

jobs:
solc_version:
runs-on: ubuntu-latest
defaults:
run:
working-directory: packages/lsp-smart-contracts
strategy:
matrix:
solc: [
Expand Down
5 changes: 3 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -135,9 +135,10 @@ forge-cache/
gas_benchmark.md

# Exclude build output folders
/**/dist
/**/contracts.ts
/devdocs
/userdocs
/**/devdocs
/**/userdocs

# test temporary folder
/.test
Expand Down
11 changes: 0 additions & 11 deletions config/tsconfig/contracts.module.json

This file was deleted.

43 changes: 0 additions & 43 deletions contracts/Imports.sol

This file was deleted.

17 changes: 0 additions & 17 deletions contracts/Version.sol

This file was deleted.

23 changes: 14 additions & 9 deletions foundry.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,21 @@ runs = 10_000
max_test_rejects = 200_000

[profile.lsp2]
src = 'packages/LSP2ERC725YJSONSchema/contracts'
test = 'packages/LSP2ERC725YJSONSchema/foundry'
out = 'packages/LSP2ERC725YJSONSchema/contracts/foundry_artifacts'
src = 'packages/lsp2-contracts/contracts'
test = 'packages/lsp2-contracts/foundry'
out = 'packages/lsp2-contracts/contracts/foundry_artifacts'

[profile.lsp6]
src = 'packages/LSP6KeyManager/contracts'
test = 'packages/LSP6KeyManager/foundry'
out = 'packages/LSP6KeyManager/contracts/foundry_artifacts'
src = 'packages/lsp6-contracts/contracts'
test = 'packages/lsp6-contracts/foundry'
out = 'packages/lsp6-contracts/contracts/foundry_artifacts'

[profile.lsp16]
src = 'packages/LSP16UniversalFactory/contracts'
test = 'packages/LSP16UniversalFactory/foundry'
out = 'packages/LSP16UniversalFactory/contracts/foundry_artifacts'
src = 'packages/lsp16-contracts/contracts'
test = 'packages/lsp16-contracts/foundry'
out = 'packages/lsp16-contracts/contracts/foundry_artifacts'

[profile.lsp_smart_contracts]
src = 'packages/lsp-smart-contracts/contracts'
test = 'packages/lsp-smart-contracts/tests/foundry'
out = 'packages/lsp-smart-contracts/contracts/foundry_artifacts'
Loading
Loading