Skip to content

Commit 50f5ef6

Browse files
committed
feat: enable sampling for parameterized tests
This adds sampling using a seed based on the day of the month to all parameterized tests. Specifically, sampling employs a cap to ensure that at most N individual tests are run for each parameterized test. Here, N is set by default to 100, but can be overriden as needed. This enables the KOALABEAR_16 field for unit & nightly tests in the CI pipeline, but not for the blockchain reference tests.
1 parent 67df788 commit 50f5ef6

File tree

60 files changed

+165
-190
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+165
-190
lines changed

.github/workflows/reusable-tracer-unit-tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ jobs:
3434
run: GOMEMLIMIT=26GiB ./gradlew :tracer:arithmetization:test
3535
env:
3636
JAVA_OPTS: -Dorg.gradle.daemon=false
37-
GOCORSET_FLAGS: -b1024 -v --ansi-escapes=false --report --air
37+
GOCORSET_FLAGS: -b1024 -v --ansi-escapes=false --report --air --field=KOALABEAR_16
3838
JUNIT_TESTS_PARALLELISM: 4
3939
ZKEVM_FORK: ${{ inputs.zkevm_fork }}
4040

.github/workflows/tracer-gradle-tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ jobs:
9393
env:
9494
JAVA_OPTS: -Dorg.gradle.daemon=false
9595
JUNIT_TESTS_PARALLELISM: 4
96-
GOCORSET_FLAGS: -b1024 -v --ansi-escapes=false --report --air
96+
GOCORSET_FLAGS: -b1024 -v --ansi-escapes=false --report --air --field=KOALABEAR_16
9797

9898
- name: Upload test report
9999
if: ${{ always() }}

tracer-constraints/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ GO_CORSET ?= go-corset
22
GIT_COMMIT := $(shell git rev-parse HEAD)
33
GIT_TAGS := $(shell git -P tag --points-at)
44
TIMESTAMP := $(shell date)
5-
GO_CORSET_COMPILE := ${GO_CORSET} compile -Dtags="${GIT_TAGS}" -Dcommit="${GIT_COMMIT}" -Dtimestamp="${TIMESTAMP}"
5+
GO_CORSET_COMPILE := ${GO_CORSET} compile --field=KOALABEAR_16 --air -Dtags="${GIT_TAGS}" -Dcommit="${GIT_COMMIT}" -Dtimestamp="${TIMESTAMP}"
66

77
# Modules setting
88
## Some modules set below are fork specific. Eg. For OOB, OOB_LONDON is the OOB module for London and OOB_SHANGHAI the OOB module for Shanghai.

tracer/arithmetization/src/test/java/net/consensys/linea/osakaReplayTests/FastReplayTests.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
@ExtendWith(UnitTestWatcher.class)
3232
public class FastReplayTests extends TracerTestBase {
3333
@Test
34+
@Disabled("timeout under KOALABEAR_16")
3435
void fatMxp(TestInfo testInfo) {
3536
replay(
3637
MAINNET_TESTCONFIG(OSAKA, false),

tracer/arithmetization/src/test/java/net/consensys/linea/osakaReplayTests/Incident1445.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
import static net.consensys.linea.zktracer.Fork.OSAKA;
2222

2323
import net.consensys.linea.reporting.TracerTestBase;
24+
import org.junit.jupiter.api.Disabled;
2425
import org.junit.jupiter.api.Tag;
2526
import org.junit.jupiter.api.Test;
2627
import org.junit.jupiter.api.TestInfo;
@@ -36,6 +37,7 @@ public class Incident1445 extends TracerTestBase {
3637
// It triggered a divergence in execution paths between the tracer node and the Besu Shomei node.
3738
// And therefore discrepancies in state updates between the tracer's trace and the Shomei's one.
3839
@Test
40+
@Disabled("timeout under KOALABEAR_16")
3941
void block_28279135_28279249(TestInfo testInfo) {
4042
replay(
4143
MAINNET_TESTCONFIG(OSAKA),

tracer/arithmetization/src/test/java/net/consensys/linea/zktracer/MultipleCallsRevertingTest.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515

1616
package net.consensys.linea.zktracer;
1717

18+
import static net.consensys.linea.zktracer.instructionprocessing.callTests.Utilities.randomSampleByCurrentCommitHash;
19+
1820
import java.util.ArrayList;
1921
import java.util.List;
2022
import java.util.stream.Stream;
@@ -211,7 +213,7 @@ private static Stream<Arguments> contractForSLoadAndSStoreTestSource() {
211213
}
212214
}
213215
}
214-
return arguments.stream();
216+
return randomSampleByCurrentCommitHash(arguments).stream();
215217
}
216218

217219
// Support methods

tracer/arithmetization/src/test/java/net/consensys/linea/zktracer/SignedOperationsExtensiveTest.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
package net.consensys.linea.zktracer;
1717

18-
import static org.identityconnectors.common.ByteUtil.randomBytes;
18+
import static net.consensys.linea.zktracer.instructionprocessing.callTests.Utilities.randomSampleByCurrentCommitHash;
1919

2020
import java.math.BigInteger;
2121
import java.util.ArrayList;
@@ -106,7 +106,7 @@ private static Stream<Arguments> signedComparisonsModDivTestSource() {
106106
}
107107
}
108108
}
109-
return arguments.stream();
109+
return randomSampleByCurrentCommitHash(arguments).stream();
110110
}
111111

