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

Debug blockchain reference test 455 #1398

Draft
wants to merge 1 commit into
base: arith-dev
Choose a base branch
from
Draft
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
Original file line number Diff line number Diff line change
Expand Up @@ -267,12 +267,15 @@ public void tracePostExecution(MessageFrame frame, Operation.OperationResult ope
}
}
}
static int counter = 0;

@Override
public void traceContextEnter(MessageFrame frame) {
// We only want to trigger on creation of new contexts, not on re-entry in
// existing contexts
counter += 1;
if (frame.getState() == MessageFrame.State.NOT_STARTED) {
log.info("Message frame not started, invoking hub.traceContextEnter, {}", counter);
try {
this.hub.traceContextEnter(frame);
this.debugMode.ifPresent(x -> x.traceContextEnter(frame));
Expand Down
7 changes: 7 additions & 0 deletions gradle/tests.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,13 @@ tasks.withType(Test).configureEach {

jvmArgs = [
'-XX:-UseGCOverheadLimit',
// '-XX:InitiatingHeapOccupancyPercent=70',
'-XX:+PrintGC',
// '-XX:+PrintGCDetails',
// '-XX:+UnlockExperimentalVMOptions',
// '-XX:+UseZGC',
// '-XX:+HeapDumpOnOutOfMemoryError',
// '-Dfile.encoding=UTF-8',
// Mockito and jackson-databind do some strange reflection during tests.
// This suppresses an illegal access warning.
'--add-opens',
Expand Down
7 changes: 4 additions & 3 deletions reference-tests/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,11 @@ tasks.register("generateGeneralStateReferenceTests", RefTestGenerationTask) {

tasks.register('referenceBlockchainTests', Test) {
description = 'Runs ETH reference blockchain tests.'
dependsOn generateBlockchainReferenceTests
// dependsOn generateBlockchainReferenceTests

boolean isCiServer = System.getenv().containsKey("CI")
minHeapSize = isCiServer ? "8g" :"4g"
maxHeapSize = isCiServer ? "50g" : "8g"
maxHeapSize = isCiServer ? "50g" : "16g"

useJUnitPlatform {
includeTags("BlockchainReferenceTest")
Expand Down Expand Up @@ -88,7 +88,8 @@ tasks.register('referenceGeneralStateTests', Test) {
dependsOn buildReferenceTestsZkevmBin
environment.put("ZKEVM_BIN", "zkevm_for_reference_tests.bin")

systemProperty("junit.jupiter.execution.timeout.default", "5 m") // 5 minutes
systemProperty("junit.jupiter.execution.timeout.default", "45 m") // 5 minutes
// systemProperty("junit.jupiter.execution.timeout.thread.mode.default", "separate_thread")
systemProperty("junit.jupiter.execution.parallel.enabled", "true")
systemProperty("junit.jupiter.execution.parallel.mode.default", "concurrent")
systemProperty("junit.jupiter.execution.parallel.mode.classes.default", "concurrent")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ public static void executeTest(final BlockchainReferenceTestCaseSpec spec) {

zkTracer.traceEndConflation(worldState);

ExecutionEnvironment.checkTracer(zkTracer, CORSET_VALIDATOR, Optional.of(log));
// ExecutionEnvironment.checkTracer(zkTracer, CORSET_VALIDATOR, Optional.of(log));

assertThat(blockchain.getChainHeadHash()).isEqualTo(spec.getLastBlockHash());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,46 +18,38 @@ package net.consensys.linea.generated.blockchain;
import static net.consensys.linea.BlockchainReferenceTestTools.executeTest;
import static net.consensys.linea.BlockchainReferenceTestTools.generateTestParametersForConfig;

import java.util.Collection;
import java.util.concurrent.ExecutionException;
import java.util.stream.Stream;

import net.consensys.linea.ReferenceTestWatcher;
import org.hyperledger.besu.ethereum.referencetests.BlockchainReferenceTestCaseSpec;
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.TestInstance;
import org.junit.jupiter.api.extension.ExtendWith;
import org.junit.jupiter.api.parallel.Execution;
import org.junit.jupiter.api.parallel.ExecutionMode;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.Arguments;
import org.junit.jupiter.params.provider.MethodSource;

import static org.junit.jupiter.api.Assumptions.assumeTrue;

/** The blockchain test operation testing framework entry point. */
@ExtendWith(ReferenceTestWatcher.class)
@Tag("BlockchainReferenceTest")
@TestInstance(TestInstance.Lifecycle.PER_CLASS)
@Execution(ExecutionMode.CONCURRENT)
public class %%TESTS_NAME%% {

public ReferenceTestWatcher testWatcher = new ReferenceTestWatcher();

private static final String FAILED_MODULE = "%%FAILED_MODULE%%";
private static final String FAILED_CONSTRAINT = "%%FAILED_CONSTRAINT%%";
private static final String[] TEST_CONFIG_FILE_DIR_PATH = new String[] {%%TESTS_FILE%%};

public static Stream<Arguments> getTestParametersForConfig()
throws ExecutionException, InterruptedException {
if (FAILED_MODULE.isEmpty()) {
return generateTestParametersForConfig(TEST_CONFIG_FILE_DIR_PATH).stream().map(params ->
Arguments.of(params[0], params[1], params[2])
);
} else {
return generateTestParametersForConfig(TEST_CONFIG_FILE_DIR_PATH, FAILED_MODULE, FAILED_CONSTRAINT).stream().map(params ->
Arguments.of(params[0], params[1], params[2])
);
Collection<Object[]> testParameters = FAILED_MODULE.isEmpty()
? generateTestParametersForConfig(TEST_CONFIG_FILE_DIR_PATH)
: generateTestParametersForConfig(TEST_CONFIG_FILE_DIR_PATH, FAILED_MODULE, FAILED_CONSTRAINT);
Collection<Object[]> filteredTestParameters = testParameters.stream().filter(params -> (Boolean) params[2]).toList();
if (filteredTestParameters.isEmpty()) {
return Stream.of(Arguments.of("%%TESTS_NAME%%", null, false));
}
return filteredTestParameters.stream().map(params -> Arguments.of(params[0], params[1], params[2]));
}

@ParameterizedTest(name = "Name: {0}")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,9 @@ public static void checkTracer(
Path traceFilePath = null;
try {
traceFilePath = Files.createTempFile(null, ".lt");
zkTracer.writeToFile(traceFilePath);
final Path finalTraceFilePath = traceFilePath;
logger.ifPresent(log -> log.debug("writing trace to {}", finalTraceFilePath));
zkTracer.writeToFile(traceFilePath);
logger.ifPresent(log -> log.debug("trace written to {}", finalTraceFilePath));
CorsetValidator.Result corsetValidationResult = corsetValidator.validate(traceFilePath);
assertThat(corsetValidationResult.isValid())
Expand Down
Loading