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

feat: tweak weekly tests #1934

Merged
merged 6 commits into from
Mar 27, 2025
Merged
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
2 changes: 0 additions & 2 deletions .github/workflows/gradle-ethereum-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@ jobs:

- name: Setup Test Environment
uses: ./.github/actions/setup-environment
with:
go-corset: true

- name: Generate General State Reference Tests
run: ./gradlew generateGeneralStateReferenceTests -Dorg.gradle.caching=true
Expand Down
2 changes: 0 additions & 2 deletions .github/workflows/gradle-nightly-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@ jobs:

- name: Setup Test Environment
uses: ./.github/actions/setup-environment
with:
go-corset: true

- name: Run Nightly tests
run: GOMEMLIMIT=32GiB ./gradlew nightlyTests
Expand Down
4 changes: 0 additions & 4 deletions .github/workflows/gradle-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ jobs:
unit-tests:
needs: [ build ]
runs-on: gha-runner-scale-set-ubuntu-22.04-amd64-xxl
continue-on-error: true
steps:
- name: Checkout repository
uses: actions/checkout@v3
Expand All @@ -67,7 +66,6 @@ jobs:
uses: ./.github/actions/setup-environment
with:
enable-ssh: ${{ inputs.tests-with-ssh }}
go-corset: true

- name: Run unit tests
run: GOMEMLIMIT=26GiB ./gradlew :arithmetization:test
Expand Down Expand Up @@ -104,7 +102,6 @@ jobs:
replay-tests:
needs: [ build ]
runs-on: gha-runner-scale-set-ubuntu-22.04-amd64-xxl
continue-on-error: true
steps:
- name: Checkout repository
uses: actions/checkout@v3
Expand All @@ -115,7 +112,6 @@ jobs:
uses: ./.github/actions/setup-environment
with:
enable-ssh: ${{ inputs.tests-with-ssh }}
go-corset: true

- name: Run replay tests
run: GOMEMLIMIT=26GiB ./gradlew :arithmetization:fastReplayTests
Expand Down
34 changes: 13 additions & 21 deletions .github/workflows/gradle-weekly-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,8 @@ concurrency:
cancel-in-progress: true

jobs:
weekly-tests:
weekly-unit-tests:
runs-on: gha-runner-scale-set-ubuntu-22.04-amd64-xxl
continue-on-error: true
steps:
- name: Checkout repository
uses: actions/checkout@v3
Expand All @@ -22,16 +21,13 @@ jobs:

- name: Setup Test Environment
uses: ./.github/actions/setup-environment
with:
go-corset: true

- name: Run Weekly tests
run: GOMEMLIMIT=55GiB ./gradlew weeklyTests
run: GOMAXPROCS=2 GOMEMLIMIT=5GiB ./gradlew weeklyTests
env:
JAVA_OPTS: -Dorg.gradle.daemon=false
WEEKLY_TESTS_PARALLELISM: 2
CORSET_FLAGS: disable
GOCORSET_FLAGS: -vw -b1024 --ansi-escapes=false --report --air
WEEKLY_TESTS_PARALLELISM: 26
GOCORSET_FLAGS: -vw -b1024 --ansi-escapes=false --report --hir

- name: Upload test report
if: always()
Expand Down Expand Up @@ -61,12 +57,11 @@ jobs:
webhook: ${{ secrets.SLACK_WEBHOOK_URL }}
webhook-type: webhook-trigger
payload: |
name: "Weekly (Go-Corset)"
name: "Weekly Unit"
status: "${{ job.status }}"

weekly-ecpairing-tests:
weekly-prc-calltests:
runs-on: gha-runner-scale-set-ubuntu-22.04-amd64-xxl
continue-on-error: true
steps:
- name: Checkout repository
uses: actions/checkout@v3
Expand All @@ -75,22 +70,19 @@ jobs:

- name: Setup Test Environment
uses: ./.github/actions/setup-environment
with:
go-corset: true

- name: Run Weekly EcPairing tests
run: GOMEMLIMIT=50GiB ./gradlew weeklyEcPairingTests
- name: Run Precompile Call tests
run: GOMAXPROCS=2 GOMEMLIMIT=5GiB ./gradlew prcCallTests
env:
JAVA_OPTS: -Dorg.gradle.daemon=false
WEEKLY_TESTS_PARALLELISM: 2
CORSET_FLAGS: disable
GOCORSET_FLAGS: -vw -b1024 --ansi-escapes=false --report --air
WEEKLY_TESTS_PARALLELISM: 20
GOCORSET_FLAGS: -vw -b1024 --ansi-escapes=false --report --hir

- name: Upload weekly ecpairing test report
- name: Upload prc calls test report
if: always()
uses: actions/upload-artifact@v4
with:
name: weekly-ecpairing-tests-report
name: prc-call-tests-report
path: arithmetization/build/reports/tests/**/*

