Skip to content

Commit

Permalink
Merge pull request #909 from lukso-network/fix/merge-to-main
Browse files Browse the repository at this point in the history
merge to main
  • Loading branch information
richtera authored Mar 6, 2024
2 parents acf5ea9 + 122556d commit 6f0ceb3
Show file tree
Hide file tree
Showing 821 changed files with 32,774 additions and 53,743 deletions.
12 changes: 0 additions & 12 deletions .eslintrc.json

This file was deleted.

9 changes: 7 additions & 2 deletions .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 All @@ -40,7 +43,9 @@ jobs:
run: npm ci

- name: 🏗️ Build contract artifacts
run: npx hardhat compile
run: |
npm run build
npm run build:turbo
- name: 🧪 Run Benchmark tests
# Rename the file to be able to generate benchmark JSON report
Expand Down
109 changes: 21 additions & 88 deletions .github/workflows/build-lint-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,17 @@ name: Node.js CI - Build + Lint + Test
on: pull_request

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

steps:
- uses: actions/checkout@v3

# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
- name: Use Node.js '16.15.0'
uses: actions/setup-node@v2
- name: Use Node.js v20
uses: actions/setup-node@v3
with:
node-version: "16.15.0"
node-version: "20.x"
cache: "npm"

- name: 📦 Install dependencies
Expand All @@ -29,87 +29,20 @@ jobs:

# This will also generate the Typechain types used by the Chai tests
- name: 🏗️ Build contract artifacts
run: npx hardhat compile

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

- name: 🧪 run import/requires tests
run: npm run test:importRequire

- 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
test-suites:
strategy:
matrix:
lsp:
[
"up",
"upinit",
"lsp1",
"lsp2",
"lsp6",
"lsp6init",
"lsp7",
"lsp7init",
"lsp8",
"lsp8init",
"lsp9",
"lsp9init",
"lsp11",
"lsp11init",
"lsp17",
"lsp17extensions",
"lsp20",
"lsp20init",
"lsp23",
"universalfactory",
"reentrancy",
"reentrancyinit",
"mocks",
]

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

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

- name: Use Node.js v16
uses: actions/setup-node@v2
with:
node-version: "16.x"
cache: "npm"

- name: Install dependencies
if: steps.build-cache.outputs.cache-hit != 'true'
run: npm ci

- name: 🧪 run tests
run: npm run test:${{ matrix.lsp }}
run: |
npm run build
npm run build:js
# - 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 tests for each package
run: npm run test
98 changes: 31 additions & 67 deletions .github/workflows/deploy-verify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@
name: Deploy + Verify Contracts on Testnet

env:
# 0x983aBC616f2442bAB7a917E6bb8660Df8b01F3bF
CONTRACT_VERIFICATION_TESTNET_PK: ${{ secrets.CONTRACT_VERIFICATION_TESTNET_PK }}
DEPLOYER_ADDRESS: "0x983aBC616f2442bAB7a917E6bb8660Df8b01F3bF"
# 0xF0efeD8d49c0FA6CFC861Bf0311b6B3a4414e4b7
CONTRACT_VERIFICATION_MAINNET_PK: ${{ secrets.CONTRACT_VERIFICATION_MAINNET_PK }}

on:
workflow_dispatch:
Expand All @@ -12,83 +14,45 @@ on:
- "main"

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Use Node.js '16.15.0'
uses: actions/setup-node@v3
with:
node-version: "16.x"
cache: "npm"

- name: Install dependencies
run: npm ci

# This will also generate the Typechain types used by the Chai tests
- name: Build contract artifacts
run: npx hardhat compile

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

deploy-verify:
runs-on: ubuntu-latest
needs: [build]
strategy:
# run each base contract verification one after the other to prevent submitting multiple transactions at the same time with the same nonce.
max-parallel: 1
matrix:
contracts: [
# Standard contracts
"UniversalProfile",
"LSP6KeyManager",
"LSP1UniversalReceiverDelegateUP",
"LSP1UniversalReceiverDelegateVault",
"LSP7Mintable",
"LSP8Mintable",
"LSP9Vault",
# Base contracts (for proxies)
"UniversalProfileInit",
"LSP6KeyManagerInit",
"LSP7MintableInit",
"LSP8MintableInit",
"LSP9VaultInit",
]
network: ["luksoTestnet", "luksoMainnet"]

runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

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

- name: Use Node.js v16
- name: Use Node.js v20
uses: actions/setup-node@v3
with:
node-version: "16.x"
node-version: "20.x"
cache: "npm"

- name: Install dependencies
if: steps.build-cache.outputs.cache-hit != 'true'
run: npm ci

- name: Verify Deployer Balance
run: npx ts-node ./scripts/ci/check-deployer-balance.ts
- name: Build contract artifacts
run: npm run build

- name: Deploy + Verify ${{ matrix.contracts }} on Testnet
run: sh ./scripts/ci/deploy-verify.sh -n luksoTestnet -c ${{ matrix.contracts }}
- name: Verify Deployer Balance
run: npx hardhat verify-balance --network ${{ matrix.network }}

# We do not deploy the standard contracts on mainnet for the following reasons:
# 1) standard contracts are expensive to deploy on mainnet
# 2) user's universal profiles use the minimal proxy pattern,
#
# therefore we only need the base contracts to be deployed on mainnet.
- name: Select tags based on network to deploy
run: |
TAGS="base"
if [[ ${{ matrix.network }} == "luksoTestnet"]]; then
TAGS+=",standard"
fi
- name: Deploy contracts on network
run: npx hardhat deploy --network ${{ matrix.network }} --tags $TAGS --write true

# Loop through deployment files and recover address of deployed contracts to verify
- name: Verify deployed contracts on mainnet
run: npx hardhat verify-all --network ${{ matrix.network }}
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 }}
18 changes: 12 additions & 6 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,32 +28,38 @@ jobs:
# a new release is created:

- uses: actions/checkout@v3
if: ${{ steps.release.outputs.release_created }}
if: ${{ steps.release.outputs.releases_created }}

- name: Use Node.js '16.15.0'
uses: actions/setup-node@v2
if: ${{ steps.release.outputs.release_created }}
if: ${{ steps.release.outputs.releases_created }}
with:
node-version: "16.15.0"
registry-url: "https://registry.npmjs.org"
scope: "@lukso"
cache: "npm"

- name: Install Dependencies
if: ${{ steps.release.outputs.release_created }}
if: ${{ steps.release.outputs.releases_created }}
run: npm ci

# `npm run build:js` will also generate the auto-generated constants for methods, errors and events,
# including extracting their devdocs and userdocs
- name: Prepare artifacts to publish
if: ${{ steps.release.outputs.release_created }}
if: ${{ steps.release.outputs.releases_created }}
run: |
npm run build
npm run build:js
npm run package
npm run build:types
- name: Publish on NPM
if: ${{ steps.release.outputs.release_created }}
run: npm publish --access public
if: ${{ steps.release.outputs.releases_created }}
run: |
(cat <<END > outputs.json
${{toJSON(steps.release.outputs)}}
END
)
node ./publish.mjs outputs.json
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_PUBLISH_KEY }}
Loading

0 comments on commit 6f0ceb3

Please sign in to comment.