Skip to content
Open
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
1 change: 1 addition & 0 deletions .github/workflows/reusable-tracer-unit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ jobs:
JAVA_OPTS: -Dorg.gradle.daemon=false
GOCORSET_FLAGS: -b1024 -v --ansi-escapes=false --report --air
JUNIT_TESTS_PARALLELISM: 4
PARAMETERIZED_TESTS_SAMPLE_SIZE: 0.2
ZKEVM_FORK: ${{ inputs.zkevm_fork }}

- name: Upload test report
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@

package net.consensys.linea.zktracer;

import static net.consensys.linea.zktracer.instructionprocessing.callTests.Utilities.randomSampleByCurrentCommitHash;

import java.util.ArrayList;
import java.util.List;
import java.util.stream.Stream;
Expand Down Expand Up @@ -211,7 +213,7 @@ private static Stream<Arguments> contractForSLoadAndSStoreTestSource() {
}
}
}
return arguments.stream();
return randomSampleByCurrentCommitHash(arguments).stream();
}

// Support methods
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

package net.consensys.linea.zktracer;

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

import java.math.BigInteger;
import java.util.ArrayList;
Expand Down Expand Up @@ -106,7 +106,7 @@ private static Stream<Arguments> signedComparisonsModDivTestSource() {
}
}
}
return arguments.stream();
return randomSampleByCurrentCommitHash(arguments).stream();
}

@ParameterizedTest
Expand Down Expand Up @@ -153,7 +153,7 @@ private static Stream<Arguments> signExtendTestSource() {
}
}
}
return arguments.stream();
return randomSampleByCurrentCommitHash(arguments).stream();
}

// Support method
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
package net.consensys.linea.zktracer.delegation;

import static net.consensys.linea.zktracer.delegation.Utils.*;
import static net.consensys.linea.zktracer.instructionprocessing.callTests.Utilities.randomSampleByCurrentCommitHash;

import java.math.BigInteger;
import java.util.ArrayList;
Expand Down Expand Up @@ -162,14 +163,14 @@ private static Stream<Arguments> delegatesAndRevertsTestsSource() {
for (scenario sc1 : scenario.values()) {
arguments.add(Arguments.of(sc1));
}
return arguments.stream();
return randomSampleByCurrentCommitHash(arguments).stream();
// arguments.clear();
// arguments.add(
// Arguments.of(
// scenario
//
// .DELEGATION_IS_VALID___SI___AUTHORITY_EXISTS___SI___REQUIRES_EVM_EXECUTION___SI___TRANSACTION_REVERTS___NO___OTHER_REFUNDS___SI));
// return arguments.stream();
// return randomSampleByCurrentCommitHash(arguments).stream();
}

private enum scenario {
Expand Down Expand Up @@ -284,6 +285,6 @@ private static Stream<Arguments> delegationsAndRevertsFullTestSource() {
}
}
}
return arguments.stream();
return randomSampleByCurrentCommitHash(arguments).stream();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@

package net.consensys.linea.zktracer.delegation;

import static net.consensys.linea.zktracer.instructionprocessing.callTests.Utilities.randomSampleByCurrentCommitHash;

import java.util.ArrayList;
import java.util.List;
import java.util.stream.Stream;
Expand Down Expand Up @@ -196,6 +198,6 @@ private static Stream<Arguments> addressCollisionTestSource() {
}
}
}
return arguments.stream();
return randomSampleByCurrentCommitHash(arguments).stream();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import static net.consensys.linea.zktracer.delegation.Utils.TouchAuthority.EXECUTION_DOES_NOT_TOUCH_AUTHORITY;
import static net.consensys.linea.zktracer.delegation.Utils.TouchMethod;
import static net.consensys.linea.zktracer.delegation.Utils.TouchMethod.BALANCE;
import static net.consensys.linea.zktracer.instructionprocessing.callTests.Utilities.randomSampleByCurrentCommitHash;

import java.util.ArrayList;
import java.util.List;
Expand Down Expand Up @@ -177,6 +178,7 @@ private static Stream<Arguments> delegationAndAccessListScenarios() {
}
}
}
return argumentsList.stream();