- name: Failure Notification
Expand All @@ -100,5 +92,5 @@ jobs:
webhook: ${{ secrets.SLACK_WEBHOOK_URL }}
webhook-type: webhook-trigger
payload: |
name: "Weekly EcPairing (Go-Corset)"
name: "Weekly Precompile call"
status: "${{ job.status }}"
2 changes: 0 additions & 2 deletions .github/workflows/reference-blockchain-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,6 @@ jobs:

- name: Setup Test Environment
uses: ./.github/actions/setup-environment
with:
go-corset: true

- name: Generate block chain reference tests
run: ./gradlew :reference-tests:generateBlockchainReferenceTests -Dorg.gradle.caching=true
Expand Down
2 changes: 0 additions & 2 deletions .github/workflows/validate-one-blockchain-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@ jobs:

- name: Setup Test Environment
uses: ./.github/actions/setup-environment
with:
go-corset: true

- name: Run Reference Blockchain test sample
run: ./gradlew referenceBlockchainTests -x spotlessCheck --tests "BlockchainReferenceTest_104"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,10 @@
import static net.consensys.linea.zktracer.Trace.WORD_SIZE;
import static net.consensys.linea.zktracer.opcode.OpCode.*;

import java.util.Calendar;
import java.util.Collections;
import java.util.List;
import java.util.Random;

import net.consensys.linea.UnitTestWatcher;
import net.consensys.linea.testing.BytecodeCompiler;
Expand Down Expand Up @@ -304,4 +307,27 @@ public static void pushSeveral(BytecodeCompiler program, int... values) {
program.push(value);
}
}

