Skip to content

Commit 4fdca2b

Browse files
committed
simplify, more make helpers
1 parent dbf7b22 commit 4fdca2b

File tree

2 files changed

+28
-48
lines changed

2 files changed

+28
-48
lines changed

Makefile

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,14 @@ default: build
77
CARGO=cargo
88

99
## bindings: generating bindings
10-
bindings:
10+
bindings: _build_forge
1111
# Generate new bindings
1212
@forge bind --bindings-path ./crates/bindings --crate-name bindings --overwrite \
1313
--alloy --alloy-version v0.9.2
1414
@$(CARGO) fmt --manifest-path ./crates/bindings/Cargo.toml
1515

1616
## build: building the project
17-
build: bindings wasi-build
17+
build: _build_forge bindings wasi-build
1818
@$(CARGO) build --target-dir ./target --manifest-path ./app/Cargo.toml
1919

2020
## wasi-build: building the WAVS wasi component(s)
@@ -26,10 +26,6 @@ wasi-build:
2626
@mkdir -p ./compiled
2727
@cp ./target/wasm32-wasip1/release/*.wasm ./compiled/
2828

29-
## build-release: building the project in release mode
30-
build-release: bindings
31-
@$(CARGO) build --release
32-
3329
## update-submodules: update the git submodules
3430
update-submodules:
3531
@git submodule update --init --recursive
@@ -41,7 +37,7 @@ clean: clean-docker
4137

4238
## clean-docker: remove unused docker containers
4339
clean-docker:
44-
@docker rm -v $(shell docker ps --filter status=exited -q)
40+
@docker rm -v $(shell docker ps --filter status=exited -q) || true
4541

4642
## fmt: formatting solidity and rust code
4743
fmt:
@@ -51,7 +47,7 @@ fmt:
5147
## test: running forge and rust tests
5248
test:
5349
@forge test
54-
@$(CARGO) test
50+
@$(CARGO) test --manifest-path ./app/Cargo.toml
5551

5652
## setup: installing forge dependencies
5753
setup:
@@ -65,8 +61,11 @@ start-all: clean-docker
6561
@docker compose up
6662
@wait
6763

64+
_build_forge:
65+
@forge build
66+
6867
# Declare phony targets
69-
.PHONY: build build-release clean fmt bindings test
68+
.PHONY: build clean fmt bindings test
7069

7170
.PHONY: help
7271
help: Makefile

README.md

Lines changed: 20 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -18,66 +18,47 @@ Create a new project using this template:
1818

1919
```bash
2020
# If you don't have forge: `curl -L https://foundry.paradigm.xyz | bash`
21-
2221
forge init --template Lay3rLabs/wavs-foundry-template my-wavs
2322
```
2423

25-
## Testing
26-
27-
Given the repository contains both Solidity and Rust code, there's 2 different
28-
workflows.
29-
30-
### Setting up the Environment
31-
32-
Initialize the submodule dependencies:
24+
### Solidity
3325

3426
```bash
27+
# Initialize the submodule dependencies
3528
forge install
36-
```
37-
38-
Build the contracts:
3929

40-
```bash
30+
# Build the contracts
4131
forge build
42-
```
43-
44-
Run the tests:
4532

46-
```bash
33+
# Run the solidity tests. alias: `make test`
4734
forge test
4835
```
4936

50-
## Rust
37+
> You can also use `make build` to build the contracts, bindings, and components.
5138
52-
Rust bindings to the contracts can be generated via `forge bind`, which requires
53-
first building your contracts:
39+
## Rust
5440

5541
```bash
42+
# Generate new bindings from your contract(s)
5643
make bindings
57-
```
58-
59-
Then, you can run the tests:
6044

61-
```bash
62-
cargo test
45+
# Run rust tests
46+
make test
6347
```
6448

6549
## WAVS
6650

67-
Build the latest solidity:
51+
### Install the WAVS CLI
6852

6953
```bash
70-
make build
71-
```
72-
73-
Install the WAVS CLI:
74-
75-
```bash
76-
# MacOS: if you get permission errors: eval `ssh-agent -s`; ssh-add
54+
# MacOS: if you get permission errors: eval `ssh-agent -s` && ssh-add
7755
(cd lib/WAVS; cargo install --path ./packages/cli)
7856
```
7957

58+
### Start Anvil, WAVS, and Deploy Eigenlayer
59+
8060
```bash
61+
# copy over the .env file
8162
cp .env.example .env
8263

8364
# [!] Get your key from: https://openweathermap.org/
@@ -90,7 +71,7 @@ cp .env.example .env
9071
make start-all
9172
```
9273

93-
Upload your WAVS Service contract
74+
### Upload your WAVS Service Manager
9475

9576
```bash
9677
# Deploy (override: FOUNDRY_ANVIL_PRIVATE_KEY)
@@ -102,19 +83,19 @@ export SERVICE_MANAGER_ADDRESS=`jq -r '.transactions[] | select(.contractName ==
10283
echo "Service Manager Address: $SERVICE_MANAGER_ADDRESS"
10384
```
10485

105-
Build WAVS WASI component(s)
86+
### Build WASI components
87+
88+
> Install `cargo binstall cargo-component` if you have not already. -- https://github.com/bytecodealliance/cargo-component#installation
10689
10790
```bash
108-
# build all wasi components/*
109-
# https://github.com/bytecodealliance/cargo-component#installation / cargo binstall cargo-component
11091
make wasi-build
11192

112-
# Verify execution works as expected without deploying
11393
# TODO: currently broken upstream
94+
# Verify execution works as expected without deploying
11495
# wavs-cli exec --component $(pwd)/compiled/eth_trigger_weather.wasm --input Nashville,TN
11596
```
11697

117-
Deploy service and verify with adding a task
98+
## Deploy Service and Verify
11899

119100
```bash
120101
# add read-write access

0 commit comments

Comments
 (0)