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
6 changes: 3 additions & 3 deletions Cargo-component.lock
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ version = 1
name = "wavs:worker"

[[package.version]]
requirement = "^0.4.0-beta.4"
version = "0.4.0-beta.4"
digest = "sha256:daee6b7f83a38ebfe7ed168d17e4c97cf6dc2d1b5af3816d3088c19daf7c5d8c"
requirement = "^0.4.0"
version = "0.4.0"
digest = "sha256:3530635218173131d0af9f114f61d97f08f080b3e25f1daacb15dc6dafa302ec"
4 changes: 2 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ wit-bindgen-rt ={ version = "0.42.1", features = ["bitflags"]}
wit-bindgen = "0.42.1"
wstd = "0.5.3"
wasi = "0.14.1"
wavs-wasi-utils = "0.4.0-beta.4"
wavs-wasi-utils = "0.4.0"

# Other
serde = { version = "1.0.219", features = ["derive"] }
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ COIN_MARKET_CAP_ID?=1
COMPONENT_FILENAME?=evm_price_oracle.wasm
CREDENTIAL?=""
DOCKER_IMAGE?=ghcr.io/lay3rlabs/wavs:35c96a4
MIDDLEWARE_DOCKER_IMAGE?=ghcr.io/lay3rlabs/wavs-middleware:79dffa2
MIDDLEWARE_DOCKER_IMAGE?=ghcr.io/lay3rlabs/wavs-middleware:0.4.1
IPFS_ENDPOINT?=http://127.0.0.1:5001
RPC_URL?=http://127.0.0.1:8545
SERVICE_FILE?=.docker/service.json
Expand Down
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,8 @@ cargo binstall cargo-component wasm-tools warg-cli wkg --locked --no-confirm --f
wkg config --default-registry wa.dev
# Allow publishing to a registry
#
# if WSL: `warg config --keyring-backend linux-keyutils`
warg key new
```
Expand All @@ -130,7 +132,7 @@ warg key new
```bash docci-ignore
# if foundry is not installed:
# `curl -L https://foundry.paradigm.xyz | bash && $HOME/.foundry/bin/foundryup`
forge init --template Lay3rLabs/wavs-foundry-template my-wavs --branch main
forge init --template Lay3rLabs/wavs-foundry-template my-wavs --branch 0.4
```
> \[!TIP]
Expand Down
2 changes: 1 addition & 1 deletion components/evm-price-oracle/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,4 @@ lto = true

[package.metadata.component]
package = "component:evm-price-oracle"
target = "wavs:worker/layer-trigger-world@0.4.0-beta.4"
target = "wavs:worker/layer-trigger-world@0.4.0"
645 changes: 322 additions & 323 deletions components/evm-price-oracle/src/bindings.rs

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion components/golang-evm-price-oracle/Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
WAVS_PACKAGE=wavs:worker@0.4.0-beta.4
WAVS_PACKAGE=wavs:worker@0.4.0
WAVS_WIT_WORLD=wavs:worker/layer-trigger-world
# get the first line of the go.mod and get the last element after the last /, then replace - with _
GO_MOD_NAME?=$(shell head -n 1 go.mod | cut -d' ' -f2 | rev | cut -d'/' -f1 | rev | tr '-' '_')
Expand Down
2 changes: 1 addition & 1 deletion components/golang-evm-price-oracle/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ replace (
)

require (
github.com/Lay3rLabs/wavs-wasi/go v0.4.0-beta.4
github.com/Lay3rLabs/wavs-wasi/go v0.4.0
github.com/dev-wasm/dev-wasm-go/lib v0.0.0-20240907000152-b653306ed695
go.bytecodealliance.org/cm v0.2.2
)
Expand Down
4 changes: 2 additions & 2 deletions components/golang-evm-price-oracle/go.sum
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
github.com/Lay3rLabs/wavs-wasi/go v0.4.0-beta.4 h1:gAdI6IOn3OtVnR0226XlarZXYSSeNRRJ51o8eGyGOeA=
github.com/Lay3rLabs/wavs-wasi/go v0.4.0-beta.4/go.mod h1:+YuQa+Asl1vAeeXewN3ZAnLaP19aQMGrQU0bWWmvSpw=
github.com/Lay3rLabs/wavs-wasi/go v0.4.0 h1:2GFt3coPnonCY7fa5nY5kErZIBKZ725zlXnoH1NVIik=
github.com/Lay3rLabs/wavs-wasi/go v0.4.0/go.mod h1:+YuQa+Asl1vAeeXewN3ZAnLaP19aQMGrQU0bWWmvSpw=
github.com/Reecepbcups/dev-wasm-go/lib v1.0.0 h1:wehTQiW+QP71bX24iVZB5xxZdpbg9qcVb81zYvrvf4Y=
github.com/Reecepbcups/dev-wasm-go/lib v1.0.0/go.mod h1:IAZDQaELmHlCjhQkmfnFesp2pAymqgvlPak5JEdNu4c=
github.com/Reecepbcups/go-eth v0.7.1 h1:dH1E85arpYZAG33m1FPvFsEClgwPF3qXzWQW3oCmV1I=
Expand Down
2 changes: 1 addition & 1 deletion components/js-evm-price-oracle/Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
WAVS_PACKAGE=wavs:worker@0.4.0-beta.4
WAVS_PACKAGE=wavs:worker@0.4.0
WAVS_WIT_WORLD=wavs:worker/layer-trigger-world
OUTPUT_DIR?=../../compiled

Expand Down
2 changes: 1 addition & 1 deletion components/js-evm-price-oracle/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { TriggerAction, WasmResponse } from "./out/wavs:worker@0.4.0-beta.4";
import { TriggerAction, WasmResponse } from "./out/wavs:worker@0.4.0";
import { decodeTriggerEvent, encodeOutput, Destination } from "./trigger";

async function run(triggerAction: TriggerAction): Promise<WasmResponse> {
Expand Down
2 changes: 1 addition & 1 deletion docs/handbook/components/blockchain-interactions.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ The following dependencies are commonly required in your component's `Cargo.toml
[dependencies]
# Core WAVS blockchain functionality
wit-bindgen-rt = { workspace = true, features = ["bitflags"] } # Required for WASI bindings
wavs-wasi-utils = "0.4.0-beta.4" # Blockchain interaction utilities
wavs-wasi-utils = "0.4.0" # Blockchain interaction utilities
wstd = "0.5.3" # WASI standard library