return randomSampleByCurrentCommitHash(argumentsList).stream();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

import static net.consensys.linea.testing.ToyExecutionEnvironmentV2.DEFAULT_COINBASE_ADDRESS;
import static net.consensys.linea.zktracer.Trace.LINEA_CHAIN_ID;
import static net.consensys.linea.zktracer.instructionprocessing.callTests.Utilities.randomSampleByCurrentCommitHash;
import static net.consensys.linea.zktracer.utilities.Utils.addDelegationPrefixToAddress;
import static net.consensys.linea.zktracer.utilities.Utils.getDelegationAddress;
import static org.junit.jupiter.api.Assertions.assertEquals;
Expand Down Expand Up @@ -287,14 +288,14 @@ public enum AuthorityScenario {
}

static Stream<Arguments> multiDelegationMonoTransactionTestSource() {
return multiDelegationTestSourceBody(false);
return randomSampleByCurrentCommitHash(multiDelegationTestSourceBody(false)).stream();
}

static Stream<Arguments> multiDelegationMultiTransactionTestSource() {
return multiDelegationTestSourceBody(true);
return randomSampleByCurrentCommitHash(multiDelegationTestSourceBody(true)).stream();
}

static Stream<Arguments> multiDelegationTestSourceBody(boolean isMultiTransaction) {
static List<Arguments> multiDelegationTestSourceBody(boolean isMultiTransaction) {
ToyAccount authorityAccountInitial;
ToyAccount authorityAccountUpdated;
List<Arguments> arguments = new ArrayList<>();
Expand Down Expand Up @@ -369,7 +370,7 @@ static Stream<Arguments> multiDelegationTestSourceBody(boolean isMultiTransactio
}
}
}
return arguments.stream();
return arguments;
}

static final Address delegationAddressA =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
*/
package net.consensys.linea.zktracer.exceptions;

import static net.consensys.linea.zktracer.instructionprocessing.callTests.Utilities.randomSampleByCurrentCommitHash;
import static org.junit.jupiter.api.Assertions.assertEquals;

import java.util.ArrayList;
Expand Down Expand Up @@ -67,6 +68,6 @@ static Stream<Arguments> nonOpcodeExceptionSource() {
arguments.add(Arguments.of(value));
}
}
return arguments.stream();
return randomSampleByCurrentCommitHash(arguments).stream();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

package net.consensys.linea.zktracer.exceptions;

import static net.consensys.linea.zktracer.instructionprocessing.callTests.Utilities.randomSampleByCurrentCommitHash;
import static net.consensys.linea.zktracer.module.hub.signals.TracedException.MEMORY_EXPANSION_EXCEPTION;
import static net.consensys.linea.zktracer.module.mxp.MxpTestUtils.opCodesType2;
import static net.consensys.linea.zktracer.module.mxp.MxpTestUtils.opCodesType3;
Expand Down Expand Up @@ -95,6 +96,6 @@ private static Stream<Arguments> memoryExpansionExceptionTestSource() {
arguments.add(Arguments.of(false, opCode));
arguments.add(Arguments.of(true, opCode));
}
return arguments.stream();
return randomSampleByCurrentCommitHash(arguments).stream();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

import static net.consensys.linea.testing.ToyExecutionEnvironmentV2.DEFAULT_BLOCK_NUMBER;
import static net.consensys.linea.zktracer.Trace.*;
import static net.consensys.linea.zktracer.instructionprocessing.callTests.Utilities.randomSampleByCurrentCommitHash;
import static net.consensys.linea.zktracer.module.hub.signals.TracedException.OUT_OF_GAS_EXCEPTION;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotEquals;
Expand Down Expand Up @@ -111,15 +112,15 @@ static boolean noMemoryExpansion(OpCodeData opCodeData) {
}

