Skip to content
New issue

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

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

Already on GitHub? # to your account

build: build a separate zkevm.bin for reference tests #1177

Merged
merged 9 commits into from
Sep 16, 2024
Merged
Show file tree
Hide file tree
Changes from 7 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
7 changes: 4 additions & 3 deletions .github/workflows/gradle-ethereum-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,15 +52,16 @@ jobs:
- name: Generate block chain reference tests
run: ./gradlew :reference-tests:generateBlockchainReferenceTests -Dorg.gradle.parallel=true -Dorg.gradle.caching=true
env:
JAVA_OPTS: -Dorg.gradle.daemon=false -DZKEVM_BIN_ORIGINAL_PATH="linea-constraints/zkevm.bin"
JAVA_OPTS: -Dorg.gradle.daemon=false
CORSET_FLAGS: fields,expand,expand,expand

- name: generate zkevm.bin
run: cd ./linea-constraints; make zkevm.bin -B; cd ..
run: cd ./linea-constraints; make zkevm_for_reference_tests.bin -B; cd ..

- name: Run general reference tests
run: ./gradlew referenceGeneralStateTests
run: ./gradlew referenceGeneralStateTests -x spotlessCheck
env:
JAVA_OPTS: -Dorg.gradle.daemon=false
ZKEVM_BIN: zkevm_for_reference_tests.bin
CORSET_FLAGS: fields,expand,expand,expand

7 changes: 4 additions & 3 deletions .github/workflows/reference-blockchain-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -78,16 +78,17 @@ jobs:
- name: Generate block chain reference tests
run: ./gradlew :reference-tests:generateBlockchainReferenceTests -Dorg.gradle.parallel=true -Dorg.gradle.caching=true
env:
JAVA_OPTS: -Dorg.gradle.daemon=false -DZKEVM_BIN_ORIGINAL_PATH="linea-constraints/zkevm.bin"
JAVA_OPTS: -Dorg.gradle.daemon=false
CORSET_FLAGS: fields,expand,expand,expand

- name: generate zkevm.bin
run: cd ./linea-constraints; make zkevm.bin -B; cd ..
run: cd ./linea-constraints; make zkevm_for_reference_tests.bin -B; cd ..

- name: Run reference blockchain tests
run: ./gradlew referenceBlockchainTests
run: ./gradlew referenceBlockchainTests -x spotlessCheck
env:
JAVA_OPTS: -Dorg.gradle.daemon=false
ZKEVM_BIN: zkevm_for_reference_tests.bin
CORSET_FLAGS: fields,expand,expand,expand
FAILED_TESTS_FILE_NAME: ${{ inputs.failed_tests_file_name || '' }}
FAILED_TEST_JSON_DIRECTORY: ${{ ../tmp/${{ inputs.branch-name }}/ || '' }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,9 @@ public class CorsetValidator {
public record Result(boolean isValid, File traceFile, String corsetOutput) {}

/** */
private static final String ZK_EVM_RELATIVE_PATH = "/linea-constraints/zkevm.bin";
private static final String ZK_EVM_RELATIVE_PATH = "/linea-constraints/";

private static final String ZK_EVM_BIN = "zkevm.bin";

/** Specifies the default zkEVM.bin file to use (including its path). */
private String defaultZkEvm = null;
Expand Down Expand Up @@ -120,18 +122,22 @@ private void initDefaultZkEvm() {
throw new RuntimeException(e);
}

final String zkEvmBinInCurrentDir = currentDir + ZK_EVM_RELATIVE_PATH;
final String zkEvmBinInCurrentDir = currentDir + ZK_EVM_RELATIVE_PATH + binName();
if (new File(zkEvmBinInCurrentDir).exists()) {
defaultZkEvm = zkEvmBinInCurrentDir;
return;
}

final String zkEvmBinInDirAbove = currentDir + "/.." + ZK_EVM_RELATIVE_PATH;
final String zkEvmBinInDirAbove = currentDir + "/.." + ZK_EVM_RELATIVE_PATH + binName();
if (new File(zkEvmBinInDirAbove).exists()) {
defaultZkEvm = zkEvmBinInDirAbove;
return;
}

log.warn("Could not find default path for zkevm.bin");
log.warn("Could not find default path for {}", binName());
}

private String binName() {
return System.getenv("ZKEVM_BIN") != null ? System.getenv("ZKEVM_BIN") : ZK_EVM_BIN;
}
}
2 changes: 1 addition & 1 deletion linea-constraints
6 changes: 6 additions & 0 deletions reference-tests/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,12 @@ tasks.register('referenceGeneralStateTests', Test) {

dependsOn generateGeneralStateReferenceTests

systemProperties["junit.jupiter.execution.timeout.default"] = "5 m" // 5 minutes
systemProperties["junit.jupiter.execution.parallel.enabled"] = true
systemProperties["junit.jupiter.execution.parallel.mode.default"] = "concurrent"
systemProperties["junit.jupiter.execution.parallel.mode.classes.default"] = "concurrent"
maxParallelForks = Runtime.getRuntime().availableProcessors()

boolean isCiServer = System.getenv().containsKey("CI")
minHeapSize = "4g"
maxHeapSize = isCiServer ? "32g" : "8g"
Expand Down
Loading