Skip to content
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
53 changes: 53 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
---
name: Bug report
about: Report a defect in interchain-kit
labels: bug
---

## Description

<!-- A clear and concise description of what the bug is. -->

## Steps to reproduce

<!-- Exact commands and any config changes needed to trigger the bug. -->

1.
2.
3.

## Expected behavior

<!-- What you expected to happen. -->

## Actual behavior

<!-- What actually happened. -->

## Environment

- OS / arch:
- Node version (`node -v`):
- pnpm version (`pnpm -v`):
- `avalanchego` commit / version (`avalanchego --version`):
- Foundry version (`forge --version`):
- interchain-kit commit (`git rev-parse HEAD`):

## Logs

<!--
Paste relevant output from the harness, icm-relayer, signature aggregator, or avalanchego.
Trim to the failing window; use a collapsible block for anything long:

<details><summary>logs</summary>

```
...
```

</details>
-->

## Additional context

<!-- Anything else worth knowing — screenshots, related issues, suspected cause. -->
21 changes: 21 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
---
name: Feature request
about: Suggest an improvement or new capability for interchain-kit
labels: enhancement
---

## Problem

<!-- What are you trying to do that's hard or impossible today? Who is affected? -->

## Proposed solution

<!-- Describe the change you'd like. Be concrete — API shape, new flag, new flow, etc. -->

## Alternatives considered

<!-- Other approaches you thought about and why you didn't pick them. -->

## Additional context

<!-- Links to related issues, prior art in other Avalanche repos, screenshots, etc. -->
23 changes: 23 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
## Summary

<!-- One or two sentences: why this PR exists. -->

## What changed

<!-- Bullet the concrete changes. Call out anything that touches public APIs, the harness, or generated artifacts. -->

-
-

## How to verify

<!-- Exact commands a reviewer can run locally. Include expected output where useful. -->

```sh
pnpm install
pnpm test:harness
```

## Linked issues

<!-- e.g. Closes #123, Refs #456. -->
67 changes: 67 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
name: CI

on:
push:
branches: [main]
pull_request:
branches: [main]

jobs:
test-contracts:
name: Foundry tests
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

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

- name: Install forge dependencies
working-directory: contracts
run: |
# `forge install --no-git` strips .git, which breaks recursive submodule
# init inside icm-contracts (it depends on subnet-evm as a git submodule).
# Clone deps directly with --recurse-submodules instead.
mkdir -p lib
git clone --depth 1 --branch v1.9.4 --recurse-submodules \
https://github.com/foundry-rs/forge-std.git lib/forge-std
git clone --depth 1 --branch v5.0.2 --recurse-submodules \
https://github.com/OpenZeppelin/openzeppelin-contracts-upgradeable.git lib/openzeppelin-contracts-upgradeable
git clone --depth 1 --branch v1.0.9 --recurse-submodules \
https://github.com/ava-labs/icm-contracts.git lib/icm-contracts

- name: Check formatting
run: forge fmt --check --root contracts

- name: Run tests
run: forge test --root contracts -vv

typecheck-ts:
name: TypeScript build & typecheck
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
version: 9.12.0

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20
cache: pnpm

- name: Install dependencies
run: pnpm install --frozen-lockfile

- name: Build packages
run: pnpm -r --filter './packages/**' build

- name: Typecheck examples
run: pnpm --filter @interchain-kit/examples typecheck
83 changes: 83 additions & 0 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
# Contributor Covenant Code of Conduct

## Our Pledge

We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, caste, color, religion, or sexual identity and orientation.

We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community.

## Our Standards

Examples of behavior that contributes to a positive environment for our community include:

* Demonstrating empathy and kindness toward other people
* Being respectful of differing opinions, viewpoints, and experiences
* Giving and gracefully accepting constructive feedback
* Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience
* Focusing on what is best not just for us as individuals, but for the overall community

Examples of unacceptable behavior include:

* The use of sexualized language or imagery, and sexual attention or advances of any kind
* Trolling, insulting or derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or email address, without their explicit permission
* Other conduct which could reasonably be considered inappropriate in a professional setting

## Enforcement Responsibilities

Community leaders are responsible for clarifying and enforcing our standards of acceptable behavior and will take appropriate and fair corrective action in response to any behavior that they deem inappropriate, threatening, offensive, or harmful.

Community leaders have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, and will communicate reasons for moderation decisions when appropriate.

## Scope

This Code of Conduct applies within all community spaces, and also applies when an individual is officially representing the community in public spaces. Examples of representing our community include using an official e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event.

## Enforcement

Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement at [security@avalabs.org](mailto:security@avalabs.org). All complaints will be reviewed and investigated promptly and fairly.

All community leaders are obligated to respect the privacy and security of the reporter of any incident.

## Enforcement Guidelines

Community leaders will follow these Community Impact Guidelines in determining the consequences for any action they deem in violation of this Code of Conduct:

### 1. Correction

