Skip to content

Commit

Permalink
chore: Change the repository architecture to a monorepo
Browse files Browse the repository at this point in the history
  • Loading branch information
alainncls committed Sep 29, 2023
1 parent e475d26 commit d651e65
Show file tree
Hide file tree
Showing 66 changed files with 269 additions and 219 deletions.
45 changes: 45 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Lint

on:
pull_request:
branches:
- main
- dev
- release/*
push:
branches:
- main
- dev
- release/*

jobs:
lint:
runs-on: "ubuntu-latest"
steps:
- name: "Check out the repo"
uses: "actions/checkout@v3"

- name: "Install Pnpm"
uses: "pnpm/action-setup@v2"
with:
version: "8"

- name: "Install Node.js"
uses: "actions/setup-node@v3"
with:
cache: "pnpm"
node-version: "lts/*"

- name: "Install the Node.js dependencies"
run: "pnpm install"

- name: "Check code linting"
run: "pnpm -r run lint"

- name: "Run Prettier"
run: "pnpm run prettier"

- name: "Add lint summary"
run: |
echo "## Lint result" >> $GITHUB_STEP_SUMMARY
echo "✅ Passed" >> $GITHUB_STEP_SUMMARY
66 changes: 29 additions & 37 deletions .github/workflows/smart-contracts-test.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Smart Contracts Test
name: Smart Contracts

on:
pull_request:
Expand All @@ -16,39 +16,13 @@ env:
FOUNDRY_PROFILE: ci

jobs:
lint:
runs-on: "ubuntu-latest"
steps:
- name: "Check out the repo"
uses: "actions/checkout@v3"

- name: "Install Foundry"
uses: "foundry-rs/foundry-toolchain@v1"

- name: "Install Pnpm"
uses: "pnpm/action-setup@v2"
with:
version: "8"

- name: "Install Node.js"
uses: "actions/setup-node@v3"
with:
cache: "pnpm"
node-version: "lts/*"

- name: "Install the Node.js dependencies"
run: "pnpm install"

- name: "Lint the contracts"
run: "pnpm lint"

- name: "Add lint summary"
run: |
echo "## Lint result" >> $GITHUB_STEP_SUMMARY
echo "✅ Passed" >> $GITHUB_STEP_SUMMARY
build:
defaults:
run:
working-directory: contracts

runs-on: "ubuntu-latest"

steps:
- name: "Check out the repo"
uses: "actions/checkout@v3"
Expand All @@ -70,10 +44,17 @@ jobs:
echo "✅ Passed" >> $GITHUB_STEP_SUMMARY
test-unit:
defaults:
run:
working-directory: contracts

env:
FOUNDRY_FUZZ_RUNS: "5000"
needs: ["lint", "build"]

needs: ["build"]

runs-on: "ubuntu-latest"

steps:
- name: "Check out the repo"
uses: "actions/checkout@v3"
Expand All @@ -84,16 +65,18 @@ jobs:
uses: "foundry-rs/foundry-toolchain@v1"

- name: "Run the unit tests"
run: 'forge test --match-path "test/*"'
run: "forge test"

- name: "Add test summary"
run: |
echo "## Unit tests result" >> $GITHUB_STEP_SUMMARY
echo "✅ Passed" >> $GITHUB_STEP_SUMMARY
coverage:
needs: ["lint", "build"]
needs: ["build"]

runs-on: "ubuntu-latest"

steps:
- name: "Check out the repo"
uses: "actions/checkout@v3"
Expand All @@ -104,7 +87,10 @@ jobs:
uses: "foundry-rs/foundry-toolchain@v1"

- name: "Generate the coverage report using the unit tests"
run: 'forge coverage --match-path "test/**/*.sol" --report lcov'
run: "cd contracts && forge coverage --report lcov"

- name: "ls"
run: "cp contracts/lcov.info ."

- name: "Upload coverage report to Codecov"
uses: "codecov/codecov-action@v3"
Expand All @@ -126,8 +112,14 @@ jobs:
echo "✅ Uploaded to Codecov" >> $GITHUB_STEP_SUMMARY
upgradeability:
needs: ["lint", "build"]
defaults:
run:
working-directory: contracts

needs: ["build"]

runs-on: "ubuntu-latest"

steps:
- name: "Check out the repo"
uses: "actions/checkout@v3"
Expand Down
21 changes: 11 additions & 10 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
[submodule "lib/forge-std"]
branch = "v1"
path = "lib/forge-std"
url = "https://github.com/foundry-rs/forge-std"
[submodule "lib/openzeppelin-contracts-upgradeable"]
branch = "release-v4.9"
path = "lib/openzeppelin-contracts-upgradeable"
url = "https://github.com/OpenZeppelin/openzeppelin-contracts-upgradeable"
[submodule "lib/openzeppelin-contracts"]
path = lib/openzeppelin-contracts
[submodule "contracts/lib/forge-std"]
branch = "v1"
path = contracts/lib/forge-std
url = https://github.com/foundry-rs/forge-std
[submodule "contracts/lib/openzeppelin-contracts-upgradeable"]
branch = "release-v4.9"
path = contracts/lib/openzeppelin-contracts-upgradeable
url = https://github.com/OpenZeppelin/openzeppelin-contracts-upgradeable
[submodule "contracts/lib/openzeppelin-contracts"]
branch = "release-v4.9"
path = contracts/lib/openzeppelin-contracts
url = https://github.com/OpenZeppelin/openzeppelin-contracts
4 changes: 2 additions & 2 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
. "$(dirname -- "$0")/_/husky.sh"

