Skip to content

Commit

Permalink
update to besu 25.1-delivery42
Browse files Browse the repository at this point in the history
This updates the linea-tracer to use the latest development branch of
(linea) besu, and address some minor changes to its API.
  • Loading branch information
DavePearce committed Jan 14, 2025
1 parent b9ddc4f commit 615340b
Show file tree
Hide file tree
Showing 8 changed files with 18 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ public void tracePreExecution(MessageFrame frame) {
// Sanity check block within last 256 blocks.
if (blockNumber < currentBlockNumber && (currentBlockNumber - blockNumber) <= 256) {
// Use enclosing frame to determine hash
Hash blockHash = frame.getBlockHashLookup().apply(blockNumber);
Hash blockHash = frame.getBlockHashLookup().apply(frame, blockNumber);
// Record it was seen
this.reaper.touchBlockHash(blockNumber, blockHash);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@
import java.util.Map;

import org.hyperledger.besu.datatypes.Hash;
import org.hyperledger.besu.evm.operation.BlockHashOperation.BlockHashLookup;
import org.hyperledger.besu.evm.blockhash.BlockHashLookup;
import org.hyperledger.besu.evm.frame.MessageFrame;

/**
* Contain the minimal set of information to replay a conflation as a unit test without requiring
Expand Down Expand Up @@ -64,7 +65,7 @@ private static class BlockHashMap implements BlockHashLookup {
private final Map<Long, Hash> blockHashCache = new HashMap<>();

@Override
public Hash apply(Long blockNumber) {
public Hash apply(MessageFrame frame, Long blockNumber) {
// Sanity check we found the hash
if (!this.blockHashCache.containsKey(blockNumber)) {
// Missing for some reason
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
releaseVersion=0.8.0-rc8
besuVersion=24.12-delivery41
besuVersion=25.1-delivery42
besuArtifactGroup=io.consensys.linea-besu
distributionIdentifier=linea-tracer
distributionBaseUrl=https://artifacts.consensys.net/public/linea-besu/raw/names/linea-besu.tar.gz/versions/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@
import org.hyperledger.besu.ethereum.processing.TransactionProcessingResult;
import org.hyperledger.besu.ethereum.trie.diffbased.bonsai.worldview.BonsaiWorldState;
import org.hyperledger.besu.ethereum.trie.diffbased.bonsai.worldview.BonsaiWorldStateUpdateAccumulator;
import org.hyperledger.besu.ethereum.vm.CachingBlockHashLookup;
import org.hyperledger.besu.evm.operation.BlockHashOperation;
import org.hyperledger.besu.ethereum.vm.BlockchainBasedBlockHashLookup;
import org.hyperledger.besu.evm.blockhash.BlockHashLookup;
import org.hyperledger.besu.evm.worldstate.WorldUpdater;

@Slf4j
Expand Down Expand Up @@ -96,8 +96,8 @@ public BlockProcessingResult processBlock(

final WorldUpdater worldStateUpdater = worldState.updater();

final BlockHashOperation.BlockHashLookup blockHashLookup =
new CachingBlockHashLookup(blockHeader, blockchain);
final BlockHashLookup blockHashLookup =
new BlockchainBasedBlockHashLookup(blockHeader, blockchain);
final Address miningBeneficiary =
miningBeneficiaryCalculator.calculateBeneficiary(blockHeader);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
import org.hyperledger.besu.ethereum.referencetests.ReferenceTestProtocolSchedules;
import org.hyperledger.besu.ethereum.referencetests.ReferenceTestWorldState;
import org.hyperledger.besu.ethereum.rlp.RLP;
import org.hyperledger.besu.ethereum.vm.CachingBlockHashLookup;
import org.hyperledger.besu.ethereum.vm.BlockchainBasedBlockHashLookup;
import org.hyperledger.besu.evm.account.Account;
import org.hyperledger.besu.evm.log.Log;
import org.hyperledger.besu.evm.worldstate.WorldUpdater;
Expand Down Expand Up @@ -187,7 +187,7 @@ public static void executeTest(final GeneralStateTestCaseEipSpec spec) {
transaction,
blockHeader.getCoinbase(),
zkTracer,
new CachingBlockHashLookup(blockHeader, blockchain),
new BlockchainBasedBlockHashLookup(blockHeader, blockchain),
false,
TransactionValidationParams.processingBlock(),
blobGasPrice);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
import net.consensys.linea.corset.CorsetValidator;
import net.consensys.linea.zktracer.ZkTracer;
import org.apache.tuweni.bytes.Bytes32;
import org.hyperledger.besu.config.GenesisConfigFile;
import org.hyperledger.besu.config.GenesisConfig;
import org.hyperledger.besu.config.GenesisConfigOptions;
import org.hyperledger.besu.consensus.clique.CliqueBlockHeaderFunctions;
import org.hyperledger.besu.consensus.clique.CliqueForksSchedulesFactory;
Expand Down Expand Up @@ -57,8 +57,8 @@
public class ExecutionEnvironment {
public static final String CORSET_VALIDATION_RESULT = "Corset validation result: ";

static GenesisConfigFile GENESIS_CONFIG =
GenesisConfigFile.fromSource(GenesisConfigFile.class.getResource("/linea.json"));
static GenesisConfig GENESIS_CONFIG =
GenesisConfig.fromSource(GenesisConfig.class.getResource("/linea.json"));

static final BlockHeaderBuilder DEFAULT_BLOCK_HEADER_BUILDER =
BlockHeaderBuilder.createDefault()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
import org.hyperledger.besu.ethereum.referencetests.ReferenceTestBlockchain;
import org.hyperledger.besu.ethereum.referencetests.ReferenceTestWorldState;
import org.hyperledger.besu.ethereum.rlp.RLP;
import org.hyperledger.besu.ethereum.vm.CachingBlockHashLookup;
import org.hyperledger.besu.ethereum.vm.BlockchainBasedBlockHashLookup;
import org.hyperledger.besu.evm.account.Account;
import org.hyperledger.besu.evm.log.Log;
import org.hyperledger.besu.evm.worldstate.WorldUpdater;
Expand Down Expand Up @@ -111,7 +111,7 @@ public static void executeTest(
transaction,
blockHeader.getCoinbase(),
tracer,
new CachingBlockHashLookup(blockHeader, blockchain),
new BlockchainBasedBlockHashLookup(blockHeader, blockchain),
false,
TransactionValidationParams.processingBlock(),
blobGasPrice);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,9 @@
import org.hyperledger.besu.ethereum.processing.TransactionProcessingResult;
import org.hyperledger.besu.ethereum.referencetests.ReferenceTestWorldState;
import org.hyperledger.besu.evm.account.MutableAccount;
import org.hyperledger.besu.evm.blockhash.BlockHashLookup;
import org.hyperledger.besu.evm.internal.EvmConfiguration;
import org.hyperledger.besu.evm.internal.Words;
import org.hyperledger.besu.evm.operation.BlockHashOperation;
import org.hyperledger.besu.evm.tracing.OperationTracer;
import org.hyperledger.besu.evm.worldstate.WorldUpdater;

Expand Down Expand Up @@ -187,7 +187,7 @@ private static void executeFrom(
final boolean txResultChecking,
final boolean useCoinbaseAddressFromBlockHeader,
final TransactionProcessingResultValidator resultValidator) {
BlockHashOperation.BlockHashLookup blockHashLookup = conflation.toBlockHashLookup();
BlockHashLookup blockHashLookup = conflation.toBlockHashLookup();
// Initialise world state from conflation
MutableWorldState world = initWorld(conflation);
// Construct the transaction processor
Expand Down

0 comments on commit 615340b

Please sign in to comment.