static Stream<Arguments> outOfGasExceptionWithEmptyAccountsAndNoMemoryExpansionCostTestSource() {
ArrayList<Arguments> args = new ArrayList<>();
ArrayList<Arguments> arguments = new ArrayList<>();
//
for (int i = 0; i < 256; i++) {
args.add(Arguments.of(i, -1));
args.add(Arguments.of(i, 0));
args.add(Arguments.of(i, 1));
arguments.add(Arguments.of(i, -1));
arguments.add(Arguments.of(i, 0));
arguments.add(Arguments.of(i, 1));
}
//
return args.stream();
return randomSampleByCurrentCommitHash(arguments).stream();
}

@ParameterizedTest
Expand Down Expand Up @@ -191,7 +192,8 @@ static Stream<Arguments> outOfGasExceptionCallSource() {
arguments.add(Arguments.of(value, false, false, cornerCase));
}
}
return arguments.stream();
//
return randomSampleByCurrentCommitHash(arguments).stream();
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
*/
package net.consensys.linea.zktracer.exceptions;

import static net.consensys.linea.zktracer.instructionprocessing.callTests.Utilities.randomSampleByCurrentCommitHash;
import static net.consensys.linea.zktracer.module.hub.signals.TracedException.STACK_OVERFLOW;
import static org.junit.jupiter.api.Assertions.assertEquals;

Expand Down Expand Up @@ -66,6 +67,6 @@ static Stream<Arguments> stackOverflowExceptionSource() {
}
}
}
return arguments.stream();
return randomSampleByCurrentCommitHash(arguments).stream();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
*/
package net.consensys.linea.zktracer.exceptions;

import static net.consensys.linea.zktracer.instructionprocessing.callTests.Utilities.randomSampleByCurrentCommitHash;
import static net.consensys.linea.zktracer.module.hub.signals.TracedException.STACK_UNDERFLOW;
import static org.junit.jupiter.api.Assertions.assertEquals;

Expand Down Expand Up @@ -70,6 +71,6 @@ static Stream<Arguments> stackUnderflowExceptionSource() {
}
}
}
return arguments.stream();
return randomSampleByCurrentCommitHash(arguments).stream();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import static net.consensys.linea.zktracer.Trace.GAS_CONST_G_TRANSACTION;
import static net.consensys.linea.zktracer.exceptions.ExceptionUtils.*;
import static net.consensys.linea.zktracer.exceptions.ExceptionUtils.getProgramStaticCallToCodeAddress;
import static net.consensys.linea.zktracer.instructionprocessing.callTests.Utilities.randomSampleByCurrentCommitHash;
import static net.consensys.linea.zktracer.module.hub.signals.TracedException.STATIC_FAULT;
import static org.junit.jupiter.api.Assertions.assertEquals;

Expand Down Expand Up @@ -131,7 +132,7 @@ static Stream<Arguments> addExistsAndIsWarmCallSource() {
arguments.add(Arguments.of(true, true));
arguments.add(Arguments.of(true, false));
arguments.add(Arguments.of(false, false));
return arguments.stream();
return randomSampleByCurrentCommitHash(arguments).stream();
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
package net.consensys.linea.zktracer.forkSpecific.cancun;

import static net.consensys.linea.zktracer.Trace.LINEA_BLOB_PER_TRANSACTION_MAXIMUM;
import static net.consensys.linea.zktracer.instructionprocessing.callTests.Utilities.randomSampleByCurrentCommitHash;

import java.util.ArrayList;
import java.util.List;
Expand All @@ -38,7 +39,7 @@ public static Stream<Arguments> stackArgument() {
arguments.add(Arguments.of(Bytes32.leftPad(Bytes.ofUnsignedInt(stackArgument))));
}
arguments.add(Arguments.of(Bytes32.repeat((byte) 0xFF)));
return arguments.stream();
return randomSampleByCurrentCommitHash(arguments).stream();
}

// just run the EVM with the BLOBHASH opcode, and a stack item from 0 to
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@

package net.consensys.linea.zktracer.forkSpecific.cancun;

import static net.consensys.linea.zktracer.instructionprocessing.callTests.Utilities.randomSampleByCurrentCommitHash;

