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

use listener feature of junit to write to the file once only. #1391

Merged
merged 66 commits into from
Oct 15, 2024
Merged
Show file tree
Hide file tree
Changes from 64 commits
Commits
Show all changes
66 commits
Select commit Hold shift + click to select a range
5bc6b77
use listener feature of junit to write to the file once only.
FlorianHuc Oct 8, 2024
79e3e7b
Adding test, fixing collecting data.
FlorianHuc Oct 8, 2024
e0a9510
fix getting exception message.
FlorianHuc Oct 9, 2024
ab7d083
detect conflicting names
FlorianHuc Oct 9, 2024
723ba4b
remove comments..
FlorianHuc Oct 9, 2024
1b9ff25
clean up
FlorianHuc Oct 9, 2024
96adeab
Revert "Use self-hosted runners (#1367)"
bradbown Oct 9, 2024
aa22801
adding volatile!
FlorianHuc Oct 9, 2024
872092e
Merge remote-tracking branch 'origin/arith-dev' into arith-dev
bradbown Oct 9, 2024
85351aa
Merge branch 'refs/heads/arith-dev' into fix/tests-results
bradbown Oct 9, 2024
f9329e8
missing config file
FlorianHuc Oct 9, 2024
c85c654
Merge remote-tracking branch 'origin/fix/tests-results' into fix/test…
FlorianHuc Oct 9, 2024
dee82fd
add header
FlorianHuc Oct 9, 2024
4f182a5
spotless
FlorianHuc Oct 9, 2024
713703a
add logs while looking for right folder...
FlorianHuc Oct 9, 2024
9e8c081
add logs while looking for right folder...
FlorianHuc Oct 9, 2024
4b0bd22
add logs while looking for right folder...
FlorianHuc Oct 9, 2024
dff1e37
spotless
FlorianHuc Oct 9, 2024
09479e2
limit cause to first line only
FlorianHuc Oct 9, 2024
e28e8eb
limit cause to first line only
FlorianHuc Oct 9, 2024
789a294
wait for file to be written.
FlorianHuc Oct 9, 2024
7187119
wait for file to be written.
FlorianHuc Oct 9, 2024
aabc693
file is not written..
FlorianHuc Oct 10, 2024
6d0fb0e
skip tests with empty blocks.
FlorianHuc Oct 10, 2024
1b8e72b
create folder
FlorianHuc Oct 10, 2024
077b23e
add details on the
FlorianHuc Oct 10, 2024
fc3e2d3
fails fast when folder can't be created.
FlorianHuc Oct 10, 2024
9a81c75
max is length...
FlorianHuc Oct 10, 2024
1e87a59
max is length...
FlorianHuc Oct 10, 2024
87c8772
Merge branch 'arith-dev' into fix/tests-results
FlorianHuc Oct 10, 2024
27b2116
spotless
FlorianHuc Oct 10, 2024
2a3ad13
remove useless entry call
FlorianHuc Oct 10, 2024
d3317d0
add memory
FlorianHuc Oct 10, 2024
6e27dc1
add log at entry.
FlorianHuc Oct 10, 2024
69443d6
add log at entry.
FlorianHuc Oct 10, 2024
05807ea
add listener back
FlorianHuc Oct 10, 2024
58e48bc
removing opeened
FlorianHuc Oct 11, 2024
adf60bc
add persistence every 100 failures in case of OOM
FlorianHuc Oct 11, 2024
d6535db
reduce parralelism to limit memory usage.
FlorianHuc Oct 11, 2024
1d183f8
Francois' fix
FlorianHuc Oct 11, 2024
1e7c16e
extract more constraints.
FlorianHuc Oct 11, 2024
ca00703
extract more constraints.
FlorianHuc Oct 11, 2024
1c7fcf7
extract more constraints.
FlorianHuc Oct 11, 2024
20501ab
add info for improvements.
FlorianHuc Oct 11, 2024
23cbf3f
improving error extraction
FlorianHuc Oct 11, 2024
89e01c1
Merge branch 'arith-dev' into fix/tests-results
FlorianHuc Oct 11, 2024
5e70bdc
improving error extraction
FlorianHuc Oct 11, 2024
8d318ee
improving error extraction
FlorianHuc Oct 11, 2024
32dad69
skip invalid blocks
FlorianHuc Oct 11, 2024
33a8db2
wait for future
FlorianHuc Oct 11, 2024
1168afe
limit paralelism + update memory
FlorianHuc Oct 11, 2024
d8192eb
Re-add JSON_INPUT_FILENAME to separate files to avoid overwriting fil…
bradbown Oct 11, 2024
3c105f3
change way of writing file to use less memory
FlorianHuc Oct 11, 2024
6b07431
Merge remote-tracking branch 'origin/fix/tests-results' into fix/test…
FlorianHuc Oct 11, 2024
4ca6864
write using stream to be memory friendly
FlorianHuc Oct 11, 2024
fa36e1e
add parallelism to speed up a bit...
FlorianHuc Oct 11, 2024
04cc4f4
add parallelism to speed up a bit...
FlorianHuc Oct 11, 2024
993584e
Revert "add parallelism to speed up a bit..."
FlorianHuc Oct 11, 2024
dd0dc92
Revert "write using stream to be memory friendly"
FlorianHuc Oct 11, 2024
4582f20
add parallelism to speed up a bit...
FlorianHuc Oct 11, 2024
e4ea778
add parallelism to speed up a bit...
FlorianHuc Oct 14, 2024
8582290
fix comments
FlorianHuc Oct 14, 2024
4e983b5
fix comments
FlorianHuc Oct 14, 2024
9e05e56
remove intermediary files
FlorianHuc Oct 14, 2024
721117e
spotless
FlorianHuc Oct 15, 2024
780b265
improve key name
FlorianHuc Oct 15, 2024
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: 6 additions & 1 deletion .github/workflows/reference-blockchain-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,18 +70,23 @@ jobs:
commit: ${{ inputs.commit || '' }}
if_no_artifact_found: ignore

