From e2f541a44700aabe59c527bd5e19580e3bb0f672 Mon Sep 17 00:00:00 2001 From: Karim Taam Date: Wed, 12 Jun 2024 10:44:11 +0200 Subject: [PATCH] fix unit tests Signed-off-by: Karim Taam --- .../besu/ethereum/api/jsonrpc/JsonRpcResponseUtils.java | 1 + .../internal/methods/engine/AbstractEngineNewPayload.java | 2 +- .../internal/parameters/ExecutionWitnessParameter.java | 2 +- .../api/jsonrpc/internal/parameters/IPAProofParameter.java | 4 ++-- .../api/jsonrpc/internal/parameters/StateDiffParameter.java | 2 +- .../jsonrpc/internal/parameters/StemStateDiffParameter.java | 2 +- .../jsonrpc/internal/parameters/SuffixStateDiffParameter.java | 2 +- .../api/jsonrpc/internal/parameters/VerkleProofParameter.java | 4 ++-- .../java/org/hyperledger/besu/ethereum/core/BlockHeader.java | 2 +- .../hyperledger/besu/ethereum/core/BlockHeaderBuilder.java | 2 +- .../hyperledger/besu/ethereum/core/SealableBlockHeader.java | 2 +- .../besu/ethereum/core/witness}/ExecutionWitness.java | 2 +- .../org/hyperledger/besu/ethereum/core/witness}/IPAProof.java | 2 +- .../hyperledger/besu/ethereum/core/witness}/StateDiff.java | 2 +- .../besu/ethereum/core/witness}/StemStateDiff.java | 2 +- .../besu/ethereum/core/witness}/SuffixStateDiff.java | 2 +- .../hyperledger/besu/ethereum/core/witness}/VerkleProof.java | 2 +- .../besu/ethereum/mainnet/ExecutionWitnessValidator.java | 2 +- .../besu/ethereum/mainnet/MainnetTransactionProcessor.java | 2 +- plugin-api/build.gradle | 2 +- .../besu/plugin/services/storage/rocksdb/Utils.java | 1 + 21 files changed, 23 insertions(+), 21 deletions(-) rename ethereum/{trie/src/main/java/org/hyperledger/besu/ethereum/trie/verkle => core/src/main/java/org/hyperledger/besu/ethereum/core/witness}/ExecutionWitness.java (97%) rename ethereum/{trie/src/main/java/org/hyperledger/besu/ethereum/trie/verkle => core/src/main/java/org/hyperledger/besu/ethereum/core/witness}/IPAProof.java (96%) rename ethereum/{trie/src/main/java/org/hyperledger/besu/ethereum/trie/verkle => core/src/main/java/org/hyperledger/besu/ethereum/core/witness}/StateDiff.java (94%) rename ethereum/{trie/src/main/java/org/hyperledger/besu/ethereum/trie/verkle => core/src/main/java/org/hyperledger/besu/ethereum/core/witness}/StemStateDiff.java (94%) rename ethereum/{trie/src/main/java/org/hyperledger/besu/ethereum/trie/verkle => core/src/main/java/org/hyperledger/besu/ethereum/core/witness}/SuffixStateDiff.java (94%) rename ethereum/{trie/src/main/java/org/hyperledger/besu/ethereum/trie/verkle => core/src/main/java/org/hyperledger/besu/ethereum/core/witness}/VerkleProof.java (96%) diff --git a/ethereum/api/src/integration-test/java/org/hyperledger/besu/ethereum/api/jsonrpc/JsonRpcResponseUtils.java b/ethereum/api/src/integration-test/java/org/hyperledger/besu/ethereum/api/jsonrpc/JsonRpcResponseUtils.java index 4e067e6ec8a..09235fbdb20 100644 --- a/ethereum/api/src/integration-test/java/org/hyperledger/besu/ethereum/api/jsonrpc/JsonRpcResponseUtils.java +++ b/ethereum/api/src/integration-test/java/org/hyperledger/besu/ethereum/api/jsonrpc/JsonRpcResponseUtils.java @@ -131,6 +131,7 @@ public JsonRpcResponse response( null, // ToDo 4844: set with the value of excess_blob_gas field null, // TODO 4788: set with the value of the parent beacon block root field requestsRoot, + null, blockHeaderFunctions); return new JsonRpcSuccessResponse( 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 c4471ea9877..6ff4a78c1e4 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 @@ -67,7 +67,7 @@ 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.trie.verkle.ExecutionWitness; +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/ExecutionWitnessParameter.java b/ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/parameters/ExecutionWitnessParameter.java index 6382abbf597..9c6337b0c48 100644 --- a/ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/parameters/ExecutionWitnessParameter.java +++ b/ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/parameters/ExecutionWitnessParameter.java @@ -14,7 +14,7 @@ */ package org.hyperledger.besu.ethereum.api.jsonrpc.internal.parameters; -import org.hyperledger.besu.ethereum.trie.verkle.ExecutionWitness; +import org.hyperledger.besu.ethereum.core.witness.ExecutionWitness; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonGetter; diff --git a/ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/parameters/IPAProofParameter.java b/ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/parameters/IPAProofParameter.java index fa502144252..d42189296ac 100644 --- a/ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/parameters/IPAProofParameter.java +++ b/ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/parameters/IPAProofParameter.java @@ -15,7 +15,7 @@ package org.hyperledger.besu.ethereum.api.jsonrpc.internal.parameters; import org.hyperledger.besu.ethereum.core.json.HexStringDeserializer; -import org.hyperledger.besu.ethereum.trie.verkle.IPAProof; +import org.hyperledger.besu.ethereum.core.witness.IPAProof; import java.util.List; @@ -52,7 +52,7 @@ public static IPAProofParameter fromIPAProof(final IPAProof ipaProof) { } public static IPAProof toIPAProof(final IPAProofParameter ipaProofParameter) { - return new org.hyperledger.besu.ethereum.trie.verkle.IPAProof( + return new IPAProof( ipaProofParameter.getCl().stream().map(Bytes32::fromHexString).toList(), ipaProofParameter.getCr().stream().map(Bytes32::fromHexString).toList(), ipaProofParameter.getFinalEvaluation()); diff --git a/ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/parameters/StateDiffParameter.java b/ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/parameters/StateDiffParameter.java index f671023b398..9331b3e9d22 100644 --- a/ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/parameters/StateDiffParameter.java +++ b/ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/parameters/StateDiffParameter.java @@ -14,7 +14,7 @@ */ package org.hyperledger.besu.ethereum.api.jsonrpc.internal.parameters; -import org.hyperledger.besu.ethereum.trie.verkle.StateDiff; +import org.hyperledger.besu.ethereum.core.witness.StateDiff; import java.util.List; diff --git a/ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/parameters/StemStateDiffParameter.java b/ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/parameters/StemStateDiffParameter.java index 360823b398f..8a4903bc863 100644 --- a/ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/parameters/StemStateDiffParameter.java +++ b/ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/parameters/StemStateDiffParameter.java @@ -15,7 +15,7 @@ package org.hyperledger.besu.ethereum.api.jsonrpc.internal.parameters; import org.hyperledger.besu.ethereum.core.json.HexStringDeserializer; -import org.hyperledger.besu.ethereum.trie.verkle.StemStateDiff; +import org.hyperledger.besu.ethereum.core.witness.StemStateDiff; import java.util.ArrayList; import java.util.List; diff --git a/ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/parameters/SuffixStateDiffParameter.java b/ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/parameters/SuffixStateDiffParameter.java index b932bc7ede6..0282e68afbe 100644 --- a/ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/parameters/SuffixStateDiffParameter.java +++ b/ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/parameters/SuffixStateDiffParameter.java @@ -15,7 +15,7 @@ package org.hyperledger.besu.ethereum.api.jsonrpc.internal.parameters; import org.hyperledger.besu.ethereum.core.json.HexStringDeserializer; -import org.hyperledger.besu.ethereum.trie.verkle.SuffixStateDiff; +import org.hyperledger.besu.ethereum.core.witness.SuffixStateDiff; import java.util.ArrayList; import java.util.List; 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 2373e939457..b3d15e06e87 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 @@ -15,7 +15,7 @@ package org.hyperledger.besu.ethereum.api.jsonrpc.internal.parameters; import org.hyperledger.besu.ethereum.core.json.HexStringDeserializer; -import org.hyperledger.besu.ethereum.trie.verkle.VerkleProof; +import org.hyperledger.besu.ethereum.core.witness.VerkleProof; import java.util.List; @@ -51,7 +51,7 @@ public VerkleProofParameter( } public static VerkleProofParameter fromVerkleProof( - final org.hyperledger.besu.ethereum.trie.verkle.VerkleProof verkleProof) { + final VerkleProof verkleProof) { return new VerkleProofParameter( verkleProof.otherStems().stream().map(Bytes::toHexString).toList(), verkleProof.depthExtensionPresent(), diff --git a/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/core/BlockHeader.java b/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/core/BlockHeader.java index 6c262d23558..d381e982937 100644 --- a/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/core/BlockHeader.java +++ b/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/core/BlockHeader.java @@ -18,9 +18,9 @@ import org.hyperledger.besu.datatypes.BlobGas; import org.hyperledger.besu.datatypes.Hash; import org.hyperledger.besu.datatypes.Wei; +import org.hyperledger.besu.ethereum.core.witness.ExecutionWitness; import org.hyperledger.besu.ethereum.rlp.RLPInput; import org.hyperledger.besu.ethereum.rlp.RLPOutput; -import org.hyperledger.besu.ethereum.trie.verkle.ExecutionWitness; import org.hyperledger.besu.evm.log.LogsBloomFilter; import java.util.Objects; 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 2dcde436259..8ea903786e2 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 @@ -23,7 +23,7 @@ import org.hyperledger.besu.datatypes.Hash; import org.hyperledger.besu.datatypes.Wei; import org.hyperledger.besu.ethereum.mainnet.MainnetBlockHeaderFunctions; -import org.hyperledger.besu.ethereum.trie.verkle.ExecutionWitness; +import org.hyperledger.besu.ethereum.core.witness.ExecutionWitness; import org.hyperledger.besu.evm.log.LogsBloomFilter; import java.time.Instant; diff --git a/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/core/SealableBlockHeader.java b/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/core/SealableBlockHeader.java index f645d1a0855..1b3d2dc6465 100644 --- a/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/core/SealableBlockHeader.java +++ b/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/core/SealableBlockHeader.java @@ -18,7 +18,7 @@ import org.hyperledger.besu.datatypes.BlobGas; import org.hyperledger.besu.datatypes.Hash; import org.hyperledger.besu.datatypes.Wei; -import org.hyperledger.besu.ethereum.trie.verkle.ExecutionWitness; +import org.hyperledger.besu.ethereum.core.witness.ExecutionWitness; import org.hyperledger.besu.evm.log.LogsBloomFilter; import java.util.Optional; diff --git a/ethereum/trie/src/main/java/org/hyperledger/besu/ethereum/trie/verkle/ExecutionWitness.java b/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/core/witness/ExecutionWitness.java similarity index 97% rename from ethereum/trie/src/main/java/org/hyperledger/besu/ethereum/trie/verkle/ExecutionWitness.java rename to ethereum/core/src/main/java/org/hyperledger/besu/ethereum/core/witness/ExecutionWitness.java index b803697a25b..977a78997dc 100644 --- a/ethereum/trie/src/main/java/org/hyperledger/besu/ethereum/trie/verkle/ExecutionWitness.java +++ b/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/core/witness/ExecutionWitness.java @@ -12,7 +12,7 @@ * * SPDX-License-Identifier: Apache-2.0 */ -package org.hyperledger.besu.ethereum.trie.verkle; +package org.hyperledger.besu.ethereum.core.witness; import org.hyperledger.besu.ethereum.rlp.RLPInput; diff --git a/ethereum/trie/src/main/java/org/hyperledger/besu/ethereum/trie/verkle/IPAProof.java b/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/core/witness/IPAProof.java similarity index 96% rename from ethereum/trie/src/main/java/org/hyperledger/besu/ethereum/trie/verkle/IPAProof.java rename to ethereum/core/src/main/java/org/hyperledger/besu/ethereum/core/witness/IPAProof.java index faa757200fc..a6fde167d85 100644 --- a/ethereum/trie/src/main/java/org/hyperledger/besu/ethereum/trie/verkle/IPAProof.java +++ b/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/core/witness/IPAProof.java @@ -12,7 +12,7 @@ * * SPDX-License-Identifier: Apache-2.0 */ -package org.hyperledger.besu.ethereum.trie.verkle; +package org.hyperledger.besu.ethereum.core.witness; import java.util.List; diff --git a/ethereum/trie/src/main/java/org/hyperledger/besu/ethereum/trie/verkle/StateDiff.java b/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/core/witness/StateDiff.java similarity index 94% rename from ethereum/trie/src/main/java/org/hyperledger/besu/ethereum/trie/verkle/StateDiff.java rename to ethereum/core/src/main/java/org/hyperledger/besu/ethereum/core/witness/StateDiff.java index a4667b7ce48..895b02467fb 100644 --- a/ethereum/trie/src/main/java/org/hyperledger/besu/ethereum/trie/verkle/StateDiff.java +++ b/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/core/witness/StateDiff.java @@ -12,7 +12,7 @@ * * SPDX-License-Identifier: Apache-2.0 */ -package org.hyperledger.besu.ethereum.trie.verkle; +package org.hyperledger.besu.ethereum.core.witness; import java.util.List; diff --git a/ethereum/trie/src/main/java/org/hyperledger/besu/ethereum/trie/verkle/StemStateDiff.java b/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/core/witness/StemStateDiff.java similarity index 94% rename from ethereum/trie/src/main/java/org/hyperledger/besu/ethereum/trie/verkle/StemStateDiff.java rename to ethereum/core/src/main/java/org/hyperledger/besu/ethereum/core/witness/StemStateDiff.java index abfee93377e..0e1e7d43036 100644 --- a/ethereum/trie/src/main/java/org/hyperledger/besu/ethereum/trie/verkle/StemStateDiff.java +++ b/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/core/witness/StemStateDiff.java @@ -12,7 +12,7 @@ * * SPDX-License-Identifier: Apache-2.0 */ -package org.hyperledger.besu.ethereum.trie.verkle; +package org.hyperledger.besu.ethereum.core.witness; import java.util.List; diff --git a/ethereum/trie/src/main/java/org/hyperledger/besu/ethereum/trie/verkle/SuffixStateDiff.java b/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/core/witness/SuffixStateDiff.java similarity index 94% rename from ethereum/trie/src/main/java/org/hyperledger/besu/ethereum/trie/verkle/SuffixStateDiff.java rename to ethereum/core/src/main/java/org/hyperledger/besu/ethereum/core/witness/SuffixStateDiff.java index 156d35cd728..410e924ac4f 100644 --- a/ethereum/trie/src/main/java/org/hyperledger/besu/ethereum/trie/verkle/SuffixStateDiff.java +++ b/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/core/witness/SuffixStateDiff.java @@ -12,7 +12,7 @@ * * SPDX-License-Identifier: Apache-2.0 */ -package org.hyperledger.besu.ethereum.trie.verkle; +package org.hyperledger.besu.ethereum.core.witness; import org.apache.tuweni.bytes.Bytes32; diff --git a/ethereum/trie/src/main/java/org/hyperledger/besu/ethereum/trie/verkle/VerkleProof.java b/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/core/witness/VerkleProof.java similarity index 96% rename from ethereum/trie/src/main/java/org/hyperledger/besu/ethereum/trie/verkle/VerkleProof.java rename to ethereum/core/src/main/java/org/hyperledger/besu/ethereum/core/witness/VerkleProof.java index 54dc11e6237..c2603b04a1b 100644 --- a/ethereum/trie/src/main/java/org/hyperledger/besu/ethereum/trie/verkle/VerkleProof.java +++ b/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/core/witness/VerkleProof.java @@ -12,7 +12,7 @@ * * SPDX-License-Identifier: Apache-2.0 */ -package org.hyperledger.besu.ethereum.trie.verkle; +package org.hyperledger.besu.ethereum.core.witness; import java.util.List; diff --git a/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/ExecutionWitnessValidator.java b/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/ExecutionWitnessValidator.java index 99fe97b3b49..f72dbecd70d 100644 --- a/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/ExecutionWitnessValidator.java +++ b/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/ExecutionWitnessValidator.java @@ -14,7 +14,7 @@ */ package org.hyperledger.besu.ethereum.mainnet; -import org.hyperledger.besu.ethereum.trie.verkle.ExecutionWitness; +import org.hyperledger.besu.ethereum.core.witness.ExecutionWitness; import java.util.Optional; diff --git a/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/MainnetTransactionProcessor.java b/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/MainnetTransactionProcessor.java index 881202dd94f..9b99f866d09 100644 --- a/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/MainnetTransactionProcessor.java +++ b/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/MainnetTransactionProcessor.java @@ -502,7 +502,7 @@ public TransactionProcessingResult processTransaction( initialFrame.getSelfDestructs().forEach(worldState::deleteAccount); - clearEmptyAccountStrategy.process(worldUpdater); + clearEmptyAccountStrategy.process(worldState); if (initialFrame.getState() == MessageFrame.State.COMPLETED_SUCCESS) { return TransactionProcessingResult.successful( diff --git a/plugin-api/build.gradle b/plugin-api/build.gradle index f61fe316bf3..66801e3c2ed 100644 --- a/plugin-api/build.gradle +++ b/plugin-api/build.gradle @@ -70,7 +70,7 @@ Calculated : ${currentHash} tasks.register('checkAPIChanges', FileStateChecker) { description = "Checks that the API for the Plugin-API project does not change without deliberate thought" files = sourceSets.main.allJava.files - knownHash = 'xU0LMvStiFihBKBxkfNHB7oIg0PUHWkPuv2yt1GVC94=' + knownHash = 'pXUnzOxMq+cCmmaS39fa2nHlZWQm2wqYxU2nNSDdNfs=' } check.dependsOn('checkAPIChanges') diff --git a/plugins/rocksdb/src/test/java/org/hyperledger/besu/plugin/services/storage/rocksdb/Utils.java b/plugins/rocksdb/src/test/java/org/hyperledger/besu/plugin/services/storage/rocksdb/Utils.java index a5d4f1ba913..c79e25a277b 100644 --- a/plugins/rocksdb/src/test/java/org/hyperledger/besu/plugin/services/storage/rocksdb/Utils.java +++ b/plugins/rocksdb/src/test/java/org/hyperledger/besu/plugin/services/storage/rocksdb/Utils.java @@ -86,6 +86,7 @@ private static int dataStorageFormatToV1(final DataStorageFormat dataStorageForm return switch (dataStorageFormat) { case FOREST -> 1; case BONSAI -> 2; + case VERKLE -> 3; }; } }