Skip to content

Commit

Permalink
test: enable heavy test to ci (scroll-tech#481)
Browse files Browse the repository at this point in the history
* test: enable heavy test to ci

* Switch self-hosts for test-default and test-scroll in CI.

* Fix clippy.

* Revert "Fix clippy."

This reverts commit c74e009.

* Revert "Fix clippy."

This reverts commit c74e009.

* fix

---------

Co-authored-by: Steven Gu <[email protected]>
  • Loading branch information
lispc and silathdiir authored Apr 20, 2023
1 parent 6e667d0 commit 567d811
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 14 deletions.
18 changes: 10 additions & 8 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,10 @@ jobs:
name: Test Default
needs: [runner]
runs-on: ${{ matrix.os }}
concurrency: ${{ needs.runner.outputs.concurrency-group1 }}
concurrency: ${{ needs.runner.outputs.concurrency-group2 }}
strategy:
matrix:
# We don't need to test across multiple platforms yet
# os: [ubuntu-latest, windows-latest, macOS-latest]
os: ${{ fromJSON(needs.runner.outputs.runner-matrix1) }}
os: ${{ fromJSON(needs.runner.outputs.runner-matrix2) }}

steps:
- uses: actions/checkout@v2
Expand Down Expand Up @@ -93,12 +91,10 @@ jobs:
name: Test Scroll
needs: [runner]
runs-on: ${{ matrix.os }}
concurrency: ${{ needs.runner.outputs.concurrency-group2 }}
concurrency: ${{ needs.runner.outputs.concurrency-group1 }}
strategy:
matrix:
# We don't need to test across multiple platforms yet
# os: [ubuntu-latest, windows-latest, macOS-latest]
os: ${{ fromJSON(needs.runner.outputs.runner-matrix2) }}
os: ${{ fromJSON(needs.runner.outputs.runner-matrix1) }}

steps:
- uses: actions/checkout@v2
Expand Down Expand Up @@ -133,6 +129,12 @@ jobs:
with:
command: test
args: --verbose --release --all --features scroll --exclude integration-tests --exclude circuit-benchmarks --exclude testool
- name: Run heavy tests
uses: actions-rs/cargo@v1
with:
command: test
args: --verbose --release --features scroll --all --exclude integration-tests --exclude circuit-benchmarks serial_ -- --ignored


build:
needs: [skip_check]
Expand Down
7 changes: 7 additions & 0 deletions zkevm-circuits/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,14 @@ serde_json = "1.0.78"
[features]
default = ["test", "test-circuits", "enable-sign-verify"]
test = ["ethers-signers", "mock", "bus-mapping/test"]
# even if "scroll" feature is enabled, unittests use l1 geth to generate execution traces,
# which cannot pass some constraints related to poseidon hash since codehash there is keccak hash.
# So there is another feature "poseidon-codehash-lookup".
# If it is enabled, poseidon code hash constraints inside bytecode circuits are enabled.
# scroll-zkevm repo enables both "scroll" and "poseidon-codehash-lookup",
# while tests inside this repo should not enable "poseidon-codehash-lookup" feature.
scroll = ["bus-mapping/scroll", "eth-types/scroll", "zktrie", "enable-sign-verify", "reject-eip2718", "poseidon-codehash"]
poseidon-codehash-lookup = []
test-circuits = []
warn-unimplemented = ["eth-types/warn-unimplemented"]
onephase = [] # debug only
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,7 @@ impl<F: Field, const BYTES_IN_FIELD: usize> ToHashBlockCircuitConfig<F, BYTES_IN
// * PoseidonTable::INPUT_WIDTH lookups for each input field
// * PoseidonTable::INPUT_WIDTH -1 lookups for the padded zero input
// so we have 2*PoseidonTable::INPUT_WIDTH -1 lookups
#[cfg(feature = "poseidon-codehash-lookup")]
for i in 0..PoseidonTable::INPUT_WIDTH {
meta.lookup_any("poseidon input", |meta| {
// Conditions:
Expand Down Expand Up @@ -346,6 +347,7 @@ impl<F: Field, const BYTES_IN_FIELD: usize> ToHashBlockCircuitConfig<F, BYTES_IN
}

// the canonical form should be `for i in 1..PoseidonTable::INPUT_WIDTH{...}`
#[cfg(feature = "poseidon-codehash-lookup")]
meta.lookup_any("poseidon input padding zero for final", |meta| {
// Conditions:
// - On the row with the last byte (`is_byte_to_header == 1`)
Expand Down
14 changes: 12 additions & 2 deletions zkevm-circuits/src/bytecode_circuit/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,12 @@ fn bytecode_push() {
}

/// Test invalid code_hash data
/// There is only one case where this test should be disabled:
/// "poseidon-codehash" enabled, but "poseidon-codehash-lookup" disabled.
#[cfg(any(
not(feature = "poseidon-codehash"),
feature = "poseidon-codehash-lookup"
))]
#[test]
fn bytecode_invalid_hash_data() {
let k = 9;
Expand All @@ -197,7 +203,6 @@ fn bytecode_invalid_hash_data() {

/// Test invalid index
#[test]
#[ignore]
fn bytecode_invalid_index() {
let k = 9;
let bytecode = vec![8u8, 2, 3, 8, 9, 7, 128];
Expand All @@ -220,7 +225,12 @@ fn bytecode_invalid_index() {
}

/// Test invalid byte data
#[test]
/// There is only one case where this test should be disabled:
/// "poseidon-codehash" enabled, but "poseidon-codehash-lookup" disabled.
#[cfg(any(
not(feature = "poseidon-codehash"),
feature = "poseidon-codehash-lookup"
))]
fn bytecode_invalid_byte_data() {
let k = 9;
let bytecode = vec![8u8, 2, 3, 8, 9, 7, 128];
Expand Down
8 changes: 4 additions & 4 deletions zkevm-circuits/src/super_circuit/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ const TEST_MOCK_RANDOMNESS: u64 = 0x100;
fn serial_test_super_circuit_1tx_1max_tx() {
let block = block_1tx();
const MAX_TXS: usize = 1;
const MAX_CALLDATA: usize = 32;
const MAX_CALLDATA: usize = 256;
const MAX_INNER_BLOCKS: usize = 1;
let circuits_params = CircuitsParams {
max_txs: MAX_TXS,
Expand All @@ -218,7 +218,7 @@ fn serial_test_super_circuit_1tx_1max_tx() {
fn serial_test_super_circuit_1tx_deploy_2max_tx() {
let block = block_1tx_deploy();
const MAX_TXS: usize = 2;
const MAX_CALLDATA: usize = 32;
const MAX_CALLDATA: usize = 256;
const MAX_INNER_BLOCKS: usize = 1;
const MAX_RWS: usize = 256;
const MAX_COPY_ROWS: usize = 256;
Expand Down Expand Up @@ -246,7 +246,7 @@ fn serial_test_super_circuit_1tx_deploy_2max_tx() {
fn serial_test_super_circuit_1tx_2max_tx() {
let block = block_1tx();
const MAX_TXS: usize = 2;
const MAX_CALLDATA: usize = 32;
const MAX_CALLDATA: usize = 256;
const MAX_INNER_BLOCKS: usize = 1;
let circuits_params = CircuitsParams {
max_txs: MAX_TXS,
Expand Down Expand Up @@ -300,7 +300,7 @@ fn serial_test_super_circuit_2tx_4max_tx() {
fn serial_test_super_circuit_2tx_2max_tx() {
let block = block_2tx();
const MAX_TXS: usize = 2;
const MAX_CALLDATA: usize = 32;
const MAX_CALLDATA: usize = 256;
const MAX_INNER_BLOCKS: usize = 1;
let circuits_params = CircuitsParams {
max_txs: MAX_TXS,
Expand Down

0 comments on commit 567d811

Please sign in to comment.