Skip to content
Open
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
52 changes: 52 additions & 0 deletions .github/workflows/check-contracts-clients.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# Check if Go clients consistent with contracts
name: Check Contracts Clients

on:
pull_request:
# TODO: Remove test branch after testing
branches: ["tanssi-main"]

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
check-contracts-clients:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Check jq
run: jq --version

- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: "1.23"

- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1
with:
version: "v1.1.0"

- name: Show Forge version
run: forge --version

- name: Install abigen
run: go install github.com/ethereum/go-ethereum/cmd/abigen@v1.14.11

- name: Check abigen
run: abigen --version

- name: Build Contracts
working-directory: contracts
run: |
forge build

- name: Generate clients
working-directory: relayer
run: |
go generate ./...

- name: Check if go contract bindings are up-to-date
run: git diff --exit-code ./relayer/contracts || (echo "The contract bindings are not up-to-date against contracts." && exit 1)
15 changes: 11 additions & 4 deletions .github/workflows/contracts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,13 @@ on:
- "contracts/**"
- "!contracts/**/README.md"

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
build:
runs-on: snowbridge-runner
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- uses: actions/checkout@v1
Expand All @@ -25,13 +29,16 @@ jobs:
- name: Test
working-directory: contracts
run: forge test
env:
RPC_URL: ${{ secrets.RPC_URL }}
- name: Coverage
working-directory: contracts
run: forge coverage --report=lcov
run: forge coverage --report=lcov --via-ir
env:
RPC_URL: ${{ secrets.RPC_URL }}
- name: Upload coverage reports to Codecov with GitHub Action
uses: codecov/codecov-action@v5
uses: codecov/codecov-action@v3
with:
working-directory: contracts
token: ${{ secrets.CODECOV_TOKEN }}
files: lcov.info
flags: solidity
7 changes: 5 additions & 2 deletions .github/workflows/control.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,13 @@ on:
paths:
- "control/**"

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
control:
runs-on: snowbridge-runner
runs-on: ubuntu-latest
env:
CARGO_INCREMENTAL: 0
RUST_BACKTRACE: 1
Expand Down Expand Up @@ -59,4 +63,3 @@ jobs:
- name: Build Westend
run: |
nix develop -c sh -c 'cd control && cargo build --features westend'

3 changes: 2 additions & 1 deletion .github/workflows/labels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,12 @@ on:

jobs:
labeler:
if: false
permissions:
contents: read
pull-requests: write
runs-on: ubuntu-latest
steps:
- uses: actions/labeler@v5
with:
sync-labels: true
sync-labels: true
1 change: 1 addition & 0 deletions .github/workflows/npm-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ env:

jobs:
publish:
if: false
runs-on: snowbridge-runner
timeout-minutes: 15
steps:
Expand Down
8 changes: 6 additions & 2 deletions .github/workflows/relayer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,13 @@ on:
paths:
- "relayer/**"

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
build:
runs-on: snowbridge-runner
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- uses: actions/checkout@v1
Expand All @@ -22,7 +26,7 @@ jobs:
- name: setup go
uses: actions/checkout@v4
with:
go-version: '^1.23.0'
go-version: "^1.22.5"

- name: check go version
run: go version
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/release-relayer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ env:
IMAGE_NAME: snowfork/snowbridge-relay

jobs:
if: false
release-relayer:
runs-on: snowbridge-runner
timeout-minutes: 15
Expand All @@ -29,7 +30,7 @@ jobs:
- name: Setup go
uses: actions/checkout@v4
with:
go-version: "^1.23.0"
go-version: "^1.21.0"

- name: Install Go tools
run: >
Expand Down
12 changes: 8 additions & 4 deletions .github/workflows/smoke-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,13 @@ on:
# Runs at 8:00 AM every day
- cron: "0 8 * * *"

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
smoketests:
runs-on: snowbridge-runner
runs-on: ubuntu-latest
env:
CARGO_INCREMENTAL: 0
RUST_BACKTRACE: 1
Expand Down Expand Up @@ -40,7 +44,7 @@ jobs:
run: echo "POLKADOT_SDK_DIR=./polkadot-sdk" >> $GITHUB_ENV
- name: Create directories
run: mkdir -p $OUTPUT_DIR && mkdir -p $LOG_DIR
- uses: actions/cache@v1
- uses: actions/cache@v3
with:
path: |
~/.cargo/registry
Expand All @@ -63,12 +67,12 @@ jobs:
./scripts/run-smoketests.sh'
continue-on-error: true
- name: Save start-services log file
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v3
with:
name: start-services.log
path: "${{ env.LOG_DIR }}/start-services.log"
- name: Save beacon-relay log file
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v3
with:
name: beacon-relay.log
path: "${{ env.OUTPUT_DIR }}/beacon-relay.log"
Expand Down
54 changes: 54 additions & 0 deletions contracts/scripts/DeployBeefyLocal.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
// SPDX-License-Identifier: Apache-2.0
// SPDX-FileCopyrightText: 2023 Snowfork <hello@snowfork.com>
pragma solidity 0.8.28;