- name: Rename filter input file
if: ${{ inputs.failed_module != '' }}
run: mv ${{ github.workspace }}/tmp/${{ steps.extract_branch.outputs.branch }}/failedBlockchainReferenceTests.json ${{ github.workspace }}/tmp/${{ steps.extract_branch.outputs.branch }}/failedBlockchainReferenceTests-input.json

- name: Run reference blockchain tests
run: ./gradlew referenceBlockchainTests -x spotlessCheck
timeout-minutes: 180
continue-on-error: true
env:
REFERENCE_TESTS_PARALLELISM: 20
REFERENCE_TESTS_PARALLELISM: 8
JAVA_OPTS: -Dorg.gradle.daemon=false
CORSET_FLAGS: disable
GOCORSET_FLAGS: -wd --ansi-escapes=false --report --air
FAILED_TEST_JSON_DIRECTORY: ${{ github.workspace }}/tmp/${{ steps.extract_branch.outputs.branch }}/
FAILED_MODULE: ${{ inputs.failed_module || '' }}
FAILED_CONSTRAINT: ${{ inputs.failed_constraint || '' }}
REFERENCE_TEST_FILTER_INPUT: failedBlockchainReferenceTests.json

- name: Upload artifact
uses: actions/upload-artifact@v4
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -220,4 +220,8 @@ public void resolveUponContextReEntry(Hub hub, CallFrame callFrame) {
contextReEntryDefers.remove(callFrame);
}
}