pnpm run prettier:write
pnpm run lint
pnpm run test
pnpm -r run lint
pnpm -r run test
File renamed without changes.
File renamed without changes.
File renamed without changes.
3 changes: 0 additions & 3 deletions foundry.toml → contracts/foundry.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,3 @@ linea_goerli = "${LINEA_GOERLI_RPC_URL}"

[etherscan]
linea_goerli = { key = "${ETHERSCAN_API_KEY}" }


# See more config options https://github.com/foundry-rs/foundry/tree/master/config
File renamed without changes.
1 change: 1 addition & 0 deletions contracts/lib/forge-std
Submodule forge-std added at 1d9650
1 change: 1 addition & 0 deletions contracts/lib/openzeppelin-contracts
Submodule openzeppelin-contracts added at 98c7a4
1 change: 1 addition & 0 deletions contracts/lib/openzeppelin-contracts-upgradeable
64 changes: 64 additions & 0 deletions contracts/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
{
"name": "linea-attestation-registry-contracts",
"version": "0.0.1",
"description": "Verax Attestation Registry core smart contracts",
"keywords": [
"linea-attestation-registry",
"blockchain",
"attestation",
"ethereum",
"foundry",
"smart-contracts",
"solidity"
],
"repository": "github.com/Consensys/linea-attestation-registry",
"license": "MIT",
"author": "Consensys",
"files": [
"src"
],
"scripts": {
"build": "forge build",
"check:upgradeability": "npx hardhat run script/upgrade/checkUpgradeability.ts",
"check:upgradeability:ci": "cp .env.example .env && pnpm run check:upgradeability",
"check:upgradeable": "npx hardhat run --network linea script/upgrade/checkUpgradeable.ts",
"check:upgradeable:goerli": "npx hardhat run --network linea-goerli script/upgrade/checkUpgradeable.ts",
"clean": "rm -rf lcov.info coverage artifacts cache_hardhat cache out typechain-types",
"deploy:CorrectModule": "npx hardhat run --network linea script/deploy/deployCorrectModule.ts",
"deploy:CorrectModule:goerli": "npx hardhat run --network linea-goerli script/deploy/deployCorrectModule.ts",
"deploy:IncorrectModule": "npx hardhat run --network linea script/deploy/deployIncorrectModule.ts",
"deploy:IncorrectModule:goerli": "npx hardhat run --network linea-goerli script/deploy/deployIncorrectModule.ts",
"deploy:MsgSenderModule": "npx hardhat run --network linea script/deploy/deployMsgSenderModule.ts",
"deploy:MsgSenderModule:goerli": "npx hardhat run --network linea-goerli script/deploy/deployMsgSenderModule.ts",
"deploy:all": "npx hardhat run --network linea script/deploy/deployEverything.ts",
"deploy:all:goerli": "npx hardhat run --network linea-goerli script/deploy/deployEverything.ts",
"deploy:post": "npx hardhat run --network linea script/deploy/postDeployment.ts",
"deploy:post:goerli": "npx hardhat run --network linea-goerli script/deploy/postDeployment.ts",
"lint": "pnpm solhint \"{script,src,test}/**/*.sol\"",
"reimport": "npx hardhat run --network linea script/recreateNetworkFile.ts",
"reimport:goerli": "npx hardhat run --network linea-goerli script/recreateNetworkFile.ts",
"test": "forge test",
"upgrade:all": "npx hardhat run --network linea script/upgrade/upgradeEverything.ts",
"upgrade:all:force": "npx hardhat run --network linea script/upgrade/forceUgradeEverything.ts",
"upgrade:all:goerli": "npx hardhat run --network linea-goerli script/upgrade/upgradeEverything.ts",
"upgrade:all:goerli:force": "npx hardhat run --network linea-goerli script/upgrade/forceUgradeEverything.ts"
},
"devDependencies": {
"@nomicfoundation/hardhat-ethers": "^3.0.4",
"@nomicfoundation/hardhat-foundry": "^1.1.1",
"@nomicfoundation/hardhat-toolbox": "^3.0.0",
"@openzeppelin/hardhat-upgrades": "^2.2.1",
"dotenv": "^16.3.1",
"ethers": "^6.7.1",
"hardhat": "^2.17.2",
"solhint": "^3.6.2",
"solhint-plugin-prettier": "^0.0.5"
},
"pnpm": {
"overrides": {
"flat@<5.0.1": ">=5.0.1",
"tough-cookie@<4.1.3": ">=4.1.3",
"minimatch@<3.0.5": ">=3.0.5"
}
}
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
1 change: 0 additions & 1 deletion lib/forge-std
Submodule forge-std deleted from 74cfb7
1 change: 0 additions & 1 deletion lib/openzeppelin-contracts
Submodule openzeppelin-contracts deleted from fd81a9
1 change: 0 additions & 1 deletion lib/openzeppelin-contracts-upgradeable
Submodule openzeppelin-contracts-upgradeable deleted from f34a3a
59 changes: 8 additions & 51 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "linea-attestation-registry",
"version": "0.0.1",
"description": "Core smart contracts to read and write attestations on Linea",
"description": "Verax is a shared on-chain attestation registry",
"keywords": [
"linea-attestation-registry",
"blockchain",
Expand All @@ -14,61 +14,18 @@
"repository": "github.com/Consensys/linea-attestation-registry",
"license": "MIT",
"author": "Consensys",
"files": [
"src"
],
"scripts": {
"build": "forge build",
"check:upgradeability": "npx hardhat run script/upgrade/checkUpgradeability.ts",
"check:upgradeability:ci": "cp .env.example .env && pnpm run check:upgradeability",
"check:upgradeable": "npx hardhat run --network linea script/upgrade/checkUpgradeable.ts",
"check:upgradeable:goerli": "npx hardhat run --network linea-goerli script/upgrade/checkUpgradeable.ts",
"clean": "rm -rf lcov.info coverage artifacts cache_hardhat cache out typechain-types",
"deploy:CorrectModule": "npx hardhat run --network linea script/deploy/deployCorrectModule.ts",
"deploy:CorrectModule:goerli": "npx hardhat run --network linea-goerli script/deploy/deployCorrectModule.ts",
"deploy:IncorrectModule": "npx hardhat run --network linea script/deploy/deployIncorrectModule.ts",
"deploy:IncorrectModule:goerli": "npx hardhat run --network linea-goerli script/deploy/deployIncorrectModule.ts",
"deploy:MsgSenderModule": "npx hardhat run --network linea script/deploy/deployMsgSenderModule.ts",
"deploy:MsgSenderModule:goerli": "npx hardhat run --network linea-goerli script/deploy/deployMsgSenderModule.ts",
"deploy:all": "npx hardhat run --network linea script/deploy/deployEverything.ts",
"deploy:all:goerli": "npx hardhat run --network linea-goerli script/deploy/deployEverything.ts",
"deploy:post": "npx hardhat run --network linea script/deploy/postDeployment.ts",
"deploy:post:goerli": "npx hardhat run --network linea-goerli script/deploy/postDeployment.ts",
"lint": "pnpm lint:sol && eslint . && pnpm prettier:check",
"lint:sol": "pnpm solhint \"{script,src,test}/**/*.sol\"",
"lint": "eslint .",
"prepare": "husky install",
"prettier:check": "prettier --check \"**/*.{json,md,svg,yml,sol,ts}\"",
"prettier:write": "prettier --write \"**/*.{json,md,svg,yml,sol,ts}\"",
"reimport": "npx hardhat run --network linea script/recreateNetworkFile.ts",
"reimport:goerli": "npx hardhat run --network linea-goerli script/recreateNetworkFile.ts",
"test": "forge test",
"upgrade:all": "npx hardhat run --network linea script/upgrade/upgradeEverything.ts",
"upgrade:all:force": "npx hardhat run --network linea script/upgrade/forceUgradeEverything.ts",
"upgrade:all:goerli": "npx hardhat run --network linea-goerli script/upgrade/upgradeEverything.ts",
"upgrade:all:goerli:force": "npx hardhat run --network linea-goerli script/upgrade/forceUgradeEverything.ts"
"prettier": "prettier --check \"**/*.{json,md,svg,yml,sol,ts}\"",
"prettier:write": "prettier --write \"**/*.{json,md,svg,yml,sol,ts}\""
},
"devDependencies": {
"@nomicfoundation/hardhat-ethers": "^3.0.4",
"@nomicfoundation/hardhat-foundry": "^1.1.1",
"@nomicfoundation/hardhat-toolbox": "^3.0.0",
"@openzeppelin/hardhat-upgrades": "^2.2.1",
"@typescript-eslint/eslint-plugin": "^6.6.0",
"@typescript-eslint/parser": "^6.6.0",
"dotenv": "^16.3.1",
"eslint": "^8.49.0",
"ethers": "^6.7.1",
"hardhat": "^2.17.2",
"@typescript-eslint/eslint-plugin": "^6.7.3",
"@typescript-eslint/parser": "^6.7.3",
"eslint": "^8.50.0",
"husky": "^8.0.3",
"prettier": "^2.8.8",
"prettier-plugin-solidity": "^1.1.3",
"solhint": "^3.6.2",
"solhint-plugin-prettier": "^0.0.5"
},
"pnpm": {
"overrides": {
"flat@<5.0.1": ">=5.0.1",
"tough-cookie@<4.1.3": ">=4.1.3",
"minimatch@<3.0.5": ">=3.0.5"
}
"prettier-plugin-solidity": "^1.1.3"
}
}
Loading

0 comments on commit d651e65

Please sign in to comment.