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
10 changes: 4 additions & 6 deletions .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,8 @@ jobs:
cache-dependency-path: |
link/go.sum
e2e/go.sum
- run: make build-link
- run: docker info
- run: go test -count=1 ./internal/... ./cmd/...
working-directory: e2e
- run: make -C e2e test-harness
env:
IBC_BIN: ${{ github.workspace }}/link/bin/ibc

Expand All @@ -87,7 +85,7 @@ jobs:
bun-version: 1.3.14
- uses: foundry-rs/foundry-toolchain@908c540300062bd5a7e473851cdb4282204cee09 # v1
- run: go install github.com/ethereum/go-ethereum/cmd/abigen@v1.17.4
- run: make check-test-apps
- run: make -C e2e check-stale

e2e:
needs: changes
Expand All @@ -104,7 +102,7 @@ jobs:
link/go.sum
e2e/go.sum
- run: docker info
- run: make test-e2e
- run: make -C e2e test

matrix:
runs-on: ubuntu-latest
Expand All @@ -115,4 +113,4 @@ jobs:
go-version-file: e2e/go.mod
cache-dependency-path: e2e/go.sum
- run: docker info
- run: make check-e2e-matrix
- run: make -C e2e check-matrix
6 changes: 1 addition & 5 deletions .github/workflows/license-headers.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,4 @@ jobs:
timeout-minutes: 5
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
- uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7
with:
go-version-file: link/go.mod
cache-dependency-path: link/go.sum
- run: make check-license-headers
- uses: apache/skywalking-eyes/header@61275cc80d0798a405cb070f7d3a8aaf7cf2c2c1 # v0.8.0
94 changes: 8 additions & 86 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,93 +3,15 @@
help: ## List repository commands
@grep -E '^[a-zA-Z0-9_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'

E2E_FLAGS ?= -count=1
E2E_MODE ?= fast
LICENSE_EYE_VERSION ?= 0.8.0

E2E_DIR := e2e
HARNESS_DIR := $(E2E_DIR)/internal/harness
CONTRACT_BINDINGS := $(addprefix $(HARNESS_DIR)/environment/solidityibc/,\
accessmanager escrow testerc20 counter iftsendcallconstructor iftbatchtransfershim)
lint-license: ## Check SPDX license headers
go run github.com/apache/skywalking-eyes/cmd/license-eye@v$(LICENSE_EYE_VERSION) \
--config .licenserc.yaml header check

build-link: ## Build the Link binary
$(MAKE) -C link build
run-all-checks: ## Run "all-in-one" code validation step.
$(MAKE) -C link run-all-checks
$(MAKE) -C e2e run-all-checks
$(MAKE) lint-license

install-link: ## Install the Link binary
$(MAKE) -C link install

doctor-e2e: ## Check the runtime dependencies used by e2e tests
@command -v go >/dev/null || { echo "missing go" >&2; exit 1; }
@command -v docker >/dev/null || { echo "missing docker; Docker is required for e2e modes and matrix generation" >&2; exit 1; }
@docker info >/dev/null || { echo "docker daemon is not reachable" >&2; exit 1; }

doctor-e2e-tools: ## Check the generation and lint tools used by repository e2e checks
@command -v forge >/dev/null || { echo "missing forge; Forge is required to verify test-app artifacts" >&2; exit 1; }
@command -v bun >/dev/null || { echo "missing bun; bun is required to install Solidity contract dependencies" >&2; exit 1; }
@command -v abigen >/dev/null || { echo "missing abigen; abigen is required to generate typed contract bindings" >&2; exit 1; }
@command -v jq >/dev/null || { echo "missing jq; jq is required to generate typed contract bindings" >&2; exit 1; }
@command -v golangci-lint >/dev/null || { echo "missing golangci-lint; it is required for e2e checks" >&2; exit 1; }

test-harness: build-link ## Run harness tests, including Docker-backed integrations when available
go -C $(E2E_DIR) test ./internal/... ./cmd/...

