From 4222cfa2565d9a03087198263cf51733bbf6adff Mon Sep 17 00:00:00 2001 From: Samuel Laferriere Date: Mon, 16 Dec 2024 14:58:30 -0500 Subject: [PATCH 01/13] ci: add rust_ci.yaml github workflow --- .github/workflows/rust_ci.yaml | 153 +++++++++++++++++++++++++++++++++ Cargo.toml | 2 +- 2 files changed, 154 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/rust_ci.yaml diff --git a/.github/workflows/rust_ci.yaml b/.github/workflows/rust_ci.yaml new file mode 100644 index 0000000..d97c561 --- /dev/null +++ b/.github/workflows/rust_ci.yaml @@ -0,0 +1,153 @@ +name: Rust CI + +on: + push: + branches: [master] + merge_group: + pull_request: + +env: + CARGO_TERM_COLOR: always + +jobs: + cargo-tests: + runs-on: ubuntu-latest + timeout-minutes: 20 + name: test + steps: + - name: Checkout sources + uses: actions/checkout@v4 + with: + submodules: true + - uses: taiki-e/install-action@just + - name: Install Rust stable toolchain + uses: dtolnay/rust-toolchain@stable + - uses: Swatinem/rust-cache@v2 + with: + cache-on-failure: true + - uses: taiki-e/install-action@nextest + - name: cargo test + run: just test + cargo-lint: + runs-on: ubuntu-latest + timeout-minutes: 20 + strategy: + matrix: + # TODO: add back cannon and asterisc once we are using them + # See https://github.com/Layr-Labs/kona/blob/main/.github/workflows/rust_ci.yaml + target: ["native"] + name: lint-${{ matrix.target }} + steps: + - name: Checkout sources + uses: actions/checkout@v4 + with: + submodules: true + - uses: taiki-e/install-action@just + - name: Install Rust nightly toolchain + uses: dtolnay/rust-toolchain@nightly + with: + components: rustfmt, clippy + - uses: Swatinem/rust-cache@v2 + with: + cache-on-failure: true + prefix-key: ${{ matrix.target }} + - name: Log into ghcr + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + - name: fmt + lint + run: just lint-${{ matrix.target }} + - name: chown target + run: | + sudo chown -R $(id -u):$(id -g) ./target + cargo-build-benches: + runs-on: ubuntu-latest + timeout-minutes: 20 + name: build-benchmarks + continue-on-error: true + steps: + - name: Checkout sources + uses: actions/checkout@v4 + with: + submodules: true + - uses: taiki-e/install-action@just + - name: Install Rust stable toolchain + uses: dtolnay/rust-toolchain@stable + - uses: Swatinem/rust-cache@v2 + with: + cache-on-failure: true + - name: build benches + run: cargo bench --no-run --workspace --all --features test-utils + - name: chown target + run: | + sudo chown -R $(id -u):$(id -g) ./target + cargo-build: + runs-on: ubuntu-latest + timeout-minutes: 20 + strategy: + matrix: + # TODO: add back cannon and asterisc once we are using them + # See https://github.com/Layr-Labs/kona/blob/main/.github/workflows/rust_ci.yaml + target: ["native"] + name: build-${{ matrix.target }} + continue-on-error: true + steps: + - name: Checkout sources + uses: actions/checkout@v4 + with: + submodules: true + - uses: taiki-e/install-action@just + - name: Install Rust stable toolchain + uses: dtolnay/rust-toolchain@stable + - uses: Swatinem/rust-cache@v2 + with: + cache-on-failure: true + prefix-key: ${{ matrix.target }} + - name: Log into ghcr + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + - name: build + run: just build-${{ matrix.target }} + - name: chown target + run: | + sudo chown -R $(id -u):$(id -g) ./target + cargo-doc: + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - name: Checkout sources + uses: actions/checkout@v4 + with: + submodules: true + - uses: taiki-e/install-action@just + - name: Install Rust stable toolchain + uses: dtolnay/rust-toolchain@stable + - uses: Swatinem/rust-cache@v2 + with: + cache-on-failure: true + - name: doclint + run: just lint-docs + - name: doctest + run: just test-docs + cargo-hack: + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - name: Checkout sources + uses: actions/checkout@v4 + with: + submodules: true + - uses: taiki-e/install-action@just + - name: Install Rust stable toolchain + uses: dtolnay/rust-toolchain@stable + - uses: taiki-e/install-action@cargo-hack + - uses: Swatinem/rust-cache@v2 + with: + cache-on-failure: true + - name: cargo hack + run: just hack diff --git a/Cargo.toml b/Cargo.toml index 1408458..130a138 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [workspace] resolver = "2" -members = ["bin/*"] +members = ["bin/*", "crates/*"] [workspace.dependencies] # Workspace From e43b5013565e3088ee182f183153f65cff441fcc Mon Sep 17 00:00:00 2001 From: Samuel Laferriere Date: Mon, 16 Dec 2024 15:09:45 -0500 Subject: [PATCH 02/13] ci: remove benchmark from rust_ci since we don't have any --- .github/workflows/rust_ci.yaml | 21 --------------------- 1 file changed, 21 deletions(-) diff --git a/.github/workflows/rust_ci.yaml b/.github/workflows/rust_ci.yaml index d97c561..016bfbd 100644 --- a/.github/workflows/rust_ci.yaml +++ b/.github/workflows/rust_ci.yaml @@ -62,27 +62,6 @@ jobs: - name: chown target run: | sudo chown -R $(id -u):$(id -g) ./target - cargo-build-benches: - runs-on: ubuntu-latest - timeout-minutes: 20 - name: build-benchmarks - continue-on-error: true - steps: - - name: Checkout sources - uses: actions/checkout@v4 - with: - submodules: true - - uses: taiki-e/install-action@just - - name: Install Rust stable toolchain - uses: dtolnay/rust-toolchain@stable - - uses: Swatinem/rust-cache@v2 - with: - cache-on-failure: true - - name: build benches - run: cargo bench --no-run --workspace --all --features test-utils - - name: chown target - run: | - sudo chown -R $(id -u):$(id -g) ./target cargo-build: runs-on: ubuntu-latest timeout-minutes: 20 From c93d973f9bd849d62214d64a5b47f9133eb13102 Mon Sep 17 00:00:00 2001 From: Samuel Laferriere Date: Mon, 16 Dec 2024 16:28:12 -0500 Subject: [PATCH 03/13] test: add dummy test in eigenda_data just to make `just test` not complain --- crates/eigenda/src/eigenda_data.rs | 32 ++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/crates/eigenda/src/eigenda_data.rs b/crates/eigenda/src/eigenda_data.rs index 754f3a2..5d593ec 100644 --- a/crates/eigenda/src/eigenda_data.rs +++ b/crates/eigenda/src/eigenda_data.rs @@ -17,3 +17,35 @@ impl EigenDABlobData { Ok(self.blob.clone()) } } + +#[cfg(test)] +mod tests { + use super::*; + use alloc::vec; + use alloy_primitives::Bytes; + + #[test] + fn test_decode_success() { + let data = EigenDABlobData { + blob: Bytes::from(vec![1, 2, 3, 4]), + }; + let result = data.decode(); + assert!(result.is_ok()); + assert_eq!(result.unwrap(), Bytes::from(vec![1, 2, 3, 4])); + } + + #[test] + fn test_decode_empty_blob() { + let data = EigenDABlobData { + blob: Bytes::from(vec![]), + }; + let result = data.decode(); + assert!(result.is_ok()); + assert_eq!(result.unwrap(), Bytes::from(vec![])); + } + + #[test] + fn test_decode_invalid_blob() { + // TODO: implement this once decode actually does something + } +} From 9daf2e4300c0e7e5cd3a800ab1fabf0994e411b6 Mon Sep 17 00:00:00 2001 From: Samuel Laferriere Date: Mon, 16 Dec 2024 16:52:29 -0500 Subject: [PATCH 04/13] style: fix lint issues --- bin/host/src/eigenda_blobs.rs | 2 +- bin/host/src/fetcher/mod.rs | 2 +- bin/host/src/lib.rs | 2 - crates/eigenda/src/eigenda_blobs.rs | 64 ++++++++++++++-------------- crates/eigenda/src/eigenda_data.rs | 1 + crates/eigenda/src/traits.rs | 6 ++- crates/proof/src/eigenda_provider.rs | 6 +-- crates/proof/src/hint.rs | 8 ++-- 8 files changed, 48 insertions(+), 43 deletions(-) diff --git a/bin/host/src/eigenda_blobs.rs b/bin/host/src/eigenda_blobs.rs index cbc0e51..f9c675b 100644 --- a/bin/host/src/eigenda_blobs.rs +++ b/bin/host/src/eigenda_blobs.rs @@ -2,7 +2,7 @@ use alloy_primitives::Bytes; use anyhow::Ok; use reqwest; -/// An online implementation of the [EigenDABlobProvider] trait. +/// Fetches blobs from EigenDA via an eigenda-proxy instance. #[derive(Debug, Clone)] pub struct OnlineEigenDABlobProvider { /// The base url. diff --git a/bin/host/src/fetcher/mod.rs b/bin/host/src/fetcher/mod.rs index 8993882..24a908d 100644 --- a/bin/host/src/fetcher/mod.rs +++ b/bin/host/src/fetcher/mod.rs @@ -569,7 +569,7 @@ where kv_write_lock.set(key.into(), preimage.into())?; } } - HintType::AltDACommitment => { + HintType::EigenDACommitment => { let cert = hint_data; info!(target: "fetcher", "Fetching AltDACommitment cert: {:?}", cert); // Fetch the blob sidecar from the blob provider. diff --git a/bin/host/src/lib.rs b/bin/host/src/lib.rs index 5881630..6c6a6b1 100644 --- a/bin/host/src/lib.rs +++ b/bin/host/src/lib.rs @@ -12,8 +12,6 @@ use kona_host::cli::HostCli; use kona_host::kv; -use hokulea_client; - use crate::eigenda_blobs::OnlineEigenDABlobProvider; use anyhow::{anyhow, Result}; use fetcher::Fetcher; diff --git a/crates/eigenda/src/eigenda_blobs.rs b/crates/eigenda/src/eigenda_blobs.rs index c8e023e..1fb3957 100644 --- a/crates/eigenda/src/eigenda_blobs.rs +++ b/crates/eigenda/src/eigenda_blobs.rs @@ -37,6 +37,38 @@ where } } + /// Fetches the next blob from the source. + pub async fn next(&mut self, altda_commitment: &Bytes) -> PipelineResult { + info!(target: "eigenda-blobsource", "next"); + self.load_blobs(altda_commitment).await?; + info!(target: "eigenda-blobsource", "next 1"); + let next_data = match self.next_data() { + Ok(d) => d, + Err(e) => return e, + }; + info!(target: "eigenda-blobsource", "next 2"); + // Decode the blob data to raw bytes. + // Otherwise, ignore blob and recurse next. + match next_data.decode() { + Ok(d) => { + info!(target: "eigenda-blobsource", "next 3"); + Ok(d) + } + Err(_) => { + warn!(target: "blob-source", "Failed to decode blob data, skipping"); + panic!() + // todo need to add recursion + // self.next(altda_commitment).await + } + } + } + + /// Clears the source. + pub fn clear(&mut self) { + self.data.clear(); + self.open = false; + } + /// Loads blob data into the source if it is not open. async fn load_blobs(&mut self, altda_commitment: &Bytes) -> Result<(), BlobProviderError> { if self.open { @@ -60,7 +92,7 @@ where } Err(_) => { self.open = true; - return Ok(()); + Ok(()) } } } @@ -73,34 +105,4 @@ where } Ok(self.data.remove(0)) } - - pub async fn next(&mut self, altda_commitment: &Bytes) -> PipelineResult { - info!(target: "eigenda-blobsource", "next"); - self.load_blobs(altda_commitment).await?; - info!(target: "eigenda-blobsource", "next 1"); - let next_data = match self.next_data() { - Ok(d) => d, - Err(e) => return e, - }; - info!(target: "eigenda-blobsource", "next 2"); - // Decode the blob data to raw bytes. - // Otherwise, ignore blob and recurse next. - match next_data.decode() { - Ok(d) => { - info!(target: "eigenda-blobsource", "next 3"); - Ok(d) - } - Err(_) => { - warn!(target: "blob-source", "Failed to decode blob data, skipping"); - panic!() - // todo need to add recursion - // self.next(altda_commitment).await - } - } - } - - pub fn clear(&mut self) { - self.data.clear(); - self.open = false; - } } diff --git a/crates/eigenda/src/eigenda_data.rs b/crates/eigenda/src/eigenda_data.rs index 5d593ec..7a60e9d 100644 --- a/crates/eigenda/src/eigenda_data.rs +++ b/crates/eigenda/src/eigenda_data.rs @@ -3,6 +3,7 @@ use alloy_primitives::Bytes; use kona_derive::errors::BlobDecodingError; #[derive(Default, Clone, Debug)] +/// Represents the data structure for EigenDA Blob. pub struct EigenDABlobData { /// The calldata pub(crate) blob: Bytes, diff --git a/crates/eigenda/src/traits.rs b/crates/eigenda/src/traits.rs index 2fbd23e..5fad440 100644 --- a/crates/eigenda/src/traits.rs +++ b/crates/eigenda/src/traits.rs @@ -4,12 +4,16 @@ use async_trait::async_trait; use core::fmt::Display; use kona_derive::errors::PipelineErrorKind; +/// A trait for providing EigenDA blobs. +/// TODO: add explanation for why we need this to be a trait. #[async_trait] pub trait EigenDABlobProvider { - /// The error type for the [EigenDAProvider]. + /// The error type for the [EigenDABlobProvider]. type Error: Display + ToString + Into; + /// Fetches a blob. async fn get_blob(&mut self, cert: &Bytes) -> Result; + /// Fetches an element from a blob. async fn get_element(&mut self, cert: &Bytes, element: &Bytes) -> Result; } diff --git a/crates/proof/src/eigenda_provider.rs b/crates/proof/src/eigenda_provider.rs index 14647bd..63a81f4 100644 --- a/crates/proof/src/eigenda_provider.rs +++ b/crates/proof/src/eigenda_provider.rs @@ -29,7 +29,7 @@ impl EigenDABlobProvider for OracleEigenDAProvider async fn get_blob(&mut self, cert: &Bytes) -> Result { self.oracle - .write(&HintType::AltDACommitment.encode_with(&[&cert])) + .write(&HintType::EigenDACommitment.encode_with(&[cert])) .await .map_err(OracleProviderError::Preimage)?; let data = self @@ -45,14 +45,14 @@ impl EigenDABlobProvider for OracleEigenDAProvider async fn get_element(&mut self, cert: &Bytes, element: &Bytes) -> Result { self.oracle - .write(&HintType::AltDACommitment.encode_with(&[&cert])) + .write(&HintType::EigenDACommitment.encode_with(&[cert])) .await .map_err(OracleProviderError::Preimage)?; let cert_point_key = Bytes::copy_from_slice(&[cert.to_vec(), element.to_vec()].concat()); self.oracle - .write(&HintType::AltDACommitment.encode_with(&[&cert_point_key])) + .write(&HintType::EigenDACommitment.encode_with(&[&cert_point_key])) .await .map_err(OracleProviderError::Preimage)?; let data = self diff --git a/crates/proof/src/hint.rs b/crates/proof/src/hint.rs index 75a6581..7863207 100644 --- a/crates/proof/src/hint.rs +++ b/crates/proof/src/hint.rs @@ -79,8 +79,8 @@ pub enum HintType { /// A hint that specifies bulk storage of all the code, state and keys generated by an /// execution witness. L2PayloadWitness, - /// - AltDACommitment, + /// A hint that specifies the EigenDA commitment. + EigenDACommitment, } impl HintType { @@ -109,7 +109,7 @@ impl TryFrom<&str> for HintType { "l2-account-proof" => Ok(Self::L2AccountProof), "l2-account-storage-proof" => Ok(Self::L2AccountStorageProof), "l2-payload-witness" => Ok(Self::L2PayloadWitness), - "altda-commitment" => Ok(Self::AltDACommitment), + "altda-commitment" => Ok(Self::EigenDACommitment), _ => Err(HintParsingError(value.to_string())), } } @@ -131,7 +131,7 @@ impl From for &str { HintType::L2AccountProof => "l2-account-proof", HintType::L2AccountStorageProof => "l2-account-storage-proof", HintType::L2PayloadWitness => "l2-payload-witness", - HintType::AltDACommitment => "altda-commitment", + HintType::EigenDACommitment => "altda-commitment", } } } From d9f873e3dd16402430cd4cc91f9c383257607041 Mon Sep 17 00:00:00 2001 From: Samuel Laferriere Date: Mon, 16 Dec 2024 17:27:43 -0500 Subject: [PATCH 05/13] style: beautify justfile layout to make it easier to read --- justfile | 113 ++++++++++++++++++++++++++++++------------------------- 1 file changed, 62 insertions(+), 51 deletions(-) diff --git a/justfile b/justfile index 684b6ba..7889eec 100644 --- a/justfile +++ b/justfile @@ -1,14 +1,11 @@ set positional-arguments -alias l := lint-native -alias lint := lint-native -alias f := fmt-native-fix -alias b := build -alias h := hack # default recipe to display help information default: @just --list +############################### STYLE ############################### + # unused-deps finds unused dependencies in the workspace. # See https://rustprojectprimer.com/checks/unused.html # machete runs very fast but is less accurate, on by default. @@ -17,6 +14,46 @@ unused-deps slow="false": cargo machete # cargo +nightly udeps +# Lint the workspace for all available targets +alias la := lint +lint: lint-native lint-docs + +# Lint the workspace +alias l := lint-native +alias lint := lint-native +lint-native: fmt-native-check lint-docs + cargo +nightly clippy --workspace --all --all-features --all-targets -- -D warnings + +# Lint the Rust documentation +lint-docs: + RUSTDOCFLAGS="-D warnings" cargo doc --all --no-deps --document-private-items + +# Runs `cargo hack check` against the workspace +alias h := hack +hack: + cargo hack check --feature-powerset --no-dev-deps + +# Fixes the formatting of the workspace +alias f := fmt-native-fix +fmt-native-fix: + cargo +nightly fmt --all + +# Check the formatting of the workspace +fmt-native-check: + cargo +nightly fmt --all -- --check + +############################### BUILD ############################### + +# Build the workspace for all available targets +alias b := build +build: build-native + +# Build for the native target +build-native *args='': + cargo build --workspace $@ + +############################### UNIT TESTS ############################### + # Run all tests (excluding online tests) alias t := tests tests: test test-docs @@ -26,9 +63,28 @@ test *args="-E '!test(test_online)'": cargo nextest run --workspace --all --all-features {{args}} # Run all online tests +# TODO: understand when this is needed test-online: just test "-E 'test(test_online)'" +# Test the Rust documentation +test-docs: + cargo test --doc --all --locked + +############################### E2E TESTS ############################### + +# TODO: Use the below stuff to add an e2e test for the client program using hokulea + +# Clones and checks out the monorepo at the commit present in `.monorepo` +monorepo: + ([ ! -d monorepo ] && git clone https://github.com/ethereum-optimism/monorepo) || exit 0 + cd monorepo && git checkout $(cat ../.monorepo) + +# Updates the pinned version of the monorepo +update-monorepo: + [ ! -d monorepo ] && git clone https://github.com/ethereum-optimism/monorepo + cd monorepo && git rev-parse HEAD > ../.monorepo + # Run action tests for the client program on the native target action-tests test_name='Test_ProgramAction' *args='': #!/bin/bash @@ -52,49 +108,4 @@ action-tests test_name='Test_ProgramAction' *args='': # Clean the action tests directory clean-actions: - rm -rf monorepo/ - -# Lint the workspace for all available targets -alias la := lint-all -lint-all: lint-native lint-docs - -# Runs `cargo hack check` against the workspace -hack: - cargo hack check --feature-powerset --no-dev-deps - -# Fixes the formatting of the workspace -fmt-native-fix: - cargo +nightly fmt --all - -# Check the formatting of the workspace -fmt-native-check: - cargo +nightly fmt --all -- --check - -# Lint the workspace -lint-native: fmt-native-check lint-docs - cargo +nightly clippy --workspace --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 - -# Build the workspace for all available targets -build: build-native - -# Build for the native target -build-native *args='': - cargo build --workspace $@ - -# Clones and checks out the monorepo at the commit present in `.monorepo` -monorepo: - ([ ! -d monorepo ] && git clone https://github.com/ethereum-optimism/monorepo) || exit 0 - cd monorepo && git checkout $(cat ../.monorepo) - -# Updates the pinned version of the monorepo -update-monorepo: - [ ! -d monorepo ] && git clone https://github.com/ethereum-optimism/monorepo - cd monorepo && git rev-parse HEAD > ../.monorepo + rm -rf monorepo/ \ No newline at end of file From 415487b3781a088b59e841294f50ca72929760eb Mon Sep 17 00:00:00 2001 From: Samuel Laferriere Date: Mon, 16 Dec 2024 17:28:16 -0500 Subject: [PATCH 06/13] ci: add unused deps job to rust_ci workflow --- .github/workflows/rust_ci.yaml | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/.github/workflows/rust_ci.yaml b/.github/workflows/rust_ci.yaml index 016bfbd..aa9b968 100644 --- a/.github/workflows/rust_ci.yaml +++ b/.github/workflows/rust_ci.yaml @@ -17,8 +17,6 @@ jobs: steps: - name: Checkout sources uses: actions/checkout@v4 - with: - submodules: true - uses: taiki-e/install-action@just - name: Install Rust stable toolchain uses: dtolnay/rust-toolchain@stable @@ -40,8 +38,6 @@ jobs: steps: - name: Checkout sources uses: actions/checkout@v4 - with: - submodules: true - uses: taiki-e/install-action@just - name: Install Rust nightly toolchain uses: dtolnay/rust-toolchain@nightly @@ -75,8 +71,6 @@ jobs: steps: - name: Checkout sources uses: actions/checkout@v4 - with: - submodules: true - uses: taiki-e/install-action@just - name: Install Rust stable toolchain uses: dtolnay/rust-toolchain@stable @@ -101,8 +95,6 @@ jobs: steps: - name: Checkout sources uses: actions/checkout@v4 - with: - submodules: true - uses: taiki-e/install-action@just - name: Install Rust stable toolchain uses: dtolnay/rust-toolchain@stable @@ -119,8 +111,6 @@ jobs: steps: - name: Checkout sources uses: actions/checkout@v4 - with: - submodules: true - uses: taiki-e/install-action@just - name: Install Rust stable toolchain uses: dtolnay/rust-toolchain@stable @@ -130,3 +120,18 @@ jobs: cache-on-failure: true - name: cargo hack run: just hack + unused-deps: + runs-on: ubuntu-latest + timeout-minutes: 1 + steps: + - name: Checkout sources + uses: actions/checkout@v4 + - uses: taiki-e/install-action@v2 + with: + tool: just, cargo-udeps + - name: Install Rust stable toolchain + uses: dtolnay/rust-toolchain@stable + - uses: Swatinem/rust-cache@v2 + with: + cache-on-failure: true + - run: just unused-deps From aae4f73ee565265df063d886b920fbd46686f97a Mon Sep 17 00:00:00 2001 From: Samuel Laferriere Date: Mon, 16 Dec 2024 17:31:25 -0500 Subject: [PATCH 07/13] ci: remove build job from rust_ci workflow --- .github/workflows/rust_ci.yaml | 31 ------------------------------- 1 file changed, 31 deletions(-) diff --git a/.github/workflows/rust_ci.yaml b/.github/workflows/rust_ci.yaml index aa9b968..529e931 100644 --- a/.github/workflows/rust_ci.yaml +++ b/.github/workflows/rust_ci.yaml @@ -58,37 +58,6 @@ jobs: - name: chown target run: | sudo chown -R $(id -u):$(id -g) ./target - cargo-build: - runs-on: ubuntu-latest - timeout-minutes: 20 - strategy: - matrix: - # TODO: add back cannon and asterisc once we are using them - # See https://github.com/Layr-Labs/kona/blob/main/.github/workflows/rust_ci.yaml - target: ["native"] - name: build-${{ matrix.target }} - continue-on-error: true - steps: - - name: Checkout sources - uses: actions/checkout@v4 - - uses: taiki-e/install-action@just - - name: Install Rust stable toolchain - uses: dtolnay/rust-toolchain@stable - - uses: Swatinem/rust-cache@v2 - with: - cache-on-failure: true - prefix-key: ${{ matrix.target }} - - name: Log into ghcr - uses: docker/login-action@v3 - with: - registry: ghcr.io - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - name: build - run: just build-${{ matrix.target }} - - name: chown target - run: | - sudo chown -R $(id -u):$(id -g) ./target cargo-doc: runs-on: ubuntu-latest timeout-minutes: 20 From 4f46e7f5b08db8ac8634024a3023849285faddc3 Mon Sep 17 00:00:00 2001 From: Samuel Laferriere Date: Mon, 16 Dec 2024 17:34:27 -0500 Subject: [PATCH 08/13] chore: fix justfile (lint was being redefined twice) --- justfile | 1 - 1 file changed, 1 deletion(-) diff --git a/justfile b/justfile index 7889eec..c245655 100644 --- a/justfile +++ b/justfile @@ -20,7 +20,6 @@ lint: lint-native lint-docs # Lint the workspace alias l := lint-native -alias lint := lint-native lint-native: fmt-native-check lint-docs cargo +nightly clippy --workspace --all --all-features --all-targets -- -D warnings From d43fd2f229314485924ff8aa2de33a224cbc7225 Mon Sep 17 00:00:00 2001 From: Samuel Laferriere Date: Mon, 16 Dec 2024 17:38:46 -0500 Subject: [PATCH 09/13] ci: fix unused-deps job, need to install machete, not unused-deps --- .github/workflows/rust_ci.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/rust_ci.yaml b/.github/workflows/rust_ci.yaml index 529e931..576c0bb 100644 --- a/.github/workflows/rust_ci.yaml +++ b/.github/workflows/rust_ci.yaml @@ -97,7 +97,7 @@ jobs: uses: actions/checkout@v4 - uses: taiki-e/install-action@v2 with: - tool: just, cargo-udeps + tool: just, machete - name: Install Rust stable toolchain uses: dtolnay/rust-toolchain@stable - uses: Swatinem/rust-cache@v2 From 4bb5dd265592d8ce1f47dc580c49e606fcf61fee Mon Sep 17 00:00:00 2001 From: Samuel Laferriere Date: Mon, 16 Dec 2024 17:43:05 -0500 Subject: [PATCH 10/13] ci: properly install cargo-machete in rust_ci --- .github/workflows/rust_ci.yaml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/rust_ci.yaml b/.github/workflows/rust_ci.yaml index 576c0bb..59e5083 100644 --- a/.github/workflows/rust_ci.yaml +++ b/.github/workflows/rust_ci.yaml @@ -97,7 +97,9 @@ jobs: uses: actions/checkout@v4 - uses: taiki-e/install-action@v2 with: - tool: just, machete + tool: just, unused-deps + - name: Install cargo-machete + run: cargo install cargo-machete - name: Install Rust stable toolchain uses: dtolnay/rust-toolchain@stable - uses: Swatinem/rust-cache@v2 From 19b18a6f4c16ccbfcb8e22d9c23b5084d82e4cb4 Mon Sep 17 00:00:00 2001 From: Samuel Laferriere Date: Mon, 16 Dec 2024 17:44:46 -0500 Subject: [PATCH 11/13] ci: wrong name for cargo-udeps --- .github/workflows/rust_ci.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/rust_ci.yaml b/.github/workflows/rust_ci.yaml index 59e5083..990c19d 100644 --- a/.github/workflows/rust_ci.yaml +++ b/.github/workflows/rust_ci.yaml @@ -97,7 +97,7 @@ jobs: uses: actions/checkout@v4 - uses: taiki-e/install-action@v2 with: - tool: just, unused-deps + tool: just, cargo-udeps - name: Install cargo-machete run: cargo install cargo-machete - name: Install Rust stable toolchain From d65f8dc9dbd370e070299dd891c746b78539905c Mon Sep 17 00:00:00 2001 From: Samuel Laferriere Date: Mon, 16 Dec 2024 17:47:10 -0500 Subject: [PATCH 12/13] ci: increase unused-deps job timeout to 5 mins --- .github/workflows/rust_ci.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/rust_ci.yaml b/.github/workflows/rust_ci.yaml index 990c19d..f9da74a 100644 --- a/.github/workflows/rust_ci.yaml +++ b/.github/workflows/rust_ci.yaml @@ -91,7 +91,7 @@ jobs: run: just hack unused-deps: runs-on: ubuntu-latest - timeout-minutes: 1 + timeout-minutes: 5 # machete runs very quickly but need longer timeout to install the tools steps: - name: Checkout sources uses: actions/checkout@v4 From c4ef7c9e0398641a3dd11f4a7b22ac0a6e8c5f45 Mon Sep 17 00:00:00 2001 From: Samuel Laferriere Date: Mon, 16 Dec 2024 22:01:02 -0500 Subject: [PATCH 13/13] style: stringify EigenDACommitment hint as "eigenda-commitment" instead of "altda-commitment" --- crates/proof/src/hint.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/proof/src/hint.rs b/crates/proof/src/hint.rs index 7863207..c099534 100644 --- a/crates/proof/src/hint.rs +++ b/crates/proof/src/hint.rs @@ -109,7 +109,7 @@ impl TryFrom<&str> for HintType { "l2-account-proof" => Ok(Self::L2AccountProof), "l2-account-storage-proof" => Ok(Self::L2AccountStorageProof), "l2-payload-witness" => Ok(Self::L2PayloadWitness), - "altda-commitment" => Ok(Self::EigenDACommitment), + "eigenda-commitment" => Ok(Self::EigenDACommitment), _ => Err(HintParsingError(value.to_string())), } } @@ -131,7 +131,7 @@ impl From for &str { HintType::L2AccountProof => "l2-account-proof", HintType::L2AccountStorageProof => "l2-account-storage-proof", HintType::L2PayloadWitness => "l2-payload-witness", - HintType::EigenDACommitment => "altda-commitment", + HintType::EigenDACommitment => "eigenda-commitment", } } }