diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml index e465ac1c7..514a6936d 100644 --- a/.github/workflows/benchmark.yml +++ b/.github/workflows/benchmark.yml @@ -23,8 +23,10 @@ jobs: go-version-file: ./go.mod - name: Set up Docker Buildx uses: docker/setup-buildx-action@b5ca514318bd6ebac0fb2aedd5d36ec1b5c232a2 # v3.10.0 + - name: Install just + uses: extractions/setup-just@v3 - name: Build binaries - run: make build-evm build-da + run: just build-evm build-da - name: Run EVM benchmarks run: | cd test/e2e && go test -tags evm -bench=. -benchmem -run='^$' \ @@ -53,8 +55,10 @@ jobs: go-version-file: ./go.mod - name: Set up Docker Buildx uses: docker/setup-buildx-action@b5ca514318bd6ebac0fb2aedd5d36ec1b5c232a2 # v3.10.0 + - name: Install just + uses: extractions/setup-just@v3 - name: Build binaries - run: make build-evm build-da + run: just build-evm build-da - name: Run Spamoor smoke test run: | cd test/e2e && BENCH_JSON_OUTPUT=spamoor_bench.json go test -tags evm \ diff --git a/.github/workflows/dependabot-auto-fix.yml b/.github/workflows/dependabot-auto-fix.yml index f52d11b08..d89bf71f2 100644 --- a/.github/workflows/dependabot-auto-fix.yml +++ b/.github/workflows/dependabot-auto-fix.yml @@ -22,11 +22,11 @@ jobs: with: go-version-file: ./go.mod - - name: Install make (if missing) - run: sudo apt-get update && sudo apt-get install -y make + - name: Install just + uses: extractions/setup-just@v3 - name: Run dependency update - run: make deps + run: just deps - name: Commit and push changes run: | @@ -34,7 +34,7 @@ jobs: git config user.name "github-actions[bot]" git config user.email "41898282+github-actions[bot]@users.noreply.github.com" git add -A - git commit -m "chore: run make deps after Dependabot update" + git commit -m "chore: run just deps after Dependabot update" git push else echo "No changes to commit." diff --git a/.github/workflows/docker-tests.yml b/.github/workflows/docker-tests.yml index 5b475d9c6..f91011d4c 100644 --- a/.github/workflows/docker-tests.yml +++ b/.github/workflows/docker-tests.yml @@ -27,8 +27,10 @@ jobs: uses: actions/setup-go@v6.2.0 with: go-version-file: ./test/docker-e2e/go.mod + - name: Install just + uses: extractions/setup-just@v3 - name: Run Docker E2E Tests - run: make test-docker-e2e + run: just test-docker-e2e env: EV_NODE_IMAGE_REPO: ghcr.io/${{ github.repository_owner }}/ev-node-testapp EV_NODE_IMAGE_TAG: ${{ inputs.image-tag }} @@ -44,8 +46,10 @@ jobs: uses: actions/setup-go@v6.2.0 with: go-version-file: ./test/docker-e2e/go.mod + - name: Install just + uses: extractions/setup-just@v3 - name: Run Docker Upgrade E2E Tests - run: make test-docker-upgrade-e2e + run: just test-docker-upgrade-e2e env: EVM_IMAGE_REPO: ghcr.io/${{ github.repository_owner }}/ev-node-evm EVM_NODE_IMAGE_TAG: ${{ inputs.image-tag }} @@ -61,8 +65,10 @@ jobs: uses: actions/setup-go@v6.2.0 with: go-version-file: ./test/docker-e2e/go.mod + - name: Install just + uses: extractions/setup-just@v3 - name: Run Docker Compat E2E Tests - run: make test-docker-compat + run: just test-docker-compat env: SEQUENCER_EVM_IMAGE_REPO: ghcr.io/${{ github.repository_owner }}/ev-node-evm SEQUENCER_EVM_IMAGE_TAG: main # TODO: set this to the last released tag diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 62b4252f2..1e66a941d 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -17,8 +17,10 @@ jobs: uses: actions/setup-go@v6.2.0 with: go-version-file: ./go.mod + - name: Install just + uses: extractions/setup-just@v3 - name: Build all ev-node binaries - run: make build-all + run: just build-all go_mod_tidy_check: name: Go Mod Tidy Check @@ -28,7 +30,8 @@ jobs: - uses: actions/setup-go@v6.2.0 with: go-version-file: ./go.mod - - run: make deps + - uses: extractions/setup-just@v3 + - run: just deps - name: check for diff run: git diff --exit-code @@ -44,8 +47,10 @@ jobs: uses: actions/setup-go@v6.2.0 with: go-version-file: ./go.mod + - name: Install just + uses: extractions/setup-just@v3 - name: Run unit test - run: make test-cover + run: just test-cover - name: Upload unit test coverage report uses: actions/upload-artifact@v6 with: @@ -61,8 +66,10 @@ jobs: uses: actions/setup-go@v6.2.0 with: go-version-file: ./go.mod + - name: Install just + uses: extractions/setup-just@v3 - name: Run integration test - run: make test-integration-cover + run: just test-integration-cover - name: Upload integration test coverage report uses: actions/upload-artifact@v6 with: @@ -93,8 +100,10 @@ jobs: tags: evstack:local-dev cache-from: type=gha cache-to: type=gha,mode=max + - name: Install just + uses: extractions/setup-just@v3 - name: E2E Tests - run: make test-e2e + run: just test-e2e evm-tests: name: Run EVM Execution Tests @@ -106,8 +115,10 @@ jobs: uses: actions/setup-go@v6.2.0 with: go-version-file: ./go.mod + - name: Install just + uses: extractions/setup-just@v3 - name: EVM Tests - run: make test-evm + run: just test-evm combine_and_upload_coverage: name: Combine and Upload Coverage diff --git a/.just/build.just b/.just/build.just new file mode 100644 index 000000000..bb7f22453 --- /dev/null +++ b/.just/build.just @@ -0,0 +1,71 @@ +# Build Testapp CLI +[group('build')] +build: + @echo "--> Building Testapp CLI" + @mkdir -p {{ build_dir }} + @cd apps/testapp && go build -ldflags "{{ ldflags }}" -o {{ build_dir }}/testapp . + @echo "--> Testapp CLI Built!" + @echo " Check the version with: build/testapp version" + @echo " Check the binary with: {{ build_dir }}/testapp" + +# Install Testapp CLI to Go bin directory +[group('build')] +install: + @echo "--> Installing Testapp CLI" + @cd apps/testapp && go install -ldflags "{{ ldflags }}" . + @echo "--> Testapp CLI Installed!" + @echo " Check the version with: testapp version" + @echo " Check the binary with: which testapp" + +# Build all ev-node binaries +[group('build')] +build-all: + @echo "--> Building all ev-node binaries" + @mkdir -p {{ build_dir }} + @echo "--> Building testapp" + @cd apps/testapp && go build -ldflags "{{ ldflags }}" -o {{ build_dir }}/testapp . + @echo "--> Building evm" + @cd apps/evm && go build -ldflags "{{ ldflags }}" -o {{ build_dir }}/evm . + @echo "--> Building local-da" + @cd tools/local-da && go build -ldflags "{{ ldflags }}" -o {{ build_dir }}/local-da . + @echo "--> All ev-node binaries built!" + +# Build Testapp Bench +[group('build')] +build-testapp-bench: + @echo "--> Building Testapp Bench" + @mkdir -p {{ build_dir }} + @cd apps/testapp && go build -ldflags "{{ ldflags }}" -o {{ build_dir }}/testapp-bench ./kv/bench + @echo " Check the binary with: {{ build_dir }}/testapp-bench" + +# Build EVM binary +[group('build')] +build-evm: + @echo "--> Building EVM" + @mkdir -p {{ build_dir }} + @cd apps/evm && go build -ldflags "{{ ldflags }}" -o {{ build_dir }}/evm . + @echo " Check the binary with: {{ build_dir }}/evm" + +# Build local-da binary +[group('build')] +build-da: + @echo "--> Building local-da" + @mkdir -p {{ build_dir }} + @cd tools/local-da && go build -ldflags "{{ ldflags }}" -o {{ build_dir }}/local-da . + @echo " Check the binary with: {{ build_dir }}/local-da" + +# Build Docker image for local testing +[group('build')] +docker-build: + @echo "--> Building Docker image for local testing" + @docker build -t evstack:local-dev -f apps/testapp/Dockerfile . + @echo "--> Docker image built: evstack:local-dev" + @echo "--> Checking if image exists locally..." + @docker images evstack:local-dev + +# Clean build artifacts +[group('build')] +clean: + @echo "--> Cleaning build directory" + @rm -rf {{ build_dir }} + @echo "--> Build directory cleaned!" diff --git a/.just/codegen.just b/.just/codegen.just new file mode 100644 index 000000000..a1bb03ac2 --- /dev/null +++ b/.just/codegen.just @@ -0,0 +1,18 @@ +# Generate mocks +[group('codegen')] +mock-gen: + @echo "-> Generating mocks" + go run github.com/vektra/mockery/v3@latest + +# Install dependencies and tidy all modules +[group('codegen')] +deps: + @echo "--> Installing dependencies" + @go mod download + @go mod tidy + @go run scripts/tidy.go + +# Tidy all go.mod files +[group('codegen')] +tidy-all: + @go run -tags=tidy scripts/tidy.go diff --git a/.just/lint.just b/.just/lint.just new file mode 100644 index 000000000..6075d8d81 --- /dev/null +++ b/.just/lint.just @@ -0,0 +1,29 @@ +# Run all linters +[group('lint')] +lint: vet + @echo "--> Running golangci-lint" + @golangci-lint run + @echo "--> Running markdownlint" + @markdownlint --config .markdownlint.yaml '**/*.md' + @echo "--> Running hadolint" + @hadolint test/docker/mockserv.Dockerfile + @echo "--> Running yamllint" + @yamllint --no-warnings . -c .yamllint.yml + @echo "--> Running goreleaser check" + @goreleaser check + @echo "--> Running actionlint" + @actionlint + +# Auto-fix linting issues +[group('lint')] +lint-fix: + @echo "--> Formatting go" + @golangci-lint run --fix + @echo "--> Formatting markdownlint" + @markdownlint --config .markdownlint.yaml --ignore './changelog.md' '**/*.md' -f + +# Run go vet +[group('lint')] +vet: + @echo "--> Running go vet" + @go vet ./... diff --git a/.just/proto.just b/.just/proto.just new file mode 100644 index 000000000..722e53397 --- /dev/null +++ b/.just/proto.just @@ -0,0 +1,30 @@ +# Generate protobuf files +[group('proto')] +proto-gen: + @echo "--> Generating Protobuf files" + buf generate --path="./proto/evnode" --template="buf.gen.yaml" --config="buf.yaml" + buf generate --path="./proto/execution/evm" --template="buf.gen.evm.yaml" --config="buf.yaml" + +# Lint protobuf files (requires Docker) +[group('proto')] +proto-lint: + @echo "--> Linting Protobuf files" + @docker run --rm -v {{ justfile_directory() }}:/workspace --workdir /workspace bufbuild/buf:latest lint --error-format=json + +# Generate Rust protobuf files +[group('proto')] +rust-proto-gen: + @echo "--> Generating Rust protobuf files" + @cd client/crates/types && EV_TYPES_FORCE_PROTO_GEN=1 cargo build + +# Check if Rust protobuf files are up to date +[group('proto')] +rust-proto-check: + @echo "--> Checking Rust protobuf files" + @rm -rf client/crates/types/src/proto/*.rs + @cd client/crates/types && cargo build + @if ! git diff --exit-code client/crates/types/src/proto/; then \ + echo "Error: Generated Rust proto files are not up to date."; \ + echo "Run 'just rust-proto-gen' and commit the changes."; \ + exit 1; \ + fi diff --git a/.just/run.just b/.just/run.just new file mode 100644 index 000000000..dd833993a --- /dev/null +++ b/.just/run.just @@ -0,0 +1,10 @@ +# Run 'n' nodes (default: 1). Usage: just run-n 3 +[group('run')] +run-n nodes="1": build build-da + @go run -tags=run scripts/run.go --nodes={{ nodes }} + +# Run EVM nodes (one sequencer and one full node) +[group('run')] +run-evm-nodes nodes="1": build-da build-evm + @echo "Starting EVM nodes..." + @go run -tags=run_evm scripts/run-evm-nodes.go --nodes={{ nodes }} diff --git a/.just/test.just b/.just/test.just new file mode 100644 index 000000000..c0360d43f --- /dev/null +++ b/.just/test.just @@ -0,0 +1,100 @@ +# Clear test cache +[group('test')] +clean-testcache: + @echo "--> Clearing testcache" + @go clean --testcache + +# Run unit tests for all go.mods +[group('test')] +test: + @echo "--> Running unit tests" + @go run -tags='run integration' scripts/test.go + +# Run all tests including Docker E2E +[group('test')] +test-all: test test-docker-e2e + @echo "--> All tests completed" + +# Run integration tests +[group('test')] +test-integration: + @echo "--> Running integration tests" + @cd node && go test -mod=readonly -failfast -timeout=15m -tags='integration' ./... + +# Run e2e tests +[group('test')] +test-e2e: build build-da build-evm docker-build-if-local + @echo "--> Running e2e tests" + @cd test/e2e && go test -mod=readonly -failfast -timeout=15m -tags='e2e evm' ./... --binary=../../build/testapp --evm-binary=../../build/evm + +# Run integration tests with coverage +[group('test')] +test-integration-cover: + @echo "--> Running integration tests with coverage" + @cd node && go test -mod=readonly -failfast -timeout=15m -tags='integration' -coverprofile=coverage.txt -covermode=atomic ./... + +# Generate code coverage report +[group('test')] +test-cover: + @echo "--> Running unit tests" + @go run -tags=cover -race scripts/test_cover.go + +# Run micro-benchmarks for internal cache +[group('test')] +bench: + @echo "--> Running internal cache benchmarks" + @go test -bench=. -benchmem -run='^$' ./block/internal/cache + +# Run EVM tests +[group('test')] +test-evm: + @echo "--> Running EVM tests" + @cd execution/evm/test && go test -mod=readonly -failfast -timeout=15m ./... -tags=evm + +# Run Docker E2E tests +[group('test')] +test-docker-e2e: docker-build-if-local + @echo "--> Running Docker E2E tests" + @echo "--> Verifying Docker image exists locally..." + @if [ -z "${EV_NODE_IMAGE_REPO:-}" ] || [ "${EV_NODE_IMAGE_REPO:-}" = "ev-node" ]; then \ + echo "--> Verifying Docker image exists locally..."; \ + docker image inspect evstack:local-dev >/dev/null 2>&1 || (echo "ERROR: evstack:local-dev image not found. Run 'just docker-build' first." && exit 1); \ + fi + @cd test/docker-e2e && go test -mod=readonly -failfast -v -tags='docker_e2e' -timeout=30m ./... + @just docker-cleanup-if-local + +# Run Docker E2E Upgrade tests +[group('test')] +test-docker-upgrade-e2e: + @echo "--> Running Docker Upgrade E2E tests" + @cd test/docker-e2e && go test -mod=readonly -failfast -v -tags='docker_e2e evm' -timeout=30m -run '^TestEVMSingleUpgradeSuite$$/^TestEVMSingleUpgrade$$' ./... + +# Run Docker E2E cross-version compatibility tests +[group('test')] +test-docker-compat: + @echo "--> Running Docker Sync Compatibility E2E tests" + @cd test/docker-e2e && go test -mod=readonly -failfast -v -tags='docker_e2e evm' -timeout=30m -run '^TestEVMCompatSuite$$/^TestCrossVersionSync$$' ./... + +# Build Docker image if using local repository +[group('test')] +docker-build-if-local: + @if [ -z "${EV_NODE_IMAGE_REPO:-}" ] || [ "${EV_NODE_IMAGE_REPO:-}" = "evstack" ]; then \ + if docker image inspect evstack:local-dev >/dev/null 2>&1; then \ + echo "--> Found local Docker image: evstack:local-dev (skipping build)"; \ + else \ + echo "--> Local repository detected, building Docker image..."; \ + just docker-build; \ + fi; \ + else \ + echo "--> Using remote repository: ${EV_NODE_IMAGE_REPO}"; \ + fi + +# Clean up local Docker image if using local repository +[group('test')] +docker-cleanup-if-local: + @if [ -z "${EV_NODE_IMAGE_REPO:-}" ] || [ "${EV_NODE_IMAGE_REPO:-}" = "evstack" ]; then \ + echo "--> Untagging local Docker image (preserving layers for faster rebuilds)..."; \ + docker rmi evstack:local-dev --no-prune 2>/dev/null || echo "Image evstack:local-dev not found or already removed"; \ + else \ + echo "--> Using remote repository, no cleanup needed"; \ + fi diff --git a/.just/tools.just b/.just/tools.just new file mode 100644 index 000000000..9c30f2c4f --- /dev/null +++ b/.just/tools.just @@ -0,0 +1,69 @@ +# Build da-debug tool +[group('tools')] +build-tool-da-debug: + @echo "--> Building da-debug tool" + @mkdir -p {{ build_dir }} + @cd tools/da-debug && go build -ldflags "{{ tool_ldflags }}" -o {{ build_dir }}/da-debug . + @echo "--> da-debug built: {{ build_dir }}/da-debug" + +# Build blob-decoder tool +[group('tools')] +build-tool-blob-decoder: + @echo "--> Building blob-decoder tool" + @mkdir -p {{ build_dir }} + @cd tools/blob-decoder && go build -ldflags "{{ tool_ldflags }}" -o {{ build_dir }}/blob-decoder . + @echo "--> blob-decoder built: {{ build_dir }}/blob-decoder" + +# Build cache-analyzer tool +[group('tools')] +build-tool-cache-analyzer: + @echo "--> Building cache-analyzer tool" + @mkdir -p {{ build_dir }} + @cd tools/cache-analyzer && go build -ldflags "{{ tool_ldflags }}" -o {{ build_dir }}/cache-analyzer . + @echo "--> cache-analyzer built: {{ build_dir }}/cache-analyzer" + +# Build all tools +[group('tools')] +build-tools: build-tool-da-debug build-tool-blob-decoder build-tool-cache-analyzer + @echo "--> All tools built successfully!" + +# Install da-debug tool to Go bin +[group('tools')] +install-tool-da-debug: + @echo "--> Installing da-debug tool" + @cd tools/da-debug && go install -ldflags "{{ tool_ldflags }}" . + @echo "--> da-debug installed to Go bin" + +# Install blob-decoder tool to Go bin +[group('tools')] +install-tool-blob-decoder: + @echo "--> Installing blob-decoder tool" + @cd tools/blob-decoder && go install -ldflags "{{ tool_ldflags }}" . + @echo "--> blob-decoder installed to Go bin" + +# Install cache-analyzer tool to Go bin +[group('tools')] +install-tool-cache-analyzer: + @echo "--> Installing cache-analyzer tool" + @cd tools/cache-analyzer && go install -ldflags "{{ tool_ldflags }}" . + @echo "--> cache-analyzer installed to Go bin" + +# Install all tools to Go bin +[group('tools')] +install-tools: install-tool-da-debug install-tool-blob-decoder install-tool-cache-analyzer + @echo "--> All tools installed successfully!" + +# Remove built tool binaries +[group('tools')] +clean-tools: + @echo "--> Cleaning built tools" + @rm -f {{ build_dir }}/da-debug {{ build_dir }}/blob-decoder {{ build_dir }}/cache-analyzer + @echo "--> Tools cleaned" + +# List available tools +[group('tools')] +list-tools: + @echo "Available tools:" + @echo " - da-debug" + @echo " - blob-decoder" + @echo " - cache-analyzer" diff --git a/CLAUDE.md b/CLAUDE.md index ead38632a..66b074711 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -8,33 +8,35 @@ ev-node is a sovereign rollup framework built in Go that allows developers to bu ## Build and Development Commands +Uses [just](https://github.com/casey/just) as the command runner. Run `just help` to list all recipes. + ### Building -- `make build` - Builds the Testapp CLI to `./build/testapp` -- `make install` - Installs Testapp CLI to your Go bin directory -- `make build-all` - Builds all ev-node binaries -- `make docker-build` - Builds Docker image tagged as `evstack:local-dev` +- `just build` - Builds the Testapp CLI to `./build/testapp` +- `just install` - Installs Testapp CLI to your Go bin directory +- `just build-all` - Builds all ev-node binaries +- `just docker-build` - Builds Docker image tagged as `evstack:local-dev` ### Testing -- `make test` - Runs unit tests for all go.mod files -- `make test-integration` - Runs integration tests (15m timeout) -- `make test-e2e` - Runs end-to-end tests (requires building binaries first) -- `make test-cover` - Generates code coverage report -- `make test-all` - Runs all tests including Docker E2E tests +- `just test` - Runs unit tests for all go.mod files +- `just test-integration` - Runs integration tests (15m timeout) +- `just test-e2e` - Runs end-to-end tests (requires building binaries first) +- `just test-cover` - Generates code coverage report +- `just test-all` - Runs all tests including Docker E2E tests ### Linting and Code Quality -- `make lint` - Runs all linters (golangci-lint, markdownlint, hadolint, yamllint, goreleaser check, actionlint) -- `make lint-fix` - Auto-fixes linting issues where possible -- `make vet` - Runs go vet +- `just lint` - Runs all linters (golangci-lint, markdownlint, hadolint, yamllint, goreleaser check, actionlint) +- `just lint-fix` - Auto-fixes linting issues where possible +- `just vet` - Runs go vet ### Development Utilities -- `make deps` - Downloads dependencies and runs go mod tidy for all modules -- `make proto-gen` - Generates protobuf files (requires Docker) -- `make mock-gen` - Generates mocks using mockery -- `make run-n NODES=3` - Run multiple nodes locally (default: 1) +- `just deps` - Downloads dependencies and runs go mod tidy for all modules +- `just proto-gen` - Generates protobuf files (requires Docker) +- `just mock-gen` - Generates mocks using mockery +- `just run-n 3` - Run multiple nodes locally (default: 1) ## Code Architecture @@ -91,7 +93,7 @@ go test -race ./package/... ### Mock Generation - Mocks are defined in `.mockery.yaml` -- Generate with `make mock-gen` +- Generate with `just mock-gen` - Mocks are placed in `mocks/` directories ## Code Style Guidelines @@ -128,7 +130,7 @@ go test -race ./package/... ### Modifying Protobuf Definitions 1. Edit `.proto` files in `types/pb/` -2. Run `make proto-gen` to regenerate Go code +2. Run `just proto-gen` to regenerate Go code 3. Update any affected code 4. Run tests to ensure compatibility @@ -157,15 +159,15 @@ go test -race ./package/... ## Debugging Tips -- Use `make run-n NODES=2` to test multi-node scenarios locally +- Use `just run-n 2` to test multi-node scenarios locally - Check logs for error messages and stack traces - Use Go's built-in profiling tools for performance issues - The testapp provides a simple way to test changes ## Contributing Guidelines -- All code must pass linting (`make lint`) -- All tests must pass (`make test-all`) +- All code must pass linting (`just lint`) +- All tests must pass (`just test-all`) - Follow the existing code patterns - Update tests when changing functionality - Keep commits focused and atomic diff --git a/Makefile b/Makefile deleted file mode 100644 index 1b86d6f70..000000000 --- a/Makefile +++ /dev/null @@ -1,16 +0,0 @@ -include ./scripts/build.mk -include ./scripts/test.mk -include ./scripts/proto.mk -include ./scripts/utils.mk -include ./scripts/run.mk -include ./tools/tools.mk - -# Sets the default make target to `build`. -# Requires GNU Make >= v3.81. -.DEFAULT_GOAL := build - -## help: Show this help message -help: Makefile - @echo " Choose a command run in "$(PROJECTNAME)":" - @sed -n 's/^##//p' $< | column -t -s ':' | sort | sed -e 's/^/ /' -.PHONY: help diff --git a/README.md b/README.md index 013fc7360..03bb86083 100644 --- a/README.md +++ b/README.md @@ -33,7 +33,7 @@ To install the example `testapp`, simply run the following command at the root o ev-node repo: ```bash -make install +just install ``` The latest TestApp example is now installed. You can verify the installation by running: @@ -100,16 +100,16 @@ to ask questions, discuss your ideas, and connect with other contributors. ```sh # Run unit tests -make test +just test # Generate protobuf files (requires Docker) -make proto-gen +just proto-gen # Run linters (requires golangci-lint, markdownlint, hadolint, and yamllint) -make lint +just lint # Lint protobuf files (requires Docker and buf) -make proto-lint +just proto-lint ``` diff --git a/apps/grpc/Dockerfile b/apps/grpc/Dockerfile index 7fedf430f..ba69913c9 100644 --- a/apps/grpc/Dockerfile +++ b/apps/grpc/Dockerfile @@ -2,7 +2,7 @@ FROM golang:1.25-alpine AS builder #hadolint ignore=DL3018 -RUN apk add --no-cache git make gcc musl-dev linux-headers +RUN apk add --no-cache git gcc musl-dev linux-headers # Set working directory WORKDIR /ev-node diff --git a/apps/testapp/Dockerfile b/apps/testapp/Dockerfile index 23ff14e9b..fe3701947 100644 --- a/apps/testapp/Dockerfile +++ b/apps/testapp/Dockerfile @@ -21,7 +21,7 @@ WORKDIR /ev-node COPY . . # Now download dependencies and build -RUN go mod download && make install +RUN go mod download && cd apps/testapp && go install . ## prep the final image. # diff --git a/client/crates/types/README.md b/client/crates/types/README.md index 3650fe9ef..c9b10cb5e 100644 --- a/client/crates/types/README.md +++ b/client/crates/types/README.md @@ -63,8 +63,8 @@ The generated code is committed to the repository. If you modify the proto files # Force regeneration by setting the environment variable EV_TYPES_FORCE_PROTO_GEN=1 cargo build -# Or from the repository root (if a make target exists) -make rust-proto-gen +# Or from the repository root +just rust-proto-gen ``` **Important**: @@ -88,7 +88,7 @@ To ensure consistency with CI: 1. Install protoc version 25.1 2. Use the provided script: `./client/scripts/generate-protos.sh` -3. Or use the Makefile: `make rust-proto-gen` +3. Or use just: `just rust-proto-gen` ### Common Issues diff --git a/docs/CLAUDE.md b/docs/CLAUDE.md index 539ee92db..fd2ba2594 100644 --- a/docs/CLAUDE.md +++ b/docs/CLAUDE.md @@ -10,7 +10,7 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co - `yarn dev` - Start VitePress development server (hot reload enabled) - `yarn build` - Build static documentation site - `yarn preview` - Preview built site locally -- `make testlink` - Validate all links in markdown files using lychee +- `just testlink` - Validate all links in markdown files using lychee ### Deployment @@ -44,14 +44,14 @@ docs/ - **Navigation Structure**: Configured in `.vitepress/config.ts` with collapsible sidebar sections - **Analytics**: Plausible analytics and Chatbase integration - **Content Format**: Markdown files with frontmatter support -- **Link Validation**: Automated via `make testlink` and GitHub Actions +- **Link Validation**: Automated via `just testlink` and GitHub Actions ### Development Workflow 1. Content changes: Edit markdown files in appropriate directories 2. Navigation changes: Update `.vitepress/config.ts` 3. Test locally with `yarn dev` -4. Validate links with `make testlink` +4. Validate links with `just testlink` 5. Create PR - preview deployment will be available 6. Merge to main triggers automatic deployment diff --git a/docs/guides/create-genesis.md b/docs/guides/create-genesis.md index e113cfcfe..5886325da 100644 --- a/docs/guides/create-genesis.md +++ b/docs/guides/create-genesis.md @@ -30,7 +30,7 @@ STAKING_AMOUNT="1000000000stake" Ensure that `.gm` folder is present at `/Users/you/.gm` (if not, follow a [Guide](./gm-world.md) to set it up) and run the following command to (re)generate an entrypoint binary out of the code: ```sh -make install +just install ``` Once completed, run the following command to ensure that the `/Users/you/.gm` directory is present: diff --git a/docs/guides/evm/single.md b/docs/guides/evm/single.md index 5063a654f..05c42d185 100644 --- a/docs/guides/evm/single.md +++ b/docs/guides/evm/single.md @@ -25,8 +25,8 @@ cd evolve ### 2. Build the Evolve EVM Single Sequencer Implementation ```bash -make build-evm -make build-da +just build-evm +just build-da ``` This will create the following binaries in the `build` directory: diff --git a/docs/guides/gm-world.md b/docs/guides/gm-world.md index e28d746c6..62ef64049 100644 --- a/docs/guides/gm-world.md +++ b/docs/guides/gm-world.md @@ -67,7 +67,7 @@ ignite app install -g github.com/ignite/apps/evolve Install your app locally: ```bash -make install +just install ``` ## Add Evolve Features {#add-evolve-features} diff --git a/docs/guides/quick-start.md b/docs/guides/quick-start.md index 4d6bf012c..82bbd2d84 100644 --- a/docs/guides/quick-start.md +++ b/docs/guides/quick-start.md @@ -20,19 +20,19 @@ git clone --depth 1 https://github.com/evstack/ev-node.git cd ev-node # Build the testapp binary -make build +just build # Optional: Install to your Go bin directory for system-wide access -make install +just install ``` Verify the installation by checking the Evolve version: ```bash -# If you ran 'make install' +# If you ran 'just install' testapp version -# Or if you only ran 'make build' +# Or if you only ran 'just build' ./build/testapp version ``` diff --git a/justfile b/justfile new file mode 100644 index 000000000..4259dcc46 --- /dev/null +++ b/justfile @@ -0,0 +1,24 @@ +# ev-node justfile + +# Extract version information from git +version := `git describe --tags --abbrev=0 2>/dev/null || echo "dev"` +gitsha := `git rev-parse --short HEAD 2>/dev/null || echo "unknown"` +ldflags := "-X github.com/evstack/ev-node/pkg/cmd.Version=" + version + " -X github.com/evstack/ev-node/pkg/cmd.GitSHA=" + gitsha + +# Tool build ldflags (uses main package) +tool_ldflags := "-X main.Version=" + version + " -X main.GitSHA=" + gitsha + +# Build directory +build_dir := justfile_directory() / "build" + +import '.just/build.just' +import '.just/test.just' +import '.just/proto.just' +import '.just/lint.just' +import '.just/codegen.just' +import '.just/run.just' +import '.just/tools.just' + +# List available recipes when running `just` with no args +default: + @just --list --unsorted diff --git a/pkg/cmd/README.md b/pkg/cmd/README.md index 20d53371b..820980d4e 100644 --- a/pkg/cmd/README.md +++ b/pkg/cmd/README.md @@ -9,7 +9,7 @@ NOTE: Requires Go version >= 1.19. To install `evolve`, simply run the following command at the root of the evolve repo ```bash -make install +just install ``` The latest Evolve is now installed. You can verify the installation by running: @@ -23,5 +23,5 @@ evolve version If you have Evolve installed, and you make updates that you want to test, simply run: ```bash -make install +just install ``` diff --git a/scripts/build.mk b/scripts/build.mk deleted file mode 100644 index 5ed508f70..000000000 --- a/scripts/build.mk +++ /dev/null @@ -1,74 +0,0 @@ -# Extract the latest Git tag as the version number -VERSION := $(shell git describe --tags --abbrev=0) -GITSHA := $(shell git rev-parse --short HEAD) -LDFLAGS := \ - -X github.com/evstack/ev-node/pkg/cmd.Version=$(VERSION) \ - -X github.com/evstack/ev-node/pkg/cmd.GitSHA=$(GITSHA) - -## build: build Testapp CLI -build: - @echo "--> Building Testapp CLI" - @mkdir -p $(CURDIR)/build - @cd apps/testapp && go build -ldflags "$(LDFLAGS)" -o $(CURDIR)/build/testapp . - @echo "--> Testapp CLI Built!" - @echo " Check the version with: build/testapp version" - @echo " Check the binary with: $(CURDIR)/build/testapp" -.PHONY: build - -## install: Install Testapp CLI -install: - @echo "--> Installing Testapp CLI" - @cd apps/testapp && go install -ldflags "$(LDFLAGS)" . - @echo "--> Testapp CLI Installed!" - @echo " Check the version with: testapp version" - @echo " Check the binary with: which testapp" -.PHONY: install - -build-all: - @echo "--> Building all ev-node binaries" - @mkdir -p $(CURDIR)/build - @echo "--> Building testapp" - @cd apps/testapp && go build -ldflags "$(LDFLAGS)" -o $(CURDIR)/build/testapp . - @echo "--> Building evm" - @cd apps/evm && go build -ldflags "$(LDFLAGS)" -o $(CURDIR)/build/evm . - @echo "--> Building local-da" - @cd tools/local-da && go build -ldflags "$(LDFLAGS)" -o $(CURDIR)/build/local-da . - @echo "--> All ev-node binaries built!" - -## build-testapp-bench: -build-testapp-bench: - @echo "--> Building Testapp Bench" - @mkdir -p $(CURDIR)/build - @cd apps/testapp && go build -ldflags "$(LDFLAGS)" -o $(CURDIR)/build/testapp-bench ./kv/bench - @echo " Check the binary with: $(CURDIR)/build/testapp-bench" -.PHONY: build-testapp-bench - -## build-evm: build evm single -build-evm: - @echo "--> Building EVM" - @mkdir -p $(CURDIR)/build - @cd apps/evm && go build -ldflags "$(LDFLAGS)" -o $(CURDIR)/build/evm . - @echo " Check the binary with: $(CURDIR)/build/evm" - -build-da: - @echo "--> Building local-da" - @mkdir -p $(CURDIR)/build - @cd tools/local-da && go build -ldflags "$(LDFLAGS)" -o $(CURDIR)/build/local-da . - @echo " Check the binary with: $(CURDIR)/build/local-da" -.PHONY: build-da - -## docker-build: Build Docker image for local testing -docker-build: - @echo "--> Building Docker image for local testing" - @docker build -t evstack:local-dev -f apps/testapp/Dockerfile . - @echo "--> Docker image built: evstack:local-dev" - @echo "--> Checking if image exists locally..." - @docker images evstack:local-dev -.PHONY: docker-build - -## clean: clean and build -clean: - @echo "--> Cleaning Testapp CLI" - @rm -rf $(CURDIR)/build/ - @echo "--> Testapp CLI Cleaned!" -.PHONY: clean diff --git a/scripts/proto.mk b/scripts/proto.mk deleted file mode 100644 index deeb2a341..000000000 --- a/scripts/proto.mk +++ /dev/null @@ -1,33 +0,0 @@ -DOCKER := $(shell which docker) -DOCKER_BUF := $(DOCKER) run --rm -v $(CURDIR):/workspace --workdir /workspace bufbuild/buf:latest - -## proto-gen: Generate protobuf files. Requires docker. -proto-gen: - @echo "--> Generating Protobuf files" - buf generate --path="./proto/evnode" --template="buf.gen.yaml" --config="buf.yaml" - buf generate --path="./proto/execution/evm" --template="buf.gen.evm.yaml" --config="buf.yaml" -.PHONY: proto-gen - -## proto-lint: Lint protobuf files. Requires docker. -proto-lint: - @echo "--> Linting Protobuf files" - @$(DOCKER_BUF) lint --error-format=json -.PHONY: proto-lint - -## rust-proto-gen: Generate Rust protobuf files -rust-proto-gen: - @echo "--> Generating Rust protobuf files" - @cd client/crates/types && EV_TYPES_FORCE_PROTO_GEN=1 cargo build -.PHONY: rust-proto-gen - -## rust-proto-check: Check if Rust protobuf files are up to date -rust-proto-check: - @echo "--> Checking Rust protobuf files" - @rm -rf client/crates/types/src/proto/*.rs - @cd client/crates/types && cargo build - @if ! git diff --exit-code client/crates/types/src/proto/; then \ - echo "Error: Generated Rust proto files are not up to date."; \ - echo "Run 'make rust-proto-gen' and commit the changes."; \ - exit 1; \ - fi -.PHONY: rust-proto-check diff --git a/scripts/run.mk b/scripts/run.mk deleted file mode 100644 index c451c6c53..000000000 --- a/scripts/run.mk +++ /dev/null @@ -1,12 +0,0 @@ -## run-n: Run 'n' nodes where 'n' is specified by the NODES variable (default: 1) -## Usage: make run-n NODES=3 -run-n: build build-da - @go run -tags=run scripts/run.go --nodes=$(or $(NODES),1) -.PHONY: run-n - -## run-evm-nodes: Run EVM nodes (one sequencer and one full node) -## Usage: make run-evm-nodes -run-evm-nodes: build-da build-evm - @echo "Starting EVM nodes..." - @go run -tags=run_evm scripts/run-evm-nodes.go --nodes=$(or $(NODES),1) -.PHONY: run-evm-nodes diff --git a/scripts/test.mk b/scripts/test.mk deleted file mode 100644 index f9f76c1ab..000000000 --- a/scripts/test.mk +++ /dev/null @@ -1,97 +0,0 @@ -## clean-testcache: clean testcache -clean-testcache: - @echo "--> Clearing testcache" - @go clean --testcache -.PHONY: clean-testcache - -## test: Running unit tests for all go.mods -test: - @echo "--> Running unit tests" - @go run -tags='run integration' scripts/test.go -.PHONY: test - -## test-all: Running all tests including Docker E2E -test-all: test test-docker-e2e - @echo "--> All tests completed" -.PHONY: test-all - -## test-integration: Running integration tests -test-integration: - @echo "--> Running integration tests" - @cd node && go test -mod=readonly -failfast -timeout=15m -tags='integration' ./... -.PHONY: test-integration - -## test-e2e: Running e2e tests -test-e2e: build build-da build-evm docker-build-if-local - @echo "--> Running e2e tests" - @cd test/e2e && go test -mod=readonly -failfast -timeout=15m -tags='e2e evm' ./... --binary=../../build/testapp --evm-binary=../../build/evm -.PHONY: test-e2e - -## test-integration-cover: generate code coverage report for integration tests. -test-integration-cover: - @echo "--> Running integration tests with coverage" - @cd node && go test -mod=readonly -failfast -timeout=15m -tags='integration' -coverprofile=coverage.txt -covermode=atomic ./... -.PHONY: test-integration-cover - -## test-cover: generate code coverage report. -test-cover: - @echo "--> Running unit tests" - @go run -tags=cover -race scripts/test_cover.go -.PHONY: test-cover - -## bench: run micro-benchmarks for internal cache -bench: - @echo "--> Running internal cache benchmarks" - @go test -bench=. -benchmem -run=^$$ ./block/internal/cache -.PHONY: bench - -## test-evm: Running EVM tests -test-evm: - @echo "--> Running EVM tests" - @cd execution/evm/test && go test -mod=readonly -failfast -timeout=15m ./... -tags=evm - -## test-docker-e2e: Running Docker E2E tests -test-docker-e2e: docker-build-if-local - @echo "--> Running Docker E2E tests" - @echo "--> Verifying Docker image exists locally..." - @if [ -z "$(EV_NODE_IMAGE_REPO)" ] || [ "$(EV_NODE_IMAGE_REPO)" = "ev-node" ]; then \ - echo "--> Verifying Docker image exists locally..."; \ - docker image inspect evstack:local-dev >/dev/null 2>&1 || (echo "ERROR: evstack:local-dev image not found. Run 'make docker-build' first." && exit 1); \ - fi - @cd test/docker-e2e && go test -mod=readonly -failfast -v -tags='docker_e2e' -timeout=30m ./... - @$(MAKE) docker-cleanup-if-local - -## test-docker-upgrade-e2e: Running Docker E2E Upgrade tests -test-docker-upgrade-e2e: - @echo "--> Running Docker Upgrade E2E tests" - @cd test/docker-e2e && go test -mod=readonly -failfast -v -tags='docker_e2e evm' -timeout=30m -run '^TestEVMSingleUpgradeSuite$$/^TestEVMSingleUpgrade$$' ./... - -## test-docker-compat: Running Docker E2E cross-version compatibility tests -test-docker-compat: - @echo "--> Running Docker Sync Compatibility E2E tests" - @cd test/docker-e2e && go test -mod=readonly -failfast -v -tags='docker_e2e evm' -timeout=30m -run '^TestEVMCompatSuite$$/^TestCrossVersionSync$$' ./... -.PHONY: test-docker-compat - -## docker-build-if-local: Build Docker image if using local repository -docker-build-if-local: - @if [ -z "$(EV_NODE_IMAGE_REPO)" ] || [ "$(EV_NODE_IMAGE_REPO)" = "evstack" ]; then \ - if docker image inspect evstack:local-dev >/dev/null 2>&1; then \ - echo "--> Found local Docker image: evstack:local-dev (skipping build)"; \ - else \ - echo "--> Local repository detected, building Docker image..."; \ - $(MAKE) docker-build; \ - fi; \ - else \ - echo "--> Using remote repository: $(EV_NODE_IMAGE_REPO)"; \ - fi -.PHONY: docker-build-if-local - -## docker-cleanup-if-local: Clean up local Docker image if using local repository -docker-cleanup-if-local: - @if [ -z "$(EV_NODE_IMAGE_REPO)" ] || [ "$(EV_NODE_IMAGE_REPO)" = "evstack" ]; then \ - echo "--> Untagging local Docker image (preserving layers for faster rebuilds)..."; \ - docker rmi evstack:local-dev --no-prune 2>/dev/null || echo "Image evstack:local-dev not found or already removed"; \ - else \ - echo "--> Using remote repository, no cleanup needed"; \ - fi -.PHONY: docker-cleanup-if-local diff --git a/scripts/utils.mk b/scripts/utils.mk deleted file mode 100644 index c56d8d811..000000000 --- a/scripts/utils.mk +++ /dev/null @@ -1,47 +0,0 @@ -## deps: Install dependencies -deps: - @echo "--> Installing dependencies" - @go mod download - @go mod tidy - @go run scripts/tidy.go -.PHONY: deps - -tidy-all: - @go run -tags=tidy scripts/tidy.go -.PHONY: tidy-all - -## lint: Run linters golangci-lint and markdownlint. -lint: vet - @echo "--> Running golangci-lint" - @golangci-lint run - @echo "--> Running markdownlint" - @markdownlint --config .markdownlint.yaml '**/*.md' - @echo "--> Running hadolint" - @hadolint test/docker/mockserv.Dockerfile - @echo "--> Running yamllint" - @yamllint --no-warnings . -c .yamllint.yml - @echo "--> Running goreleaser check" - @goreleaser check - @echo "--> Running actionlint" - @actionlint -.PHONY: lint - -## fmt: Run fixes for linters. -lint-fix: - @echo "--> Formatting go" - @golangci-lint run --fix - @echo "--> Formatting markdownlint" - @markdownlint --config .markdownlint.yaml --ignore './changelog.md' '**/*.md' -f -.PHONY: lint-fix - -## vet: Run go vet -vet: - @echo "--> Running go vet" - @go vet ./... -.PHONY: vet - -## mock-gen: generate mocks of types -mock-gen: - @echo "-> Generating mocks" - go run github.com/vektra/mockery/v3@latest -.PHONY: mock-gen diff --git a/tools/local-da/Dockerfile b/tools/local-da/Dockerfile index 0364731aa..134eeaa6b 100644 --- a/tools/local-da/Dockerfile +++ b/tools/local-da/Dockerfile @@ -3,8 +3,6 @@ FROM golang:1.25-alpine AS build-env WORKDIR /src #hadolint ignore=DL3018 -RUN apk add --no-cache make - COPY core core COPY go.mod go.sum ./ @@ -12,7 +10,7 @@ RUN go mod download COPY . . -RUN make build-da +RUN mkdir -p build && cd tools/local-da && go build -o /src/build/local-da . FROM alpine:3.22.2 diff --git a/tools/local-da/README.md b/tools/local-da/README.md index 0db00aacf..ec8813e35 100644 --- a/tools/local-da/README.md +++ b/tools/local-da/README.md @@ -11,7 +11,7 @@ It is intended to be used for testing DA layers without having to set up the act To build and run the local-da binary: ```sh -make build +just build ./build/local-da ``` diff --git a/tools/tools.mk b/tools/tools.mk deleted file mode 100644 index 2eefeec77..000000000 --- a/tools/tools.mk +++ /dev/null @@ -1,90 +0,0 @@ -# tools.mk - Build configuration for ev-node tools - -# Tool names -TOOLS := da-debug blob-decoder cache-analyzer - -# Build directory -TOOLS_BUILD_DIR := $(CURDIR)/build - -# Version information (inherited from main build.mk if available) -VERSION ?= $(shell git describe --tags --abbrev=0 2>/dev/null || echo "dev") -GITSHA ?= $(shell git rev-parse --short HEAD 2>/dev/null || echo "unknown") -LDFLAGS ?= \ - -X main.Version=$(VERSION) \ - -X main.GitSHA=$(GITSHA) - -# Individual tool build targets -## build-tool-da-debug: Build da-debug tool -build-tool-da-debug: - @echo "--> Building da-debug tool" - @mkdir -p $(TOOLS_BUILD_DIR) - @cd tools/da-debug && go build -ldflags "$(LDFLAGS)" -o $(TOOLS_BUILD_DIR)/da-debug . - @echo "--> da-debug built: $(TOOLS_BUILD_DIR)/da-debug" -.PHONY: build-tool-da-debug - -## build-tool-blob-decoder: Build blob-decoder tool -build-tool-blob-decoder: - @echo "--> Building blob-decoder tool" - @mkdir -p $(TOOLS_BUILD_DIR) - @cd tools/blob-decoder && go build -ldflags "$(LDFLAGS)" -o $(TOOLS_BUILD_DIR)/blob-decoder . - @echo "--> blob-decoder built: $(TOOLS_BUILD_DIR)/blob-decoder" -.PHONY: build-tool-blob-decoder - -## build-tool-cache-analyzer: Build cache-analyzer tool -build-tool-cache-analyzer: - @echo "--> Building cache-analyzer tool" - @mkdir -p $(TOOLS_BUILD_DIR) - @cd tools/cache-analyzer && go build -ldflags "$(LDFLAGS)" -o $(TOOLS_BUILD_DIR)/cache-analyzer . - @echo "--> cache-analyzer built: $(TOOLS_BUILD_DIR)/cache-analyzer" -.PHONY: build-tool-cache-analyzer - -# Build all tools -## build-tools: Build all tools -build-tools: $(addprefix build-tool-, $(TOOLS)) - @echo "--> All tools built successfully!" -.PHONY: build-tools - -# Install individual tools -## install-tool-da-debug: Install da-debug tool to Go bin -install-tool-da-debug: - @echo "--> Installing da-debug tool" - @cd tools/da-debug && go install -ldflags "$(LDFLAGS)" . - @echo "--> da-debug installed to Go bin" -.PHONY: install-tool-da-debug - -## install-tool-blob-decoder: Install blob-decoder tool to Go bin -install-tool-blob-decoder: - @echo "--> Installing blob-decoder tool" - @cd tools/blob-decoder && go install -ldflags "$(LDFLAGS)" . - @echo "--> blob-decoder installed to Go bin" -.PHONY: install-tool-blob-decoder - -## install-tool-cache-analyzer: Install cache-analyzer tool to Go bin -install-tool-cache-analyzer: - @echo "--> Installing cache-analyzer tool" - @cd tools/cache-analyzer && go install -ldflags "$(LDFLAGS)" . - @echo "--> cache-analyzer installed to Go bin" -.PHONY: install-tool-cache-analyzer - -# Install all tools -## install-tools: Install all tools to Go bin -install-tools: $(addprefix install-tool-, $(TOOLS)) - @echo "--> All tools installed successfully!" -.PHONY: install-tools - -# Clean built tools -## clean-tools: Remove built tool binaries -clean-tools: - @echo "--> Cleaning built tools" - @rm -f $(addprefix $(TOOLS_BUILD_DIR)/, $(TOOLS)) - @echo "--> Tools cleaned" -.PHONY: clean-tools - -# List available tools -## list-tools: List all available tools -list-tools: - @echo "Available tools:" - @for tool in $(TOOLS); do \ - echo " - $$tool"; \ - done -.PHONY: list-tools \ No newline at end of file