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

Update Java, Gradle and dependencies #20

Merged
merged 2 commits into from
Jun 12, 2024
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
28 changes: 14 additions & 14 deletions .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v3

- name: Set up JDK 17
- name: Set up JDK 21
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'adopt'
java-version: 21
distribution: temurin

- name: Build without tests
run: ./gradlew build -x test -x spotlessCheck
Expand All @@ -51,11 +51,11 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v3

- name: Set up JDK 17
- name: Set up JDK 21
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'adopt'
java-version: 21
distribution: temurin

- name: Run acceptance tests
run: ./gradlew :acceptance-tests:acceptanceTests
Expand All @@ -81,11 +81,11 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v3

- name: Set up JDK 17
- name: Set up JDK 21
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'adopt'
java-version: 21
distribution: temurin

- name: Run libcompress JNI tests
run: ./gradlew :native:compress:test
Expand All @@ -105,11 +105,11 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v3

- name: Set up JDK 17
- name: Set up JDK 21
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'adopt'
java-version: 21
distribution: temurin

- name: Run unit tests
run: ./gradlew :arithmetization:test
Expand All @@ -130,7 +130,7 @@ jobs:
- name: Set up Java
uses: actions/setup-java@v3
with:
distribution: adopt
java-version: 17
distribution: temurin
java-version: 21
- name: spotless
run: ./gradlew --no-daemon --parallel clean spotlessCheck
6 changes: 3 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ jobs:

steps:
- uses: actions/checkout@v3
- name: Set up JDK 17
- name: Set up JDK 21
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'adopt'
java-version: 21
distribution: temurin
cache: 'gradle'

- name: Grant execute permission for gradlew
Expand Down
Empty file removed .web3j/solc/release.json
Empty file.
8 changes: 6 additions & 2 deletions acceptance-tests/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ import java.time.LocalTime

plugins {
id 'common-plugins'
id 'org.web3j' version '4.9.2'
id 'org.web3j.solidity' version '0.3.5'
id 'org.web3j' version '4.12.0'
id 'org.web3j.solidity' version '0.5.0'
}

