From e58f8d863583070655af4208a20c624765282ded Mon Sep 17 00:00:00 2001 From: refcell Date: Mon, 29 Apr 2024 09:09:28 -0700 Subject: [PATCH 1/4] feat: migrate to justfile over makefile --- Justfile | 76 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Makefile | 25 ------------------- 2 files changed, 76 insertions(+), 25 deletions(-) create mode 100644 Justfile delete mode 100644 Makefile diff --git a/Justfile b/Justfile new file mode 100644 index 00000000..1e0d921e --- /dev/null +++ b/Justfile @@ -0,0 +1,76 @@ +set positional-arguments +set dotenv-load := true + +alias t := test +alias b := build-all +alias l := lint +alias f := fmt + +# default recipe to display help information +default: + @just --list + +# Builds all docker images +build-all: + docker buildx build --platform linux/arm64,linux/amd64 -t a16zcrypto/magi --push . + +# Builds local magi docker images +build-local: + docker buildx build -t noah7545/magi --load . + +# Pulls all docker images +pull: + cd docker && docker compose pull + +# Cleans all docker images +clean: + cd docker && docker compose down -v --remove-orphans + +# Composes docker +run: + cd docker && docker compose up + +# Composes docker with local images +run-local: + make build-local && cd docker && docker compose up + +# Runs op-geth with docker +run-geth: + cd docker && COMPOSE_PROFILES=op-geth docker compose up + +# Runs op-erigon with docker +run-erigon: + cd docker && COMPOSE_PROFILES=op-erigon docker compose up + +# Run all tests +tests: test test-docs + +# Test for the native target with all features +test *args='': + cargo nextest run --all --all-features $@ + +# Lint for all available targets +lint: lint-native lint-docs + +# Fixes and checks the formatting +fmt: fmt-native-fix fmt-native-check + +# Fixes the formatting +fmt-native-fix: + cargo +nightly fmt --all + +# Check the formatting +fmt-native-check: + cargo +nightly fmt --all -- --check + +# Lints +lint-native: fmt-native-check + cargo +nightly clippy --all --all-features --all-targets -- -D warnings + +# Lint the Rust documentation +lint-docs: + RUSTDOCFLAGS="-D warnings" cargo doc --all --no-deps --document-private-items + +# Test the Rust documentation +test-docs: + cargo test --doc --all --locked diff --git a/Makefile b/Makefile deleted file mode 100644 index a76adac2..00000000 --- a/Makefile +++ /dev/null @@ -1,25 +0,0 @@ -.PHONY: build-all build-local pull clean run run-local run-geth run-erigon - -build-all: - docker buildx build --platform linux/arm64,linux/amd64 -t a16zcrypto/magi --push . - -build-local: - docker buildx build -t noah7545/magi --load . - -pull: - cd docker && docker compose pull - -clean: - cd docker && docker compose down -v --remove-orphans - -run: - cd docker && docker compose up - -run-local: - make build-local && cd docker && docker compose up - -run-geth: - cd docker && COMPOSE_PROFILES=op-geth docker compose up - -run-erigon: - cd docker && COMPOSE_PROFILES=op-erigon docker compose up From ca2a0dbaf159fd32f09e0a5722fcc957fedcc4c3 Mon Sep 17 00:00:00 2001 From: refcell Date: Mon, 29 Apr 2024 09:55:08 -0700 Subject: [PATCH 2/4] fix: doc cleaning --- Justfile | 4 ++-- docker/README.md | 4 +++- docs/devnet.md | 7 +++++-- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/Justfile b/Justfile index 1e0d921e..040638f2 100644 --- a/Justfile +++ b/Justfile @@ -31,8 +31,8 @@ run: cd docker && docker compose up # Composes docker with local images -run-local: - make build-local && cd docker && docker compose up +run-local: build-local + cd docker && docker compose up # Runs op-geth with docker run-geth: diff --git a/docker/README.md b/docker/README.md index 0bc1879d..529ca161 100644 --- a/docker/README.md +++ b/docker/README.md @@ -4,7 +4,9 @@ This contains a simple docker setup for running magi and op-geth. ## Running -Begin by copying `.env.default` to `.env`. You can set the network to sync to by changing the `NETWORK` value (supported options are optimism-goerli and base-goerli). Make sure to set the `L1_RPC_URL` value to a valid RPC URL for the L1 being used by the given network. If you are running in production, you may also want to set a secure `JWT_SECRET` value. You can create a new secret by running `openssl rand -hex 32`. +Begin by copying `.env.default` to `.env`. You can set the network to sync to by changing the `NETWORK` value (supported options are optimism-goerli and base-goerli). +Make sure to set the `L1_RPC_URL` value to a valid RPC URL for the L1 being used by the given network. If you are running in production, you may also want to set a secure `JWT_SECRET` value. +You can create a new secret by running `openssl rand -hex 32`. To run both magi and op-geth together, run `docker compose up`. To run just op-geth without magi for local development, run `COMPOSE_PROFILES=no-magi docker compose up` diff --git a/docs/devnet.md b/docs/devnet.md index cf5415d5..596f3133 100644 --- a/docs/devnet.md +++ b/docs/devnet.md @@ -18,7 +18,7 @@ To launch the OP devnet, ensure you have [Docker](https://www.docker.com/): cd optimism git submodule update --init --recursive - make devnet-up + just devnet-up For troubleshooting, please refer to the official [documentation](https://community.optimism.io/docs/developers/build/dev-node/#). @@ -130,6 +130,9 @@ To test withdrawal from your account refer to this [tutorial](https://stack.opti ## Trouble shooting -If the Magi node stops syncing, you can reset the devnet. To do this, navigate to the Optimism root directory and run the following command: make devnet-clean. Afterward, start again both the devnet and Magi. +If the Magi node stops syncing, you can reset the devnet. +To do this, navigate to the root of the Optimism monorepo directory +and run the following command: `make devnet-clean`. +Afterward, start again both the devnet and Magi. If the issue continues, please create a new issue on GitHub providing detailed information about the problem. From 6f54e492fb2c2201cd965e5e4bc7d9ae021b1696 Mon Sep 17 00:00:00 2001 From: refcell Date: Mon, 29 Apr 2024 09:55:51 -0700 Subject: [PATCH 3/4] fix: doc cleaning --- Justfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Justfile b/Justfile index 040638f2..0a21c76c 100644 --- a/Justfile +++ b/Justfile @@ -31,8 +31,8 @@ run: cd docker && docker compose up # Composes docker with local images -run-local: build-local - cd docker && docker compose up +run-local: + just build-local && cd docker && docker compose up # Runs op-geth with docker run-geth: From dbcb01600b216bec6c895a8c7d566c7b2c99cd3b Mon Sep 17 00:00:00 2001 From: refcell Date: Mon, 20 May 2024 11:53:42 -0400 Subject: [PATCH 4/4] fix: consistently use spaces --- Justfile | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Justfile b/Justfile index 0a21c76c..976e1742 100644 --- a/Justfile +++ b/Justfile @@ -24,23 +24,23 @@ pull: # Cleans all docker images clean: - cd docker && docker compose down -v --remove-orphans + cd docker && docker compose down -v --remove-orphans # Composes docker run: - cd docker && docker compose up + cd docker && docker compose up # Composes docker with local images run-local: - just build-local && cd docker && docker compose up + just build-local && cd docker && docker compose up # Runs op-geth with docker run-geth: - cd docker && COMPOSE_PROFILES=op-geth docker compose up + cd docker && COMPOSE_PROFILES=op-geth docker compose up # Runs op-erigon with docker run-erigon: - cd docker && COMPOSE_PROFILES=op-erigon docker compose up + cd docker && COMPOSE_PROFILES=op-erigon docker compose up # Run all tests tests: test test-docs