Skip to content

Commit

Permalink
Remove CI_TEST_MODE (#1537)
Browse files Browse the repository at this point in the history
  • Loading branch information
jfldde authored Nov 29, 2024
1 parent 3ef83cb commit 1ebe899
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 45 deletions.
2 changes: 0 additions & 2 deletions .github/workflows/checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,6 @@ jobs:
env:
RUST_BACKTRACE: 1
TEST_BITCOIN_DOCKER: 1
CI_TEST_MODE: 1
RISC0_DEV_MODE: 1 # This is needed to generate mock proofs and verify them
CITREA_E2E_TEST_BINARY: ${{ github.workspace }}/target/debug/citrea
PARALLEL_PROOF_LIMIT: 1
Expand Down Expand Up @@ -417,7 +416,6 @@ jobs:
RUST_BACKTRACE: 1
RISC0_DEV_MODE: 1 # This is needed to generate mock proofs and verify them
TEST_BITCOIN_DOCKER: 1
CI_TEST_MODE: 1
CITREA_E2E_TEST_BINARY: ${{ github.workspace }}/target/debug/citrea
PARALLEL_PROOF_LIMIT: 1
TEST_OUT_DIR: ${{ runner.temp }}/test
Expand Down
11 changes: 1 addition & 10 deletions .github/workflows/nightly_build_push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,6 @@ env:
jobs:
linux_amd64_binary_extraction:
runs-on: ubicloud-standard-30
strategy:
matrix:
include:
- ci_test_mode: 1
ci_test_mode_value: "-ci"
- ci_test_mode: 0
ci_test_mode_value: ""
steps:
- name: Checkout
uses: actions/checkout@v4
Expand All @@ -41,8 +34,6 @@ jobs:
github_token: ${{ secrets.GITHUB_TOKEN }}

- name: Build Project
env:
CI_TEST_MODE: ${{ matrix.ci_test_mode }}
run: |
cargo build --release
Expand All @@ -68,7 +59,7 @@ jobs:
with:
file: ./docker/build-push/nightly/Dockerfile
context: ./docker/build-push/nightly
tags: ${{ vars.DOCKERHUB_USERNAME }}/citrea-test:${{ env.IMAGE_TAG }}${{ matrix.ci_test_mode_value }}
tags: ${{ vars.DOCKERHUB_USERNAME }}/citrea-test:${{ env.IMAGE_TAG }}
platforms: linux/amd64
push: true
load: false
Expand Down
2 changes: 1 addition & 1 deletion 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 @@ -155,7 +155,7 @@ tower-http = { version = "0.5.0", features = ["full"] }
tower = { version = "0.4.13", features = ["full"] }
hyper = { version = "1.4.0" }

citrea-e2e = { git = "https://github.com/chainwayxyz/citrea-e2e", rev = "8342386" }
citrea-e2e = { git = "https://github.com/chainwayxyz/citrea-e2e", rev = "c3f27fc" }

[patch.crates-io]
bitcoincore-rpc = { version = "0.18.0", git = "https://github.com/chainwayxyz/rust-bitcoincore-rpc.git", rev = "ca3cfa2" }
6 changes: 1 addition & 5 deletions bin/citrea/tests/bitcoin_e2e/batch_prover_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -367,11 +367,7 @@ impl TestCase for LocalProvingTest {

fn test_env() -> TestCaseEnv {
TestCaseEnv {
test: vec![
("CI_TEST_MODE", "1"),
("BONSAI_API_URL", ""),
("BONSAI_API_KEY", ""),
],
test: vec![("BONSAI_API_URL", ""), ("BONSAI_API_KEY", "")],
..Default::default()
}
}
Expand Down
3 changes: 3 additions & 0 deletions bin/citrea/tests/bitcoin_e2e/bitcoin_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,9 @@ impl TestCase for BitcoinReorgTest {
let block = da0.get_block(&original_chain_hash).await?;
assert_eq!(block.txdata.len(), 3); // Coinbase + seq commit/reveal txs

// Buffer to wait for monitoring to update status to confirmed
tokio::time::sleep(Duration::from_secs(2)).await;

let da1_generated_blocks = 2;
da1.generate(da1_generated_blocks).await?;

Expand Down
36 changes: 10 additions & 26 deletions crates/primitives/src/constants.rs
Original file line number Diff line number Diff line change
@@ -1,36 +1,20 @@
// Generates a prefix for REVEAL_BATCH_PROOF_PREFIX and REVEAL_LIGHT_CLIENT_PREFIX constants based on compile-time environment.
// Returns a single-byte prefix [1] if CI_TEST_MODE env var is set, otherwise defaults to [1, 1].
// This greatly reduces the time required to find a nonce when generating batch proving txs and LightClientTxs
// We have to make these prefixes constants due to zk proving.
// But two bytes takes too long to generate nonce, making tests very flaky and slow.
// So in CI we define an env var CI_TEST_MODE to use less bytes.
// This doesn't change any method ids, just the prefixes.
const fn get_reveal_batch_proof_prefix() -> &'static [u8] {
match option_env!("CI_TEST_MODE") {
Some(v) if matches!(v.as_bytes(), b"1" | b"true") => &[1],
_ => &[1, 1],
}
}

const fn get_reveal_light_client_prefix() -> &'static [u8] {
match option_env!("CI_TEST_MODE") {
Some(v) if matches!(v.as_bytes(), b"1" | b"true") => &[2],
_ => &[2, 2],
}
}

#[cfg_attr(feature = "testing", allow(dead_code))]
const fn get_max_txbody_size() -> usize {
match option_env!("CI_TEST_MODE") {
Some(v) if matches!(v.as_bytes(), b"1" | b"true") => 39700,
_ => 397000,
#[cfg(feature = "testing")]
{
39700
}
#[cfg(not(feature = "testing"))]
{
397000
}
}

/// Prefix for the reveal transaction ids - batch proof namespace.
pub const TO_BATCH_PROOF_PREFIX: &[u8] = get_reveal_batch_proof_prefix();
pub const TO_BATCH_PROOF_PREFIX: &[u8] = &[1, 1];

/// Prefix for the reveal transaction ids - light client namespace.
pub const TO_LIGHT_CLIENT_PREFIX: &[u8] = get_reveal_light_client_prefix();
pub const TO_LIGHT_CLIENT_PREFIX: &[u8] = &[2, 2];

pub const TEST_PRIVATE_KEY: &str =
"1212121212121212121212121212121212121212121212121212121212121212";
Expand Down

0 comments on commit 1ebe899

Please sign in to comment.