-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* chore(build): add prettier and solidity plugin * chore(build): add `lint.yml` workflow * chore(lint): add prettier config * chore(lint): apply lint * chore(lint): apply lint on missed file * chore(ci): change trigger for lint ci It does not need to trigger on each push * chore(lint): add solidity parser to prettierrc * doc(bootstrap): remove superfluous comments * doc(test): remove unnecessary comments * refactor: implement token whitelisting in storage This way, we avoid repeating the token whitelisting code in `Bootstrap` and `ClientChainGateway`. * chore(lint) * fix(test): update test strings in Bootstrap * chore(lint) * Revert chore(build): add prettier solidity plugin This reverts commit 9a4f47b. * chore(build): remove prettier * fix(build): move to `forge fmt` from prettier * fix(ci): update test comment * chore(lint): apply `forge fmt` It applies recursively automatically * fix(ci): fail if not formatted * chore(lint): set up solhint config * build(ci): set up `solhint` workflow * chore(lint): run `solhint` * chore(fmt): run `forge fmt` * fix(bootstrap): deploy vaults correctly I had mistakenly confused the `BeaconProxyBytecode` and the beacon chain related functions * fix(build): rename fmt workflow * fix(ci): rename `lint` workflow * fix(bootstrap): validate client chain init params * fix(mocks): return value in withdraw mock * test(doc): add comments for Bootstrap deposit test * fix(bootstrap): validate length of init data >= 4 * doc(test): update bootstrap unit test comments * chore(ci): forge fmt * chore(fmt): bring back Endian.sol and add config * build(ci): merge workflows and use cache We now have a multi-job workflow, which means it will run the jobs in parallel. Between jobs, we cache the artifacts generated by Foundry so they can be reused. The artifacts cached are the result of compilation by Foundry, and hence, they can be reused across jobs. The `build` job is responsible for generating them, while the `test` and `fmt` jobs can reuse them, which is why they `need` the `build` job. * build(ci): use a common foundry-setup action ...and do not let the cache key depend on the job name. * build(ci): another attempt at common workflow * fix(ci): correct extension of foundry-setup * build(ci): another attempt * fix(ci): save key cache correctly * fix(ci): remove deprecated code * fix(ci): use output instead of env * fix(ci): save install dir for forge * fix(ci): finally, fix the workflows * fix(git): ignore the forge snapshot * fix(ci): also cache git submodules * chore(lint): lint the ci * refactor: getWhitelistedTokensCount in gateway * config: activate new Foundry rules * chore(fmt): run `forge fmt` * lint:Update src/core/ExocoreGateway.sol Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * refactor(bootstrap): use modifier not require * lint: use disable-next-item for clarity ...instead of ignoring the whole file * optimize: explicitly mark recipient as payable * chore(lint): run forge fmt --------- Co-authored-by: adu <[email protected]> Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
- Loading branch information
1 parent
e57bf41
commit 8c0aef0
Showing
95 changed files
with
2,223 additions
and
2,003 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,132 @@ | ||
--- | ||
name: Forge CI to build, test and format | ||
|
||
on: | ||
pull_request: | ||
push: | ||
branches: | ||
- main | ||
- release/** | ||
tags: | ||
- "*" | ||
|
||
jobs: | ||
setup: | ||
uses: ./.github/workflows/foundry-setup.yml | ||
with: | ||
foundry-version: nightly-f625d0fa7c51e65b4bf1e8f7931cd1c6e2e285e9 | ||
|
||
build: | ||
runs-on: ubuntu-latest | ||
needs: setup | ||
outputs: | ||
installation-dir: ${{ needs.setup.outputs.installation-dir }} | ||
cache-key: ${{ needs.setup.outputs.cache-key }} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
submodules: recursive | ||
- name: Restore cached Foundry toolchain | ||
uses: actions/cache/restore@v3 | ||
with: | ||
path: ${{ needs.setup.outputs.installation-dir }} | ||
key: ${{ needs.setup.outputs.cache-key }} | ||
- name: Add Foundry to PATH | ||
run: echo "${{ needs.setup.outputs.installation-dir }}" >> $GITHUB_PATH | ||
- name: Build | ||
run: forge build | ||
- name: Add comment for build failure | ||
if: failure() | ||
uses: actions/github-script@v6 | ||
with: | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
script: | | ||
github.rest.issues.createComment({ | ||
issue_number: context.issue.number, | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
body: 'The build has failed. Please check the logs.' | ||
}) | ||
- name: Cache build artifacts | ||
uses: actions/cache/save@v3 | ||
with: | ||
path: | | ||
./lib | ||
./out | ||
./cache | ||
./broadcast | ||
key: ${{ runner.os }}-build-${{ github.sha }} | ||
|
||
test: | ||
runs-on: ubuntu-latest | ||
needs: build | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Restore cached Foundry toolchain | ||
uses: actions/cache/restore@v3 | ||
with: | ||
path: ${{ needs.build.outputs.installation-dir }} | ||
key: ${{ needs.build.outputs.cache-key }} | ||
- name: Add Foundry to PATH | ||
run: echo "${{ needs.build.outputs.installation-dir }}" >> $GITHUB_PATH | ||
- name: Restore build artifacts | ||
uses: actions/cache/restore@v3 | ||
with: | ||
path: | | ||
./lib | ||
./out | ||
./cache | ||
./broadcast | ||
key: ${{ runner.os }}-build-${{ github.sha }} | ||
- name: Run tests | ||
run: forge test -vvv | ||
- name: Run test snapshot | ||
run: NO_COLOR=1 forge snapshot >> $GITHUB_STEP_SUMMARY | ||
- name: Add comment for test failure | ||
if: failure() | ||
uses: actions/github-script@v6 | ||
with: | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
script: | | ||
github.rest.issues.createComment({ | ||
issue_number: context.issue.number, | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
body: 'The tests have failed. Please check the logs.' | ||
}) | ||
fmt: | ||
runs-on: ubuntu-latest | ||
needs: build | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Restore cached Foundry toolchain | ||
uses: actions/cache/restore@v3 | ||
with: | ||
path: ${{ needs.build.outputs.installation-dir }} | ||
key: ${{ needs.build.outputs.cache-key }} | ||
- name: Add Foundry to PATH | ||
run: echo "${{ needs.build.outputs.installation-dir }}" >> $GITHUB_PATH | ||
- name: Restore build artifacts | ||
uses: actions/cache/restore@v3 | ||
with: | ||
path: | | ||
./lib | ||
./out | ||
./cache | ||
./broadcast | ||
key: ${{ runner.os }}-build-${{ github.sha }} | ||
- name: Check formatting | ||
run: forge fmt --check | ||
- name: Add comment for format failure | ||
if: failure() | ||
uses: actions/github-script@v6 | ||
with: | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
script: | | ||
github.rest.issues.createComment({ | ||
issue_number: context.issue.number, | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
body: 'The code is not formatted correctly. Please run `forge fmt` and push the changes.' | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
--- | ||
name: Foundry Setup | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
foundry-version: | ||
required: true | ||
type: string | ||
outputs: | ||
installation-dir: | ||
description: "The installation directory of Foundry toolchain" | ||
value: ${{ jobs.setup.outputs.installation-dir }} | ||
cache-key: | ||
description: "The cache key for Foundry toolchain" | ||
value: ${{ jobs.setup.outputs.cache-key }} | ||
|
||
jobs: | ||
setup: | ||
runs-on: ubuntu-latest | ||
outputs: | ||
cache-key: ${{ steps.set-cache-key.outputs.cache-key }} | ||
installation-dir: ${{ steps.find-path.outputs.installation-dir }} | ||
steps: | ||
- name: Install Foundry | ||
uses: foundry-rs/foundry-toolchain@v1 | ||
with: | ||
version: ${{ inputs.foundry-version }} | ||
- name: Print forge version | ||
run: forge --version | ||
# Unfortunately, the `foundry-toolchain` action installs it in a | ||
# randomly generated location, so we must determine it ourselves | ||
- name: Determine Foundry installation path | ||
id: find-path | ||
run: | | ||
installation_path=$(which forge) | ||
installation_dir=$(dirname $installation_path) | ||
echo "installation-dir=$installation_dir" >> "$GITHUB_OUTPUT" | ||
- name: Cached Foundry toolchain | ||
uses: actions/cache/save@v3 | ||
with: | ||
path: ${{ steps.find-path.outputs.installation-dir }} | ||
key: ${{ runner.os }}-foundry-${{ inputs.foundry-version }} | ||
- name: Set cache key | ||
id: set-cache-key | ||
run: | | ||
echo "cache-key=${{ runner.os }}-foundry-${{ inputs.foundry-version }}" >> "$GITHUB_OUTPUT" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
name: Run `solhint` linter | ||
|
||
on: | ||
pull_request: | ||
push: | ||
branches: | ||
- main | ||
- release/** | ||
tags: | ||
- "*" | ||
|
||
jobs: | ||
check: | ||
strategy: | ||
fail-fast: true | ||
|
||
name: Foundry project | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Set up Node.js | ||
uses: actions/setup-node@v2 | ||
with: | ||
node-version: '22' | ||
|
||
- name: Install Solhint | ||
run: npm install --save-dev solhint | ||
|
||
- name: Run Solhint | ||
run: | | ||
npx solhint 'src/**/*.sol' -c ./src/.solhint.json | ||
- name: Add comment on failure | ||
if: failure() | ||
uses: actions/github-script@v6 | ||
with: | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
script: | | ||
github.rest.issues.createComment({ | ||
issue_number: context.issue.number, | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
body: 'Linting failed. Please check the logs.' | ||
}) |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,3 +21,5 @@ node_modules | |
**/cache_hardhat | ||
|
||
.idea | ||
|
||
.gas-snapshot |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
src/lzApp/*.sol |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.