# Alloy crates for Ethereum interaction
Expand Down
2 changes: 1 addition & 1 deletion docs/handbook/components/network-requests.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ The following dependencies are required for making HTTP requests from a componen

```toml Cargo.toml
[dependencies]
wavs-wasi-utils = "0.4.0-beta.4" # HTTP utilities
wavs-wasi-utils = "0.4.0" # HTTP utilities
wstd = "0.5.3" # Runtime utilities (includes block_on)
serde = { version = "1.0.219", features = ["derive"] } # Serialization
serde_json = "1.0.140" # JSON handling
Expand Down
2 changes: 1 addition & 1 deletion docs/handbook/template.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ lto = true

[package.metadata.component]
package = "component:evm-price-oracle"
target = "wavs:worker/layer-trigger-world@0.4.0-beta.4"
target = "wavs:worker/layer-trigger-world@0.4.0"

```

Expand Down
2 changes: 2 additions & 0 deletions docs/tutorial/2-setup.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,8 @@ cargo binstall cargo-component wasm-tools warg-cli wkg --locked --no-confirm --f
wkg config --default-registry wa.dev

# Allow publishing to a registry
#
# if WSL: `warg config --keyring-backend linux-keyutils`
warg key new
```

Expand Down
2 changes: 2 additions & 0 deletions docs/tutorial/5-build.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ cargo binstall cargo-component wasm-tools warg-cli wkg --locked --no-confirm --f
wkg config --default-registry wa.dev

# Allow publishing to a registry
#
# if WSL: `warg config --keyring-backend linux-keyutils`
warg key new
```

Expand Down
16 changes: 15 additions & 1 deletion docs/tutorial/6-run-service.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,20 @@ You can stop the services with `ctrl+c`. Some MacOS terminals require pressing t

</Callout>

<Callout title="Run super simple" type="info">

You can skip all the setup steps below and just run a single command to deploy and run the entire service setup

```bash
export RPC_URL=`bash ./script/get-rpc.sh`
export AGGREGATOR_URL=http://127.0.0.1:8001

bash ./script/deploy-script.sh
```

This performs all the below steps (with the exception of actually triggering the contract).

</Callout>

With the chain running, you can deploy and run your service.