import {Script, console2} from "forge-std/Script.sol";
import {stdJson} from "forge-std/StdJson.sol";

import {BeefyClient} from "../src/BeefyClient.sol";
import {HelperConfig} from "./HelperConfig.sol";

contract DeployBeefyClient is Script {
using stdJson for string;

function setUp() public {}

function run() public {
HelperConfig helperConfig = new HelperConfig("");
HelperConfig.BeefyClientConfig memory beefyClientConfig =
helperConfig.getBeefyClientConfig();

vm.startBroadcast();

// BeefyClient
// Seems `fs_permissions` explicitly configured as absolute path does not work and only allowed from project root
string memory root = vm.projectRoot();
string memory beefyCheckpointFile = string.concat(root, "/beefy-state.json");
string memory beefyCheckpointRaw = vm.readFile(beefyCheckpointFile);
uint64 startBlock = uint64(beefyCheckpointRaw.readUint(".startBlock"));

BeefyClient.ValidatorSet memory current = BeefyClient.ValidatorSet(
uint128(beefyCheckpointRaw.readUint(".current.id")),
uint128(beefyCheckpointRaw.readUint(".current.length")),
beefyCheckpointRaw.readBytes32(".current.root")
);
BeefyClient.ValidatorSet memory next = BeefyClient.ValidatorSet(
uint128(beefyCheckpointRaw.readUint(".next.id")),
uint128(beefyCheckpointRaw.readUint(".next.length")),
beefyCheckpointRaw.readBytes32(".next.root")
);

BeefyClient beefyClient = new BeefyClient(
beefyClientConfig.randaoCommitDelay,
beefyClientConfig.randaoCommitExpiration,
beefyClientConfig.minimumSignatures,
startBlock,
current,
next
);

console2.log("BeefyClient: ", address(beefyClient));

vm.stopBroadcast();
}
}
52 changes: 52 additions & 0 deletions contracts/scripts/DeployGatewayUpgrade.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
// SPDX-License-Identifier: Apache-2.0
// SPDX-FileCopyrightText: 2023 Snowfork <hello@snowfork.com>
pragma solidity 0.8.28;

import {console2} from "forge-std/console2.sol";
import {Script} from "forge-std/Script.sol";
import {stdJson} from "forge-std/StdJson.sol";

import {GatewayTanssi202509} from "../src/upgrades/GatewayTanssi202509.sol";
import {HelperConfig} from "./HelperConfig.sol";
import {UpgradeParams} from "../src/v1/Types.sol";
import {AgentExecutor} from "../src/AgentExecutor.sol";

contract DeployLocal is Script {
using stdJson for string;

function setUp() public {}

function run() public {
HelperConfig helperConfig = new HelperConfig("");
_deploy(helperConfig);
}

function run(string calldata testnet) public {
HelperConfig helperConfig = new HelperConfig(testnet);
_deploy(helperConfig);
}

function _deploy(HelperConfig helperConfig) private {
vm.startBroadcast();
HelperConfig.GatewayConfig memory gatewayConfig = helperConfig.getGatewayConfig();

// Needed for the native transfer feature
AgentExecutor agentExecutor = new AgentExecutor();

GatewayTanssi202509 gatewayLogic =
new GatewayTanssi202509(address(gatewayConfig.beefyClient), address(agentExecutor));

console2.log("AgentExecutor: ", address(agentExecutor));
console2.log("Gateway logic impl: ", address(gatewayLogic));
console2.log("Gateway logic codehash: ");
console2.logBytes32(address(gatewayLogic).codehash);
UpgradeParams memory params = UpgradeParams({
impl: address(gatewayLogic),
implCodeHash: address(gatewayLogic).codehash,
initParams: bytes("")
});

console2.logBytes(abi.encode(params));
vm.stopBroadcast();
}
}
Loading