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

Switch to Node.js #179

Merged
merged 7 commits into from
Dec 5, 2023
Merged
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
1 change: 0 additions & 1 deletion .gitattributes

This file was deleted.

48 changes: 41 additions & 7 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,6 @@ jobs:
steps:
- name: "Check out the repo"
uses: "actions/checkout@v3"
with:
submodules: "recursive"

- name: "Install Foundry"
uses: "foundry-rs/foundry-toolchain@v1"
Expand Down Expand Up @@ -103,8 +101,6 @@ jobs:
steps:
- name: "Check out the repo"
uses: "actions/checkout@v3"
with:
submodules: "recursive"

- name: "Install Foundry"
uses: "foundry-rs/foundry-toolchain@v1"
Expand All @@ -116,6 +112,20 @@ jobs:
key: "foundry-build-${{ github.sha }}"
path: "out-optimized"

- 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: "Run the tests against the optimized build"
run: "FOUNDRY_PROFILE=test-optimized forge test"

Expand All @@ -130,12 +140,24 @@ jobs:
steps:
- name: "Check out the repo"
uses: "actions/checkout@v3"
with:
submodules: "recursive"

- 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: "Run the tests and generate the coverage report"
run: "forge coverage --report lcov"

Expand All @@ -155,8 +177,20 @@ jobs:
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:
submodules: "recursive"
cache: "pnpm"
node-version: "lts/*"

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

- name: "Run Slither"
uses: "crytic/[email protected]"
Expand Down
8 changes: 0 additions & 8 deletions .gitmodules

This file was deleted.

1 change: 0 additions & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
broadcast
cache
coverage
lib
node_modules
out-optimized
out
Expand Down
1 change: 0 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,5 @@
".gas-snapshot": "julia"
},
"editor.formatOnSave": true,
"npm.exclude": "**/lib/**",
"solidity.formatter": "forge"
}
27 changes: 6 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,35 +79,20 @@ Alternatively, you can:

You can get access to the Solidity code and the ABIs programmatically.

### Foundry

First, run the install step:
All users are recommended to install PRBProxy as a Node.js package:

```sh
forge install PaulRBerg/prb-proxy@release-v4
pnpm add @prb/math
```

Your `.gitmodules` file should now contain the following entry:
This example uses Pnpm, but using Yarn or Npm is also possible.

```toml
[submodule "lib/prb-proxy"]
branch = "release-v4"
path = "lib/prb-proxy"
url = "https://github.com/PaulRBerg/prb-proxy"
```
### Foundry

Finally, add this to your `remappings.txt` file:
If you're using Foundry, you have to add this to your `remappings.txt` file:

```text
prb-proxy/=lib/prb-proxy/
```

### Hardhat

PRBProxy is available as an npm package:

```sh
pnpm add @prb/proxy
@prb/proxy/=node_modules/@prb/proxy/
```

## Usage
Expand Down
1 change: 0 additions & 1 deletion foundry.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
ignored_error_codes = [
5159, # ignore selfdestruct warning
]
libs = ["lib"]
optimizer = true
optimizer_runs = 200
out = "out"
Expand Down
1 change: 0 additions & 1 deletion lib/forge-std
Submodule forge-std deleted from 73d44e
1 change: 0 additions & 1 deletion lib/prb-test
Submodule prb-test deleted from cfc05f
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,15 @@
"url": "https://github.com/PaulRBerg/prb-proxy/issues"
},
"devDependencies": {
"@prb/test": "0.6.4",
"forge-std": "github:foundry-rs/forge-std#e8a047e3f40f13fa37af6fe14e6e06283d9a060e",
"prettier": "^2.8.8",
"solhint-community": "^3.5.2"
},
"files": [
"artifacts",
"src",
"test/utils",
"CHANGELOG.md"
],
"homepage": "https://github.com/PaulRBerg/prb-proxy#readme",
Expand Down
16 changes: 16 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions remappings.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
@prb/test/=lib/prb-test/src/
forge-std/=lib/forge-std/src/
@prb/test/=node_modules/@prb/test
forge-std/=node_modules/forge-std/
2 changes: 1 addition & 1 deletion script/Base.s.sol
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: MIT
pragma solidity >=0.8.19 <=0.9.0;

import { Script } from "forge-std/Script.sol";
import { Script } from "forge-std/src/Script.sol";

abstract contract BaseScript is Script {
/// @dev Included to enable compilation of the script without a $MNEMONIC environment variable.
Expand Down
2 changes: 1 addition & 1 deletion slither.config.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"detectors_to_exclude": "low-level-calls,naming-convention,reentrancy-events,solc-version",
"filter_paths": "(lib|test)"
"filter_paths": "(test)"
}
6 changes: 3 additions & 3 deletions test/Base.t.sol
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity >=0.8.19 <=0.9.0;

import { eqString } from "@prb/test/Helpers.sol";
import { StdCheats } from "forge-std/StdCheats.sol";
import { StdUtils } from "forge-std/StdUtils.sol";
import { eqString } from "@prb/test/src/Helpers.sol";
import { StdCheats } from "forge-std/src/StdCheats.sol";
import { StdUtils } from "forge-std/src/StdUtils.sol";

import { IPRBProxy } from "../src/interfaces/IPRBProxy.sol";
import { IPRBProxyRegistry } from "../src/interfaces/IPRBProxyRegistry.sol";
Expand Down
2 changes: 1 addition & 1 deletion test/proxy/execute/execute.t.sol
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity >=0.8.19 <=0.9.0;

import { stdError } from "forge-std/StdError.sol";
import { stdError } from "forge-std/src/StdError.sol";

import { IPRBProxy } from "src/interfaces/IPRBProxy.sol";

Expand Down
2 changes: 1 addition & 1 deletion test/proxy/run-plugin/runPlugin.t.sol
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity >=0.8.18 <0.9.0;

import { stdError } from "forge-std/StdError.sol";
import { stdError } from "forge-std/src/StdError.sol";

import { IPRBProxy } from "src/interfaces/IPRBProxy.sol";

Expand Down
2 changes: 1 addition & 1 deletion test/utils/Assertions.sol
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: MIT
pragma solidity >=0.8.18;

import { PRBTest } from "@prb/test/PRBTest.sol";
import { PRBTest } from "@prb/test/src/PRBTest.sol";

import { IPRBProxyPlugin } from "../../src/interfaces/IPRBProxyPlugin.sol";

Expand Down