/**
* Sample exactly n items at random from a given input list. If that list has fewer than n items,
* then the list is returned unchanged. The Random Number Generated (RNG) is seeded with the
* day-of-the-month. The idea here is that we benefit from different seeds (i.e. by testing
* different inputs), but should a failure occur we can (in principle) recreate it (provided we
* know what day of the month it failed on).
*
* @param n Number of items to sample
* @param items Source of items to sample from
* @param <T>
* @return
*/
public static <T> List<T> randomSampleByDayOfMonth(int n, List<T> items) {
// Determine day of month
int dayOfMonth = Calendar.getInstance().get(Calendar.DAY_OF_MONTH);
// Seed rng with day of month.
Random rng = new Random(dayOfMonth);
// Randomly shuffle the items
Collections.shuffle(items, rng);
//
return items.subList(0, n);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@

import java.util.ArrayList;
import java.util.List;
import java.util.stream.Stream;

import net.consensys.linea.zktracer.instructionprocessing.callTests.prc.GasParameter;
import net.consensys.linea.zktracer.instructionprocessing.callTests.prc.ReturnAtParameter;
Expand Down Expand Up @@ -52,7 +51,7 @@ public class ParameterGeneration {
* <p>- <b>ReturnAtParameter</b> the return at parameter to be tested; return data will be written
* on the aforementioned blackened word in RAM;
*/
public static Stream<Arguments> parameterGeneration() {
public static List<Arguments> parameterGeneration() {
List<OpCode> CallOpCodes = List.of(CALL, CALLCODE, DELEGATECALL, STATICCALL);
List<GasParameter> GasParameters =
List.of(GasParameter.ZERO, GasParameter.COST_MO, GasParameter.COST, GasParameter.PLENTY);
Expand All @@ -79,6 +78,6 @@ public static Stream<Arguments> parameterGeneration() {
}
}
}
return argumentsList.stream();
return argumentsList;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
*/
package net.consensys.linea.zktracer.instructionprocessing.callTests.prc.ecadd;

import static net.consensys.linea.zktracer.instructionprocessing.callTests.Utilities.randomSampleByDayOfMonth;
import static net.consensys.linea.zktracer.instructionprocessing.callTests.prc.CodeExecutionMethods.*;
import static net.consensys.linea.zktracer.instructionprocessing.callTests.prc.GasParameter.COST_MO;
import static net.consensys.linea.zktracer.instructionprocessing.callTests.prc.ecadd.MemoryContents.WELL_FORMED_POINTS;
Expand All @@ -24,14 +25,20 @@
import net.consensys.linea.testing.BytecodeCompiler;
import net.consensys.linea.zktracer.instructionprocessing.callTests.prc.ReturnAtParameter;
import net.consensys.linea.zktracer.instructionprocessing.callTests.prc.framework.PrecompileCallTests;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.params.provider.Arguments;

@Disabled
@Tag("weekly")
@Tag("prc-calltests")
public class Tests extends PrecompileCallTests<CallParameters> {
// Set sample size with potential for override.
private static final int ECADD_SAMPLE_SIZE =
Integer.parseInt(System.getenv().getOrDefault("PRC_CALLTESTS_SAMPLE_SIZE", "1000"));

public static Stream<Arguments> parameterGeneration() {
return randomSampleByDayOfMonth(ECADD_SAMPLE_SIZE, ParameterGeneration.parameterGeneration())
.stream();
}

/** Non-parametric test to make sure things are working as expected. */
@Test
Expand All @@ -48,8 +55,4 @@ public void singleMessageCallTransactionTest() {
BytecodeCompiler rootCode = params.customPrecompileCallsSeparatedByReturnDataWipingOperation();
runMessageCallTransactionWithProvidedCodeAsRootCode(rootCode);
}

public static Stream<Arguments> parameterGeneration() {
return ParameterGeneration.parameterGeneration();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@

import java.util.ArrayList;
import java.util.List;
import java.util.stream.Stream;

import net.consensys.linea.zktracer.instructionprocessing.callTests.prc.GasParameter;
import net.consensys.linea.zktracer.instructionprocessing.callTests.prc.ReturnAtParameter;
Expand All @@ -29,7 +28,7 @@

public class ParameterGeneration {

public static Stream<Arguments> parameterGeneration() {
public static List<Arguments> parameterGeneration() {
List<OpCode> CallOpCodes = List.of(CALL, CALLCODE, DELEGATECALL, STATICCALL);
List<GasParameter> GasParameters = List.of(ZERO, COST_MO, COST, PLENTY);
List<ReturnAtParameter> ReturnAtParameters =
Expand All @@ -55,6 +54,6 @@ public static Stream<Arguments> parameterGeneration() {
}
}
}
return argumentsList.stream();
return argumentsList;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,19 @@
import net.consensys.linea.testing.BytecodeCompiler;
import net.consensys.linea.zktracer.instructionprocessing.callTests.prc.ReturnAtParameter;
import net.consensys.linea.zktracer.instructionprocessing.callTests.prc.framework.PrecompileCallTests;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.params.provider.Arguments;

@Disabled
@Tag("weekly")
@Tag("prc-calltests")
public class Tests extends PrecompileCallTests<CallParameters> {
// Set sample size with potential for override.
private static final int ECMUL_SAMPLE_SIZE =
Integer.parseInt(System.getenv().getOrDefault("PRC_CALLTESTS_SAMPLE_SIZE", "700"));

public static Stream<Arguments> parameterGeneration() {
return ParameterGeneration.parameterGeneration();
return randomSampleByDayOfMonth(ECMUL_SAMPLE_SIZE, ParameterGeneration.parameterGeneration())
.stream();
}

/** Non-parametric test to make sure things are working as expected. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@

import java.util.ArrayList;
import java.util.List;
import java.util.stream.Stream;

import net.consensys.linea.zktracer.instructionprocessing.callTests.prc.GasParameter;
import net.consensys.linea.zktracer.instructionprocessing.callTests.prc.ReturnAtParameter;
Expand All @@ -32,7 +31,7 @@

public class ParameterGeneration {

public static Stream<Arguments> parameterGeneration() {
public static List<Arguments> parameterGeneration() {
List<OpCode> CallOpCodes = List.of(CALL, STATICCALL);
List<GasParameter> GasParameters = List.of(COST_MO, COST, PLENTY);
List<ReturnAtParameter> ReturnAtParameters = List.of(PARTIAL, FULL);
Expand Down Expand Up @@ -88,6 +87,6 @@ public static Stream<Arguments> parameterGeneration() {
}
}
}
return argumentsList.stream();
return argumentsList;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,24 @@
*/
package net.consensys.linea.zktracer.instructionprocessing.callTests.prc.ecpairing;

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

import java.util.stream.Stream;

import net.consensys.linea.zktracer.instructionprocessing.callTests.prc.framework.PrecompileCallTests;
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.params.provider.Arguments;

@Tag("weekly-ecpairing")
@Tag("prc-calltests")
public class Tests extends PrecompileCallTests<CallParameters> {
// Set sample size with potential for override.
private static final int ECPAIRING_SAMPLE_SIZE =
Integer.parseInt(System.getenv().getOrDefault("PRC_CALLTESTS_SAMPLE_SIZE", "7500"));

public static Stream<Arguments> parameterGeneration() {
return ParameterGeneration.parameterGeneration();
return randomSampleByDayOfMonth(
ECPAIRING_SAMPLE_SIZE, ParameterGeneration.parameterGeneration())
.stream();
}

// @Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@

import java.util.ArrayList;
import java.util.List;
import java.util.stream.Stream;

import net.consensys.linea.zktracer.instructionprocessing.callTests.prc.GasParameter;
import net.consensys.linea.zktracer.instructionprocessing.callTests.prc.ReturnAtParameter;
Expand All @@ -28,7 +27,7 @@

public class ParameterGeneration {

public static Stream<Arguments> parameterGeneration() {
public static List<Arguments> parameterGeneration() {
List<OpCode> CallOpCodes = List.of(CALL, CALLCODE, DELEGATECALL, STATICCALL);
List<GasParameter> GasParameters = List.of(ZERO, COST_MO, COST, PLENTY);
List<ReturnAtParameter> ReturnAtParameters =
Expand All @@ -54,6 +53,6 @@ public static Stream<Arguments> parameterGeneration() {
}
}
}
return argumentsList.stream();
return argumentsList;
}
}
Loading
Loading