From 9d88191ec859f0a13d78d2ca6cd0304c4b58483c Mon Sep 17 00:00:00 2001 From: Karim Taam Date: Wed, 12 Jun 2024 17:04:12 +0200 Subject: [PATCH] fix build Signed-off-by: Karim Taam --- .../engine/AbstractEngineNewPayload.java | 2 +- .../parameters/VerkleProofParameter.java | 3 +- .../internal/methods/EthGasPriceTest.java | 1 + .../methods/EthGetTransactionReceiptTest.java | 7 +++-- .../engine/AbstractEngineNewPayloadTest.java | 4 +-- ...neExchangeTransitionConfigurationTest.java | 1 + .../engine/EngineNewPayloadV2Test.java | 16 +++++++--- .../engine/EngineNewPayloadV3Test.java | 6 ++-- .../engine/EngineNewPayloadV4Test.java | 16 +++++++--- .../query/BlockchainQueriesLogCacheTest.java | 1 + .../cache/TransactionLogBloomCacherTest.java | 2 ++ .../ethereum/core/BlockHeaderBuilder.java | 2 +- .../common/GenesisWorldStateProvider.java | 5 +-- .../bonsai/BonsaiWorldStateProvider.java | 5 --- .../common/DiffBasedWorldStateProvider.java | 4 +++ .../common/trielog/TrieLogManager.java | 9 +++--- .../verkle/VerkleWorldStateProvider.java | 11 +++++-- .../VerkleCachedWorldStorageManager.java | 11 +++++-- .../VerkleNoOpCachedWorldStorageManager.java | 3 +- .../verkle/worldview/VerkleWorldState.java | 18 ++++++++--- .../diffbased/verkle/LogRollingTests.java | 31 +++++++++++++------ .../besu/evm/frame/MessageFrame.java | 1 + .../operation/AbstractCreateOperation.java | 3 +- 23 files changed, 108 insertions(+), 54 deletions(-) diff --git a/ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/engine/AbstractEngineNewPayload.java b/ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/engine/AbstractEngineNewPayload.java index 8674314967..f2004f6e4f 100644 --- a/ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/engine/AbstractEngineNewPayload.java +++ b/ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/engine/AbstractEngineNewPayload.java @@ -57,6 +57,7 @@ import org.hyperledger.besu.ethereum.core.Transaction; import org.hyperledger.besu.ethereum.core.Withdrawal; import org.hyperledger.besu.ethereum.core.encoding.EncodingContext; import org.hyperledger.besu.ethereum.core.encoding.TransactionDecoder; +import org.hyperledger.besu.ethereum.core.witness.ExecutionWitness; import org.hyperledger.besu.ethereum.eth.manager.EthPeers; import org.hyperledger.besu.ethereum.mainnet.BodyValidation; import org.hyperledger.besu.ethereum.mainnet.MainnetBlockHeaderFunctions; @@ -67,7 +68,6 @@ import org.hyperledger.besu.ethereum.mainnet.feemarket.ExcessBlobGasCalculator; import org.hyperledger.besu.ethereum.mainnet.requests.RequestUtil; import org.hyperledger.besu.ethereum.rlp.RLPException; import org.hyperledger.besu.ethereum.trie.MerkleTrieException; -import org.hyperledger.besu.ethereum.core.witness.ExecutionWitness; import org.hyperledger.besu.plugin.services.exception.StorageException; import java.security.InvalidParameterException; diff --git a/ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/parameters/VerkleProofParameter.java b/ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/parameters/VerkleProofParameter.java index b3d15e06e8..1b302ecd79 100644 --- a/ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/parameters/VerkleProofParameter.java +++ b/ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/parameters/VerkleProofParameter.java @@ -50,8 +50,7 @@ public class VerkleProofParameter { this.ipaProof = ipaProof; } - public static VerkleProofParameter fromVerkleProof( - final VerkleProof verkleProof) { + public static VerkleProofParameter fromVerkleProof(final VerkleProof verkleProof) { return new VerkleProofParameter( verkleProof.otherStems().stream().map(Bytes::toHexString).toList(), verkleProof.depthExtensionPresent(), diff --git a/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/EthGasPriceTest.java b/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/EthGasPriceTest.java index 54e17cb21c..4992c09986 100644 --- a/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/EthGasPriceTest.java +++ b/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/EthGasPriceTest.java @@ -371,6 +371,7 @@ public class EthGasPriceTest { null, null, null, + null, null), new BlockBody( IntStream.range(0, txsNum) diff --git a/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/EthGetTransactionReceiptTest.java b/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/EthGetTransactionReceiptTest.java index 884cc504d8..c747ffb5d0 100644 --- a/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/EthGetTransactionReceiptTest.java +++ b/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/EthGetTransactionReceiptTest.java @@ -45,6 +45,7 @@ import org.hyperledger.besu.ethereum.core.BlockHeaderTestFixture; import org.hyperledger.besu.ethereum.core.MiningParameters; import org.hyperledger.besu.ethereum.core.Transaction; import org.hyperledger.besu.ethereum.core.TransactionReceipt; +import org.hyperledger.besu.ethereum.mainnet.ExecutionWitnessValidator; import org.hyperledger.besu.ethereum.mainnet.PoWHasher; import org.hyperledger.besu.ethereum.mainnet.ProtocolSchedule; import org.hyperledger.besu.ethereum.mainnet.ProtocolSpec; @@ -151,7 +152,8 @@ public class EthGetTransactionReceiptTest { Optional.empty(), new FrontierBlockHashProcessor(), true, - true); + true, + new ExecutionWitnessValidator.ProhibitedExecutionWitness()); private final ProtocolSpec statusTransactionTypeSpec = new ProtocolSpec( "status", @@ -182,7 +184,8 @@ public class EthGetTransactionReceiptTest { Optional.empty(), new FrontierBlockHashProcessor(), true, - true); + true, + new ExecutionWitnessValidator.ProhibitedExecutionWitness()); @SuppressWarnings("unchecked") private final ProtocolSchedule protocolSchedule = mock(ProtocolSchedule.class); diff --git a/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/engine/AbstractEngineNewPayloadTest.java b/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/engine/AbstractEngineNewPayloadTest.java index 5025c8e747..38aa5bd3ad 100644 --- a/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/engine/AbstractEngineNewPayloadTest.java +++ b/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/engine/AbstractEngineNewPayloadTest.java @@ -411,9 +411,9 @@ public abstract class AbstractEngineNewPayloadTest extends AbstractScheduledApiT final BlockHeader header, final List txs, final List withdrawals, - final List depositRequests, + final List depositRequests, final List withdrawalRequests, - final ExecutionWitnessParameter executionWitness) { + final ExecutionWitnessParameter executionWitness) { return new EnginePayloadParameter( header.getHash(), header.getParentHash(), diff --git a/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/engine/EngineExchangeTransitionConfigurationTest.java b/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/engine/EngineExchangeTransitionConfigurationTest.java index d3104670de..f5928091c1 100644 --- a/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/engine/EngineExchangeTransitionConfigurationTest.java +++ b/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/engine/EngineExchangeTransitionConfigurationTest.java @@ -254,6 +254,7 @@ public class EngineExchangeTransitionConfigurationTest { null, null, null, + null, new BlockHeaderFunctions() { @Override public Hash hash(final BlockHeader header) { diff --git a/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/engine/EngineNewPayloadV2Test.java b/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/engine/EngineNewPayloadV2Test.java index 6421d7eeb2..412dc6f892 100644 --- a/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/engine/EngineNewPayloadV2Test.java +++ b/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/engine/EngineNewPayloadV2Test.java @@ -87,7 +87,9 @@ public class EngineNewPayloadV2Test extends AbstractEngineNewPayloadTest { .when(blockchain.getBlockHeader(mockHeader.getParentHash())) .thenReturn(Optional.of(mock(BlockHeader.class))); var resp = - resp(mockEnginePayload(mockHeader, Collections.emptyList(), withdrawalsParam, null, null, null)); + resp( + mockEnginePayload( + mockHeader, Collections.emptyList(), withdrawalsParam, null, null, null)); assertValidResponse(mockHeader, resp); } @@ -127,7 +129,8 @@ public class EngineNewPayloadV2Test extends AbstractEngineNewPayloadTest { Collections.emptyList(), withdrawals, null, - null, null)); + null, + null)); final JsonRpcError jsonRpcError = fromErrorResp(resp); assertThat(jsonRpcError.getCode()).isEqualTo(INVALID_PARAMS.getCode()); @@ -143,7 +146,8 @@ public class EngineNewPayloadV2Test extends AbstractEngineNewPayloadTest { .blobGasUsed(100L) .buildHeader(); - var resp = resp(mockEnginePayload(blockHeader, Collections.emptyList(), List.of(), null, null, null)); + var resp = + resp(mockEnginePayload(blockHeader, Collections.emptyList(), List.of(), null, null, null)); final JsonRpcError jsonRpcError = fromErrorResp(resp); assertThat(jsonRpcError.getCode()).isEqualTo(INVALID_PARAMS.getCode()); assertThat(jsonRpcError.getData()).isEqualTo("non-null BlobGasUsed pre-cancun"); @@ -159,7 +163,8 @@ public class EngineNewPayloadV2Test extends AbstractEngineNewPayloadTest { .excessBlobGas(BlobGas.MAX_BLOB_GAS) .buildHeader(); - var resp = resp(mockEnginePayload(blockHeader, Collections.emptyList(), List.of(), null, null, null)); + var resp = + resp(mockEnginePayload(blockHeader, Collections.emptyList(), List.of(), null, null, null)); final JsonRpcError jsonRpcError = fromErrorResp(resp); assertThat(jsonRpcError.getCode()).isEqualTo(INVALID_PARAMS.getCode()); @@ -180,7 +185,8 @@ public class EngineNewPayloadV2Test extends AbstractEngineNewPayloadTest { Collections.emptyList(), withdrawals, null, - null, null)); + null, + null)); assertThat(fromErrorResp(resp).getCode()).isEqualTo(INVALID_PARAMS.getCode()); verify(engineCallListener, times(1)).executionEngineCalled(); diff --git a/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/engine/EngineNewPayloadV3Test.java b/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/engine/EngineNewPayloadV3Test.java index eae3223fd4..c19bb8fbcb 100644 --- a/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/engine/EngineNewPayloadV3Test.java +++ b/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/engine/EngineNewPayloadV3Test.java @@ -193,7 +193,8 @@ public class EngineNewPayloadV3Test extends EngineNewPayloadV2Test { .blobGasUsed(null) .buildHeader(); - var resp = resp(mockEnginePayload(blockHeader, Collections.emptyList(), List.of(), null, null, null)); + var resp = + resp(mockEnginePayload(blockHeader, Collections.emptyList(), List.of(), null, null, null)); final JsonRpcError jsonRpcError = fromErrorResp(resp); assertThat(jsonRpcError.getCode()).isEqualTo(INVALID_PARAMS.getCode()); @@ -212,7 +213,8 @@ public class EngineNewPayloadV3Test extends EngineNewPayloadV2Test { .blobGasUsed(100L) .buildHeader(); - var resp = resp(mockEnginePayload(blockHeader, Collections.emptyList(), List.of(), null, null, null)); + var resp = + resp(mockEnginePayload(blockHeader, Collections.emptyList(), List.of(), null, null, null)); final JsonRpcError jsonRpcError = fromErrorResp(resp); assertThat(jsonRpcError.getCode()).isEqualTo(INVALID_PARAMS.getCode()); diff --git a/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/engine/EngineNewPayloadV4Test.java b/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/engine/EngineNewPayloadV4Test.java index 28efa560d5..9ea1721305 100644 --- a/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/engine/EngineNewPayloadV4Test.java +++ b/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/engine/EngineNewPayloadV4Test.java @@ -109,7 +109,9 @@ public class EngineNewPayloadV4Test extends EngineNewPayloadV3Test { .thenReturn(Optional.of(mockHeader.getHash())); var resp = - resp(mockEnginePayload(mockHeader, Collections.emptyList(), null, depositRequests, null, null)); + resp( + mockEnginePayload( + mockHeader, Collections.emptyList(), null, depositRequests, null, null)); assertValidResponse(mockHeader, resp); } @@ -125,7 +127,8 @@ public class EngineNewPayloadV4Test extends EngineNewPayloadV3Test { Collections.emptyList(), null, depositRequests, - null, null)); + null, + null)); assertThat(fromErrorResp(resp).getCode()).isEqualTo(INVALID_PARAMS.getCode()); verify(engineCallListener, times(1)).executionEngineCalled(); @@ -172,7 +175,8 @@ public class EngineNewPayloadV4Test extends EngineNewPayloadV3Test { Collections.emptyList(), null, depositRequests, - null, null)); + null, + null)); final JsonRpcError jsonRpcError = fromErrorResp(resp); assertThat(jsonRpcError.getCode()).isEqualTo(INVALID_PARAMS.getCode()); @@ -211,7 +215,8 @@ public class EngineNewPayloadV4Test extends EngineNewPayloadV3Test { Collections.emptyList(), null, null, - null, null)); + null, + null)); assertThat(fromErrorResp(resp).getCode()).isEqualTo(INVALID_PARAMS.getCode()); verify(engineCallListener, times(1)).executionEngineCalled(); @@ -258,7 +263,8 @@ public class EngineNewPayloadV4Test extends EngineNewPayloadV3Test { Collections.emptyList(), null, null, - withdrawalRequests, null)); + withdrawalRequests, + null)); final JsonRpcError jsonRpcError = fromErrorResp(resp); assertThat(jsonRpcError.getCode()).isEqualTo(INVALID_PARAMS.getCode()); diff --git a/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/query/BlockchainQueriesLogCacheTest.java b/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/query/BlockchainQueriesLogCacheTest.java index c0420163de..4b96317329 100644 --- a/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/query/BlockchainQueriesLogCacheTest.java +++ b/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/query/BlockchainQueriesLogCacheTest.java @@ -120,6 +120,7 @@ public class BlockchainQueriesLogCacheTest { null, null, null, + null, new MainnetBlockHeaderFunctions()); testHash = fakeHeader.getHash(); final BlockBody fakeBody = new BlockBody(Collections.emptyList(), Collections.emptyList()); diff --git a/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/query/cache/TransactionLogBloomCacherTest.java b/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/query/cache/TransactionLogBloomCacherTest.java index 5772a04a49..293c0b176e 100644 --- a/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/query/cache/TransactionLogBloomCacherTest.java +++ b/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/query/cache/TransactionLogBloomCacherTest.java @@ -108,6 +108,7 @@ public class TransactionLogBloomCacherTest { null, null, null, + null, new MainnetBlockHeaderFunctions()); testHash = fakeHeader.getHash(); when(blockchain.getBlockHeader(anyLong())).thenReturn(Optional.of(fakeHeader)); @@ -283,6 +284,7 @@ public class TransactionLogBloomCacherTest { null, null, null, + null, new MainnetBlockHeaderFunctions()); testHash = fakeHeader.getHash(); when(blockchain.getBlockHeader(number)).thenReturn(Optional.of(fakeHeader)); diff --git a/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/core/BlockHeaderBuilder.java b/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/core/BlockHeaderBuilder.java index 8ea903786e..d65b99f0b1 100644 --- a/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/core/BlockHeaderBuilder.java +++ b/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/core/BlockHeaderBuilder.java @@ -22,8 +22,8 @@ import org.hyperledger.besu.datatypes.Address; import org.hyperledger.besu.datatypes.BlobGas; import org.hyperledger.besu.datatypes.Hash; import org.hyperledger.besu.datatypes.Wei; -import org.hyperledger.besu.ethereum.mainnet.MainnetBlockHeaderFunctions; import org.hyperledger.besu.ethereum.core.witness.ExecutionWitness; +import org.hyperledger.besu.ethereum.mainnet.MainnetBlockHeaderFunctions; import org.hyperledger.besu.evm.log.LogsBloomFilter; import java.time.Instant; diff --git a/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/trie/common/GenesisWorldStateProvider.java b/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/trie/common/GenesisWorldStateProvider.java index 1298db1663..6282fb4e22 100644 --- a/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/trie/common/GenesisWorldStateProvider.java +++ b/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/trie/common/GenesisWorldStateProvider.java @@ -22,10 +22,10 @@ import org.hyperledger.besu.ethereum.trie.diffbased.bonsai.cache.NoOpBonsaiCache import org.hyperledger.besu.ethereum.trie.diffbased.bonsai.storage.BonsaiWorldStateKeyValueStorage; import org.hyperledger.besu.ethereum.trie.diffbased.bonsai.worldview.BonsaiWorldState; import org.hyperledger.besu.ethereum.trie.diffbased.common.trielog.NoOpTrieLogManager; +import org.hyperledger.besu.ethereum.trie.diffbased.common.worldview.DiffBasedWorldStateConfig; import org.hyperledger.besu.ethereum.trie.diffbased.verkle.cache.VerkleNoOpCachedWorldStorageManager; import org.hyperledger.besu.ethereum.trie.diffbased.verkle.storage.VerkleWorldStateKeyValueStorage; import org.hyperledger.besu.ethereum.trie.diffbased.verkle.worldview.VerkleWorldState; -import org.hyperledger.besu.ethereum.trie.diffbased.common.worldview.DiffBasedWorldStateConfig; import org.hyperledger.besu.ethereum.trie.forest.storage.ForestWorldStateKeyValueStorage; import org.hyperledger.besu.ethereum.trie.forest.worldview.ForestMutableWorldState; import org.hyperledger.besu.ethereum.worldstate.DataStorageConfiguration; @@ -95,7 +95,8 @@ public class GenesisWorldStateProvider { verkleWorldStateKeyValueStorage, new VerkleNoOpCachedWorldStorageManager(verkleWorldStateKeyValueStorage), new NoOpTrieLogManager(), - EvmConfiguration.DEFAULT); + EvmConfiguration.DEFAULT, + new DiffBasedWorldStateConfig()); } /** diff --git a/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/trie/diffbased/bonsai/BonsaiWorldStateProvider.java b/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/trie/diffbased/bonsai/BonsaiWorldStateProvider.java index 4d91341c88..15513f987f 100644 --- a/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/trie/diffbased/bonsai/BonsaiWorldStateProvider.java +++ b/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/trie/diffbased/bonsai/BonsaiWorldStateProvider.java @@ -24,7 +24,6 @@ import org.hyperledger.besu.ethereum.trie.diffbased.bonsai.storage.BonsaiWorldSt import org.hyperledger.besu.ethereum.trie.diffbased.bonsai.worldview.BonsaiWorldState; import org.hyperledger.besu.ethereum.trie.diffbased.common.DiffBasedWorldStateProvider; import org.hyperledger.besu.ethereum.trie.diffbased.common.trielog.TrieLogManager; -import org.hyperledger.besu.ethereum.trie.diffbased.common.worldview.DiffBasedWorldStateConfig; import org.hyperledger.besu.ethereum.trie.patricia.StoredMerklePatriciaTrie; import org.hyperledger.besu.ethereum.worldstate.StateTrieAccountValue; import org.hyperledger.besu.evm.internal.EvmConfiguration; @@ -153,8 +152,4 @@ public class BonsaiWorldStateProvider extends DiffBasedWorldStateProvider { getBonsaiWorldStateKeyValueStorage().downgradeToPartialFlatDbMode(); } - - private DiffBasedWorldStateConfig cloneBonsaiWorldStateConfig() { - return new DiffBasedWorldStateConfig(defaultWorldStateConfig); - } } diff --git a/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/trie/diffbased/common/DiffBasedWorldStateProvider.java b/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/trie/diffbased/common/DiffBasedWorldStateProvider.java index 5cb06a1c31..53e9e56860 100644 --- a/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/trie/diffbased/common/DiffBasedWorldStateProvider.java +++ b/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/trie/diffbased/common/DiffBasedWorldStateProvider.java @@ -336,4 +336,8 @@ public abstract class DiffBasedWorldStateProvider implements WorldStateArchive { // no op } } + + protected DiffBasedWorldStateConfig cloneBonsaiWorldStateConfig() { + return new DiffBasedWorldStateConfig(defaultWorldStateConfig); + } } diff --git a/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/trie/diffbased/common/trielog/TrieLogManager.java b/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/trie/diffbased/common/trielog/TrieLogManager.java index d61b3c458e..91338d13ca 100644 --- a/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/trie/diffbased/common/trielog/TrieLogManager.java +++ b/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/trie/diffbased/common/trielog/TrieLogManager.java @@ -135,11 +135,12 @@ public class TrieLogManager { trieLogObservers.unsubscribe(id); } - private TrieLogFactory setupTrieLogFactory(final DataStorageFormat dataStorageFormat,final BesuContext pluginContext) { + private TrieLogFactory setupTrieLogFactory( + final DataStorageFormat dataStorageFormat, final BesuContext pluginContext) { // if we have a TrieLogService from pluginContext, use it. var trieLogServicez = - Optional.ofNullable(pluginContext) - .flatMap(context -> context.getService(TrieLogService.class)); + Optional.ofNullable(pluginContext) + .flatMap(context -> context.getService(TrieLogService.class)); if (trieLogServicez.isPresent()) { var trieLogService = trieLogServicez.get(); @@ -158,7 +159,7 @@ public class TrieLogManager { if (dataStorageFormat.equals(DataStorageFormat.VERKLE)) { return new TrieLogFactoryImpl(); } - //or default to BONSAI TrieLogFactoryImpl + // or default to BONSAI TrieLogFactoryImpl return new org.hyperledger.besu.ethereum.trie.diffbased.bonsai.trielog.TrieLogFactoryImpl(); } diff --git a/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/trie/diffbased/verkle/VerkleWorldStateProvider.java b/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/trie/diffbased/verkle/VerkleWorldStateProvider.java index 59c914653c..12fd5fe51c 100644 --- a/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/trie/diffbased/verkle/VerkleWorldStateProvider.java +++ b/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/trie/diffbased/verkle/VerkleWorldStateProvider.java @@ -43,8 +43,11 @@ public class VerkleWorldStateProvider extends DiffBasedWorldStateProvider { maxLayersToLoad, pluginContext); provideCachedWorldStorageManager( - new VerkleCachedWorldStorageManager(this, worldStateKeyValueStorage)); - loadPersistedState(new VerkleWorldState(this, worldStateKeyValueStorage, evmConfiguration)); + new VerkleCachedWorldStorageManager( + this, worldStateKeyValueStorage, this::cloneBonsaiWorldStateConfig)); + loadPersistedState( + new VerkleWorldState( + this, worldStateKeyValueStorage, evmConfiguration, defaultWorldStateConfig)); } @VisibleForTesting @@ -56,6 +59,8 @@ public class VerkleWorldStateProvider extends DiffBasedWorldStateProvider { final EvmConfiguration evmConfiguration) { super(worldStateKeyValueStorage, blockchain, trieLogManager); provideCachedWorldStorageManager(cachedWorldStorageManager); - loadPersistedState(new VerkleWorldState(this, worldStateKeyValueStorage, evmConfiguration)); + loadPersistedState( + new VerkleWorldState( + this, worldStateKeyValueStorage, evmConfiguration, defaultWorldStateConfig)); } } diff --git a/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/trie/diffbased/verkle/cache/VerkleCachedWorldStorageManager.java b/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/trie/diffbased/verkle/cache/VerkleCachedWorldStorageManager.java index d180b7b7e2..8d123a4aee 100644 --- a/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/trie/diffbased/verkle/cache/VerkleCachedWorldStorageManager.java +++ b/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/trie/diffbased/verkle/cache/VerkleCachedWorldStorageManager.java @@ -18,6 +18,7 @@ import org.hyperledger.besu.ethereum.trie.diffbased.common.DiffBasedWorldStatePr import org.hyperledger.besu.ethereum.trie.diffbased.common.cache.DiffBasedCachedWorldStorageManager; import org.hyperledger.besu.ethereum.trie.diffbased.common.storage.DiffBasedWorldStateKeyValueStorage; import org.hyperledger.besu.ethereum.trie.diffbased.common.worldview.DiffBasedWorldState; +import org.hyperledger.besu.ethereum.trie.diffbased.common.worldview.DiffBasedWorldStateConfig; import org.hyperledger.besu.ethereum.trie.diffbased.verkle.VerkleWorldStateProvider; import org.hyperledger.besu.ethereum.trie.diffbased.verkle.storage.VerkleLayeredWorldStateKeyValueStorage; import org.hyperledger.besu.ethereum.trie.diffbased.verkle.storage.VerkleSnapshotWorldStateKeyValueStorage; @@ -25,12 +26,15 @@ import org.hyperledger.besu.ethereum.trie.diffbased.verkle.storage.VerkleWorldSt import org.hyperledger.besu.ethereum.trie.diffbased.verkle.worldview.VerkleWorldState; import org.hyperledger.besu.evm.internal.EvmConfiguration; +import java.util.function.Supplier; + public class VerkleCachedWorldStorageManager extends DiffBasedCachedWorldStorageManager { public VerkleCachedWorldStorageManager( final DiffBasedWorldStateProvider archive, - final DiffBasedWorldStateKeyValueStorage worldStateKeyValueStorage) { - super(archive, worldStateKeyValueStorage); + final DiffBasedWorldStateKeyValueStorage worldStateKeyValueStorage, + final Supplier defaultBonsaiWorldStateConfigSupplier) { + super(archive, worldStateKeyValueStorage, defaultBonsaiWorldStateConfigSupplier); } @Override @@ -41,7 +45,8 @@ public class VerkleCachedWorldStorageManager extends DiffBasedCachedWorldStorage return new VerkleWorldState( (VerkleWorldStateProvider) archive, (VerkleWorldStateKeyValueStorage) worldStateKeyValueStorage, - evmConfiguration); + evmConfiguration, + defaultBonsaiWorldStateConfigSupplier.get()); } @Override diff --git a/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/trie/diffbased/verkle/cache/VerkleNoOpCachedWorldStorageManager.java b/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/trie/diffbased/verkle/cache/VerkleNoOpCachedWorldStorageManager.java index 67810ce0a4..be8085af7d 100644 --- a/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/trie/diffbased/verkle/cache/VerkleNoOpCachedWorldStorageManager.java +++ b/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/trie/diffbased/verkle/cache/VerkleNoOpCachedWorldStorageManager.java @@ -17,6 +17,7 @@ package org.hyperledger.besu.ethereum.trie.diffbased.verkle.cache; import org.hyperledger.besu.datatypes.Hash; import org.hyperledger.besu.ethereum.core.BlockHeader; import org.hyperledger.besu.ethereum.trie.diffbased.common.worldview.DiffBasedWorldState; +import org.hyperledger.besu.ethereum.trie.diffbased.common.worldview.DiffBasedWorldStateConfig; import org.hyperledger.besu.ethereum.trie.diffbased.verkle.storage.VerkleWorldStateKeyValueStorage; import java.util.Optional; @@ -26,7 +27,7 @@ public class VerkleNoOpCachedWorldStorageManager extends VerkleCachedWorldStorag public VerkleNoOpCachedWorldStorageManager( final VerkleWorldStateKeyValueStorage verkleWorldStateKeyValueStorage) { - super(null, verkleWorldStateKeyValueStorage); + super(null, verkleWorldStateKeyValueStorage, DiffBasedWorldStateConfig::new); } @Override diff --git a/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/trie/diffbased/verkle/worldview/VerkleWorldState.java b/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/trie/diffbased/verkle/worldview/VerkleWorldState.java index b095b86b9f..3e3bf89bd1 100644 --- a/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/trie/diffbased/verkle/worldview/VerkleWorldState.java +++ b/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/trie/diffbased/verkle/worldview/VerkleWorldState.java @@ -26,6 +26,7 @@ import org.hyperledger.besu.ethereum.trie.diffbased.common.cache.DiffBasedCached import org.hyperledger.besu.ethereum.trie.diffbased.common.storage.DiffBasedWorldStateKeyValueStorage; import org.hyperledger.besu.ethereum.trie.diffbased.common.trielog.TrieLogManager; import org.hyperledger.besu.ethereum.trie.diffbased.common.worldview.DiffBasedWorldState; +import org.hyperledger.besu.ethereum.trie.diffbased.common.worldview.DiffBasedWorldStateConfig; import org.hyperledger.besu.ethereum.trie.diffbased.common.worldview.accumulator.DiffBasedWorldStateUpdateAccumulator; import org.hyperledger.besu.ethereum.trie.diffbased.common.worldview.accumulator.preload.StorageConsumingMap; import org.hyperledger.besu.ethereum.trie.diffbased.verkle.VerkleAccount; @@ -67,20 +68,27 @@ public class VerkleWorldState extends DiffBasedWorldState { public VerkleWorldState( final VerkleWorldStateProvider archive, final VerkleWorldStateKeyValueStorage worldStateKeyValueStorage, - final EvmConfiguration evmConfiguration) { + final EvmConfiguration evmConfiguration, + final DiffBasedWorldStateConfig diffBasedWorldStateConfig) { this( worldStateKeyValueStorage, archive.getCachedWorldStorageManager(), archive.getTrieLogManager(), - evmConfiguration); + evmConfiguration, + diffBasedWorldStateConfig); } public VerkleWorldState( final VerkleWorldStateKeyValueStorage worldStateKeyValueStorage, final DiffBasedCachedWorldStorageManager cachedWorldStorageManager, final TrieLogManager trieLogManager, - final EvmConfiguration evmConfiguration) { - super(worldStateKeyValueStorage, cachedWorldStorageManager, trieLogManager); + final EvmConfiguration evmConfiguration, + final DiffBasedWorldStateConfig diffBasedWorldStateConfig) { + super( + worldStateKeyValueStorage, + cachedWorldStorageManager, + trieLogManager, + diffBasedWorldStateConfig); this.trieKeyPreloader = new TrieKeyPreloader(); this.setAccumulator( new VerkleWorldStateUpdateAccumulator( @@ -360,7 +368,7 @@ public class VerkleWorldState extends DiffBasedWorldState { @Override public MutableWorldState freeze() { - this.isFrozen = true; + this.worldStateConfig.setFrozen(true); this.worldStateKeyValueStorage = new VerkleLayeredWorldStateKeyValueStorage(getWorldStateStorage()); return this; diff --git a/ethereum/core/src/test/java/org/hyperledger/besu/ethereum/trie/diffbased/verkle/LogRollingTests.java b/ethereum/core/src/test/java/org/hyperledger/besu/ethereum/trie/diffbased/verkle/LogRollingTests.java index 9db0811f70..a474fe412f 100644 --- a/ethereum/core/src/test/java/org/hyperledger/besu/ethereum/trie/diffbased/verkle/LogRollingTests.java +++ b/ethereum/core/src/test/java/org/hyperledger/besu/ethereum/trie/diffbased/verkle/LogRollingTests.java @@ -29,6 +29,7 @@ import org.hyperledger.besu.ethereum.mainnet.MainnetBlockHeaderFunctions; import org.hyperledger.besu.ethereum.rlp.BytesValueRLPInput; import org.hyperledger.besu.ethereum.storage.keyvalue.KeyValueSegmentIdentifier; import org.hyperledger.besu.ethereum.trie.diffbased.common.trielog.TrieLogLayer; +import org.hyperledger.besu.ethereum.trie.diffbased.common.worldview.DiffBasedWorldStateConfig; import org.hyperledger.besu.ethereum.trie.diffbased.verkle.storage.VerkleWorldStateKeyValueStorage; import org.hyperledger.besu.ethereum.trie.diffbased.verkle.trielog.TrieLogFactoryImpl; import org.hyperledger.besu.ethereum.trie.diffbased.verkle.worldview.VerkleWorldState; @@ -217,7 +218,8 @@ class LogRollingTests { new VerkleWorldState( archive, new VerkleWorldStateKeyValueStorage(provider, new NoOpMetricsSystem()), - EvmConfiguration.DEFAULT); + EvmConfiguration.DEFAULT, + new DiffBasedWorldStateConfig()); final WorldUpdater updater = worldState.updater(); final MutableAccount contract = @@ -243,7 +245,8 @@ class LogRollingTests { new VerkleWorldState( archive, new VerkleWorldStateKeyValueStorage(provider, new NoOpMetricsSystem()), - EvmConfiguration.DEFAULT); + EvmConfiguration.DEFAULT, + new DiffBasedWorldStateConfig()); final WorldUpdater updater = worldState.updater(); final MutableAccount mutableAccount = updater.createAccount(addressOne, 1, Wei.of(1L)); @@ -256,7 +259,8 @@ class LogRollingTests { new VerkleWorldState( secondArchive, new VerkleWorldStateKeyValueStorage(secondProvider, new NoOpMetricsSystem()), - EvmConfiguration.DEFAULT); + EvmConfiguration.DEFAULT, + new DiffBasedWorldStateConfig()); final VerkleWorldStateUpdateAccumulator secondUpdater = (VerkleWorldStateUpdateAccumulator) secondWorldState.updater(); @@ -287,7 +291,8 @@ class LogRollingTests { new VerkleWorldState( archive, new VerkleWorldStateKeyValueStorage(provider, new NoOpMetricsSystem()), - EvmConfiguration.DEFAULT); + EvmConfiguration.DEFAULT, + new DiffBasedWorldStateConfig()); final WorldUpdater updater = worldState.updater(); final MutableAccount mutableAccount = updater.createAccount(addressOne, 1, Wei.of(1L)); @@ -308,7 +313,8 @@ class LogRollingTests { new VerkleWorldState( secondArchive, new VerkleWorldStateKeyValueStorage(secondProvider, new NoOpMetricsSystem()), - EvmConfiguration.DEFAULT); + EvmConfiguration.DEFAULT, + new DiffBasedWorldStateConfig()); final VerkleWorldStateUpdateAccumulator secondUpdater = (VerkleWorldStateUpdateAccumulator) secondWorldState.updater(); @@ -340,7 +346,8 @@ class LogRollingTests { new VerkleWorldState( archive, new VerkleWorldStateKeyValueStorage(provider, new NoOpMetricsSystem()), - EvmConfiguration.DEFAULT); + EvmConfiguration.DEFAULT, + new DiffBasedWorldStateConfig()); final WorldUpdater updater = worldState.updater(); final MutableAccount mutableAccount = updater.createAccount(addressOne, 1, Wei.of(1L)); @@ -368,7 +375,8 @@ class LogRollingTests { new VerkleWorldState( secondArchive, new VerkleWorldStateKeyValueStorage(secondProvider, new NoOpMetricsSystem()), - EvmConfiguration.DEFAULT); + EvmConfiguration.DEFAULT, + new DiffBasedWorldStateConfig()); final WorldUpdater secondUpdater = secondWorldState.updater(); final MutableAccount secondMutableAccount = @@ -397,7 +405,8 @@ class LogRollingTests { new VerkleWorldState( archive, new VerkleWorldStateKeyValueStorage(provider, new NoOpMetricsSystem()), - EvmConfiguration.DEFAULT); + EvmConfiguration.DEFAULT, + new DiffBasedWorldStateConfig()); final WorldUpdater updater = worldState.updater(); final MutableAccount mutableAccount = updater.createAccount(addressOne, 1, Wei.of(1L)); @@ -437,7 +446,8 @@ class LogRollingTests { new VerkleWorldState( archive, new VerkleWorldStateKeyValueStorage(provider, new NoOpMetricsSystem()), - EvmConfiguration.DEFAULT); + EvmConfiguration.DEFAULT, + new DiffBasedWorldStateConfig()); final WorldUpdater updater = worldState.updater(); final MutableAccount mutableAccount = updater.createAccount(addressOne, 1, Wei.of(1L)); @@ -507,7 +517,8 @@ class LogRollingTests { new VerkleWorldState( archive, new VerkleWorldStateKeyValueStorage(provider, new NoOpMetricsSystem()), - EvmConfiguration.DEFAULT); + EvmConfiguration.DEFAULT, + new DiffBasedWorldStateConfig()); final WorldUpdater updater = worldState.updater(); final MutableAccount mutableAccount = updater.createAccount(addressOne, 1, Wei.of(1L)); diff --git a/evm/src/main/java/org/hyperledger/besu/evm/frame/MessageFrame.java b/evm/src/main/java/org/hyperledger/besu/evm/frame/MessageFrame.java index 270ab86109..7d93b4c108 100644 --- a/evm/src/main/java/org/hyperledger/besu/evm/frame/MessageFrame.java +++ b/evm/src/main/java/org/hyperledger/besu/evm/frame/MessageFrame.java @@ -1442,6 +1442,7 @@ public class MessageFrame { private Optional> versionedHashes = Optional.empty(); private AccessWitness accessWitness = null; + /** Instantiates a new Builder. */ public Builder() {} diff --git a/evm/src/main/java/org/hyperledger/besu/evm/operation/AbstractCreateOperation.java b/evm/src/main/java/org/hyperledger/besu/evm/operation/AbstractCreateOperation.java index e6e58ae27a..c3d13d6abf 100644 --- a/evm/src/main/java/org/hyperledger/besu/evm/operation/AbstractCreateOperation.java +++ b/evm/src/main/java/org/hyperledger/besu/evm/operation/AbstractCreateOperation.java @@ -100,15 +100,16 @@ public abstract class AbstractCreateOperation extends AbstractOperation { } else { account.incrementNonce(); + System.out.println("aalloo"); final Bytes inputData = frame.readMemory(inputOffset, inputSize); // Never cache CREATEx initcode. The amount of reuse is very low, and caching mostly // addresses disk loading delay, and we already have the code. Code code = evm.getCodeUncached(inputData); - final Address contractAddress = targetContractAddress(frame, code); final Wei contractValue = Wei.wrap(frame.getStackItem(0)); if (code.isValid() && frame.getCode().getEofVersion() <= code.getEofVersion()) { + final Address contractAddress = targetContractAddress(frame, code); frame.decrementRemainingGas(statelessCost(frame, contractAddress, contractValue)); frame.decrementRemainingGas(cost); spawnChildMessage(frame, contractAddress, contractValue, code, evm);