-
Notifications
You must be signed in to change notification settings - Fork 23
Add CI job for verifier factory contracts #784
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
Merged
Merged
Changes from all commits
Commits
Show all changes
33 commits
Select commit
Hold shift + click to select a range
e80040c
base refactor
lemunozm 6c9aa5d
standalone script
lemunozm 6e9550a
adapt CI and add new job
lemunozm 1a1ceed
use envconfig in layerzero fork
lemunozm 3ff8384
use live for the layerzero fork test
lemunozm b39e982
fix imports
lemunozm b3627ed
fix test
lemunozm f29d7e7
base implementation
lemunozm 011c783
minor reorder in EnvConfig
lemunozm 3d4a8e4
temp test changes
lemunozm bcb9091
fixes
lemunozm 621a647
mask secrets
lemunozm 7d097b5
better error and network processing
lemunozm 0a7a013
fixes
lemunozm d8c5d7b
add (new) tag
lemunozm 5c49429
reduce parallelism to avoid reach api rate limits
lemunozm 9910a18
factorize job work
lemunozm 4a1fdb6
add extra delay to avoid rate issues
lemunozm ee131f6
compile only src
lemunozm fff0e18
compilation per job
lemunozm 965caf2
fix
lemunozm 92298bb
add extra fix
lemunozm 5246ccf
add extra time gap
lemunozm 3bdde6e
remove logs on failure
lemunozm bfdd66f
remove temp test additions
lemunozm caf137f
Merge remote-tracking branch 'origin/main' into ci-verifier
lemunozm 43b3973
add load_secrets.py permissions
lemunozm 61bc4c7
move gcloud secret part to each job
lemunozm c30e70a
remove changes in EnvConfig to avoid conflicts
lemunozm af09160
simplify jobs and avoid tarball
lemunozm c61e482
fix minor errors
lemunozm 9b7cd48
Merge branch 'main' into ci-verifier
gpmayorga 7379538
fix deploy commit
lemunozm File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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,83 @@ | ||
| name: Verify Factory Contracts | ||
|
|
||
| on: | ||
| workflow_dispatch: | ||
| inputs: | ||
| source_version: | ||
| description: "Git tag of the deployed source code (e.g. v3.1.0). src/ will be checked out from this tag so forge verify-contract uses matching bytecode." | ||
| required: true | ||
| default: "v3.1.0" | ||
|
|
||
| jobs: | ||
| setup: | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| contents: "read" | ||
| outputs: | ||
| networks: ${{ steps.list.outputs.networks }} | ||
| steps: | ||
| - uses: actions/checkout@v3 | ||
|
|
||
| - name: List networks from env/*.json | ||
| id: list | ||
| run: | | ||
| networks=$(ls env/*.json | xargs -n1 basename | sed 's/.json//' | grep -v anvil | jq -R -s -c 'split("\n") | map(select(length > 0))') | ||
| echo "networks=$networks" >> "$GITHUB_OUTPUT" | ||
| echo "Discovered networks: $networks" | ||
|
|
||
| verify: | ||
| needs: setup | ||
| runs-on: ubuntu-latest | ||
| timeout-minutes: 30 | ||
| permissions: | ||
| contents: "read" | ||
| id-token: "write" | ||
| strategy: | ||
|
gpmayorga marked this conversation as resolved.
|
||
| fail-fast: false | ||
| max-parallel: 3 | ||
| matrix: | ||
| network: ${{ fromJson(needs.setup.outputs.networks) }} | ||
|
|
||
| name: "${{ matrix.network }}" | ||
|
|
||
| steps: | ||
| - uses: actions/checkout@v3 | ||
| with: | ||
| fetch-depth: 0 | ||
| submodules: recursive | ||
|
|
||
| - name: Checkout src/ from deployed version | ||
| run: git checkout ${{ inputs.source_version }} -- src/ | ||
|
|
||
| - id: "auth" | ||
| uses: "google-github-actions/auth@6fc4af4b145ae7821d527454aa9bd537d1f2dc5f" # v2.1.7 | ||
| with: | ||
| workload_identity_provider: ${{ secrets.GCP_WIP }} | ||
| service_account: ${{ secrets.GCP_SA }} | ||
| create_credentials_file: true | ||
| cleanup_credentials: true | ||
|
|
||
| - name: "Set up Cloud SDK" | ||
| uses: "google-github-actions/setup-gcloud@6189d56e4096ee891640bb02ac264be376592d6a" # v2.1.2 | ||
| with: | ||
| version: ">= 363.0.0" | ||
|
|
||
| - name: Load secrets | ||
| run: python3 script/deploy/load_secrets.py | ||
|
|
||
| - name: Mask secrets | ||
| run: | | ||
| while IFS='=' read -r key value; do | ||
| [[ -z "$key" || "$key" == \#* || -z "$value" ]] && continue | ||
| echo "::add-mask::$value" | ||
| done < .env | ||
|
|
||
| - name: Install Foundry | ||
| uses: foundry-rs/foundry-toolchain@v1 | ||
| with: | ||
| version: v1.4.4 | ||
|
|
||
| - name: Verify ${{ matrix.network }} | ||
| env: | ||
| NETWORK: ${{ matrix.network }} | ||
| run: forge script script/VerifyFactoryContracts.s.sol --skip test | ||
This file contains hidden or 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 hidden or 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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a especial addition to the CI jobs that uses secrets that avoid leak those secret in some logs by error
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doesn't Github upload the tarball of an action as an artifact that's publicly available, including the secrets in the
.env? Also, we don't need thePRIVATE_KEYfor verification.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good question 🤔, then that would be something to fix...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very good catch @wischli! Now here (61bc4c7), I've moved the loading secret part to each individual job, so the tarball never has an
.envfile.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unless you specify a file upload on the job the files are normally lost.
The private key is accessible to any job in this repository that calls the Google cloud login step whether we put it in an environment file or not, it doesn't really matter