test-e2e: build-link ## Run e2e tests (E2E_MODE=... E2E_FLAGS=...)
# -parallel caps concurrent Docker environments; the GOMAXPROCS default can overload a large machine.
E2E_MODE=$(E2E_MODE) go -C $(E2E_DIR) test . -timeout 60m -parallel 4 $(E2E_FLAGS)

generate-e2e-matrix: ## Regenerate the E2E provider and topology matrix (requires Docker)
go -C $(E2E_DIR) run ./cmd/e2e-matrix -write test-matrix.md

check-e2e-matrix: ## Check that the E2E provider and topology matrix is current (requires Docker)
go -C $(E2E_DIR) run ./cmd/e2e-matrix -check test-matrix.md

lint: lint-link lint-e2e ## Lint all Go modules

lint-fix: lint-fix-link lint-fix-e2e ## Lint all Go modules and fix errors

lint-link: ## Lint the Link module
$(MAKE) -C link lint

lint-fix-link: ## Lint the Link module and fix errors
$(MAKE) -C link lint-fix

lint-e2e: ## Lint the e2e module, harness included
cd $(E2E_DIR) && golangci-lint run

lint-fix-e2e: ## Lint the e2e module, harness included, and fix errors
cd $(E2E_DIR) && golangci-lint run --fix

clean-e2e-dry-run: ## Preview e2e processes and Docker resources
$(E2E_DIR)/scripts/clean.sh --dry-run

clean-e2e: ## Kill e2e processes and remove Docker resources
$(E2E_DIR)/scripts/clean.sh

test-apps: ## Rebuild test-app artifacts and typed Go bindings (requires bun, forge, abigen, and jq)
bun install --cwd $(HARNESS_DIR)/environment/solidityibc/contracts --frozen-lockfile
forge build --root $(HARNESS_DIR)/environment/solidityibc/contracts
$(E2E_DIR)/scripts/generate-contract-bindings.sh

check-test-apps: ## Fail if typed Go contract bindings are stale
bun install --cwd $(HARNESS_DIR)/environment/solidityibc/contracts --frozen-lockfile
forge build --force --root $(HARNESS_DIR)/environment/solidityibc/contracts
$(E2E_DIR)/scripts/generate-contract-bindings.sh
@status="$$(git status --porcelain --untracked-files=all -- $(CONTRACT_BINDINGS))"; \
test -z "$$status" || { \
echo "contract bindings are stale — run 'make test-apps' and commit the result" >&2; \
echo "$$status" >&2; \
exit 1; \
}

check-license-headers: ## Check SPDX license headers
go run github.com/apache/skywalking-eyes/cmd/license-eye@v$(LICENSE_EYE_VERSION) --config .licenserc.yaml header check

check-link: ## Run Link-local checks
$(MAKE) -C link check

check-e2e: doctor-e2e doctor-e2e-tools test-harness lint-e2e check-test-apps test-e2e check-e2e-matrix ## Run all repository e2e checks

check: check-license-headers check-link check-e2e ## Run license, Link, and repository e2e checks

.PHONY: help build-link doctor-e2e doctor-e2e-tools test-harness test-e2e generate-e2e-matrix check-e2e-matrix lint lint-fix lint-link lint-fix-link lint-e2e lint-fix-e2e \
clean-e2e-dry-run clean-e2e test-apps check-test-apps check-license-headers check-link check-e2e check
.PHONY: help lint-license run-all-checks
10 changes: 5 additions & 5 deletions e2e/AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ This module contains one root repository-level acceptance package: linear Go tes
Solidity IBC stack (ICS26Router, ICS20Transfer, ICS27GMP) with attestation light clients and
managed attestors.