112112
@ParameterizedTest
@@ -153,7 +153,7 @@ private static Stream<Arguments> signExtendTestSource() {
153153
}
154154
}
155155
}
156-
return arguments.stream();
156+
return randomSampleByCurrentCommitHash(arguments).stream();
157157
}
158158

159159
// Support method

tracer/arithmetization/src/test/java/net/consensys/linea/zktracer/delegation/AccountDelegationAndRevertTests.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
package net.consensys.linea.zktracer.delegation;
1717

1818
import static net.consensys.linea.zktracer.delegation.Utils.*;
19+
import static net.consensys.linea.zktracer.instructionprocessing.callTests.Utilities.randomSampleByCurrentCommitHash;
1920

2021
import java.math.BigInteger;
2122
import java.util.ArrayList;
@@ -162,14 +163,14 @@ private static Stream<Arguments> delegatesAndRevertsTestsSource() {
162163
for (scenario sc1 : scenario.values()) {
163164
arguments.add(Arguments.of(sc1));
164165
}
165-
return arguments.stream();
166+
return randomSampleByCurrentCommitHash(arguments).stream();
166167
// arguments.clear();
167168
// arguments.add(
168169
// Arguments.of(
169170
// scenario
170171
//
171172
// .DELEGATION_IS_VALID___SI___AUTHORITY_EXISTS___SI___REQUIRES_EVM_EXECUTION___SI___TRANSACTION_REVERTS___NO___OTHER_REFUNDS___SI));
172-
// return arguments.stream();
173+
// return randomSampleByCurrentCommitHash(arguments).stream();
173174
}
174175

175176
private enum scenario {
@@ -284,6 +285,6 @@ private static Stream<Arguments> delegationsAndRevertsFullTestSource() {
284285
}
285286
}
286287
}
287-
return arguments.stream();
288+
return randomSampleByCurrentCommitHash(arguments).stream();
288289
}
289290
}

tracer/arithmetization/src/test/java/net/consensys/linea/zktracer/delegation/AddressCollisionTests.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515

1616
package net.consensys.linea.zktracer.delegation;
1717

18+
import static net.consensys.linea.zktracer.instructionprocessing.callTests.Utilities.randomSampleByCurrentCommitHash;
19+
1820
import java.util.ArrayList;
1921
import java.util.List;
2022
import java.util.stream.Stream;
@@ -196,6 +198,6 @@ private static Stream<Arguments> addressCollisionTestSource() {
196198
}
197199
}
198200
}
199-
return arguments.stream();
201+
return randomSampleByCurrentCommitHash(arguments).stream();
200202
}
201203
}

tracer/arithmetization/src/test/java/net/consensys/linea/zktracer/delegation/DelegationAndAccessListTests.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
import static net.consensys.linea.zktracer.delegation.Utils.TouchAuthority.EXECUTION_DOES_NOT_TOUCH_AUTHORITY;
2424
import static net.consensys.linea.zktracer.delegation.Utils.TouchMethod;
2525
import static net.consensys.linea.zktracer.delegation.Utils.TouchMethod.BALANCE;
26+
import static net.consensys.linea.zktracer.instructionprocessing.callTests.Utilities.randomSampleByCurrentCommitHash;
2627

2728
import java.util.ArrayList;
2829
import java.util.List;
@@ -177,6 +178,7 @@ private static Stream<Arguments> delegationAndAccessListScenarios() {
177178
}
178179
}
179180
}
180-
return argumentsList.stream();
181+
182+
return randomSampleByCurrentCommitHash(argumentsList).stream();
181183
}
182184
}

0 commit comments

Comments
 (0)