**Community Impact**: Use of inappropriate language or other behavior deemed unprofessional or unwelcome in the community.

**Consequence**: A private, written warning from community leaders, providing clarity around the nature of the violation and an explanation of why the behavior was inappropriate. A public apology may be requested.

### 2. Warning

**Community Impact**: A violation through a single incident or series of actions.

**Consequence**: A warning with consequences for continued behavior. No interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, for a specified period of time. This includes avoiding interactions in community spaces as well as external channels like social media. Violating these terms may lead to a temporary or permanent ban.

### 3. Temporary Ban

**Community Impact**: A serious violation of community standards, including sustained inappropriate behavior.

**Consequence**: A temporary ban from any sort of interaction or public communication with the community for a specified period of time. No public or private interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, is allowed during this period. Violating these terms may lead to a permanent ban.

### 4. Permanent Ban

**Community Impact**: Demonstrating a pattern of violation of community standards, including sustained inappropriate behavior, harassment of an individual, or aggression toward or disparagement of classes of individuals.

**Consequence**: A permanent ban from any sort of public interaction within the community.

## Attribution

This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 2.1, available at [https://www.contributor-covenant.org/version/2/1/code_of_conduct.html][v2.1].

Community Impact Guidelines were inspired by [Mozilla's code of conduct enforcement ladder][Mozilla CoC].

For answers to common questions about this code of conduct, see the FAQ at [https://www.contributor-covenant.org/faq][FAQ]. Translations are available at [https://www.contributor-covenant.org/translations][translations].

[homepage]: https://www.contributor-covenant.org
[v2.1]: https://www.contributor-covenant.org/version/2/1/code_of_conduct.html
[Mozilla CoC]: https://github.com/mozilla/diversity
[FAQ]: https://www.contributor-covenant.org/faq
[translations]: https://www.contributor-covenant.org/translations
43 changes: 43 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# Contributing to interchain-kit

Thanks for your interest in improving interchain-kit. This kit boots a local Avalanche network with ICM, ICTT, the validator manager, an icm-relayer, and a signature aggregator — contributions that make those flows faster, clearer, or more reliable are very welcome.

## Prerequisites

See the [Prerequisites section in the README](./README.md#prerequisites) for the full toolchain (Node 20+, pnpm 9+, Foundry, an `avalanchego` binary, etc.). Please don't open a PR until you can run the harness locally.

## Development

```sh
pnpm install
pnpm test:harness # boots the local network and runs the end-to-end flows
pnpm up # bring the network up for manual exploration
```

If you're touching Solidity, run `forge build` and `forge test` from the relevant contracts package.

## Issues

### Security

**Do not** open a public GitHub issue for a security vulnerability. Follow the process in [SECURITY.md](./SECURITY.md) instead.

### Bugs and features

- Search [existing issues](https://github.com/ava-labs/interchain-kit/issues) before filing a new one.
- For bugs, use the bug report template and include logs plus your environment (OS, Node, pnpm, `avalanchego` commit, Foundry version).
- For non-trivial features, open an issue first to align on scope before writing code.

## Pull requests

- Target the `main` branch.
- Branch naming: `docs/`, `feature/`, `fix/`, or `refactor/` followed by a short slug (e.g. `feature/ictt-erc20-flow`).
- All commits must be [GPG-signed](https://docs.github.com/en/authentication/managing-commit-signature-verification/signing-commits). Do not bypass signing or commit hooks.
- Keep PRs focused. One logical change per PR makes review and bisecting much easier.
- Update or add tests for behavior you change. The harness flows are the source of truth for end-to-end behavior.
- Fill out the PR template — Summary, What changed, How to verify, Linked issues.
- Draft PRs are welcome for early feedback.

## Questions

For usage questions, prefer [GitHub Discussions](https://github.com/ava-labs/interchain-kit/discussions) over issues.
21 changes: 19 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,17 @@ examples/ End-to-end demos against the live network

- **Node 20+** and **pnpm 9+**
- **Foundry** (`forge`)
- An **avalanchego** binary. Easiest: clone `ava-labs/avalanchego`, `./scripts/build.sh`, then build the bundled subnet-evm plugin: `cd graft/subnet-evm && ./scripts/build.sh` (symlinks into `<avalanchego>/build/plugins/`).
- An **avalanchego** binary, built with the bundled subnet-evm plugin. The avalanchego source tree includes a `graft/` directory holding plugin sources — that's where the subnet-evm build script lives. From a fresh checkout:
```bash
git clone https://github.com/ava-labs/avalanchego
cd avalanchego
./scripts/build.sh # builds the avalanchego binary
cd graft/subnet-evm && ./scripts/build.sh # builds the subnet-evm plugin
```
The second step symlinks the plugin into `<avalanchego>/build/plugins/` under its VM ID (`srEXiWaHuhNyGwPUi444Tu47ZEDwxTWrbQiuD7FmgSAQ6X7Dy`). Confirm that file exists before booting.
- Set `AVALANCHEGO_PATH` to the binary:
```bash
export AVALANCHEGO_PATH=$HOME/code/avalanchego/build/avalanchego
export AVALANCHEGO_PATH=/path/to/avalanchego/build/avalanchego
```

## Quickstart
Expand Down Expand Up @@ -122,6 +129,16 @@ const { publicClient, walletClient } = makeClients(net.cChain, net.funded.privat

Producer-side API (`up`, `down`, `Network.start`, `captureSnapshot`, …) is also exported — see [`packages/tmpnetjs/README.md`](./packages/tmpnetjs/README.md).

## Troubleshooting

| Symptom | Fix |
|---|---|
| `avalanchego binary not found` (lists tried paths) | Set `AVALANCHEGO_PATH` to the absolute path of the built binary, e.g. `<avalanchego>/build/avalanchego`. |
| Node never goes healthy / "plugin not found" / subnet won't bootstrap | The subnet-evm plugin isn't where avalanchego expects. Confirm `<avalanchego>/build/plugins/srEXiWaHuhNyGwPUi444Tu47ZEDwxTWrbQiuD7FmgSAQ6X7Dy` exists. Rebuild via `cd <avalanchego>/graft/subnet-evm && ./scripts/build.sh` if missing. |
| `up` fails partway, subsequent runs reuse stale data and fail again | `pnpm run clean` then `pnpm run up`. `clean` nukes `.interchain-kit/` (data, snapshots, logs). |
| `forge: command not found` | Install Foundry: <https://book.getfoundry.sh/getting-started/installation>. |
| Port already in use (`:9650-9950`, `:8080`, `:8090`, `:9090`) | The primary nodes use `9650+100*i`, `icm-relayer` binds `:8080` (API) + `:9090` (metrics), `signature-aggregator` binds `:8090`. Kill the process holding them (`lsof -iTCP:8080 -sTCP:LISTEN`) or stop the other service. |

## Replaces

The next-gen replacement for [`ava-labs/avalanche-starter-kit`](https://github.com/ava-labs/avalanche-starter-kit). Built on `@avalanche-sdk/{client,interchain}` and the bundled subnet-evm in the avalanchego graft. `avalanche-cli` is intentionally not used — every primitive is driven directly.
Expand Down
22 changes: 22 additions & 0 deletions SECURITY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Security Policy

Avalanche takes the security of the platform and of its users very seriously. We and our community recognize the critical role of external security researchers and developers and welcome responsible disclosures.

## Reporting a Vulnerability

**Please do not file a public GitHub issue** for any security vulnerability in interchain-kit or in the Avalanche components it exercises (ICM, ICTT, validator manager, icm-relayer, signature aggregator).

Disclose vulnerabilities privately through one of the following channels:

- The Avalanche [Bug Bounty Program on Immunefi](https://immunefi.com/bug-bounty/avalanche/information/) — valid reports may be eligible for a reward (terms and conditions apply).
- Email [security@avalabs.org](mailto:security@avalabs.org) if the issue is out of Immunefi scope.

Vulnerabilities must be disclosed privately with reasonable time to respond, and must avoid compromise of other users and accounts, or loss of funds that are not your own. We do not reward spam or social engineering vulnerabilities.

Do not test for or validate any security issues against the live Avalanche networks (Mainnet and Fuji testnet). Reproduce exploits in a local private network — that is exactly what this repo is for.

Please refer to the [Bug Bounty page](https://immunefi.com/bug-bounty/avalanche/information/) for the most up-to-date program rules and scope.

## Supported Versions

Please use the latest commit on `main` when validating security issues.
4 changes: 1 addition & 3 deletions contracts/src/examples/icm-basics/SimpleReceiver.sol
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,7 @@ contract SimpleReceiver is TeleporterRegistryApp {

/// @notice Emitted whenever a cross-chain message is successfully processed.
event MessageReceived(
bytes32 indexed sourceBlockchainID,
address indexed originSenderAddress,
string message
bytes32 indexed sourceBlockchainID, address indexed originSenderAddress, string message
);

/// @param teleporterRegistryAddress Address of the TeleporterRegistry on
Expand Down
9 changes: 4 additions & 5 deletions contracts/src/examples/icm-basics/SimpleSender.sol
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,10 @@ contract SimpleSender {
/// @param destinationAddress The receiver contract address on that L1.
/// @param message Arbitrary UTF-8 string payload.
/// @return messageID Teleporter's unique ID for this message.
function sendMessage(
bytes32 destinationBlockchainID,
address destinationAddress,
string calldata message
) external returns (bytes32 messageID) {
function sendMessage(bytes32 destinationBlockchainID, address destinationAddress, string calldata message)
external
returns (bytes32 messageID)
{
// ABI-encode the user payload. ICM messages are arbitrary `bytes`; both
// sides agree on the encoding. Here we just wrap a single string.
bytes memory encodedMessage = abi.encode(message);
Expand Down
Loading
Loading