- Run from the repository root: `make test-e2e` uses fast mode;
`make test-e2e E2E_MODE=complete|production` selects another mode, and
- Run from the repository root: `make -C e2e test` uses fast mode;
`make -C e2e test E2E_MODE=complete|production` selects another mode, and
`E2E_FLAGS='-run TestTransfer_AutoRelay -count=1'` focuses a run. `-e2e.mode` in `E2E_FLAGS`
overrides `E2E_MODE`.
- Tests declare portable EVM, controlled-mining, or node-lifecycle requirements. Fast mode may
Expand All @@ -25,6 +25,6 @@ managed attestors.
paused and resumed it is interval-only, so transaction inclusion may take one second.
- `Environment` cleans up managed resources only. Attached chains remain caller-owned and expose no
harness mining or node-lifecycle controls.
- Run `make generate-e2e-matrix` after changing requirements or topology, and
`make check-e2e-matrix` to check the committed matrix. Both require Docker.
- After a hard crash: `make clean-e2e-dry-run`, then `make clean-e2e` from the repository root.
- Run `make -C e2e generate-matrix` after changing requirements or topology, and
`make -C e2e check-matrix` to check the committed matrix. Both require Docker.
- After a hard crash: `make -C e2e clean-dry-run`, then `make -C e2e clean` from the repository root.
90 changes: 90 additions & 0 deletions e2e/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
# SPDX-License-Identifier: Apache-2.0

E2E_FLAGS ?= -count=1
E2E_MODE ?= fast
FORGE_BUILD_FLAGS ?=

HARNESS_DIR := internal/harness
CONTRACT_BINDINGS := $(addprefix $(HARNESS_DIR)/environment/solidityibc/,\
accessmanager escrow testerc20 counter iftsendcallconstructor iftbatchtransfershim)

help: ## List e2e commands
@grep -E '^[a-zA-Z0-9_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'

doctor: ## Check the runtime dependencies used by e2e tests
@command -v go >/dev/null || { echo "missing go" >&2; exit 1; }
@command -v docker >/dev/null || { echo "missing docker; Docker is required for e2e modes and matrix generation" >&2; exit 1; }
@docker info >/dev/null || { echo "docker daemon is not reachable" >&2; exit 1; }

doctor-tools: ## Check the generation and lint tools used by e2e checks
@command -v forge >/dev/null || { echo "missing forge; Forge is required to verify test-app artifacts" >&2; exit 1; }
@command -v bun >/dev/null || { echo "missing bun; bun is required to install Solidity contract dependencies" >&2; exit 1; }
@command -v abigen >/dev/null || { echo "missing abigen; abigen is required to generate typed contract bindings" >&2; exit 1; }
@command -v jq >/dev/null || { echo "missing jq; jq is required to generate typed contract bindings" >&2; exit 1; }
@command -v golangci-lint >/dev/null || { echo "missing golangci-lint; it is required for e2e checks" >&2; exit 1; }

lint: ## Lint code
golangci-lint run

lint-fix: ## Lint & fix code
golangci-lint run --fix

test-harness: _build-link ## Run tests for e2e harness itself
go test ./internal/... ./cmd/... -count=1

test-apps: ## Rebuild test-app artifacts and typed Go bindings (requires bun, forge, abigen, and jq)
bun install --cwd $(HARNESS_DIR)/environment/solidityibc/contracts --frozen-lockfile
forge build $(FORGE_BUILD_FLAGS) --root $(HARNESS_DIR)/environment/solidityibc/contracts
./scripts/generate-contract-bindings.sh

test: _build-link ## Run e2e tests (E2E_MODE=... E2E_FLAGS=...)
# -parallel caps concurrent Docker environments; the GOMAXPROCS default can overload a large machine.
E2E_MODE=$(E2E_MODE) go test . -timeout 60m -parallel 4 $(E2E_FLAGS)

generate-matrix: ## Regenerate the E2E provider and topology matrix
go run ./cmd/e2e-matrix -write test-matrix.md

check-matrix: ## Check that the generated E2E matrix is current
go run ./cmd/e2e-matrix -check test-matrix.md

clean: ## Kill e2e processes and remove Docker resources
./scripts/clean.sh

clean-dry-run: ## Preview e2e processes and Docker resources
./scripts/clean.sh --dry-run

check-stale: ## Run all checks for stale code
@echo "Checking for stale ABI Go bindings..."
$(MAKE) test-apps FORGE_BUILD_FLAGS=--force
@status="$$(git status --porcelain --untracked-files=all -- $(CONTRACT_BINDINGS))"; \
test -z "$$status" || { \
echo "contract bindings are stale — run 'make -C e2e test-apps' and commit the result" >&2; \
echo "$$status" >&2; \
exit 1; \
}

