Skip to content

Commit

Permalink
Merge branch 'main' into linea_setExtraData
Browse files Browse the repository at this point in the history
# Conflicts:
#	sequencer/src/main/java/net/consensys/linea/extradata/LineaExtraDataException.java
#	sequencer/src/main/java/net/consensys/linea/rpc/LineaSetExtraData.java
#	sequencer/src/test/resources/log4j2.xml
  • Loading branch information
fab-10 committed Jun 21, 2024
2 parents b3ca959 + b368c08 commit 5682b8d
Show file tree
Hide file tree
Showing 458 changed files with 115 additions and 71,367 deletions.
25 changes: 1 addition & 24 deletions .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:
uses: actions/upload-artifact@v3
with:
name: distributions
path: arithmetization/build/libs
path: sequencer/build/libs

acceptanceTest:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -99,29 +99,6 @@ jobs:
name: compress-test-report
path: compress/build/reports/tests/

tests:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3

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

- name: Run unit tests
run: ./gradlew :arithmetization:test
env:
JAVA_OPTS: -Dorg.gradle.daemon=false

- name: Upload test report
uses: actions/upload-artifact@v3
with:
name: unit-test-report
path: arithmetization/build/reports/tests/

spotless:
runs-on: ubuntu-latest
steps:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,6 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./arithmetization/build/libs/besu-sequencer-plugins-${{ steps.get_version.outputs.VERSION }}.jar
asset_name: besu-sequencer-plugins-${{ steps.get_version.outputs.VERSION }}.jar
asset_path: ./sequencer/build/libs/linea-sequencer${{ steps.get_version.outputs.VERSION }}.jar
asset_name: linea-sequencer-${{ steps.get_version.outputs.VERSION }}.jar
asset_content_type: application/octet-stream
4 changes: 0 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,4 @@ out/
site/
/.direnv/
/.envrc
reference-tests/src/test/java/net/consensys/linea/generated/*
!reference-tests/src/test/java/net/consensys/linea/generated/.gitkeep
arithmetization/bin/
acceptance-tests/bin/
reference-tests/bin/
6 changes: 0 additions & 6 deletions .gitmodules

This file was deleted.

6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Besu Plugins relating to tracer and sequencer functionality
# Besu Plugins related to tracer and sequencer functionality

A Linea tracing implementation for [Hyperledger Besu](https://github.com/hyperledger/besu) based on
an [existing implementation in Go](https://github.com/Consensys/zk-evm/).
Expand Down Expand Up @@ -38,7 +38,7 @@ Linux/MacOs
Windows
* Requirement [Docker Desktop WSL 2 backend on Windows](https://docs.docker.com/desktop/wsl/)

On release native libs are build for all the supported platforms,
On release native libs are built for all the supported platforms,
if you want to test this process locally run `./gradlew -PreleaseNativeLibs jar`,
jar is generated in `arithmetization/build/libs`.

Expand Down Expand Up @@ -115,7 +115,7 @@ ______________________________________________________________________
NOTE

> Please be aware if the reference test code generation tasks `blockchainReferenceTests` and
> `generalStateReferenceTests` do not generate any java code, than probably you are missing the Ethereum tests
> `generalStateReferenceTests` do not generate any java code, then probably you are missing the Ethereum tests"
> submodule which you can clone via `git submodule update --init --recursive`.
______________________________________________________________________
Expand Down
9 changes: 6 additions & 3 deletions acceptance-tests/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ plugins {
apply from: rootProject.file("gradle/java.gradle")
apply from: rootProject.file("gradle/dependency-management.gradle")
apply from: rootProject.file('gradle/common-dependencies.gradle')
apply from: rootProject.file("gradle/corset.gradle")
apply from: rootProject.file("gradle/tests.gradle")
apply from: rootProject.file("gradle/lint.gradle")

Expand All @@ -45,7 +44,7 @@ tasks.register('acceptanceTests', Test) {
description = 'Runs acceptance tests.'

dependsOn(project(":native:compress").compileJava)
dependsOn(project(":arithmetization").copyPluginJar)
dependsOn(project(":sequencer").copyPluginJar)

inputs.property("integration.date", LocalTime.now()) // so it runs on every invocation

Expand All @@ -59,9 +58,13 @@ tasks.register('acceptanceTests', Test) {
}

dependencies {
testImplementation project(":arithmetization")
testImplementation 'net.consensys.linea.zktracer:arithmetization'
testImplementation project(":native:compress")
testImplementation project(":sequencer")
testImplementation "${besuArtifactGroup}.internal:dsl:$besuVersion"
testImplementation "${besuArtifactGroup}.internal:api:${besuVersion}"
testImplementation "${besuArtifactGroup}:plugin-api"
testImplementation "${besuArtifactGroup}.internal:algorithms:${besuVersion}"
testImplementation "${besuArtifactGroup}:besu-datatypes:$besuVersion"
testImplementation "${besuArtifactGroup}.internal:eth:$besuVersion"
testImplementation "${besuArtifactGroup}.internal:eth:$besuVersion:test-support"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
import net.consensys.linea.bl.TransactionProfitabilityCalculator;
import net.consensys.linea.config.LineaProfitabilityCliOptions;
import net.consensys.linea.config.LineaProfitabilityConfiguration;
import net.consensys.linea.rpc.linea.LineaEstimateGas;
import net.consensys.linea.rpc.LineaEstimateGas;
import org.apache.tuweni.bytes.Bytes;
import org.apache.tuweni.units.bigints.UInt64;
import org.bouncycastle.crypto.digests.KeccakDigest;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,6 @@

package org.hyperledger.besu.tests.acceptance.dsl;

import static org.hyperledger.besu.datatypes.Hash.fromHexString;

import java.math.BigInteger;

import org.apache.tuweni.bytes.Bytes;
import org.hyperledger.besu.datatypes.Address;
import org.hyperledger.besu.datatypes.Hash;
import org.hyperledger.besu.ethereum.core.BlockHeader;
import org.hyperledger.besu.ethereum.core.BlockHeaderFunctions;
import org.hyperledger.besu.ethereum.core.Difficulty;
import org.hyperledger.besu.evm.log.LogsBloomFilter;
import org.web3j.protocol.core.methods.response.EthBlock.Block;

/** Helper functions for creating and manipulating blocks and block headers. */
public class BlockUtils {

Expand All @@ -38,35 +25,35 @@ public class BlockUtils {
* @param blockHeaderFunctions functions for calculating parts of a {@link BlockHeader}
* @return a block header of type {@link BlockHeader}
*/
public static BlockHeader createBlockHeader(
final Block block, final BlockHeaderFunctions blockHeaderFunctions) {
final Hash mixHash =
block.getMixHash() == null
? Hash.fromHexStringLenient("0x0")
: fromHexString(block.getMixHash());

return new BlockHeader(
fromHexString(block.getParentHash()),
fromHexString(block.getSha3Uncles()),
Address.fromHexString(block.getMiner()),
fromHexString(block.getStateRoot()),
fromHexString(block.getTransactionsRoot()),
fromHexString(block.getReceiptsRoot()),
LogsBloomFilter.fromHexString(block.getLogsBloom()),
Difficulty.fromHexString(block.getDifficultyRaw()),
block.getNumber().longValue(),
block.getGasLimit().longValue(),
block.getGasUsed().longValue(),
block.getTimestamp().longValue(),
Bytes.fromHexString(block.getExtraData()),
null,
mixHash,
new BigInteger(block.getNonceRaw().substring(2), 16).longValue(),
null,
0L,
null,
null,
null,
blockHeaderFunctions);
}
// public static BlockHeader createBlockHeader(
// final Block block, final BlockHeaderFunctions blockHeaderFunctions) {
// final Hash mixHash =
// block.getMixHash() == null
// ? Hash.fromHexStringLenient("0x0")
// : fromHexString(block.getMixHash());
//
// return new BlockHeader(
// fromHexString(block.getParentHash()),
// fromHexString(block.getSha3Uncles()),
// Address.fromHexString(block.getMiner()),
// fromHexString(block.getStateRoot()),
// fromHexString(block.getTransactionsRoot()),
// fromHexString(block.getReceiptsRoot()),
// LogsBloomFilter.fromHexString(block.getLogsBloom()),
// Difficulty.fromHexString(block.getDifficultyRaw()),
// block.getNumber().longValue(),
// block.getGasLimit().longValue(),
// block.getGasUsed().longValue(),
// block.getTimestamp().longValue(),
// Bytes.fromHexString(block.getExtraData()),
// null,
// mixHash,
// new BigInteger(block.getNonceRaw().substring(2), 16).longValue(),
// null,
// 0L,
// null,
// null,
// null,
// blockHeaderFunctions);
// }
}
6 changes: 5 additions & 1 deletion acceptance-tests/src/test/resources/moduleLimits.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ BIN = 262144
BIN_RT = 262144
EC_DATA = 4096
EUC = 16384 # can probably be lower
EXP = 32760
EXT = 32768
HUB = 2097152
INSTRUCTION_DECODER = 512 # Ugly hack, TODO: @franklin
Expand Down Expand Up @@ -43,7 +44,7 @@ RLP_TXN = 262144
RLP_TXRCPT = 262144
TXN_DATA = 262144
STP = 262144

OOB = 262144
#
# Block-specific limits
#
Expand All @@ -52,6 +53,9 @@ BLOCK_L2L1LOGS = 16
BLOCK_KECCAK = 8192
BLOCK_L1SIZE = 1000000

BLOCKDATA = 13
BLOCKHASH = 1

#
# Precompiles limits
#
Expand Down
4 changes: 4 additions & 0 deletions acceptance-tests/src/test/resources/noModuleLimits.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ BIN = 262144
BIN_RT = 262144
EC_DATA = 4096
EUC = 16384 # can probably be lower
EXP = 32760
EXT = 32768
HUB = 2097152
INSTRUCTION_DECODER = 512 # Ugly hack, TODO: @franklin
Expand Down Expand Up @@ -43,6 +44,9 @@ RLP_TXN = 262144
RLP_TXRCPT = 262144
TXN_DATA = 262144
STP = 262144
OOB = 262144
BLOCKDATA = 13
BLOCKHASH = 1

#
# Block-specific limits
Expand Down
4 changes: 4 additions & 0 deletions acceptance-tests/src/test/resources/strictModuleLimits.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ BIN = 262144
BIN_RT = 262144
EC_DATA = 4096
EUC = 16384 # can probably be lower
EXP = 32760
EXT = 32768
HUB = 10000
INSTRUCTION_DECODER = 512 # Ugly hack, TODO: @franklin
Expand Down Expand Up @@ -43,6 +44,9 @@ RLP_TXN = 262144
RLP_TXRCPT = 262144
TXN_DATA = 262144
STP = 262144
OOB = 262144
BLOCKDATA = 13
BLOCKHASH = 1

#
# Block-specific limits
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@ BIN = 262144
BIN_RT = 262144
EC_DATA = 4096
EUC = 16384 # can probably be lower
EXP = 32760
EXT = 20
HUB = 30
HUB = 33
INSTRUCTION_DECODER = 256 # Ugly hack, TODO: @franklin
MMIO = 1048576
MMU = 524288
Expand Down Expand Up @@ -44,6 +45,9 @@ RLP_TXN = 1300
RLP_TXRCPT = 100
TXN_DATA = 30
STP = 20
OOB = 262144
BLOCKDATA = 13
BLOCKHASH = 1

#
# Block-specific limits
Expand Down
Loading

0 comments on commit 5682b8d

Please sign in to comment.