Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(ci): Optimism unit / integration tests #5318

Merged
merged 4 commits into from
Nov 6, 2023
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
9 changes: 0 additions & 9 deletions .github/workflows/integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,19 +35,10 @@ jobs:
- uses: Swatinem/rust-cache@v2
with:
cache-on-failure: true
- name: Set binary value
id: binary
run: |
if [[ "${{ matrix.network }}" == "ethereum" ]]; then
echo "binary=reth" >> $GITHUB_OUTPUT
else
echo "binary=op-reth" >> $GITHUB_OUTPUT
fi
- name: Run tests
run: |
cargo nextest run \
--locked --features "${{ matrix.network }}" \
--bin ${{ steps.binary.outputs.binary }} \
--workspace --exclude examples --exclude ef-tests \
--partition hash:${{ matrix.partition }}/2 \
-E 'kind(test)'
Expand Down
9 changes: 0 additions & 9 deletions .github/workflows/unit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,19 +33,10 @@ jobs:
with:
cache-on-failure: true
- uses: taiki-e/install-action@nextest
- name: Set binary value
id: binary
run: |
if [[ "${{ matrix.network }}" == "ethereum" ]]; then
echo "binary=reth" >> $GITHUB_OUTPUT
else
echo "binary=op-reth" >> $GITHUB_OUTPUT
fi
- name: Run tests
run: |
cargo nextest run \
--locked --features "${{ matrix.network }}" \
--bin ${{ steps.binary.outputs.binary }} \
--workspace --exclude examples --exclude ef-tests \
--partition hash:${{ matrix.partition }}/2 \
-E "kind(lib) | kind(bin) | kind(proc-macro)"
Expand Down
2 changes: 1 addition & 1 deletion bin/reth/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#[global_allocator]
static ALLOC: jemallocator::Jemalloc = jemallocator::Jemalloc;

#[cfg(feature = "optimism")]
#[cfg(all(feature = "optimism", not(test)))]
compile_error!("Cannot build the `reth` binary with the `optimism` feature flag enabled. Did you mean to build `op-reth`?");

#[cfg(not(feature = "optimism"))]
Expand Down
4 changes: 4 additions & 0 deletions crates/consensus/auto-seal/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,7 @@ clap = { workspace = true }
jsonrpsee = { workspace = true }
eyre = { workspace = true }
serde_json = { workspace = true }

[features]
# Included solely to ignore certain tests.
optimism = []
4 changes: 4 additions & 0 deletions crates/consensus/auto-seal/tests/it/auto_mine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,11 @@ impl RethNodeCommandConfig for AutoMineConfig {
}
}

/// This test is disabled for the `optimism` feature flag due to an incompatible feature set.
/// L1 info transactions are not included automatically, which are required for `op-reth` to
/// process transactions.
#[test]
#[cfg_attr(feature = "optimism", ignore)]
pub fn test_auto_mine() {
// create temp path for test
let temp_path = tempfile::TempDir::new().expect("tempdir is okay").into_path();
Expand Down
20 changes: 3 additions & 17 deletions crates/primitives/src/transaction/optimism.rs
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ impl TxDeposit {

#[cfg(test)]
mod tests {
use super::*;
use crate::{Bytes, TransactionSigned};
use alloy_rlp::Decodable;
use bytes::BytesMut;
Expand All @@ -166,24 +167,9 @@ mod tests {
tx_b.encode_enveloped(&mut buf_b);
assert_eq!(&buf_b[..], &bytes[..]);
}
#[test]
fn test_tx_deposit_size() {
let tx_deposit = TxDeposit {
source_hash: B256::default(),
from: Address::default(),
to: TransactionKind::default(),
mint: Some(100),
value: TxValue::default(),
gas_limit: 50000,
is_system_transaction: false,
input: Bytes::default(),
};

assert_eq!(tx_deposit.size(), mem::size_of_val(&tx_deposit));
}

#[test]
fn test_encode_decode_inner() {
fn test_encode_decode_fields() {
let original = TxDeposit {
source_hash: B256::default(),
from: Address::default(),
Expand All @@ -196,7 +182,7 @@ mod tests {
};

let mut buffer = BytesMut::new();
original.encode(&mut buffer, false);
original.encode_fields(&mut buffer);
let decoded = TxDeposit::decode_inner(&mut &buffer[..]).expect("Failed to decode");

assert_eq!(original, decoded);
Expand Down
Loading