Skip to content

Commit

Permalink
Merge branch 'main' into support-l2-plus
Browse files Browse the repository at this point in the history
  • Loading branch information
raulk committed Jan 2, 2025
2 parents 8780344 + e06f7cf commit 5a92d52
Show file tree
Hide file tree
Showing 37 changed files with 921 additions and 464 deletions.
132 changes: 60 additions & 72 deletions .github/workflows/auto-deploy-contracts.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Auto deploy IPC contracts when changed
name: Auto-deploy IPC contracts to Calibrationnet when changed

on:
workflow_dispatch:
Expand All @@ -8,6 +8,9 @@ on:
paths:
- contracts/**

permissions:
contents: write

env:
GIT_USERNAME: github-actions[bot]
GIT_EMAIL: ipc+github-actions[bot]@users.noreply.github.com
Expand All @@ -20,106 +23,91 @@ concurrency:
jobs:
deploy-contracts:
runs-on: ubuntu-latest

env:
RPC_URL: https://calibration.filfox.info/rpc/v1
RPC_URL: https://calibration.filfox.io/rpc/v1
PRIVATE_KEY: ${{ secrets.CONTRACTS_DEPLOYER_PRIVATE_KEY }}
steps:
- name: Checkout cd/contracts branch
uses: actions/checkout@v4
with:
ref: cd/contracts
submodules: recursive
fetch-depth: 0
token: ${{ secrets.WORKFLOW_PAT_JIE }}

- name: (Dry run) Try merge from main branch to see if there's any conflicts that can't be resolved itself
steps:
- name: Configure git
run: |
git show HEAD
git config --global user.name "$GIT_USERNAME"
git config --global user.email "$GIT_EMAIL"
git checkout main
git pull --rebase origin main
git checkout cd/contracts
git merge main --no-edit --allow-unrelated-histories
- name: Checkout the branch that triggered this run
- name: Check out the branch that triggered this run
uses: actions/checkout@v4
with:
# TODO(jie): After switch to workflow_dispatch only, we should use ref_name.
# head_ref only works for workflow triggered by pull requests.
# ref: ${{ github.ref_name }}
ref: ${{ github.head_ref }}
ref: ${{ github.ref_name }}
submodules: recursive
fetch-depth: 0

- uses: pnpm/action-setup@v2

- name: Setup node and npm
- name: Set up node.js
uses: actions/setup-node@v4
with:
node-version: 20
cache: 'npm'
cache-dependency-path: 'pnpm-lock.yaml'
node-version: '21'
cache: 'pnpm'

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

- name: Deploy IPC contracts to calibration net
- name: Restore cache
id: cache-restore
uses: actions/cache/restore@v4
with:
## Hardhat is intelligent enough to perform incremental compilation. But GitHub Actions caches are immutable.
## Since we can't have a rolling cache, we create a new cache for each run, but use restore-keys to load the
## most recently created cache.
## Reference: https://github.com/actions/cache/blob/main/tips-and-workarounds.md#update-a-cache
key: ${{ runner.os }}-contracts-artifacts-${{ github.run_id }}
restore-keys: |
${{ runner.os }}-contracts-artifacts-
path: |
contracts/out
contracts/deployments
contracts/artifacts
- name: Deploy IPC contracts to Calibrationnet
id: deploy_contracts
env:
REGISTRY_CREATION_PRIVILEGES: 'unrestricted'
run: |
cd contracts
npm install --save hardhat
output=$(make deploy-stack NETWORK=calibrationnet)
echo "deploy_output<<EOF" >> $GITHUB_OUTPUT
echo "$output" >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
pnpm install
make deploy-stack NETWORK=calibrationnet
- name: Parse deploy output
run: |
deploy_output='${{ steps.deploy_contracts.outputs.deploy_output }}'
echo "$deploy_output"
deployed_gateway_address=$(echo "$deploy_output" | grep '"Gateway"' | awk -F'"' '{print $4}')
deployed_registry_address=$(echo "$deploy_output" | grep '"SubnetRegistry"' | awk -F'"' '{print $4}')
echo "gateway_address=$deployed_gateway_address" >> $GITHUB_ENV
echo "registry_address=$deployed_registry_address" >> $GITHUB_ENV
echo "commit_hash=$(git rev-parse HEAD)" >> $GITHUB_ENV
- name: Review deployed addresses
- name: Save cache
id: cache-save
uses: actions/cache/save@v4
if: always() && steps.cache-restore.outputs.cache-hit != 'true'
with:
key: ${{ runner.os }}-contracts-artifacts-${{ github.run_id }}
path: |
contracts/out
contracts/deployments
contracts/artifacts
- name: Populate output
run: |
echo "commit_hash: $commit_hash"
echo "gateway_address: $gateway_address"
echo "registry_address: $registry_address"
cd contracts
jq -n --arg commit "$(git rev-parse HEAD)" \
--arg gateway_addr "$(jq -r '.address' deployments/calibrationnet/GatewayDiamond.json)" \
--arg registry_addr "$(jq -r '.address' deployments/calibrationnet/SubnetRegistryDiamond.json)" \
'{"commit":$commit, "gateway_addr":$gateway_addr, "registry_addr":$registry_addr}' > /tmp/output.json
cat /tmp/output.json
- name: Switch code repo to cd/contracts branch
uses: actions/checkout@v4
with:
ref: cd/contracts
submodules: recursive
fetch-depth: 0
token: ${{ secrets.WORKFLOW_PAT_JIE }}

- name: Merge from main branch and update cd/contracts branch
run: |
git config --global user.name "$GIT_USERNAME"
git config --global user.email "$GIT_EMAIL"
git checkout main
git pull --rebase origin main
git checkout cd/contracts
git merge main --no-edit --allow-unrelated-histories
git push -f origin cd/contracts
- name: Write deployed address to output file
- name: Commit and push deployment info
run: |
mkdir -p deployments
json_str='{"commit":"'$commit_hash'","gateway_addr":"'$gateway_address'","registry_addr":"'$registry_address'"}'
jq -n "$json_str" > deployments/r314159.json
cat deployments/r314159.json
- name: Commit output file and push it to remote repo
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: Update contract address
branch: cd/contracts
file_pattern: deployments/r314159.json
commit_user_name: ${{env.GIT_USERNAME}}
commit_user_email: ${{env.GIT_EMAIL}}
push_options: '--force'
skip_dirty_check: true
create_branch: true
cp /tmp/output.json deployments/r314159.json
git add deployments/r314159.json
git commit -m "Contracts deployed @ ${{ github.sha }}"
git push origin cd/contracts
16 changes: 16 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,22 @@

All notable changes to this project will be documented in this file.

## [axon-r08] - 2024-12-31

### 🚀 Features

- *(node)* Configurable chain id (#1230)
- *(cli)* Add `list-validators` command (#1221)
- *(node)* Txn prioritization based on gas parameters (#1185)
- *(node)* Support legacy transactions (#1235)

### 🐛 Bug Fixes

- Patch missing ipc messages in eth get_logs (#1226)
- Prevent panic on chain replay (#1197)
- Use current exec state when querying validator table (#1234)
- Contracts auto-deploy GitHub Actions workflow (#1238)

## [axon-r07] - 2024-12-02

### 🚀 Features
Expand Down
1 change: 1 addition & 0 deletions Cargo.lock

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

1 change: 1 addition & 0 deletions fendermint/app/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ tracing-subscriber = { workspace = true }
literally = { workspace = true }

fendermint_abci = { path = "../abci" }
fendermint_actors_api = { path = "../actors/api" }
fendermint_app_options = { path = "./options" }
fendermint_app_settings = { path = "./settings" }
fendermint_crypto = { path = "../crypto" }
Expand Down
2 changes: 1 addition & 1 deletion fendermint/app/options/src/genesis.rs
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ pub struct SealGenesisArgs {
/// The solidity artifacts output path. If you are using ipc-monorepo, it should be the `out` folder
/// of `make build`
#[arg(long, short)]
pub artifacts_path: Option<PathBuf>,
pub artifacts_path: PathBuf,

/// The sealed genesis state output path, i.e. finalized genesis state CAR file dump path
#[arg(long, short)]
Expand Down
Loading

0 comments on commit 5a92d52

Please sign in to comment.