run-all-checks: doctor doctor-tools ## Run "all-in-one" code validation step.
@echo "==== 1. Linting ===="
$(MAKE) lint

@echo "==== 2. Checking for stale code ===="
$(MAKE) check-stale

@echo "==== 3. Testing harness ===="
$(MAKE) test-harness

@echo "==== 4. Running E2E ===="
$(MAKE) test

@echo "==== 5. Checking matrix ===="
$(MAKE) check-matrix

# Hidden commands
_build-link:
$(MAKE) -C ../link build

.PHONY: help doctor doctor-tools lint lint-fix
.PHONY: test-harness test-apps test
.PHONY: generate-matrix check-matrix
.PHONY: clean clean-dry-run check-stale run-all-checks
.PHONY: _build-link
23 changes: 11 additions & 12 deletions e2e/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,11 @@ The root package covers ICS20 transfer, ICS27 GMP, IFT (burn/mint on top of GMP)
Run targets from the repository root:

```sh
make doctor-e2e
make build-link
make test-e2e
make -C e2e doctor
make -C e2e test
```

`make build-link` produces `link/bin/ibc`; `IBC_BIN` overrides that path. The real Link Relayer collects attestor signatures and submits recv, ack, and timeout transactions with attestation proofs, which the attestation light clients verify.
The test target builds `link/bin/ibc`; `IBC_BIN` overrides that path. The real Link Relayer collects attestor signatures and submits recv, ack, and timeout transactions with attestation proofs, which the attestation light clients verify.

Execution modes choose providers from each test's declared requirements:

Expand All @@ -36,15 +35,15 @@ provide those harness controls. `complete` runs each test once with the fastest
it does not run every provider permutation.

```sh
make test-e2e
make test-e2e E2E_MODE=complete
make test-e2e E2E_MODE=production
make test-e2e E2E_FLAGS='-run TestIFTTransfer_AutoRelay -count=1'
make test-e2e E2E_MODE=production E2E_FLAGS='-run TestCrossRoute -parallel 1 -count=1'
make -C e2e test
make -C e2e test E2E_MODE=complete
make -C e2e test E2E_MODE=production
make -C e2e test E2E_FLAGS='-run TestIFTTransfer_AutoRelay -count=1'
make -C e2e test E2E_MODE=production E2E_FLAGS='-run TestCrossRoute -parallel 1 -count=1'
```

`-e2e.mode` in `E2E_FLAGS` overrides `E2E_MODE`. After a hard crash, use
`make clean-e2e-dry-run` and then `make clean-e2e`.
`make -C e2e clean-dry-run` and then `make -C e2e clean`.

Every environment-backed test calls `t.Parallel()` and boots its own environment; the Makefile caps concurrency at four environments. Pass `E2E_FLAGS='-parallel 1 -count=1'` to serialize when debugging.

Expand Down Expand Up @@ -113,8 +112,8 @@ specs for all three modes. Generation starts the caller-owned Anvil used by the
so Docker is required.

```sh
make generate-e2e-matrix
make check-e2e-matrix
make -C e2e generate-matrix
make -C e2e check-matrix
```

Regenerate the matrix after changing test requirements or topology. The check compares generated
Expand Down
2 changes: 1 addition & 1 deletion e2e/internal/harness/AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,5 @@ corroborates outcomes by reading chain state with its own clients.
with `--entrypoint anvil` (PID 1, so `docker stop`'s SIGTERM reaches it and shutdown is prompt
instead of waiting out the kill grace). Don't reintroduce a shell-wrapped entrypoint.
StopNode/StartNode fault injection is docker pause/unpause; chain state stays in memory.
- Lint with `make lint-e2e` from the repository root; the shared root `.golangci.yml` covers the
- Lint with `make -C e2e lint` from the repository root; the shared root `.golangci.yml` covers the
harness and excludes exported-doc mandates for this internal test surface.
Loading
Loading