diff --git a/.github/scripts/cargo-check.sh b/.github/scripts/cargo-check.sh new file mode 100755 index 00000000..dd6c6845 --- /dev/null +++ b/.github/scripts/cargo-check.sh @@ -0,0 +1,12 @@ +#!/bin/bash +set -e + +fmt_sort(){ + while read path; do + printf "Project: %s\n" "$path" + cargo fmt --all --check --manifest-path "$path" + (cd "${path%/*}"; cargo sort --workspace --check) + done +} + +grep -rl --include "Cargo.toml" '\[workspace\]' | sort -u | fmt_sort diff --git a/.github/scripts/cargo-clippy.sh b/.github/scripts/cargo-clippy.sh new file mode 100755 index 00000000..7cd53210 --- /dev/null +++ b/.github/scripts/cargo-clippy.sh @@ -0,0 +1,11 @@ +#!/bin/bash +set -e + +clippy(){ + while read path; do + printf "Project: %s\n" "$path" + cargo clippy --workspace --all-targets --all-features --manifest-path "$path" + done +} + +grep -rl --include "Cargo.toml" '\[workspace\]' | sort -u | clippy diff --git a/.github/scripts/cargo-test.sh b/.github/scripts/cargo-test.sh new file mode 100755 index 00000000..a15b9d3a --- /dev/null +++ b/.github/scripts/cargo-test.sh @@ -0,0 +1,12 @@ +#!/bin/bash +set -e + +build_test(){ + while read path; do + printf "Project: %s\n" "$path" + cargo build --workspace --all-features --manifest-path "$path" + cargo test --workspace --all-features --manifest-path "$path" + done +} + +find . -maxdepth 2 -mindepth 2 -name 'Cargo.toml' | sort -u | build_test diff --git a/.github/scripts/forge-check.sh b/.github/scripts/forge-check.sh new file mode 100755 index 00000000..a6aaf9f8 --- /dev/null +++ b/.github/scripts/forge-check.sh @@ -0,0 +1,11 @@ +#!/bin/bash +set -e + +fmt(){ + while read path; do + printf "Project: %s\n" "$path" + (cd "${path%/*}"; forge fmt --check) + done +} + +find . -maxdepth 2 -mindepth 2 -name 'foundry.toml' | sort -u | fmt diff --git a/.github/scripts/forge-test.sh b/.github/scripts/forge-test.sh new file mode 100755 index 00000000..28396bf4 --- /dev/null +++ b/.github/scripts/forge-test.sh @@ -0,0 +1,11 @@ +#!/bin/bash +set -e + +test(){ + while read path; do + printf "Project: %s\n" "$path" + (cd "${path%/*}"; forge test -vvvv) + done +} + +find . -maxdepth 2 -mindepth 2 -name 'foundry.toml' | sort -u | test diff --git a/examples/erc20-counter/apps/src/bin/publisher.rs b/examples/erc20-counter/apps/src/bin/publisher.rs index ebaa3a52..d8a5a71e 100644 --- a/examples/erc20-counter/apps/src/bin/publisher.rs +++ b/examples/erc20-counter/apps/src/bin/publisher.rs @@ -102,7 +102,10 @@ async fn main() -> Result<()> { .on_http(args.eth_rpc_url); // Create an EVM environment from that provider defaulting to the latest block. - let mut env = EthEvmEnv::builder().provider(provider.clone()).build().await?; + let mut env = EthEvmEnv::builder() + .provider(provider.clone()) + .build() + .await?; // The `with_chain_spec` method is used to specify the chain configuration. env = env.with_chain_spec(Ð_SEPOLIA_CHAIN_SPEC); diff --git a/examples/erc20-counter/rust-toolchain.toml b/examples/erc20-counter/rust-toolchain.toml index cb78e29e..3fd28115 100644 --- a/examples/erc20-counter/rust-toolchain.toml +++ b/examples/erc20-counter/rust-toolchain.toml @@ -1,5 +1,4 @@ [toolchain] -channel = "1.79" +channel = "stable" components = ["clippy", "rustfmt", "rust-src"] -targets = [] -profile = "minimal" \ No newline at end of file +profile = "minimal" diff --git a/examples/erc20/host/src/main.rs b/examples/erc20/host/src/main.rs index 8290d637..b9107361 100644 --- a/examples/erc20/host/src/main.rs +++ b/examples/erc20/host/src/main.rs @@ -19,7 +19,6 @@ use clap::Parser; use erc20_methods::ERC20_GUEST_ELF; use risc0_steel::{ ethereum::{EthEvmEnv, ETH_SEPOLIA_CHAIN_SPEC}, - host::BlockNumberOrTag, Contract, }; use risc0_zkvm::{default_executor, ExecutorEnv}; diff --git a/examples/erc20/rust-toolchain.toml b/examples/erc20/rust-toolchain.toml index 36614c30..3fd28115 100644 --- a/examples/erc20/rust-toolchain.toml +++ b/examples/erc20/rust-toolchain.toml @@ -1,4 +1,4 @@ [toolchain] channel = "stable" -components = ["rustfmt", "rust-src"] +components = ["clippy", "rustfmt", "rust-src"] profile = "minimal" diff --git a/examples/token-stats/Cargo.toml b/examples/token-stats/Cargo.toml index 60a3170f..729cb694 100644 --- a/examples/token-stats/Cargo.toml +++ b/examples/token-stats/Cargo.toml @@ -18,7 +18,8 @@ alloy-sol-types = { version = "0.8" } anyhow = "1.0" clap = { version = "4.4", features = ["derive", "env"] } log = "0.4" -methods = { path = "methods" } +token-stats-core = { path = "core" } +token-stats-methods = { path = "methods" } once_cell = "1.19" rlp = "0.5.2" serde = "1.0" diff --git a/examples/token-stats/core/Cargo.toml b/examples/token-stats/core/Cargo.toml index e6fa7002..7c769ea4 100644 --- a/examples/token-stats/core/Cargo.toml +++ b/examples/token-stats/core/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "core" +name = "token-stats-core" version = "0.1.0" edition = "2021" diff --git a/examples/token-stats/host/Cargo.toml b/examples/token-stats/host/Cargo.toml index 4f6469d7..575c546f 100644 --- a/examples/token-stats/host/Cargo.toml +++ b/examples/token-stats/host/Cargo.toml @@ -7,10 +7,10 @@ edition = "2021" alloy-sol-types = { workspace = true } anyhow = { workspace = true } clap = { workspace = true } -core = { path = "../core" } -methods = { workspace = true } risc0-steel = { workspace = true, features = ["host"] } risc0-zkvm = { workspace = true, features = ["client"] } +token-stats-core = { workspace = true } +token-stats-methods = { workspace = true } tokio = { workspace = true } tracing-subscriber = { workspace = true } url = { workspace = true } diff --git a/examples/token-stats/host/src/main.rs b/examples/token-stats/host/src/main.rs index f3d65517..52c23d82 100644 --- a/examples/token-stats/host/src/main.rs +++ b/examples/token-stats/host/src/main.rs @@ -15,13 +15,13 @@ use alloy_sol_types::{SolCall, SolValue}; use anyhow::{Context, Result}; use clap::Parser; -use core::{APRCommitment, CometMainInterface, CONTRACT}; -use methods::TOKEN_STATS_ELF; use risc0_steel::{ ethereum::{EthEvmEnv, ETH_MAINNET_CHAIN_SPEC}, Contract, }; use risc0_zkvm::{default_executor, ExecutorEnv}; +use token_stats_core::{APRCommitment, CometMainInterface, CONTRACT}; +use token_stats_methods::TOKEN_STATS_ELF; use tracing_subscriber::EnvFilter; use url::Url; diff --git a/examples/token-stats/methods/Cargo.toml b/examples/token-stats/methods/Cargo.toml index 6de3c23b..f6449c19 100644 --- a/examples/token-stats/methods/Cargo.toml +++ b/examples/token-stats/methods/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "methods" +name = "token-stats-methods" version = "0.1.0" edition = "2021" diff --git a/examples/token-stats/methods/guest/src/main.rs b/examples/token-stats/methods/guest/src/main.rs index 59ed016b..86403326 100644 --- a/examples/token-stats/methods/guest/src/main.rs +++ b/examples/token-stats/methods/guest/src/main.rs @@ -13,12 +13,12 @@ // limitations under the License. use alloy_sol_types::SolValue; -use core::{APRCommitment, CometMainInterface, CONTRACT}; use risc0_steel::{ ethereum::{EthEvmInput, ETH_MAINNET_CHAIN_SPEC}, Contract, }; use risc0_zkvm::guest::env; +use token_stats_core::{APRCommitment, CometMainInterface, CONTRACT}; const SECONDS_PER_YEAR: u64 = 60 * 60 * 24 * 365; diff --git a/examples/token-stats/rust-toolchain.toml b/examples/token-stats/rust-toolchain.toml index 6c18dfcd..3fd28115 100644 --- a/examples/token-stats/rust-toolchain.toml +++ b/examples/token-stats/rust-toolchain.toml @@ -1,4 +1,4 @@ [toolchain] channel = "stable" -components = ["rustfmt", "rust-src"] -profile = "minimal" \ No newline at end of file +components = ["clippy", "rustfmt", "rust-src"] +profile = "minimal"