import java.util.ArrayList;
import java.util.List;
import java.util.stream.Stream;
Expand Down Expand Up @@ -98,7 +100,7 @@ public static Stream<Arguments> fourCalls() {
arguments.add(Arguments.of(CALLCODE_CALLER));
arguments.add(Arguments.of(STATIC_CALLER));
arguments.add(Arguments.of(DELEGATE_CALLER));
return arguments.stream();
return randomSampleByCurrentCommitHash(arguments).stream();
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
package net.consensys.linea.zktracer.forkSpecific.prague.floorprice;

import static net.consensys.linea.zktracer.Fork.isPostPrague;
import static net.consensys.linea.zktracer.instructionprocessing.callTests.Utilities.randomSampleByCurrentCommitHash;

import com.google.common.base.Preconditions;
import java.util.ArrayList;
Expand Down Expand Up @@ -84,7 +85,7 @@ static Stream<Arguments> adjustableByteCodeTestSource() {
false,
UserTransaction.DominantCost.EXECUTION_COST_DOMINATES));

return arguments.stream();
return randomSampleByCurrentCommitHash(arguments).stream();
}

/**
Expand Down Expand Up @@ -135,7 +136,7 @@ static Stream<Arguments> adjustableInitCodeTestSource() {
UserTransaction.DominantCost.EXECUTION_COST_DOMINATES),
UserTransaction.DominantCost.EXECUTION_COST_DOMINATES));

return arguments.stream();
return randomSampleByCurrentCommitHash(arguments).stream();
}

// Support enums and methods
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

import static net.consensys.linea.testing.BytecodeRunner.MAX_GAS_LIMIT;
import static net.consensys.linea.zktracer.Fork.isPostPrague;
import static net.consensys.linea.zktracer.instructionprocessing.callTests.Utilities.randomSampleByCurrentCommitHash;

import com.google.common.base.Preconditions;
import java.util.ArrayList;
Expand Down Expand Up @@ -145,6 +146,6 @@ static Stream<Arguments> refundTestSource() {
Arguments.of(Bytes.fromHexString("11".repeat(9)), DominantCost.EXECUTION_COST_DOMINATES));
arguments.add(
Arguments.of(Bytes.fromHexString("11".repeat(10)), DominantCost.FLOOR_COST_DOMINATES));
return arguments.stream();
return randomSampleByCurrentCommitHash(arguments).stream();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
package net.consensys.linea.zktracer.forkSpecific.prague.floorprice;

import static net.consensys.linea.zktracer.Fork.isPostPrague;
import static net.consensys.linea.zktracer.instructionprocessing.callTests.Utilities.randomSampleByCurrentCommitHash;

import com.google.common.base.Preconditions;
import java.util.ArrayList;
Expand Down Expand Up @@ -159,7 +160,7 @@ Here we change the callData (specifically the length and the CallDataSetting) to
DominantCost.FLOOR_COST_DOMINATES,
AddressCollisions.NO_COLLISION));

return arguments.stream();
return randomSampleByCurrentCommitHash(arguments).stream();
}

static Stream<Arguments> testSourceWithAllCollisionCases() {
Expand All @@ -186,7 +187,7 @@ Here we change the callData (specifically the length and the CallDataSetting) to
DominantCost.FLOOR_COST_DOMINATES,
collisionCase));
}
return arguments.stream();
return randomSampleByCurrentCommitHash(arguments).stream();
}

// Support enums and methods
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

package net.consensys.linea.zktracer.instructionprocessing.callTests;

import static net.consensys.linea.zktracer.instructionprocessing.callTests.Utilities.randomSampleByCurrentCommitHash;
import static net.consensys.linea.zktracer.instructionprocessing.utilities.Calls.appendFullGasCall;

import java.util.ArrayList;
Expand Down Expand Up @@ -251,6 +252,6 @@ static Stream<Arguments> callDelegationTestSource() {
}
}
}
return arguments.stream();
return randomSampleByCurrentCommitHash(arguments).stream();
}
}
Loading
Loading