public void unscheduleForContextReEntry(ContextReEntryDefer defer, CallFrame callFrame) {
contextReEntryDefers.get(callFrame).remove(defer);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ public ModexpSubsection(final Hub hub, final CallSection callSection) {
.compareTo(BigInteger.valueOf(PROVER_MAX_INPUT_BYTE_SIZE))
>= 0) {
hub.modexpEffectiveCall().addPrecompileLimit(Integer.MAX_VALUE);
hub.defers().unscheduleForContextReEntry(this, hub.currentFrame());
return;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ public String moduleKey() {
@Override
public void addPrecompileLimit(final int count) {
Preconditions.checkArgument(
count == 1, "can't add more than one effective precompile call at a time");
count == 1 || count == Integer.MAX_VALUE,
"Either use 1 for one effective precompile call at a time or use Integer.MAX_VALUE");
counts.add(count);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -221,11 +221,23 @@ public void oneToOnePadded(
final short targetByteOffset,
final short size) {

checkArgument(0 <= sourceByteOffset && sourceByteOffset <= LLARGEMO);
checkArgument(0 < size && size <= LLARGE);
checkArgument(sourceByteOffset + size - 1 <= LLARGEMO);
checkArgument(0 <= targetByteOffset && targetByteOffset <= LLARGEMO);
checkArgument(targetByteOffset + size - 1 <= LLARGEMO);
checkArgument(
0 <= sourceByteOffset && sourceByteOffset <= LLARGEMO,
"sourceByteOffset has value {}.",
sourceByteOffset);
checkArgument(0 < size && size <= LLARGE, "size has value {}.", size);
checkArgument(
sourceByteOffset + size - 1 <= LLARGEMO,
"sourceByteOffset has value {}.",
sourceByteOffset);
checkArgument(
0 <= targetByteOffset && targetByteOffset <= LLARGEMO,
"targetByteOffset has value {}.",
targetByteOffset);
checkArgument(
targetByteOffset + size - 1 <= LLARGEMO,
"targetByteOffset has value {}.",
targetByteOffset);

for (short ct = 0; ct < LLARGE; ct++) {
bit1.add(ct, plateau(sourceByteOffset, ct));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -542,10 +542,10 @@ private BigInteger callToMOD(
private boolean callToLT(
int k, BigInteger arg1Hi, BigInteger arg1Lo, BigInteger arg2Hi, BigInteger arg2Lo) {
// 128 = 8 * 16
checkArgument(arg1Hi.bitLength() <= 128);
checkArgument(arg1Lo.bitLength() <= 128);
checkArgument(arg2Hi.bitLength() <= 128);
checkArgument(arg2Lo.bitLength() <= 128);
checkArgument(arg1Hi.bitLength() <= 128, "arg1Hi.bitLength() has length " + arg1Hi.bitLength());
checkArgument(arg1Lo.bitLength() <= 128, "arg1Lo.bitLength() has length " + arg1Lo.bitLength());
checkArgument(arg2Hi.bitLength() <= 128, "arg2Hi.bitLength() has length " + arg2Hi.bitLength());
checkArgument(arg2Lo.bitLength() <= 128, "arg2Lo.bitLength() has length " + arg2Lo.bitLength());
final EWord arg1 = EWord.of(arg1Hi, arg1Lo);
final EWord arg2 = EWord.of(arg2Hi, arg2Lo);
addFlag[k] = false;
Expand Down
2 changes: 1 addition & 1 deletion buildSrc/src/main/groovy/RefTestGenerationTask.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ abstract class RefTestGenerationTask extends DefaultTask {
def parentPathFile = parentFile.getPath().substring(parentFile.getPath().indexOf(refTestJsonParamsDirectory))
if (!testJsonFile.getName().toString().startsWith(".") && !excludedPath.contains(parentPathFile)) {
def pathFile = testJsonFile.getPath()
paths << pathFile.substring(pathFile.indexOf(refTestJsonParamsDirectory))
paths << pathFile.substring(pathFile.indexOf(refTestJsonParamsDirectory)).replace('\\','/')
}
}

Expand Down
1 change: 1 addition & 0 deletions reference-tests/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -121,4 +121,5 @@ dependencies {
implementation project(":arithmetization")
implementation 'com.fasterxml.jackson.dataformat:jackson-dataformat-yaml'
testImplementation project(path: ':testing')
implementation 'org.junit.platform:junit-platform-launcher:1.11.2'
FlorianHuc marked this conversation as resolved.
Show resolved Hide resolved
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
*/
package net.consensys.linea;

import java.io.FileWriter;
import static net.consensys.linea.ReferenceTestOutcomeRecorderTool.setFileDirectory;

import java.io.IOException;
import java.nio.file.FileAlreadyExistsException;
import java.nio.file.Files;
Expand All @@ -27,14 +28,14 @@

@Slf4j
public class BlockchainReferenceTestJson {
static String fileDirectory = setFileDirectory();

@Synchronized
public static CompletableFuture<String> readBlockchainReferenceTestsOutput(String fileName) {
String fileDirectory = setFileDirectory();
return CompletableFuture.supplyAsync(
() -> {
Path directoryPath = Paths.get(fileDirectory);
Path filePath = Paths.get(fileDirectory + fileName);
Path filePath = directoryPath.resolve(fileName);
String jsonString = "";

try {
Expand Down Expand Up @@ -62,24 +63,4 @@ public static CompletableFuture<String> readBlockchainReferenceTestsOutput(Strin
return jsonString;
});
}

@Synchronized
public static CompletableFuture<Void> writeToJsonFile(String jsonString, String fileName) {
return CompletableFuture.runAsync(
() -> {
try (FileWriter file = new FileWriter(fileDirectory + fileName)) {
file.write(jsonString);
} catch (Exception e) {
log.error("Error - Failed to write failed test output: %s".formatted(e.getMessage()));
}
});
}

private static String setFileDirectory() {
String jsonDirectory = System.getenv("FAILED_TEST_JSON_DIRECTORY");
if (jsonDirectory == null || jsonDirectory.isEmpty()) {
return "../tmp/local/";
}
return jsonDirectory;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,28 @@
*/
package net.consensys.linea;

import java.util.List;
import java.util.concurrent.ConcurrentMap;
import java.util.concurrent.ConcurrentSkipListSet;
import java.util.concurrent.atomic.AtomicInteger;

import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import lombok.AllArgsConstructor;
import lombok.Getter;

@JsonPropertyOrder({"failedCounter", "successCounter", "modules"})
public record BlockchainReferenceTestOutcome(
int failedCounter, int successCounter, List<ModuleToConstraints> modulesToConstraints) {}
@Getter
@AllArgsConstructor
@JsonPropertyOrder({
"failedCounter",
"successCounter",
"disabledCounter",
"abortedCounter",
"modules"
})
public class BlockchainReferenceTestOutcome {
private final int failedCounter;
private final int successCounter;
private final int disabledCounter;
private final int abortedCounter;
private final ConcurrentMap<String, ConcurrentMap<String, ConcurrentSkipListSet<String>>>
modulesToConstraintsToTests;
}

This file was deleted.

Loading
Loading