From 9cf26ad59662db54771260c68f1e02af15b9e76d Mon Sep 17 00:00:00 2001 From: Esad Yusuf Atik Date: Thu, 19 Dec 2024 17:05:52 +0300 Subject: [PATCH] Citrea premitives merge short-prefix and testing features (#1627) --- .github/workflows/nightly_build_push.yml | 2 +- Makefile | 2 +- bin/citrea/Cargo.toml | 2 +- crates/primitives/Cargo.toml | 3 +-- crates/primitives/src/constants.rs | 8 ++++---- crates/sovereign-sdk/rollup-interface/Cargo.toml | 2 +- guests/risc0/Cargo.toml | 2 +- guests/risc0/batch-proof-bitcoin/Cargo.toml | 2 +- guests/risc0/batch-proof-mock/Cargo.toml | 2 +- guests/risc0/build.rs | 4 ++-- guests/risc0/light-client-proof-bitcoin/Cargo.toml | 2 +- guests/risc0/light-client-proof-mock/Cargo.toml | 2 +- 12 files changed, 16 insertions(+), 17 deletions(-) diff --git a/.github/workflows/nightly_build_push.yml b/.github/workflows/nightly_build_push.yml index 486b307bc..1337e7d1c 100644 --- a/.github/workflows/nightly_build_push.yml +++ b/.github/workflows/nightly_build_push.yml @@ -35,7 +35,7 @@ jobs: - name: Build Project run: | - cargo build --features short-prefix + cargo build --features testing - name: Copy binary to build-push/nightly run: | diff --git a/Makefile b/Makefile index c925c1375..0225ab27d 100644 --- a/Makefile +++ b/Makefile @@ -3,7 +3,7 @@ EF_TESTS_URL := https://github.com/chainwayxyz/ef-tests/archive/develop.tar.gz EF_TESTS_DIR := crates/evm/ethereum-tests CITREA_E2E_TEST_BINARY := $(CURDIR)/target/debug/citrea PARALLEL_PROOF_LIMIT := 1 -TEST_FEATURES := --features short-prefix +TEST_FEATURES := --features testing BATCH_OUT_PATH := resources/guests/risc0/ LIGHT_OUT_PATH := resources/guests/risc0/ diff --git a/bin/citrea/Cargo.toml b/bin/citrea/Cargo.toml index 50f380264..f78e815a9 100644 --- a/bin/citrea/Cargo.toml +++ b/bin/citrea/Cargo.toml @@ -102,7 +102,7 @@ sp1-helper = { version = "3.0.0", default-features = false } [features] default = [] # Deviate from convention by making the "native" feature active by default. This aligns with how this package is meant to be used (as a binary first, library second). -bench = ["hex"] +testing = ["citrea-primitives/testing", "citrea-risc0/testing", "sov-rollup-interface/testing"] [[bin]] name = "citrea" diff --git a/crates/primitives/Cargo.toml b/crates/primitives/Cargo.toml index 5adf7c5d8..5ddaa3cb2 100644 --- a/crates/primitives/Cargo.toml +++ b/crates/primitives/Cargo.toml @@ -19,5 +19,4 @@ brotli = { workspace = true } sov-rollup-interface = { path = "../sovereign-sdk/rollup-interface", features = ["testing"] } [features] -testing = ["short-prefix"] -short-prefix = [] +testing = ["sov-rollup-interface/testing"] diff --git a/crates/primitives/src/constants.rs b/crates/primitives/src/constants.rs index 276685f7b..8db31fbfa 100644 --- a/crates/primitives/src/constants.rs +++ b/crates/primitives/src/constants.rs @@ -1,13 +1,13 @@ /// Prefix for the reveal transaction ids - batch proof namespace. -#[cfg(feature = "short-prefix")] +#[cfg(feature = "testing")] pub const TO_BATCH_PROOF_PREFIX: &[u8] = &[1]; -#[cfg(not(feature = "short-prefix"))] +#[cfg(not(feature = "testing"))] pub const TO_BATCH_PROOF_PREFIX: &[u8] = &[1, 1]; /// Prefix for the reveal transaction ids - light client namespace. -#[cfg(feature = "short-prefix")] +#[cfg(feature = "testing")] pub const TO_LIGHT_CLIENT_PREFIX: &[u8] = &[2]; -#[cfg(not(feature = "short-prefix"))] +#[cfg(not(feature = "testing"))] pub const TO_LIGHT_CLIENT_PREFIX: &[u8] = &[2, 2]; pub const TEST_PRIVATE_KEY: &str = diff --git a/crates/sovereign-sdk/rollup-interface/Cargo.toml b/crates/sovereign-sdk/rollup-interface/Cargo.toml index 476aa8a1f..c216d1c74 100644 --- a/crates/sovereign-sdk/rollup-interface/Cargo.toml +++ b/crates/sovereign-sdk/rollup-interface/Cargo.toml @@ -34,7 +34,7 @@ serde_json = { workspace = true } [features] default = ["std"] native = ["std", "tokio", "futures", "tracing"] -testing = ["native"] +testing = [] std = [ "anyhow/default", "borsh/default", diff --git a/guests/risc0/Cargo.toml b/guests/risc0/Cargo.toml index f8027b5b3..fbc6c312d 100644 --- a/guests/risc0/Cargo.toml +++ b/guests/risc0/Cargo.toml @@ -19,4 +19,4 @@ methods = [ [features] bench = [] -short-prefix = [] +testing = [] diff --git a/guests/risc0/batch-proof-bitcoin/Cargo.toml b/guests/risc0/batch-proof-bitcoin/Cargo.toml index 920816b38..3e26e273b 100644 --- a/guests/risc0/batch-proof-bitcoin/Cargo.toml +++ b/guests/risc0/batch-proof-bitcoin/Cargo.toml @@ -21,7 +21,7 @@ sov-rollup-interface = { path = "../../../crates/sovereign-sdk/rollup-interface" sov-state = { path = "../../../crates/sovereign-sdk/module-system/sov-state" } [features] -short-prefix = ["citrea-primitives/short-prefix"] +testing = ["citrea-primitives/testing"] [patch.crates-io] sha2 = { git = "https://github.com/risc0/RustCrypto-hashes", tag = "sha2-v0.10.8-risczero.0" } diff --git a/guests/risc0/batch-proof-mock/Cargo.toml b/guests/risc0/batch-proof-mock/Cargo.toml index ccd1972be..0d2130df3 100644 --- a/guests/risc0/batch-proof-mock/Cargo.toml +++ b/guests/risc0/batch-proof-mock/Cargo.toml @@ -20,7 +20,7 @@ sov-modules-stf-blueprint = { path = "../../../crates/sovereign-sdk/module-syste sov-state = { path = "../../../crates/sovereign-sdk/module-system/sov-state" } [features] -short-prefix = ["citrea-primitives/short-prefix"] +testing = ["citrea-primitives/testing"] [patch.crates-io] sha2 = { git = "https://github.com/risc0/RustCrypto-hashes", tag = "sha2-v0.10.8-risczero.0" } diff --git a/guests/risc0/build.rs b/guests/risc0/build.rs index 9dea3a17d..163238bf0 100644 --- a/guests/risc0/build.rs +++ b/guests/risc0/build.rs @@ -53,8 +53,8 @@ fn get_guest_options() -> HashMap<&'static str, risc0_build::GuestOptions> { let mut features = Vec::new(); - if std::env::var("CARGO_FEATURE_SHORT_PREFIX").is_ok() { - features.push("short-prefix".to_string()); + if std::env::var("CARGO_FEATURE_TESTING").is_ok() { + features.push("testing".to_string()); } let use_docker = if std::env::var("REPR_GUEST_BUILD").is_ok() { diff --git a/guests/risc0/light-client-proof-bitcoin/Cargo.toml b/guests/risc0/light-client-proof-bitcoin/Cargo.toml index d5ac261b7..742cfecdc 100644 --- a/guests/risc0/light-client-proof-bitcoin/Cargo.toml +++ b/guests/risc0/light-client-proof-bitcoin/Cargo.toml @@ -21,7 +21,7 @@ sov-rollup-interface = { path = "../../../crates/sovereign-sdk/rollup-interface" sov-state = { path = "../../../crates/sovereign-sdk/module-system/sov-state" } [features] -short-prefix = ["citrea-primitives/short-prefix"] +testing = ["citrea-primitives/testing"] [patch.crates-io] sha2 = { git = "https://github.com/risc0/RustCrypto-hashes", tag = "sha2-v0.10.8-risczero.0" } diff --git a/guests/risc0/light-client-proof-mock/Cargo.toml b/guests/risc0/light-client-proof-mock/Cargo.toml index 25f76b58e..ad87aab07 100644 --- a/guests/risc0/light-client-proof-mock/Cargo.toml +++ b/guests/risc0/light-client-proof-mock/Cargo.toml @@ -22,7 +22,7 @@ sov-rollup-interface = { path = "../../../crates/sovereign-sdk/rollup-interface" sov-state = { path = "../../../crates/sovereign-sdk/module-system/sov-state" } [features] -short-prefix = ["citrea-primitives/short-prefix"] +testing = ["citrea-primitives/testing"] [patch.crates-io] sha2 = { git = "https://github.com/risc0/RustCrypto-hashes", tag = "sha2-v0.10.8-risczero.0" }