apply from: rootProject.file("gradle/java.gradle")
Expand All @@ -35,8 +35,12 @@ web3j {
solidity {
resolvePackages = false
optimizeRuns = 1
// TODO: remove the forced version, when DEV network is upgraded to support latest forks
version '0.8.19'
}

processTestResources.dependsOn(':acceptance-tests:generateTestContractWrappers')

tasks.register('acceptanceTests', Test) {
description = 'Runs acceptance tests.'

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,6 @@ public void estimateGasFailsForExceedingModuleLineCountTest() throws Exception {
final var respLinea = reqLinea.execute(minerNode.nodeRequests());
assertThat(respLinea.getCode()).isEqualTo(-32000);
assertThat(respLinea.getMessage())
.isEqualTo("Transaction line count for module HUB=66 is above the limit 30");
.isEqualTo("Transaction line count for module SHF=32 is above the limit 20");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ public void transactionOverModuleLineCountNotAccepted() throws Exception {

assertThat(signedTxContractInteractionResp.hasError()).isTrue();
assertThat(signedTxContractInteractionResp.getError().getMessage())
.isEqualTo("Transaction line count for module ADD=402 is above the limit 70");
.isEqualTo("Transaction line count for module ADD=2018 is above the limit 70");

assertThat(getTxPoolContent()).isEmpty();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ public class BlockCapturer implements ConflationAwareOperationTracer {
* The {@link Reaper} will collect all the data that will need to be mimicked to replay the block.
*/
private final Reaper reaper = new Reaper();

/**
* This keeps a pointer to the initial state (i.e. ) to be used at the end of tracing to store the
* minimal required information to replay the conflation.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,10 @@
public class Reaper {
/** Collect the reads from the state */
private final StorageReaper storage = new StorageReaper();

/** Collect the addresses read from the state */
private final AddressReaper addresses = new AddressReaper();

/** Collect the blocks within a conflation */
private final List<BlockSnapshot> blocks = new ArrayList<>();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
public class LineaProfitabilityConfiguration {
/** It is safe to keep this as long, since it will store value <= max_int * 1000 */
private long fixedCostWei;

/** It is safe to keep this as long, since it will store value <= max_int * 1000 */
private long variableCostWei;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
public class CountersEndpointServicePlugin extends AbstractLineaSharedOptionsPlugin {
private BesuContext besuContext;
private RpcEndpointService rpcEndpointService;

/**
* Register the RPC service.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
public class TracesEndpointServicePlugin extends AbstractLineaSharedOptionsPlugin {
private BesuContext besuContext;
private RpcEndpointService rpcEndpointService;

/**
* Register the RPC service.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
public class BaseBytes implements HighLowBytes {
/** The size in bytes of the high and low sections of the 256-bit block. */
private static final int LOW_HIGH_SIZE = 16;

/**
* The mutable `Bytes32` object that stores the 256-bit block of data. Equals and hashCode must
* only be computed on the numeric value wrapped by this class, so that sets of operations
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
public class StackedList<E extends ModuleOperation> implements List<E>, StackedContainer {

private final LinkedList<CountedList<E>> lists = new LinkedList<>();

/** The cached number of elements in this container */
private int totalSize;

Expand Down Expand Up @@ -239,8 +240,10 @@ public List<E> subList(int fromIndex, int toIndex) {
private static class StackedListIterator<F extends ModuleOperation>
implements Iterator<F>, ListIterator<F> {
private final StackedList<F> sl;

/** Position of the iterator in the list of lists */
private int head = 0;

/** Position of the iterator within the current list, i.e. this.sl.lists[head] */
private int offset = -1;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ public class EcDataOperation extends ModuleOperation {

private final int ecType;
private final int nRows;

/** -1 if no switch off (i.e. preliminary checks passed) */
private int hurdleSwitchOffRow;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,8 +160,9 @@ public static AbstractExtCalculator create(OpCode opCode) {
return switch (opCode) {
case MULMOD -> new MulModCalculator();
case ADDMOD -> new AddModCalculator();
default -> throw new RuntimeException(
"Incompatible instruction for extended modular arithmetic module");
default ->
throw new RuntimeException(
"Incompatible instruction for extended modular arithmetic module");
};
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ public final class Bytecode {

/** The bytecode. */
private final Bytes bytecode;

/** The bytecode hash; is null by default and computed & memoized on the fly when required. */
private Hash hash;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ public void reset() {
public boolean stackException() {
return this.stackUnderflow() || this.stackOverflow();
}

/**
* @return true if no stack exception has been raised
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -957,26 +957,29 @@ void traceOperation(MessageFrame frame) {

switch (this.opCodeData().instructionFamily()) {
case ADD,
MOD,
MUL,
SHF,
BIN,
WCP,
EXT,
BATCH,
MACHINE_STATE,
PUSH_POP,
DUP,
SWAP,
HALT,
INVALID -> this.addTraceSection(new StackOnlySection(this));
MOD,
MUL,
SHF,
BIN,
WCP,
EXT,
BATCH,
MACHINE_STATE,
PUSH_POP,
DUP,
SWAP,
HALT,
INVALID ->
this.addTraceSection(new StackOnlySection(this));
case KEC -> {
this.addTraceSection(
new KeccakSection(this, this.currentFrame(), new MiscFragment(this, frame)));
}
case CONTEXT, LOG -> this.addTraceSection(
new ContextLogSection(
this, new ContextFragment(this.callStack, this.currentFrame(), updateReturnData)));
case CONTEXT, LOG ->
this.addTraceSection(
new ContextLogSection(
this,
new ContextFragment(this.callStack, this.currentFrame(), updateReturnData)));
case ACCOUNT -> {
TraceSection accountSection = new AccountSection(this);
if (this.opCodeData().stackSettings().flag1()) {
Expand Down Expand Up @@ -1034,17 +1037,18 @@ void traceOperation(MessageFrame frame) {
}
this.addTraceSection(copySection);
}
case TRANSACTION -> this.addTraceSection(
new TransactionSection(
this,
TransactionFragment.prepare(
this.conflation.number(),
frame.getMiningBeneficiary(),
this.tx.transaction(),
true,
frame.getGasPrice(),
frame.getBlockValues().getBaseFee().orElse(Wei.ZERO),
this.tx.initialGas())));
case TRANSACTION ->
this.addTraceSection(
new TransactionSection(
this,
TransactionFragment.prepare(
this.conflation.number(),
frame.getMiningBeneficiary(),
this.tx.transaction(),
true,
frame.getGasPrice(),
frame.getBlockValues().getBaseFee().orElse(Wei.ZERO),
this.tx.initialGas())));
case STACK_RAM -> {
switch (this.currentFrame().opCode()) {
case CALLDATALOAD -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,13 @@
@Accessors(fluent = true)
public class PlatformController {
private final Hub hub;

/** What other modules should be triggered for the current operation */
@Getter private final Signals signals;

/** The exceptions raised during the execution of the current operation */
@Getter private final Exceptions exceptions;

/** The aborting conditions raised during the execution of the current operation */
@Getter private final AbortingConditions aborts;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
public class TxTrace {
/** The {@link TraceSection} of which this transaction trace is made of */
@Getter private final List<TraceSection> trace = new ArrayList<>();

/** A cache for the line count of this transaction */
private int cachedLineCount = 0;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,10 @@
public class DeferRegistry {
/** A list of actions deferred until the end of the current transaction */
private final List<PostTransactionDefer> txDefers = new ArrayList<>();

/** A list of actions deferred until the end of the current opcode execution */
private final List<PostExecDefer> postExecDefers = new ArrayList<>();

/** A list of actions deferred until the end of the current opcode execution */
private final List<Pair<Integer, NextContextDefer>> contextReentry = new ArrayList<>();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,11 @@ private StackFragment(
switch (this.opCode) {
case SHA3 -> exceptions.none() && gp.messageSize() > 0;
case RETURN -> exceptions.none() && gp.messageSize() > 0 && isDeploying;
case CREATE2 -> exceptions.none()
&& contextExceptions.none()
&& aborts.none()
&& gp.messageSize() > 0;
case CREATE2 ->
exceptions.none()
&& contextExceptions.none()
&& aborts.none()
&& gp.messageSize() > 0;
default -> false;
};
this.hashInfoSize = this.hashInfoFlag ? gp.messageSize() : 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ public Trace trace(Trace trace) {

/** Count the stack lines */
@Getter private int stackRowsCounter;

/** Count the non-stack lines */
private int nonStackRowsCounter;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ public class L2Block implements Module {

/** The byte size of the RLP-encoded transaction of the conflation */
@Getter private final Deque<Integer> sizesRlpEncodedTxs = new ArrayDeque<>();

/** The byte size of the L2->L1 logs messages of the conflation */
@Getter private final Deque<List<Integer>> l2l1LogSizes = new ArrayDeque<>();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@ public void tracePreOpcode(MessageFrame frame) {
long dataByteLength = 0;
switch (opCode) {
case CALL, CALLCODE -> dataByteLength = Words.clampedToLong(frame.getStackItem(4));
case DELEGATECALL, STATICCALL -> dataByteLength =
Words.clampedToLong(frame.getStackItem(3));
case DELEGATECALL, STATICCALL ->
dataByteLength = Words.clampedToLong(frame.getStackItem(3));
}

if (dataByteLength == 0) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@ public void tracePreOpcode(MessageFrame frame) {
long dataByteLength = 0;
switch (opCode) {
case CALL, CALLCODE -> dataByteLength = Words.clampedToLong(frame.getStackItem(4));
case DELEGATECALL, STATICCALL -> dataByteLength =
Words.clampedToLong(frame.getStackItem(3));
case DELEGATECALL, STATICCALL ->
dataByteLength = Words.clampedToLong(frame.getStackItem(3));
}
if (dataByteLength == 0) {
return;
Expand Down
Loading
Loading