Skip to content

Commit

Permalink
ci: simplify syntax for "on:"
Browse files Browse the repository at this point in the history
build: add "postpublish" and "prepublishOnly" hook scripts
build: add "rimraf" as Node.js dev dep
build: set "branch" to "v1" for "forge-std" submodule
build: set "branch" to "v5" for "prb-contracts" submodule
build: set "cbor_metadata" to "false"
build: upgrade to Solidity v0.8.18
chore: add Codecov config
ci: add "build", "clean" and "test" scripts in "package.json"
ci: add "workflow_syntax" in "on" for "main" branch
ci: separate jobs in workflow
ci: track coverage with Codecov
docs: capitalize username
docs: update link to "hardhat-template" repo
style: format Foundry config with Taplo
style: use spaces for indenting in ".gitmodules"
  • Loading branch information
PaulRBerg committed Feb 7, 2023
1 parent 02f149a commit b308058
Show file tree
Hide file tree
Showing 12 changed files with 128 additions and 67 deletions.
2 changes: 1 addition & 1 deletion .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
custom: ["https://gitcoin.co/grants/1657/paulrberg-open-source-engineering"]
custom: ["https://gitcoin.co/grants/1657/PaulRBerg-open-source-engineering"]
80 changes: 60 additions & 20 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,28 +4,19 @@ env:
FOUNDRY_PROFILE: "ci"

on:
workflow_dispatch:
pull_request:
branches:
- "main"
- "staging"
push:
branches:
- "main"
- "staging"

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

- name: "Install Foundry"
uses: "onbjerg/foundry-toolchain@v1"
with:
version: "nightly"

- name: "Install Node.js"
uses: "actions/setup-node@v3"
Expand All @@ -41,21 +32,70 @@ jobs:

- name: "Add lint summary"
run: |
echo "## Lint" >> $GITHUB_STEP_SUMMARY
echo "## Lint result" >> $GITHUB_STEP_SUMMARY
echo "✅ Passed" >> $GITHUB_STEP_SUMMARY
- name: "Show the Foundry config"
run: "forge config"
build:
needs: "lint"
runs-on: "ubuntu-latest"
steps:
- name: "Check out the repo"
uses: "actions/checkout@v3"
with:
submodules: "recursive"

- name: "Run the tests"
run: "forge test"
- name: "Install Foundry"
uses: "foundry-rs/foundry-toolchain@v1"

- name: "Build the contracts and print their size"
run: "forge build --sizes"

- name: "Build the contracts"
- name: "Add build summary"
run: |
forge --version
forge build --sizes
echo "## Build result" >> $GITHUB_STEP_SUMMARY
echo "✅ Passed" >> $GITHUB_STEP_SUMMARY
test:
needs: ["lint", "build"]
runs-on: "ubuntu-latest"
steps:
- name: "Check out the repo"
uses: "actions/checkout@v3"
with:
submodules: "recursive"

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

- name: "Run the tests"
run: "forge test"

- name: "Add test summary"
run: |
echo "## Tests" >> $GITHUB_STEP_SUMMARY
echo "## Tests result" >> $GITHUB_STEP_SUMMARY
echo "✅ Passed" >> $GITHUB_STEP_SUMMARY
coverage:
needs: ["lint", "build"]
runs-on: "ubuntu-latest"
steps:
- name: "Check out the repo"
uses: "actions/checkout@v3"
with:
submodules: "recursive"

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

- name: "Generate the coverage report"
run: "forge coverage --report lcov"

- name: "Upload coverage report to Codecov"
uses: "codecov/codecov-action@v3"
with:
files: "./lcov.info"