Expand Down Expand Up @@ -129,7 +143,7 @@ export WAVS_SERVICE_MANAGER_ADDRESS=$(jq -r .addresses.WavsServiceManager ./.nod
COMMAND="register ${OPERATOR_PRIVATE_KEY} ${AVS_SIGNING_ADDRESS} 0.001ether" make wavs-middleware

# Verify registration
COMMAND="list_operator" PAST_BLOCKS=500 make wavs-middleware
COMMAND="list_operators" PAST_BLOCKS=500 make wavs-middleware
```

## Trigger the service
Expand Down
8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"@defi-wonderland/natspec-smells": "1.1.6",
"@openzeppelin/contracts": "^5.2.0",
"forge-std": "github:foundry-rs/forge-std#v1.9.6",
"@wavs/solidity": "0.4.0-rc",
"@wavs/solidity": "0.4.0",
"lint-staged": ">=10",
"solhint-community": "4.0.0",
"sort-package-json": "2.10.0"
Expand Down
7 changes: 7 additions & 0 deletions script/deploy-contracts.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,13 @@ if [ -z "$WAVS_SERVICE_MANAGER_ADDRESS" ]; then
fi
fi

forge build
if [ $? -ne 0 ]; then
echo "Forge build failed. Running 'npm install' and deleting the 'out/' and 'cache/' directory."
npm install
rm -rf out/ cache/
forge build
fi

export DEPLOYER_PK=$(cat .nodes/deployer)

Expand Down
11 changes: 9 additions & 2 deletions script/deploy-script.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
#!/bin/bash
# set -e

if [ ! -d compiled/ ] || [ -z "$(find compiled/ -name '*.wasm')" ]; then
echo "No WASM files found in compiled/. Building components."
make wasi-build
fi

if git status --porcelain | grep -q "^.* components/"; then
echo "Found pending changes in components/*, building"
WASI_BUILD_DIR=components/evm-price-oracle make wasi-build
Expand Down Expand Up @@ -73,7 +78,7 @@ IPFS_URL="${IPFS_GATEWAY}${ipfs_cid}"
echo "IPFS_URL=${IPFS_URL}"

echo "Querying to verify IPFS upload... (120 second timeout)"
curl ${IPFS_URL} --connect-timeout 120 --max-time 120
curl ${IPFS_URL} --connect-timeout 120 --max-time 120 --show-error --fail

if [ "$DEPLOYER_PK" ]; then
echo ""
Expand Down Expand Up @@ -103,6 +108,8 @@ sleep 5
WAVS_ENDPOINT=http://127.0.0.1:8000 SERVICE_URL=${IPFS_URI} IPFS_GATEWAY=${IPFS_GATEWAY} make deploy-service

### === Register service specific operator ===

# OPERATOR_PRIVATE_KEY, AVS_SIGNING_ADDRESS
SERVICE_INDEX=0 source ./script/avs-signing-key.sh

# TODO: move this check into the middleware (?)
Expand All @@ -124,6 +131,6 @@ export WAVS_SERVICE_MANAGER_ADDRESS=$(jq -r .addresses.WavsServiceManager ./.nod
COMMAND="register ${OPERATOR_PRIVATE_KEY} ${AVS_SIGNING_ADDRESS} 0.001ether" make wavs-middleware

# Verify registration
COMMAND="list_operator" PAST_BLOCKS=500 make wavs-middleware
COMMAND="list_operators" PAST_BLOCKS=500 make wavs-middleware

echo "✅ Deployment complete!"
2 changes: 1 addition & 1 deletion script/start_all.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ else
fi

PORT=8545
MIDDLEWARE_IMAGE=ghcr.io/lay3rlabs/wavs-middleware:0.4.0-beta.6
MIDDLEWARE_IMAGE=ghcr.io/lay3rlabs/wavs-middleware:0.4.0
FORK_RPC_URL=${FORK_RPC_URL:-"${TESTNET_RPC_URL}"}
DEPLOY_ENV=$(sh ./script/get-deploy-status.sh)

Expand Down
29 changes: 23 additions & 6 deletions src/contracts/WavsSubmit.sol
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ contract SimpleSubmit is ITypes, IWavsServiceHandler {
/// @notice Mapping of trigger data
mapping(TriggerId _triggerId => bytes _data) internal _datas;
/// @notice Mapping of trigger signatures
mapping(TriggerId _triggerId => SignatureData _signature) internal _signatures;
mapping(TriggerId _triggerId => SignatureData _signature)
internal _signatures;

/// @notice Service manager instance
IWavsServiceManager private _serviceManager;
Expand All @@ -25,25 +26,41 @@ contract SimpleSubmit is ITypes, IWavsServiceHandler {
}

/// @inheritdoc IWavsServiceHandler
function handleSignedEnvelope(Envelope calldata envelope, SignatureData calldata signatureData) external {
function handleSignedEnvelope(
Envelope calldata envelope,
SignatureData calldata signatureData
) external {
_serviceManager.validate(envelope, signatureData);

DataWithId memory dataWithId = abi.decode(envelope.payload, (DataWithId));
DataWithId memory dataWithId = abi.decode(
envelope.payload,
(DataWithId)
);

_signatures[dataWithId.triggerId] = signatureData;
_datas[dataWithId.triggerId] = dataWithId.data;
_validTriggers[dataWithId.triggerId] = true;
}

function isValidTriggerId(TriggerId _triggerId) external view returns (bool _isValid) {
function isValidTriggerId(
TriggerId _triggerId
) external view returns (bool _isValid) {
_isValid = _validTriggers[_triggerId];
}

function getSignature(TriggerId _triggerId) external view returns (SignatureData memory _signature) {
function getSignature(
TriggerId _triggerId
) external view returns (SignatureData memory _signature) {
_signature = _signatures[_triggerId];
}

function getData(TriggerId _triggerId) external view returns (bytes memory _data) {
function getData(
TriggerId _triggerId
) external view returns (bytes memory _data) {
_data = _datas[_triggerId];
}

function getServiceManager() external view returns (address) {
return address(_serviceManager);
}
}