- name: "Add coverage summary"
run: |
echo "## Coverage result" >> $GITHUB_STEP_SUMMARY
echo "✅ Uploaded to Codecov" >> $GITHUB_STEP_SUMMARY
12 changes: 6 additions & 6 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
[submodule "lib/forge-std"]
branch = "master"
path = "lib/forge-std"
url = "https://github.com/foundry-rs/forge-std"
branch = "v1"
path = "lib/forge-std"
url = "https://github.com/foundry-rs/forge-std"
[submodule "lib/prb-contracts"]
branch = "main"
branch = "v5"
path = "lib/prb-contracts"
url = "https://github.com/paulrberg/prb-contracts"
url = "https://github.com/PaulRBerg/prb-contracts"
[submodule "lib/prb-test"]
branch = "0.3.1"
path = "lib/prb-test"
url = "https://github.com/paulrberg/prb-test"
url = "https://github.com/PaulRBerg/prb-test"
2 changes: 1 addition & 1 deletion .prettierrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@ useTabs: false
overrides:
- files: "*.sol"
options:
compiler: "0.8.17"
compiler: "0.8.18"
tabWidth: 4
12 changes: 6 additions & 6 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
- Change the extension for types from `.d.ts` to `.ts`.
- Upgrade to latest versions of `ethers`.
- Upgrade to Solidity v0.8.12.
- Use modern Solidity `create2` instead of inline assembly (see [pull request #20](https://github.com/paulrberg/prb-proxy/pull/20)).
- Use modern Solidity `target.code.length` instead of inline assembly (see pull request [pull request #19](https://github.com/paulrberg/prb-proxy/pull/19)).
- Use modern Solidity `create2` instead of inline assembly (see [pull request #20](https://github.com/PaulRBerg/prb-proxy/pull/20)).
- Use modern Solidity `target.code.length` instead of inline assembly (see pull request [pull request #19](https://github.com/PaulRBerg/prb-proxy/pull/19)).

### Fixed

- Old owner address in `TransferOwnership` (see pull request [pull request #29](https://github.com/paulrberg/prb-proxy/pull/29).
- Old owner address in `TransferOwnership` (see pull request [pull request #29](https://github.com/PaulRBerg/prb-proxy/pull/29).

### Removed

Expand All @@ -43,6 +43,6 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),

- First release.

[2.0.0]: https://github.com/paulrberg/prb-proxy/compare/v1.0.1...v2.0.0
[1.0.1]: https://github.com/paulrberg/prb-proxy/compare/v1.0.0...v1.0.1
[1.0.0]: https://github.com/paulrberg/prb-proxy/releases/tag/v1.0.0
[2.0.0]: https://github.com/PaulRBerg/prb-proxy/compare/v1.0.1...v2.0.0
[1.0.1]: https://github.com/PaulRBerg/prb-proxy/compare/v1.0.0...v1.0.1
[1.0.0]: https://github.com/PaulRBerg/prb-proxy/releases/tag/v1.0.0
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# PRBProxy [![Github Actions][gha-badge]][gha] [![Foundry][foundry-badge]][foundry] [![Styled with Prettier][prettier-badge]][prettier] [![License: MIT][license-badge]][license]

[gha]: https://github.com/paulrberg/prb-proxy/actions
[gha-badge]: https://github.com/paulrberg/prb-proxy/actions/workflows/ci.yml/badge.svg
[gha]: https://github.com/PaulRBerg/prb-proxy/actions
[gha-badge]: https://github.com/PaulRBerg/prb-proxy/actions/workflows/ci.yml/badge.svg
[foundry]: https://getfoundry.sh/
[foundry-badge]: https://img.shields.io/badge/Built%20with-Foundry-FFDB1C.svg
[prettier]: https://prettier.io
Expand Down Expand Up @@ -110,7 +110,7 @@ All snippets are written in TypeScript. It is assumed that you run them in a loc
Familiarity with [Ethers](https://github.com/ethers-io/ethers.js) and
[TypeChain](https://github.com/ethereum-ts/TypeChain/tree/master/packages/hardhat) is also requisite.

Check out my [solidity-template](https://github.com/paulrberg/solidity-template) for a boilerplate that combines
Check out my [hardhat-template](https://github.com/PaulRBerg/hardhat-template) for a Hardhat-based boilerplate that combines
Hardhat, Ethers and TypeChain.

### Target Contract
Expand Down Expand Up @@ -299,7 +299,7 @@ will not be liable for any loss, direct or indirect through continued use of thi

### Contact

If you discover any security issues, you can report them via [Keybase](https://keybase.io/paulrberg).
If you discover any security issues, you can report them via [Keybase](https://keybase.io/PaulRBerg).

## Related Efforts

Expand All @@ -309,8 +309,8 @@ If you discover any security issues, you can report them via [Keybase](https://k

## Contributing

Feel free to dive in! [Open](https://github.com/paulrberg/prb-proxy/issues/new) an issue,
[start](https://github.com/paulrberg/prb-proxy/discussions/new) a discussion or submit a PR.
Feel free to dive in! [Open](https://github.com/PaulRBerg/prb-proxy/issues/new) an issue,
[start](https://github.com/PaulRBerg/prb-proxy/discussions/new) a discussion or submit a PR.

### Pre Requisites

Expand Down
2 changes: 2 additions & 0 deletions codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
ignore:
- "test"
40 changes: 22 additions & 18 deletions foundry.toml
Original file line number Diff line number Diff line change
@@ -1,25 +1,29 @@
# Full reference https://github.com/foundry-rs/foundry/tree/master/config

[etherscan]
ethereum = { key = "${ETHERSCAN_API_KEY}" }
goerli = { key = "${ETHERSCAN_API_KEY}" }

[profile.default]
auto_detect_solc = false
bytecode_hash = "none"
fuzz = { runs = 1_000 }
gas_reports = ["*"]
libs = ["lib"]
optimizer = true
optimizer_runs = 10_000
out = "out"
solc = "0.8.17"
src = "src"
test = "test"
auto_detect_solc = false
bytecode_hash = "none"
cbor_metadata = false
gas_reports = ["*"]
libs = ["lib"]
optimizer = true
optimizer_runs = 10_000
out = "out"
solc = "0.8.18"
src = "src"
test = "test"

[profile.default.fuzz]
max_test_rejects = 100_000
runs = 1_000

[profile.ci]
fuzz = { runs = 10_000 }
fuzz = { runs = 10_000 }

[etherscan]
ethereum = { key = "${ETHERSCAN_API_KEY}" }
goerli = { key = "${ETHERSCAN_API_KEY}" }

[rpc_endpoints]
localhost="http://localhost:8545"
goerli="https://goerli.infura.io/v3/${INFURA_API_KEY}"
localhost = "http://localhost:8545"
goerli = "https://goerli.infura.io/v3/${INFURA_API_KEY}"
2 changes: 1 addition & 1 deletion lib/prb-contracts
Submodule prb-contracts updated 87 files
+1 −1 .github/FUNDING.yml
+45 −16 .github/workflows/ci.yml
+18 −0 .github/workflows/release.yml
+6 −9 .gitmodules
+2 −2 .prettierrc.yml
+103 −108 .yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs
+0 −785 .yarn/releases/yarn-3.2.0.cjs
+873 −0 .yarn/releases/yarn-3.4.1.cjs
+3 −3 .yarnrc.yml
+65 −19 CHANGELOG.md
+12 −20 LICENSE.md
+23 −27 README.md
+2 −0 codecov.yml
+16 −14 foundry.toml
+1 −1 lib/forge-std
+0 −1 lib/prb-math
+1 −1 lib/prb-test
+25 −27 package.json
+1 −1 remappings.txt
+65 −0 src/access/Adminable.sol
+64 −0 src/access/IAdminable.sol
+4 −4 src/access/IOrchestratable.sol
+0 −56 src/access/IOwnable.sol
+5 −5 src/access/Orchestratable.sol
+0 −49 src/access/Ownable.sol
+0 −4 src/math/PRBMath.sol
+0 −4 src/math/PRBMathSD59x18.sol
+0 −4 src/math/PRBMathSD59x18Typed.sol
+0 −4 src/math/PRBMathUD60x18.sol
+0 −4 src/math/PRBMathUD60x18Typed.sol
+14 −30 src/token/erc20/ERC20.sol
+4 −8 src/token/erc20/ERC20GodMode.sol
+6 −6 src/token/erc20/ERC20Normalizer.sol
+7 −11 src/token/erc20/ERC20Permit.sol
+16 −16 src/token/erc20/ERC20Recover.sol
+10 −14 src/token/erc20/IERC20.sol
+3 −3 src/token/erc20/IERC20Normalizer.sol
+6 −6 src/token/erc20/IERC20Permit.sol
+9 −9 src/token/erc20/IERC20Recover.sol
+9 −25 src/token/erc20/NonCompliantERC20.sol
+8 −17 src/token/erc20/SafeERC20.sol
+1 −1 src/utils/Address.sol
+2 −2 src/utils/ReentrancyGuard.sol
+106 −0 test/Base.t.sol
+0 −81 test/BaseTest.t.sol
+33 −0 test/access/adminable/Adminable.t.sol
+34 −0 test/access/adminable/renounce-admin/renounceAdmin.t.sol
+5 −0 test/access/adminable/renounce-admin/renounceAdmin.tree
+55 −0 test/access/adminable/transfer-admin/transferAdmin.t.sol
+11 −0 test/access/adminable/transfer-admin/transferAdmin.tree
+2 −2 test/shared/ERC20NormalizerMock.t.sol
+2 −2 test/shared/ERC20RecoverMock.t.sol
+5 −17 test/shared/SymbollessERC20.t.sol
+24 −0 test/token/erc20-normalizer/ERC20Normalizer.t.sol
+0 −21 test/token/erc20-normalizer/ERC20NormalizerTest.t.sol
+26 −26 test/token/erc20-normalizer/compute-scalar/computeScalar.t.sol
+33 −30 test/token/erc20-normalizer/denormalize/denormalize.t.sol
+33 −32 test/token/erc20-normalizer/normalize/normalize.t.sol
+23 −21 test/token/erc20-permit/ERC20Permit.t.sol
+5 −5 test/token/erc20-permit/domain-separator/domainSeparator.t.sol
+5 −5 test/token/erc20-permit/permit-typehash/permitTypehash.t.sol
+102 −94 test/token/erc20-permit/permit/permit.t.sol
+5 −5 test/token/erc20-permit/version/version.t.sol
+49 −0 test/token/erc20-recover/ERC20Recover.t.sol
+0 −42 test/token/erc20-recover/ERC20RecoverTest.t.sol
+10 −10 test/token/erc20-recover/get-token-denylist/getTokenDenylist.t.sol
+7 −7 test/token/erc20-recover/is-token-denylist-set/isTokenDenylistSet.t.sol
+29 −31 test/token/erc20-recover/recover/recover.t.sol
+21 −22 test/token/erc20-recover/set-token-denylist/setTokenDenylist.t.sol
+2 −2 test/token/erc20-recover/set-token-denylist/setTokenDenylist.tree
+41 −0 test/token/erc20/ERC20.t.sol
+0 −32 test/token/erc20/ERC20Test.t.sol
+25 −25 test/token/erc20/approve/approve.t.sol
+1 −1 test/token/erc20/approve/approve.tree
+13 −9 test/token/erc20/balance-of/balanceOf.t.sol
+54 −45 test/token/erc20/burn/burn.t.sol
+6 −6 test/token/erc20/decimals/decimals.t.sol
+31 −20 test/token/erc20/decrease-allowance/decreaseAllowance.t.sol
+25 −15 test/token/erc20/increase-allowance/increaseAllowance.t.sol
+77 −52 test/token/erc20/mint/mint.t.sol
+5 −5 test/token/erc20/name/name.t.sol
+5 −5 test/token/erc20/symbol/symbol.t.sol
+83 −49 test/token/erc20/transfer-from/transferFrom.t.sol
+2 −1 test/token/erc20/transfer-from/transferFrom.tree
+78 −53 test/token/erc20/transfer/transfer.t.sol
+6 −5 test/token/erc20/transfer/transfer.tree
+587 −413 yarn.lock
19 changes: 12 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
"version": "2.0.0",
"author": {
"name": "Paul Razvan Berg",
"url": "https://github.com/paulrberg"
"url": "https://github.com/PaulRBerg"
},
"bugs": {
"url": "https://github.com/paulrberg/prb-proxy/issues"
"url": "https://github.com/PaulRBerg/prb-proxy/issues"
},
"devDependencies": {
"@commitlint/cli": "^17.3.0",
Expand All @@ -20,6 +20,7 @@
"nyc": "^15.1.0",
"prettier": "^2.8.0",
"prettier-plugin-solidity": "^1.0.0",
"rimraf": "^4.1.2",
"solhint": "^3.3.7",
"solhint-plugin-prettier": "^0.0.5",
"ts-node": "^10.9.1",
Expand All @@ -29,7 +30,7 @@
"/src",
"CHANGELOG.md"
],
"homepage": "https://github.com/paulrberg/prb-proxy#readme",
"homepage": "https://github.com/PaulRBerg/prb-proxy#readme",
"keywords": [
"blockchain",
"delegatecall",
Expand All @@ -46,17 +47,21 @@
},
"repository": {
"type": "git",
"url": "https://github.com/paulrberg/prb-proxy"
"url": "https://github.com/PaulRBerg/prb-proxy"
},
"resolutions": {
"solhint/@solidity-parser/parser": "^0.14.5"
},
"scripts": {
"lint": "yarn solhint && yarn prettier:check",
"lint:check": "yarn prettier:check && yarn solhint:check",
"build": "forge build",
"clean": "rimraf broadcast cache out",
"lint": "yarn lint:sol && yarn prettier:check",
"lint:sol": "solhint \"{src,test}/**/*.sol\"",
"postinstall": "husky install",
"postpublish": "pinst --enable",
"prepublishOnly": "pinst --disable",
"prettier:check": "prettier --check \"**/*.{json,md,sol,yml}\"",
"prettier:write": "prettier --write \"**/*.{json,md,sol,yml}\"",
"solhint": "solhint \"{src,test}/**/*.sol\""
"test": "forge test --ignored-error-codes 5159"
}
}
10 changes: 10 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -599,6 +599,7 @@ __metadata:
nyc: ^15.1.0
prettier: ^2.8.0
prettier-plugin-solidity: ^1.0.0
rimraf: ^4.1.2
solhint: ^3.3.7
solhint-plugin-prettier: ^0.0.5
ts-node: ^10.9.1
Expand Down Expand Up @@ -4509,6 +4510,15 @@ __metadata:
languageName: node
linkType: hard

"rimraf@npm:^4.1.2":
version: 4.1.2
resolution: "rimraf@npm:4.1.2"
bin:
rimraf: dist/cjs/src/bin.js
checksum: 480b8147fd9bcbef3ac118f88a7b1169c3872977a3411a0c84df838bfc30e175a394c0db6f9619fc8b8a886a18c6d779d5e74f380a0075ecc710afaf81b3f50c
languageName: node
linkType: hard

"run-async@npm:^2.2.0, run-async@npm:^2.4.0":
version: 2.4.1
resolution: "run-async@npm:2.4.1"
Expand Down

0 comments on commit b308058

Please sign in to comment.