From ffd593d72ba404ad4f5c4b263ad4a1a111be8042 Mon Sep 17 00:00:00 2001 From: Simon Dudley Date: Tue, 7 Jan 2025 11:19:26 +1000 Subject: [PATCH 1/3] Remove EIP-7742 (#8083) This EIP was removed and equivalent functionality replaced by EIP-7840. --- Revert "Rename targetBlobCount to targetBlobsPerBlock (#7981)" This reverts commit 16713067490dc99ad36b21fa3d85d9dc639030ef. Revert "EIP-7742: Add target_blob_count to block header (#7808)" This reverts commit f855d5b72fb5e44977d995f48872cdb976333711. Signed-off-by: Simon Dudley --- .../besu/tests/acceptance/dsl/BlockUtils.java | 1 - .../ExecutionEnginePragueAcceptanceTest.java | 3 --- .../AbstractBftBesuControllerBuilderTest.java | 1 - .../CliqueBesuControllerBuilderTest.java | 1 - .../besu/services/BesuEventsImplTest.java | 2 +- .../besu/config/GenesisConfig.java | 11 ---------- .../api/jsonrpc/JsonRpcResponseKey.java | 3 +-- .../api/jsonrpc/JsonRpcResponseUtils.java | 6 ------ .../engine/AbstractEngineNewPayload.java | 1 - .../jsonrpc/internal/results/BlockResult.java | 7 ------- .../internal/methods/EthGasPriceTest.java | 1 - .../methods/EthMaxPriorityFeePerGasTest.java | 1 - ...neExchangeTransitionConfigurationTest.java | 1 - .../query/BlockchainQueriesLogCacheTest.java | 1 - .../cache/TransactionLogBloomCacherTest.java | 2 -- .../besu/ethereum/chain/GenesisState.java | 7 ------- .../besu/ethereum/core/BlockHeader.java | 15 +------------- .../ethereum/core/BlockHeaderBuilder.java | 20 +++---------------- .../ethereum/core/ProcessableBlockHeader.java | 20 +------------------ .../ethereum/core/SealableBlockHeader.java | 7 ++----- .../ethereum/core/BlockHeaderTestFixture.java | 8 -------- .../besu/ethereum/chain/GenesisStateTest.java | 12 ++++------- .../diffbased/bonsai/LogRollingTests.java | 2 -- .../besu/ethereum/chain/genesis_prague.json | 3 +-- .../eth/messages/MessageWrapperTest.java | 1 - .../backwardsync/ChainForTestCreator.java | 3 --- .../BlockchainReferenceTestCaseSpec.java | 1 - .../referencetests/ReferenceTestEnv.java | 1 - plugin-api/build.gradle | 2 +- .../plugin/data/ProcessableBlockHeader.java | 12 ----------- 30 files changed, 15 insertions(+), 141 deletions(-) diff --git a/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/BlockUtils.java b/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/BlockUtils.java index 29f60dd74a6..3a4ca71002b 100644 --- a/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/BlockUtils.java +++ b/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/BlockUtils.java @@ -58,7 +58,6 @@ public static BlockHeader createBlockHeader( null, null, null, - null, blockHeaderFunctions); } } diff --git a/acceptance-tests/tests/src/test/java/org/hyperledger/besu/tests/acceptance/jsonrpc/ExecutionEnginePragueAcceptanceTest.java b/acceptance-tests/tests/src/test/java/org/hyperledger/besu/tests/acceptance/jsonrpc/ExecutionEnginePragueAcceptanceTest.java index f38a192d4df..966c02bebde 100644 --- a/acceptance-tests/tests/src/test/java/org/hyperledger/besu/tests/acceptance/jsonrpc/ExecutionEnginePragueAcceptanceTest.java +++ b/acceptance-tests/tests/src/test/java/org/hyperledger/besu/tests/acceptance/jsonrpc/ExecutionEnginePragueAcceptanceTest.java @@ -20,11 +20,8 @@ import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.Disabled; import org.junit.jupiter.params.provider.Arguments; -// TODO SLD -@Disabled("TODO SLD - Enable when Prague spec is finalized") public class ExecutionEnginePragueAcceptanceTest extends AbstractJsonRpcTest { private static final String GENESIS_FILE = "/jsonrpc/engine/prague/genesis.json"; private static final String TEST_CASE_PATH = "/jsonrpc/engine/prague/test-cases/"; diff --git a/besu/src/test/java/org/hyperledger/besu/controller/AbstractBftBesuControllerBuilderTest.java b/besu/src/test/java/org/hyperledger/besu/controller/AbstractBftBesuControllerBuilderTest.java index b1cf3dd776d..571f98d4fb5 100644 --- a/besu/src/test/java/org/hyperledger/besu/controller/AbstractBftBesuControllerBuilderTest.java +++ b/besu/src/test/java/org/hyperledger/besu/controller/AbstractBftBesuControllerBuilderTest.java @@ -195,7 +195,6 @@ public void miningParametersBlockPeriodSecondsIsUpdatedOnTransition() { null, null, null, - null, getBlockHeaderFunctions()); final Block block1 = new Block(header1, BlockBody.empty()); diff --git a/besu/src/test/java/org/hyperledger/besu/controller/CliqueBesuControllerBuilderTest.java b/besu/src/test/java/org/hyperledger/besu/controller/CliqueBesuControllerBuilderTest.java index b9c919d18f0..284cfa8a832 100644 --- a/besu/src/test/java/org/hyperledger/besu/controller/CliqueBesuControllerBuilderTest.java +++ b/besu/src/test/java/org/hyperledger/besu/controller/CliqueBesuControllerBuilderTest.java @@ -224,7 +224,6 @@ public void miningParametersBlockPeriodSecondsIsUpdatedOnTransition() { null, null, null, - null, new CliqueBlockHeaderFunctions()); final Block block1 = new Block(header1, BlockBody.empty()); diff --git a/besu/src/test/java/org/hyperledger/besu/services/BesuEventsImplTest.java b/besu/src/test/java/org/hyperledger/besu/services/BesuEventsImplTest.java index 79885115f42..453e31378d2 100644 --- a/besu/src/test/java/org/hyperledger/besu/services/BesuEventsImplTest.java +++ b/besu/src/test/java/org/hyperledger/besu/services/BesuEventsImplTest.java @@ -219,7 +219,7 @@ private void setSyncTarget() { mock(EthPeer.class), new org.hyperledger.besu.ethereum.core.BlockHeader( null, null, null, null, null, null, null, null, 1, 1, 1, 1, null, null, null, 1, null, - null, null, null, null, null, null)); + null, null, null, null, null)); } private void clearSyncTarget() { diff --git a/config/src/main/java/org/hyperledger/besu/config/GenesisConfig.java b/config/src/main/java/org/hyperledger/besu/config/GenesisConfig.java index 47fa2967451..43bfd734070 100644 --- a/config/src/main/java/org/hyperledger/besu/config/GenesisConfig.java +++ b/config/src/main/java/org/hyperledger/besu/config/GenesisConfig.java @@ -265,17 +265,6 @@ public String getParentBeaconBlockRoot() { "0x0000000000000000000000000000000000000000000000000000000000000000"); } - /** - * Gets target blobs per block. - * - * @return the target blobs per block - */ - public Optional getTargetBlobsPerBlock() { - // TODO SLD EIP-7742 not sure if we should use a default value here or enforce any - // "pragueAtGenesis" genesis file (used in devnets) to have this value - return JsonUtil.getValueAsString(genesisRoot, "targetblobsperblock"); - } - /** * Gets coinbase. * diff --git a/ethereum/api/src/integration-test/java/org/hyperledger/besu/ethereum/api/jsonrpc/JsonRpcResponseKey.java b/ethereum/api/src/integration-test/java/org/hyperledger/besu/ethereum/api/jsonrpc/JsonRpcResponseKey.java index d29ca873902..bf5d12804b9 100644 --- a/ethereum/api/src/integration-test/java/org/hyperledger/besu/ethereum/api/jsonrpc/JsonRpcResponseKey.java +++ b/ethereum/api/src/integration-test/java/org/hyperledger/besu/ethereum/api/jsonrpc/JsonRpcResponseKey.java @@ -38,6 +38,5 @@ public enum JsonRpcResponseKey { TRANSACTION_ROOT, BASEFEE, WITHDRAWALS_ROOT, - REQUESTS_HASH, - TARGET_BLOBS_PER_BLOCK + REQUESTS_HASH } 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 1ef726ae7b8..d72db974b0a 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 @@ -63,7 +63,6 @@ import com.fasterxml.jackson.databind.JsonNode; import org.apache.tuweni.bytes.Bytes; import org.apache.tuweni.units.bigints.UInt256; -import org.apache.tuweni.units.bigints.UInt64; public class JsonRpcResponseUtils { @@ -107,10 +106,6 @@ public JsonRpcResponse response( values.containsKey(WITHDRAWALS_ROOT) ? hash(values.get(WITHDRAWALS_ROOT)) : null; final Hash requestsHash = values.containsKey(REQUESTS_HASH) ? hash(values.get(REQUESTS_HASH)) : null; - final UInt64 targetBlobsPerBlock = - values.containsKey(JsonRpcResponseKey.TARGET_BLOBS_PER_BLOCK) - ? UInt64.fromHexString(values.get(JsonRpcResponseKey.TARGET_BLOBS_PER_BLOCK)) - : null; final List ommers = new ArrayList<>(); final BlockHeader header = @@ -136,7 +131,6 @@ 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 requestsHash, - targetBlobsPerBlock, 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 0c69c9c1c1d..f3ce31b098e 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 @@ -266,7 +266,6 @@ public JsonRpcResponse syncResponse(final JsonRpcRequestContext requestContext) : BlobGas.fromHexString(blockParam.getExcessBlobGas()), maybeParentBeaconBlockRoot.orElse(null), maybeRequests.map(BodyValidation::requestsHash).orElse(null), - null, // TODO SLD EIP-7742 wiring in future PR headerFunctions); // ensure the block hash matches the blockParam hash diff --git a/ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/results/BlockResult.java b/ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/results/BlockResult.java index e74cf2f4e0a..5bfd0ff7b33 100644 --- a/ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/results/BlockResult.java +++ b/ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/results/BlockResult.java @@ -88,7 +88,6 @@ public class BlockResult implements JsonRpcResult { private final String blobGasUsed; private final String excessBlobGas; private final String parentBeaconBlockRoot; - private final String targetBlobsPerBlock; private final List callProcessingResults; public BlockResult( @@ -153,7 +152,6 @@ public BlockResult( this.excessBlobGas = header.getExcessBlobGas().map(Quantity::create).orElse(null); this.parentBeaconBlockRoot = header.getParentBeaconBlockRoot().map(Bytes32::toHexString).orElse(null); - this.targetBlobsPerBlock = header.getTargetBlobsPerBlock().map(Quantity::create).orElse(null); } @JsonGetter(value = "number") @@ -292,11 +290,6 @@ public String getParentBeaconBlockRoot() { return parentBeaconBlockRoot; } - @JsonGetter(value = "targetBlobsPerBlock") - public String getTargetBlobsPerBlock() { - return targetBlobsPerBlock; - } - @JsonGetter(value = "calls") public List getTransactionProcessingResults() { return callProcessingResults; 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 c55f9b46547..6f3360821af 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 @@ -372,7 +372,6 @@ private Block createFakeBlock( 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/EthMaxPriorityFeePerGasTest.java b/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/EthMaxPriorityFeePerGasTest.java index 05b5f8cb0d7..066f97c0d3f 100644 --- a/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/EthMaxPriorityFeePerGasTest.java +++ b/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/EthMaxPriorityFeePerGasTest.java @@ -207,7 +207,6 @@ private Block createFakeBlock( 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/engine/EngineExchangeTransitionConfigurationTest.java b/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/engine/EngineExchangeTransitionConfigurationTest.java index 351c973e82d..a230dc5cbaa 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,7 +254,6 @@ private BlockHeader createBlockHeader(final Hash blockHash, final long blockNumb 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/query/BlockchainQueriesLogCacheTest.java b/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/query/BlockchainQueriesLogCacheTest.java index 7b3d50b2d09..48f98c667a9 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,7 +120,6 @@ public void setup() { 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 293c0b176ea..5772a04a49d 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,7 +108,6 @@ public void setup() throws IOException { null, null, null, - null, new MainnetBlockHeaderFunctions()); testHash = fakeHeader.getHash(); when(blockchain.getBlockHeader(anyLong())).thenReturn(Optional.of(fakeHeader)); @@ -284,7 +283,6 @@ private BlockHeader createBlock(final long number, final Optional messag 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/chain/GenesisState.java b/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/chain/GenesisState.java index 56c33e55c7d..e770fe97520 100644 --- a/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/chain/GenesisState.java +++ b/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/chain/GenesisState.java @@ -48,7 +48,6 @@ import com.google.common.base.MoreObjects; import org.apache.tuweni.bytes.Bytes; import org.apache.tuweni.bytes.Bytes32; -import org.apache.tuweni.units.bigints.UInt64; public final class GenesisState { @@ -217,12 +216,6 @@ private static BlockHeader buildHeader( .parentBeaconBlockRoot( (isCancunAtGenesis(genesis) ? parseParentBeaconBlockRoot(genesis) : null)) .requestsHash(isPragueAtGenesis(genesis) ? Hash.EMPTY_REQUESTS_HASH : null) - .targetBlobsPerBlock( - isPragueAtGenesis(genesis) - // TODO SLD EIP-7742 Currently defaulting to null due to dependency on web3j - // BlockHeader in CodeDelegationTransactionAcceptanceTest - ? genesis.getTargetBlobsPerBlock().map(UInt64::fromHexString).orElse(null) - : null) .buildBlockHeader(); } 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 e41e0823bc8..6bd1a2aa588 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 @@ -28,7 +28,6 @@ import com.google.common.base.Suppliers; import org.apache.tuweni.bytes.Bytes; import org.apache.tuweni.bytes.Bytes32; -import org.apache.tuweni.units.bigints.UInt64; /** A mined Ethereum block header. */ public class BlockHeader extends SealableBlockHeader @@ -66,7 +65,6 @@ public BlockHeader( final BlobGas excessBlobGas, final Bytes32 parentBeaconBlockRoot, final Hash requestsHash, - final UInt64 targetBlobsPerBlock, final BlockHeaderFunctions blockHeaderFunctions) { super( parentHash, @@ -88,8 +86,7 @@ public BlockHeader( blobGasUsed, excessBlobGas, parentBeaconBlockRoot, - requestsHash, - targetBlobsPerBlock); + requestsHash); this.nonce = nonce; this.hash = Suppliers.memoize(() -> blockHeaderFunctions.hash(this)); this.parsedExtraData = Suppliers.memoize(() -> blockHeaderFunctions.parseExtraData(this)); @@ -190,9 +187,6 @@ public void writeTo(final RLPOutput out) { if (requestsHash == null) break; out.writeBytes(requestsHash); - - if (targetBlobsPerBlock == null) break; - out.writeUInt64Scalar(targetBlobsPerBlock); } while (false); out.endList(); } @@ -225,8 +219,6 @@ public static BlockHeader readFrom( !input.isEndOfCurrentList() ? BlobGas.of(input.readUInt64Scalar()) : null; final Bytes32 parentBeaconBlockRoot = !input.isEndOfCurrentList() ? input.readBytes32() : null; final Hash requestsHash = !input.isEndOfCurrentList() ? Hash.wrap(input.readBytes32()) : null; - final UInt64 targetBlobsPerBlock = - !input.isEndOfCurrentList() ? input.readUInt64Scalar() : null; input.leaveList(); return new BlockHeader( parentHash, @@ -250,7 +242,6 @@ public static BlockHeader readFrom( excessBlobGas, parentBeaconBlockRoot, requestsHash, - targetBlobsPerBlock, blockHeaderFunctions); } @@ -304,9 +295,6 @@ public String toString() { if (requestsHash != null) { sb.append("requestsHash=").append(requestsHash); } - if (targetBlobsPerBlock != null) { - sb.append("targetBlobsPerBlock=").append(targetBlobsPerBlock); - } return sb.append("}").toString(); } @@ -341,7 +329,6 @@ public static org.hyperledger.besu.ethereum.core.BlockHeader convertPluginBlockH .getRequestsHash() .map(h -> Hash.fromHexString(h.toHexString())) .orElse(null), - pluginBlockHeader.getTargetBlobsPerBlock().orElse(null), blockHeaderFunctions); } 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 381785995ac..550f6c18887 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 @@ -34,7 +34,6 @@ import org.apache.tuweni.bytes.Bytes; import org.apache.tuweni.bytes.Bytes32; -import org.apache.tuweni.units.bigints.UInt64; /** A utility class for building block headers. */ public class BlockHeaderBuilder { @@ -81,7 +80,6 @@ public class BlockHeaderBuilder { private Long blobGasUsed = null; private BlobGas excessBlobGas = null; private Bytes32 parentBeaconBlockRoot = null; - private UInt64 targetBlobsPerBlock = null; public static BlockHeaderBuilder create() { return new BlockHeaderBuilder(); @@ -130,8 +128,7 @@ public static BlockHeaderBuilder fromHeader(final BlockHeader header) { .blobGasUsed(header.getBlobGasUsed().orElse(null)) .excessBlobGas(header.getExcessBlobGas().orElse(null)) .parentBeaconBlockRoot(header.getParentBeaconBlockRoot().orElse(null)) - .requestsHash(header.getRequestsHash().orElse(null)) - .targetBlobsPerBlock(header.getTargetBlobsPerBlock().orElse(null)); + .requestsHash(header.getRequestsHash().orElse(null)); } public static BlockHeaderBuilder fromBuilder(final BlockHeaderBuilder fromBuilder) { @@ -156,7 +153,6 @@ public static BlockHeaderBuilder fromBuilder(final BlockHeaderBuilder fromBuilde .excessBlobGas(fromBuilder.excessBlobGas) .parentBeaconBlockRoot(fromBuilder.parentBeaconBlockRoot) .requestsHash(fromBuilder.requestsHash) - .targetBlobsPerBlock(fromBuilder.targetBlobsPerBlock) .blockHeaderFunctions(fromBuilder.blockHeaderFunctions); toBuilder.nonce = fromBuilder.nonce; return toBuilder; @@ -236,7 +232,6 @@ public BlockHeader buildBlockHeader() { excessBlobGas, parentBeaconBlockRoot, requestsHash, - targetBlobsPerBlock, blockHeaderFunctions); } @@ -252,8 +247,7 @@ public ProcessableBlockHeader buildProcessableBlockHeader() { timestamp, baseFee, mixHashOrPrevRandao, - parentBeaconBlockRoot, - targetBlobsPerBlock); + parentBeaconBlockRoot); } public SealableBlockHeader buildSealableBlockHeader() { @@ -279,8 +273,7 @@ public SealableBlockHeader buildSealableBlockHeader() { blobGasUsed, excessBlobGas, parentBeaconBlockRoot, - requestsHash, - targetBlobsPerBlock); + requestsHash); } private void validateBlockHeader() { @@ -320,7 +313,6 @@ public BlockHeaderBuilder populateFrom(final ProcessableBlockHeader processableB baseFee(processableBlockHeader.getBaseFee().orElse(null)); processableBlockHeader.getPrevRandao().ifPresent(this::prevRandao); processableBlockHeader.getParentBeaconBlockRoot().ifPresent(this::parentBeaconBlockRoot); - processableBlockHeader.getTargetBlobsPerBlock().ifPresent(this::targetBlobsPerBlock); return this; } @@ -346,7 +338,6 @@ public BlockHeaderBuilder populateFrom(final SealableBlockHeader sealableBlockHe sealableBlockHeader.getExcessBlobGas().ifPresent(this::excessBlobGas); sealableBlockHeader.getParentBeaconBlockRoot().ifPresent(this::parentBeaconBlockRoot); requestsHash(sealableBlockHeader.getRequestsHash().orElse(null)); - sealableBlockHeader.getTargetBlobsPerBlock().ifPresent(this::targetBlobsPerBlock); return this; } @@ -480,9 +471,4 @@ public BlockHeaderBuilder parentBeaconBlockRoot(final Bytes32 parentBeaconBlockR this.parentBeaconBlockRoot = parentBeaconBlockRoot; return this; } - - public BlockHeaderBuilder targetBlobsPerBlock(final UInt64 targetBlobsPerBlock) { - this.targetBlobsPerBlock = targetBlobsPerBlock; - return this; - } } diff --git a/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/core/ProcessableBlockHeader.java b/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/core/ProcessableBlockHeader.java index 20650bc74aa..0af72a1c83f 100644 --- a/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/core/ProcessableBlockHeader.java +++ b/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/core/ProcessableBlockHeader.java @@ -23,7 +23,6 @@ import org.apache.tuweni.bytes.Bytes; import org.apache.tuweni.bytes.Bytes32; -import org.apache.tuweni.units.bigints.UInt64; /** A block header capable of being processed. */ public class ProcessableBlockHeader @@ -47,8 +46,6 @@ public class ProcessableBlockHeader protected final Bytes32 mixHashOrPrevRandao; // parentBeaconBlockRoot is included for Cancun protected final Bytes32 parentBeaconBlockRoot; - // TODO SLD Quantity or UInt64Value instead? - protected final UInt64 targetBlobsPerBlock; protected ProcessableBlockHeader( final Hash parentHash, @@ -59,8 +56,7 @@ protected ProcessableBlockHeader( final long timestamp, final Wei baseFee, final Bytes32 mixHashOrPrevRandao, - final Bytes32 parentBeaconBlockRoot, - final UInt64 targetBlobsPerBlock) { + final Bytes32 parentBeaconBlockRoot) { this.parentHash = parentHash; this.coinbase = coinbase; this.difficulty = difficulty; @@ -70,7 +66,6 @@ protected ProcessableBlockHeader( this.baseFee = baseFee; this.mixHashOrPrevRandao = mixHashOrPrevRandao; this.parentBeaconBlockRoot = parentBeaconBlockRoot; - this.targetBlobsPerBlock = targetBlobsPerBlock; } /** @@ -183,16 +178,6 @@ public Optional getParentBeaconBlockRoot() { return Optional.ofNullable(parentBeaconBlockRoot); } - /** - * Returns the target blobs per block if available. - * - * @return the target blobs per block if available. - */ - @Override - public Optional getTargetBlobsPerBlock() { - return Optional.ofNullable(targetBlobsPerBlock); - } - public String toLogString() { return getNumber() + " (time: " + getTimestamp() + ")"; } @@ -212,9 +197,6 @@ public String toString() { if (parentBeaconBlockRoot != null) { sb.append("parentBeaconBlockRoot=").append(parentBeaconBlockRoot).append(", "); } - if (targetBlobsPerBlock != null) { - sb.append("targetBlobsPerBlock=").append(targetBlobsPerBlock); - } return sb.append("}").toString(); } } 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 40d25f9e2a7..1934c8f8c0e 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 @@ -24,7 +24,6 @@ import org.apache.tuweni.bytes.Bytes; import org.apache.tuweni.bytes.Bytes32; -import org.apache.tuweni.units.bigints.UInt64; /** A block header capable of being sealed. */ public class SealableBlockHeader extends ProcessableBlockHeader { @@ -70,8 +69,7 @@ protected SealableBlockHeader( final Long blobGasUsed, final BlobGas excessBlobGas, final Bytes32 parentBeaconBlockRoot, - final Hash requestsHash, - final UInt64 targetBlobsPerBlock) { + final Hash requestsHash) { super( parentHash, coinbase, @@ -81,8 +79,7 @@ protected SealableBlockHeader( timestamp, baseFee, mixHashOrPrevRandao, - parentBeaconBlockRoot, - targetBlobsPerBlock); + parentBeaconBlockRoot); this.ommersHash = ommersHash; this.stateRoot = stateRoot; this.transactionsRoot = transactionsRoot; diff --git a/ethereum/core/src/test-support/java/org/hyperledger/besu/ethereum/core/BlockHeaderTestFixture.java b/ethereum/core/src/test-support/java/org/hyperledger/besu/ethereum/core/BlockHeaderTestFixture.java index 825cdec29b2..99cf2407b8d 100644 --- a/ethereum/core/src/test-support/java/org/hyperledger/besu/ethereum/core/BlockHeaderTestFixture.java +++ b/ethereum/core/src/test-support/java/org/hyperledger/besu/ethereum/core/BlockHeaderTestFixture.java @@ -25,7 +25,6 @@ import org.apache.tuweni.bytes.Bytes; import org.apache.tuweni.bytes.Bytes32; -import org.apache.tuweni.units.bigints.UInt64; public class BlockHeaderTestFixture { @@ -56,7 +55,6 @@ public class BlockHeaderTestFixture { private Optional excessBlobGas = Optional.empty(); private Optional blobGasUsed = Optional.empty(); private Optional parentBeaconBlockRoot = Optional.empty(); - private Optional targetBlobsPerBlock = Optional.empty(); public BlockHeader buildHeader() { final BlockHeaderBuilder builder = BlockHeaderBuilder.create(); @@ -82,7 +80,6 @@ public BlockHeader buildHeader() { blobGasUsed.ifPresent(builder::blobGasUsed); requestsHash.ifPresent(builder::requestsHash); parentBeaconBlockRoot.ifPresent(builder::parentBeaconBlockRoot); - targetBlobsPerBlock.ifPresent(builder::targetBlobsPerBlock); builder.blockHeaderFunctions(blockHeaderFunctions); return builder.buildBlockHeader(); @@ -204,9 +201,4 @@ public BlockHeaderTestFixture parentBeaconBlockRoot( this.parentBeaconBlockRoot = parentBeaconBlockRoot; return this; } - - public BlockHeaderTestFixture targetBlobsPerBlock(final UInt64 targetBlobsPerBlock) { - this.targetBlobsPerBlock = Optional.of(targetBlobsPerBlock); - return this; - } } diff --git a/ethereum/core/src/test/java/org/hyperledger/besu/ethereum/chain/GenesisStateTest.java b/ethereum/core/src/test/java/org/hyperledger/besu/ethereum/chain/GenesisStateTest.java index a4584cc938a..ba036347085 100644 --- a/ethereum/core/src/test/java/org/hyperledger/besu/ethereum/chain/GenesisStateTest.java +++ b/ethereum/core/src/test/java/org/hyperledger/besu/ethereum/chain/GenesisStateTest.java @@ -31,7 +31,6 @@ import org.apache.tuweni.bytes.Bytes; import org.apache.tuweni.units.bigints.UInt256; -import org.apache.tuweni.units.bigints.UInt64; import org.bouncycastle.util.encoders.Hex; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtensionContext; @@ -288,6 +287,10 @@ void genesisFromPrague(final DataStorageConfiguration dataStorageConfiguration) GenesisStateTest.class.getResource("genesis_prague.json"), ProtocolScheduleFixture.MAINNET); final BlockHeader header = genesisState.getBlock().getHeader(); + assertThat(header.getHash()) + .isEqualTo( + Hash.fromHexString( + "0x554807b22674e6d335f734485993857bbad7a9543affb0663a10c14d78135ec7")); assertThat(header.getGasLimit()).isEqualTo(0x2fefd8); assertThat(header.getGasUsed()).isZero(); assertThat(header.getNumber()).isZero(); @@ -328,13 +331,6 @@ void genesisFromPrague(final DataStorageConfiguration dataStorageConfiguration) .isEqualTo( Hash.fromHexString( "0x6036c41849da9c076ed79654d434017387a88fb833c2856b32e18218b3341c5f")); - assertThat(header.getTargetBlobsPerBlock().isPresent()).isTrue(); - assertThat(header.getTargetBlobsPerBlock().get()).isEqualTo(UInt64.ONE); - - assertThat(header.getHash()) - .isEqualTo( - Hash.fromHexString( - "0xdbc64edecb3a432e48cbd270b4a248ffc611b5f3dd666c8a10d546672cae17bd")); } @Test diff --git a/ethereum/core/src/test/java/org/hyperledger/besu/ethereum/trie/diffbased/bonsai/LogRollingTests.java b/ethereum/core/src/test/java/org/hyperledger/besu/ethereum/trie/diffbased/bonsai/LogRollingTests.java index 6a70cb20e28..e43d464474c 100644 --- a/ethereum/core/src/test/java/org/hyperledger/besu/ethereum/trie/diffbased/bonsai/LogRollingTests.java +++ b/ethereum/core/src/test/java/org/hyperledger/besu/ethereum/trie/diffbased/bonsai/LogRollingTests.java @@ -99,7 +99,6 @@ class LogRollingTests { null, null, null, - null, new MainnetBlockHeaderFunctions()); private static final BlockHeader headerTwo = new BlockHeader( @@ -124,7 +123,6 @@ class LogRollingTests { null, null, null, - null, new MainnetBlockHeaderFunctions()); @BeforeEach diff --git a/ethereum/core/src/test/resources/org/hyperledger/besu/ethereum/chain/genesis_prague.json b/ethereum/core/src/test/resources/org/hyperledger/besu/ethereum/chain/genesis_prague.json index 10cf0191824..d99071b328d 100644 --- a/ethereum/core/src/test/resources/org/hyperledger/besu/ethereum/chain/genesis_prague.json +++ b/ethereum/core/src/test/resources/org/hyperledger/besu/ethereum/chain/genesis_prague.json @@ -4073,6 +4073,5 @@ "number": "0x0", "gasUsed": "0x0", "parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000", - "baseFeePerGas": "0x3b9aca00", - "targetBlobsPerBlock": "0x1" + "baseFeePerGas": "0x3b9aca00" } diff --git a/ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/messages/MessageWrapperTest.java b/ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/messages/MessageWrapperTest.java index 0256b096532..2b020cd4ac8 100644 --- a/ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/messages/MessageWrapperTest.java +++ b/ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/messages/MessageWrapperTest.java @@ -398,7 +398,6 @@ public TestBlockHeader( null, null, null, - null, new MainnetBlockHeaderFunctions()); } } diff --git a/ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/sync/backwardsync/ChainForTestCreator.java b/ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/sync/backwardsync/ChainForTestCreator.java index 109a66e2c1a..c15f3aa1dcd 100644 --- a/ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/sync/backwardsync/ChainForTestCreator.java +++ b/ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/sync/backwardsync/ChainForTestCreator.java @@ -61,7 +61,6 @@ public static BlockHeader prepareHeader(final long number, final Optional getBaseFee() { */ @Unstable Optional getParentBeaconBlockRoot(); - - /** - * The target_blobs_per_block of this header. - * - * @return The target blobs per block of this header. - */ - @Unstable - // TODO SLD should be Quantity or new subclass of Quantity? - default Optional getTargetBlobsPerBlock() { - return Optional.empty(); - } } From 01126c0853e5a1152e760b4a5d1aa3862301e1c8 Mon Sep 17 00:00:00 2001 From: Usman Saleem Date: Tue, 7 Jan 2025 13:14:39 +1000 Subject: [PATCH 2/3] Reimplement EthereumNodeRecord for DNS discovery (#7989) * Reimplement EthereumNodeRecord and remove dependency on tuweni-devp2p * Refactor EthereumNodeRecord for DNSDaemon * Update EthereumNodeRecord to use Besu RLP * additional unit tests * Convert ENR to Java record * regenerate equals and hashcode for enr record --------- Signed-off-by: Usman Saleem --- .../besu/crypto/AbstractSECP256.java | 5 + .../besu/crypto/SignatureAlgorithm.java | 8 + ethereum/p2p/build.gradle | 3 - .../ethereum/p2p/discovery/dns/DNSDaemon.java | 1 - .../p2p/discovery/dns/DNSDaemonListener.java | 2 - .../ethereum/p2p/discovery/dns/DNSEntry.java | 1 - .../p2p/discovery/dns/DNSResolver.java | 1 - .../p2p/discovery/dns/DNSVisitor.java | 2 - .../p2p/discovery/dns/EthereumNodeRecord.java | 154 ++++++++++++++++++ .../p2p/network/DefaultP2PNetwork.java | 8 +- .../p2p/discovery/dns/DNSDaemonTest.java | 18 +- .../discovery/dns/EthereumNodeRecordTest.java | 56 +++++++ gradle/verification-metadata.xml | 8 - platform/build.gradle | 1 - 14 files changed, 244 insertions(+), 24 deletions(-) create mode 100644 ethereum/p2p/src/main/java/org/hyperledger/besu/ethereum/p2p/discovery/dns/EthereumNodeRecord.java create mode 100644 ethereum/p2p/src/test/java/org/hyperledger/besu/ethereum/p2p/discovery/dns/EthereumNodeRecordTest.java diff --git a/crypto/algorithms/src/main/java/org/hyperledger/besu/crypto/AbstractSECP256.java b/crypto/algorithms/src/main/java/org/hyperledger/besu/crypto/AbstractSECP256.java index 4e228441cc4..2098dfeadc1 100644 --- a/crypto/algorithms/src/main/java/org/hyperledger/besu/crypto/AbstractSECP256.java +++ b/crypto/algorithms/src/main/java/org/hyperledger/besu/crypto/AbstractSECP256.java @@ -233,6 +233,11 @@ public String getProvider() { return PROVIDER; } + @Override + public ECDomainParameters getCurve() { + return curve; + } + /** * Gets K calculator. * diff --git a/crypto/algorithms/src/main/java/org/hyperledger/besu/crypto/SignatureAlgorithm.java b/crypto/algorithms/src/main/java/org/hyperledger/besu/crypto/SignatureAlgorithm.java index a1a79d057a5..1d077d51d26 100644 --- a/crypto/algorithms/src/main/java/org/hyperledger/besu/crypto/SignatureAlgorithm.java +++ b/crypto/algorithms/src/main/java/org/hyperledger/besu/crypto/SignatureAlgorithm.java @@ -20,6 +20,7 @@ import org.apache.tuweni.bytes.Bytes; import org.apache.tuweni.bytes.Bytes32; +import org.bouncycastle.crypto.params.ECDomainParameters; import org.bouncycastle.math.ec.ECPoint; /** The interface Signature algorithm. */ @@ -124,6 +125,13 @@ SECPSignature normaliseSignature( */ String getCurveName(); + /** + * Bouncy castle ECDomainParameters representing the curve. + * + * @return instance of ECDomainParameters + */ + ECDomainParameters getCurve(); + /** * Create secp private key. * diff --git a/ethereum/p2p/build.gradle b/ethereum/p2p/build.gradle index 6ed42425e0a..f4eb5066284 100644 --- a/ethereum/p2p/build.gradle +++ b/ethereum/p2p/build.gradle @@ -46,9 +46,6 @@ dependencies { implementation 'io.tmio:tuweni-bytes' implementation 'io.tmio:tuweni-crypto' - implementation('io.tmio:tuweni-devp2p') { - exclude group:'ch.qos.logback', module:'logback-classic' - } implementation 'io.tmio:tuweni-io' implementation 'io.tmio:tuweni-rlp' implementation 'io.tmio:tuweni-units' diff --git a/ethereum/p2p/src/main/java/org/hyperledger/besu/ethereum/p2p/discovery/dns/DNSDaemon.java b/ethereum/p2p/src/main/java/org/hyperledger/besu/ethereum/p2p/discovery/dns/DNSDaemon.java index ef794ae2047..7c2d9350f62 100644 --- a/ethereum/p2p/src/main/java/org/hyperledger/besu/ethereum/p2p/discovery/dns/DNSDaemon.java +++ b/ethereum/p2p/src/main/java/org/hyperledger/besu/ethereum/p2p/discovery/dns/DNSDaemon.java @@ -18,7 +18,6 @@ import java.util.Optional; import io.vertx.core.AbstractVerticle; -import org.apache.tuweni.devp2p.EthereumNodeRecord; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/ethereum/p2p/src/main/java/org/hyperledger/besu/ethereum/p2p/discovery/dns/DNSDaemonListener.java b/ethereum/p2p/src/main/java/org/hyperledger/besu/ethereum/p2p/discovery/dns/DNSDaemonListener.java index cfa51d4eb73..81629268a8a 100644 --- a/ethereum/p2p/src/main/java/org/hyperledger/besu/ethereum/p2p/discovery/dns/DNSDaemonListener.java +++ b/ethereum/p2p/src/main/java/org/hyperledger/besu/ethereum/p2p/discovery/dns/DNSDaemonListener.java @@ -16,8 +16,6 @@ import java.util.List; -import org.apache.tuweni.devp2p.EthereumNodeRecord; - // Adapted from https://github.com/tmio/tuweni and licensed under Apache 2.0 /** Callback listening to updates of the DNS records. */ @FunctionalInterface diff --git a/ethereum/p2p/src/main/java/org/hyperledger/besu/ethereum/p2p/discovery/dns/DNSEntry.java b/ethereum/p2p/src/main/java/org/hyperledger/besu/ethereum/p2p/discovery/dns/DNSEntry.java index cd439eea063..810bd3b41b1 100644 --- a/ethereum/p2p/src/main/java/org/hyperledger/besu/ethereum/p2p/discovery/dns/DNSEntry.java +++ b/ethereum/p2p/src/main/java/org/hyperledger/besu/ethereum/p2p/discovery/dns/DNSEntry.java @@ -25,7 +25,6 @@ import org.apache.tuweni.bytes.Bytes; import org.apache.tuweni.crypto.SECP256K1; -import org.apache.tuweni.devp2p.EthereumNodeRecord; import org.apache.tuweni.io.Base32; import org.apache.tuweni.io.Base64URLSafe; import org.bouncycastle.math.ec.ECPoint; diff --git a/ethereum/p2p/src/main/java/org/hyperledger/besu/ethereum/p2p/discovery/dns/DNSResolver.java b/ethereum/p2p/src/main/java/org/hyperledger/besu/ethereum/p2p/discovery/dns/DNSResolver.java index 0be4ca619d1..c3347aa8d9e 100644 --- a/ethereum/p2p/src/main/java/org/hyperledger/besu/ethereum/p2p/discovery/dns/DNSResolver.java +++ b/ethereum/p2p/src/main/java/org/hyperledger/besu/ethereum/p2p/discovery/dns/DNSResolver.java @@ -33,7 +33,6 @@ import org.apache.tuweni.bytes.Bytes; import org.apache.tuweni.bytes.Bytes32; import org.apache.tuweni.crypto.SECP256K1; -import org.apache.tuweni.devp2p.EthereumNodeRecord; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/ethereum/p2p/src/main/java/org/hyperledger/besu/ethereum/p2p/discovery/dns/DNSVisitor.java b/ethereum/p2p/src/main/java/org/hyperledger/besu/ethereum/p2p/discovery/dns/DNSVisitor.java index c6ea0a77ed7..fc9b5af9965 100644 --- a/ethereum/p2p/src/main/java/org/hyperledger/besu/ethereum/p2p/discovery/dns/DNSVisitor.java +++ b/ethereum/p2p/src/main/java/org/hyperledger/besu/ethereum/p2p/discovery/dns/DNSVisitor.java @@ -14,8 +14,6 @@ */ package org.hyperledger.besu.ethereum.p2p.discovery.dns; -import org.apache.tuweni.devp2p.EthereumNodeRecord; - // Adapted from https://github.com/tmio/tuweni and licensed under Apache 2.0 /** * Reads ENR (Ethereum Node Records) entries passed in from DNS. The visitor may decide to stop the diff --git a/ethereum/p2p/src/main/java/org/hyperledger/besu/ethereum/p2p/discovery/dns/EthereumNodeRecord.java b/ethereum/p2p/src/main/java/org/hyperledger/besu/ethereum/p2p/discovery/dns/EthereumNodeRecord.java new file mode 100644 index 00000000000..339afcffca3 --- /dev/null +++ b/ethereum/p2p/src/main/java/org/hyperledger/besu/ethereum/p2p/discovery/dns/EthereumNodeRecord.java @@ -0,0 +1,154 @@ +/* + * Copyright contributors to Hyperledger Besu. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + * + * SPDX-License-Identifier: Apache-2.0 + */ + +// Adapted from https://github.com/tmio/tuweni and licensed under Apache 2.0 +package org.hyperledger.besu.ethereum.p2p.discovery.dns; + +import org.hyperledger.besu.crypto.SignatureAlgorithmFactory; +import org.hyperledger.besu.ethereum.rlp.BytesValueRLPInput; + +import java.net.InetAddress; +import java.nio.charset.StandardCharsets; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +import org.apache.tuweni.bytes.Bytes; + +/** + * A modified implementation of Ethereum Node Record (ENR) that is used by DNSResolver. See EIP-778 + */ +public record EthereumNodeRecord( + Bytes rlp, Bytes publicKey, InetAddress ip, Optional tcp, Optional udp) { + + /** + * Creates an ENR from its serialized form as a RLP list + * + * @param rlp the serialized form of the ENR + * @return the ENR + * @throws IllegalArgumentException if the rlp bytes length is longer than 300 bytes + */ + public static EthereumNodeRecord fromRLP(final Bytes rlp) { + if (rlp.size() > 300) { + throw new IllegalArgumentException("Record too long"); + } + var data = new HashMap(); + + // rlp: sig, sequence, k1,v1, k2,v2, k3, [v3, vn]... + var input = new BytesValueRLPInput(rlp, false); + input.enterList(); + + input.skipNext(); // skip signature + input.skipNext(); // skip sequence + + // go through rest of the list + while (!input.isEndOfCurrentList()) { + var key = new String(input.readBytes().toArrayUnsafe(), StandardCharsets.UTF_8); + if (input.nextIsList()) { + // skip list as we currently don't need any of these complex structures + input.skipNext(); + } else { + data.put(key, input.readBytes()); + } + } + + input.leaveList(); + + var publicKey = initPublicKeyBytes(data); + + return new EthereumNodeRecord(rlp, publicKey, initIPAddr(data), initTCP(data), initUDP(data)); + } + + /** + * Returns the public key of the ENR + * + * @return the public key of the ENR + */ + static Bytes initPublicKeyBytes(final Map data) { + var keyBytes = data.get("secp256k1"); + if (keyBytes == null) { + throw new IllegalArgumentException("Missing secp256k1 entry in ENR"); + } + // convert 33 bytes compressed public key to uncompressed using Bouncy Castle + var curve = SignatureAlgorithmFactory.getInstance().getCurve(); + var ecPoint = curve.getCurve().decodePoint(keyBytes.toArrayUnsafe()); + // uncompressed public key is 65 bytes, first byte is 0x04. + var encodedPubKey = ecPoint.getEncoded(false); + return Bytes.of(Arrays.copyOfRange(encodedPubKey, 1, encodedPubKey.length)); + } + + /** + * Returns the InetAddress of the ENR + * + * @return The IP address of the ENR + */ + static InetAddress initIPAddr(final Map data) { + var ipBytes = data.get("ip"); + if (ipBytes != null) { + try { + return InetAddress.getByAddress(ipBytes.toArrayUnsafe()); + } catch (final Exception e) { + throw new RuntimeException(e); + } + } + return InetAddress.getLoopbackAddress(); + } + + /** + * The TCP port of the ENR + * + * @return the TCP port associated with this ENR + */ + static Optional initTCP(final Map data) { + var tcpBytes = data.get("tcp"); + return tcpBytes != null ? Optional.of(tcpBytes.toInt()) : Optional.empty(); + } + + /** + * The UDP port of the ENR. If the UDP port is not present, the TCP port is used. + * + * @return the UDP port associated with this ENR + */ + static Optional initUDP(final Map data) { + var udpBytes = data.get("udp"); + return udpBytes != null ? Optional.of(udpBytes.toInt()) : initTCP(data); + } + + /** + * @return the ENR as a URI + */ + @Override + public String toString() { + return "enr:" + ip() + ":" + tcp() + "?udp=" + udp(); + } + + /** Override equals method to compare the RLP bytes */ + @Override + public boolean equals(final Object o) { + if (!(o instanceof EthereumNodeRecord that)) { + return false; + } + return Objects.equals(rlp, that.rlp); + } + + /** Override hashCode method to use hashCode of the RLP bytes */ + @Override + public int hashCode() { + return Objects.hashCode(rlp); + } +} diff --git a/ethereum/p2p/src/main/java/org/hyperledger/besu/ethereum/p2p/network/DefaultP2PNetwork.java b/ethereum/p2p/src/main/java/org/hyperledger/besu/ethereum/p2p/network/DefaultP2PNetwork.java index 610ebd39d8a..bf8e76b6215 100644 --- a/ethereum/p2p/src/main/java/org/hyperledger/besu/ethereum/p2p/network/DefaultP2PNetwork.java +++ b/ethereum/p2p/src/main/java/org/hyperledger/besu/ethereum/p2p/network/DefaultP2PNetwork.java @@ -29,6 +29,7 @@ import org.hyperledger.besu.ethereum.p2p.discovery.VertxPeerDiscoveryAgent; import org.hyperledger.besu.ethereum.p2p.discovery.dns.DNSDaemon; import org.hyperledger.besu.ethereum.p2p.discovery.dns.DNSDaemonListener; +import org.hyperledger.besu.ethereum.p2p.discovery.dns.EthereumNodeRecord; import org.hyperledger.besu.ethereum.p2p.discovery.internal.PeerTable; import org.hyperledger.besu.ethereum.p2p.peers.DefaultPeerPrivileges; import org.hyperledger.besu.ethereum.p2p.peers.EnodeURLImpl; @@ -82,7 +83,6 @@ import io.vertx.core.ThreadingModel; import io.vertx.core.Vertx; import org.apache.tuweni.bytes.Bytes; -import org.apache.tuweni.devp2p.EthereumNodeRecord; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -366,9 +366,9 @@ DNSDaemonListener createDaemonListener() { final EnodeURL enodeURL = EnodeURLImpl.builder() .ipAddress(enr.ip()) - .nodeId(enr.publicKey().bytes()) - .discoveryPort(Optional.ofNullable(enr.udp())) - .listeningPort(Optional.ofNullable(enr.tcp())) + .nodeId(enr.publicKey()) + .discoveryPort(enr.udp()) + .listeningPort(enr.tcp()) .build(); final DiscoveryPeer peer = DiscoveryPeer.fromEnode(enodeURL); peers.add(peer); diff --git a/ethereum/p2p/src/test/java/org/hyperledger/besu/ethereum/p2p/discovery/dns/DNSDaemonTest.java b/ethereum/p2p/src/test/java/org/hyperledger/besu/ethereum/p2p/discovery/dns/DNSDaemonTest.java index 94d9c75e4ae..b25148126c4 100644 --- a/ethereum/p2p/src/test/java/org/hyperledger/besu/ethereum/p2p/discovery/dns/DNSDaemonTest.java +++ b/ethereum/p2p/src/test/java/org/hyperledger/besu/ethereum/p2p/discovery/dns/DNSDaemonTest.java @@ -14,6 +14,8 @@ */ package org.hyperledger.besu.ethereum.p2p.discovery.dns; +import org.hyperledger.besu.ethereum.p2p.peers.EnodeURLImpl; + import java.security.Security; import java.util.concurrent.atomic.AtomicInteger; @@ -67,10 +69,24 @@ void testDNSDaemon(final Vertx vertx, final VertxTestContext testContext) { testContext.failNow( "Expecting 115 records in first pass but got: " + records.size()); } + records.forEach( + enr -> { + try { + // make sure enode url can be built from record + EnodeURLImpl.builder() + .ipAddress(enr.ip()) + .nodeId(enr.publicKey()) + .discoveryPort(enr.udp()) + .listeningPort(enr.tcp()) + .build(); + } catch (final Exception e) { + testContext.failNow(e); + } + }); checkpoint.flag(); }, 0, - 0, + 1L, 0, "localhost:" + mockDnsServerVerticle.port()); diff --git a/ethereum/p2p/src/test/java/org/hyperledger/besu/ethereum/p2p/discovery/dns/EthereumNodeRecordTest.java b/ethereum/p2p/src/test/java/org/hyperledger/besu/ethereum/p2p/discovery/dns/EthereumNodeRecordTest.java new file mode 100644 index 00000000000..da5cfd0f31c --- /dev/null +++ b/ethereum/p2p/src/test/java/org/hyperledger/besu/ethereum/p2p/discovery/dns/EthereumNodeRecordTest.java @@ -0,0 +1,56 @@ +/* + * Copyright contributors to Besu. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + * + * SPDX-License-Identifier: Apache-2.0 + */ +package org.hyperledger.besu.ethereum.p2p.discovery.dns; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.assertThatThrownBy; + +import java.net.InetAddress; +import java.util.Random; + +import org.apache.tuweni.bytes.Bytes; +import org.junit.jupiter.api.Test; + +class EthereumNodeRecordTest { + + @Test + void buildFromRLP() throws Exception { + final Bytes rlp = + Bytes.fromHexString( + "0xf8a3b84033b8a07e5c8e19dc8ac2529354b21a6c09e5516335eb57c383924aa0ca73434c0c65d8625eb05236e172fcc00d80e913506bde5446fb5c55ea2035380c97480a86018d56dc241083657468c7c6849b192ad0808269648276348269708441157e4389736563703235366b31a102a48c4c032f4c2e1b4007dd15b0d7046b60774f6bc38e2f52a8e0361c65e4234284736e6170c08374637082765f8375647082765f"); + // method under test + final EthereumNodeRecord enr = EthereumNodeRecord.fromRLP(rlp); + // expected values + final InetAddress expectedIPAddr = + InetAddress.getByAddress(Bytes.fromHexString("0x41157e43").toArrayUnsafe()); + final Bytes expectedPublicKey = + Bytes.fromHexString( + "0xa48c4c032f4c2e1b4007dd15b0d7046b60774f6bc38e2f52a8e0361c65e423424520b07898c59a8c9e85c440594ca734f23b7f2b906d5da54676eee6a1d64874"); + + // assertions + assertThat(enr.ip()).isEqualTo(expectedIPAddr); + assertThat(enr.publicKey()).isEqualTo(expectedPublicKey); + assertThat(enr.tcp()).isNotEmpty().contains(30303); + assertThat(enr.udp()).isNotEmpty().contains(30303); + } + + @Test + void buildFromRLPWithSizeGreaterThan300() { + final Bytes rlp = Bytes.random(301, new Random(1L)); + assertThatThrownBy(() -> EthereumNodeRecord.fromRLP(rlp)) + .isInstanceOf(IllegalArgumentException.class) + .hasMessageContaining("Record too long"); + } +} diff --git a/gradle/verification-metadata.xml b/gradle/verification-metadata.xml index c3acee03312..1a36b557aa2 100644 --- a/gradle/verification-metadata.xml +++ b/gradle/verification-metadata.xml @@ -2883,14 +2883,6 @@ - - - - - - - - diff --git a/platform/build.gradle b/platform/build.gradle index f5bb54afcd1..cffc33659ff 100644 --- a/platform/build.gradle +++ b/platform/build.gradle @@ -110,7 +110,6 @@ dependencies { api 'io.tmio:tuweni-config:2.4.2' api 'io.tmio:tuweni-concurrent:2.4.2' api 'io.tmio:tuweni-crypto:2.4.2' - api 'io.tmio:tuweni-devp2p:2.4.2' api 'io.tmio:tuweni-io:2.4.2' api 'io.tmio:tuweni-net:2.4.2' api 'io.tmio:tuweni-rlp:2.4.2' From fa9ca9c27f18799c09a740057ee934dd07e266d9 Mon Sep 17 00:00:00 2001 From: Simon Dudley Date: Tue, 7 Jan 2025 16:25:02 +1000 Subject: [PATCH 3/3] Update EIP-2935 (#8066) * Update HISTORY_STORAGE_ADDRESS and HISTORY_SERVE_WINDOW for EIP-2935 https://github.com/hyperledger/besu/issues/8061 * Update HISTORY_STORAGE_ADDRESS and genesis code in tests. Even for unrelated tests, this has a knock-on impact on the state root due to the history storage account being created when the BlockHashProcessor runs for block 1 Signed-off-by: Simon Dudley --- .../ExecutionEnginePragueAcceptanceTest.java | 3 ++ .../debug_traceCall_noGasPrice.json | 2 +- .../blockhash/PragueBlockHashProcessor.java | 4 +-- .../besu/ethereum/chain/genesis_prague2.json | 4 +-- .../evmtool/block-test/osaka-eof-rjump.json | 30 +++++++++---------- .../besu/evmtool/t8n/prague-deposit.json | 10 +++---- .../t8n/prague-withdrawal-request.json | 10 +++---- 7 files changed, 33 insertions(+), 30 deletions(-) diff --git a/acceptance-tests/tests/src/test/java/org/hyperledger/besu/tests/acceptance/jsonrpc/ExecutionEnginePragueAcceptanceTest.java b/acceptance-tests/tests/src/test/java/org/hyperledger/besu/tests/acceptance/jsonrpc/ExecutionEnginePragueAcceptanceTest.java index 966c02bebde..f38a192d4df 100644 --- a/acceptance-tests/tests/src/test/java/org/hyperledger/besu/tests/acceptance/jsonrpc/ExecutionEnginePragueAcceptanceTest.java +++ b/acceptance-tests/tests/src/test/java/org/hyperledger/besu/tests/acceptance/jsonrpc/ExecutionEnginePragueAcceptanceTest.java @@ -20,8 +20,11 @@ import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Disabled; import org.junit.jupiter.params.provider.Arguments; +// TODO SLD +@Disabled("TODO SLD - Enable when Prague spec is finalized") public class ExecutionEnginePragueAcceptanceTest extends AbstractJsonRpcTest { private static final String GENESIS_FILE = "/jsonrpc/engine/prague/genesis.json"; private static final String TEST_CASE_PATH = "/jsonrpc/engine/prague/test-cases/"; diff --git a/ethereum/api/src/test/resources/org/hyperledger/besu/ethereum/api/jsonrpc/debug/trace-call/debug_traceCall_noGasPrice.json b/ethereum/api/src/test/resources/org/hyperledger/besu/ethereum/api/jsonrpc/debug/trace-call/debug_traceCall_noGasPrice.json index 18fe53baa16..b19651cb016 100644 --- a/ethereum/api/src/test/resources/org/hyperledger/besu/ethereum/api/jsonrpc/debug/trace-call/debug_traceCall_noGasPrice.json +++ b/ethereum/api/src/test/resources/org/hyperledger/besu/ethereum/api/jsonrpc/debug/trace-call/debug_traceCall_noGasPrice.json @@ -4,7 +4,7 @@ "method": "debug_traceCall", "params": [ { - "to": "0x0aae40965e6800cd9b1f4b05ff21581047e3f91e", + "to": "0x0F792be4B0c0cb4DAE440Ef133E90C0eCD48CCCC", "data": "0x000000000000000000000000000000000000000000000000000000000001A00E" }, "latest", diff --git a/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/blockhash/PragueBlockHashProcessor.java b/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/blockhash/PragueBlockHashProcessor.java index 62e2dc7c99d..5b772f1cd63 100644 --- a/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/blockhash/PragueBlockHashProcessor.java +++ b/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/blockhash/PragueBlockHashProcessor.java @@ -35,10 +35,10 @@ public class PragueBlockHashProcessor extends CancunBlockHashProcessor { private static final Logger LOG = LoggerFactory.getLogger(PragueBlockHashProcessor.class); public static final Address HISTORY_STORAGE_ADDRESS = - Address.fromHexString("0x0aae40965e6800cd9b1f4b05ff21581047e3f91e"); + Address.fromHexString("0x0F792be4B0c0cb4DAE440Ef133E90C0eCD48CCCC"); /** The HISTORY_SERVE_WINDOW */ - private static final long HISTORY_SERVE_WINDOW = 8192; + private static final long HISTORY_SERVE_WINDOW = 8191; protected final long historyServeWindow; protected final Address historyStorageAddress; diff --git a/ethereum/core/src/test/resources/org/hyperledger/besu/ethereum/chain/genesis_prague2.json b/ethereum/core/src/test/resources/org/hyperledger/besu/ethereum/chain/genesis_prague2.json index cdb755ace18..0f0485c983a 100644 --- a/ethereum/core/src/test/resources/org/hyperledger/besu/ethereum/chain/genesis_prague2.json +++ b/ethereum/core/src/test/resources/org/hyperledger/besu/ethereum/chain/genesis_prague2.json @@ -73,8 +73,8 @@ "balance": "0x0", "nonce": "0x1" }, - "0x0aae40965e6800cd9b1f4b05ff21581047e3f91e": { - "code": "0x3373fffffffffffffffffffffffffffffffffffffffe1460575767ffffffffffffffff5f3511605357600143035f3511604b575f35612000014311604b57611fff5f3516545f5260205ff35b5f5f5260205ff35b5f5ffd5b5f35611fff60014303165500", + "0x0F792be4B0c0cb4DAE440Ef133E90C0eCD48CCCC": { + "code": "0x3373fffffffffffffffffffffffffffffffffffffffe14604657602036036042575f35600143038111604257611fff81430311604257611fff9006545f5260205ff35b5f5ffd5b5f35611fff60014303065500", "balance": "0x0", "nonce": "0x1" }, diff --git a/ethereum/evmtool/src/test/resources/org/hyperledger/besu/evmtool/block-test/osaka-eof-rjump.json b/ethereum/evmtool/src/test/resources/org/hyperledger/besu/evmtool/block-test/osaka-eof-rjump.json index a6c5bcc62c3..b70da91fc9e 100644 --- a/ethereum/evmtool/src/test/resources/org/hyperledger/besu/evmtool/block-test/osaka-eof-rjump.json +++ b/ethereum/evmtool/src/test/resources/org/hyperledger/besu/evmtool/block-test/osaka-eof-rjump.json @@ -4,13 +4,13 @@ "stdin" ], "stdin": { - "tests/osaka/eip7692_eof_v1/eip4200_relative_jumps/test_rjump.py::test_rjump_zero[fork_Osaka-blockchain_test]": { + "tests/osaka/eip7692_eof_v1/eip4200_relative_jumps/test_rjump.py::test_rjump_zero[fork_Osaka-blockchain_test]": { "network": "Osaka", "genesisBlockHeader": { "parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000", "uncleHash": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347", "coinbase": "0x0000000000000000000000000000000000000000", - "stateRoot": "0xbeb30acb62768b375f7e7d36f6ba9240cb692ebd0ee04c9321c756cf4ff1c437", + "stateRoot": "0x6cb1761e069313d13f39d755da011dc921b1f0fe5c4c3e951891639e479b4cfb", "transactionsTrie": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", "receiptTrie": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", "bloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", @@ -28,7 +28,7 @@ "excessBlobGas": "0x00", "parentBeaconBlockRoot": "0x0000000000000000000000000000000000000000000000000000000000000000", "requestsHash": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", - "hash": "0x367310df4a31070aa9a5c92cb61ab8bb2742db0162619ed77594fbec6f0ddbd9" + "hash": "0x67315ef3267f6f654068ccbd317423b1028fd5305b94a56d1f27e6651e06d678" }, "pre": { "0x00000000219ab540356cbb839cbe05303d7705fa": { @@ -81,10 +81,10 @@ "code": "0x3373fffffffffffffffffffffffffffffffffffffffe146098573615156028575f545f5260205ff35b36606014156101445760115f54600182026001905f5b5f82111560595781019083028483029004916001019190603e565b90939004341061014457600154600101600155600354806004026004013381556001015f35815560010160203581556001016040359055600101600355005b6003546002548082038060011160ac575060015b5f5b81811460f15780607402838201600402600401805490600101805490600101805490600101549260601b84529083601401528260340152906054015260010160ae565b9101809214610103579060025561010e565b90505f6002555f6003555b5f548061049d141561011d57505f5b6001546001828201116101325750505f610138565b01600190035b5f555f6001556074025ff35b5f5ffd", "storage": {} }, - "0x0aae40965e6800cd9b1f4b05ff21581047e3f91e": { + "0x0f792be4b0c0cb4dae440ef133e90c0ecd48cccc": { "nonce": "0x01", "balance": "0x00", - "code": "0x3373fffffffffffffffffffffffffffffffffffffffe1460575767ffffffffffffffff5f3511605357600143035f3511604b575f35612000014311604b57611fff5f3516545f5260205ff35b5f5f5260205ff35b5f5ffd5b5f35611fff60014303165500", + "code": "0x3373fffffffffffffffffffffffffffffffffffffffe14604657602036036042575f35600143038111604257611fff81430311604257611fff9006545f5260205ff35b5f5ffd5b5f35611fff60014303065500", "storage": {} }, "0x000f3df6d732807ef1319fb7b8bb8522d0beac02": { @@ -173,12 +173,12 @@ "code": "0x3373fffffffffffffffffffffffffffffffffffffffe146098573615156028575f545f5260205ff35b36606014156101445760115f54600182026001905f5b5f82111560595781019083028483029004916001019190603e565b90939004341061014457600154600101600155600354806004026004013381556001015f35815560010160203581556001016040359055600101600355005b6003546002548082038060011160ac575060015b5f5b81811460f15780607402838201600402600401805490600101805490600101805490600101549260601b84529083601401528260340152906054015260010160ae565b9101809214610103579060025561010e565b90505f6002555f6003555b5f548061049d141561011d57505f5b6001546001828201116101325750505f610138565b01600190035b5f555f6001556074025ff35b5f5ffd", "storage": {} }, - "0x0aae40965e6800cd9b1f4b05ff21581047e3f91e": { + "0x0f792be4b0c0cb4dae440ef133e90c0ecd48cccc": { "nonce": "0x01", "balance": "0x00", - "code": "0x3373fffffffffffffffffffffffffffffffffffffffe1460575767ffffffffffffffff5f3511605357600143035f3511604b575f35612000014311604b57611fff5f3516545f5260205ff35b5f5f5260205ff35b5f5ffd5b5f35611fff60014303165500", + "code": "0x3373fffffffffffffffffffffffffffffffffffffffe14604657602036036042575f35600143038111604257611fff81430311604257611fff9006545f5260205ff35b5f5ffd5b5f35611fff60014303065500", "storage": { - "0x00": "0x367310df4a31070aa9a5c92cb61ab8bb2742db0162619ed77594fbec6f0ddbd9" + "0x00": "0x67315ef3267f6f654068ccbd317423b1028fd5305b94a56d1f27e6651e06d678" } }, "0x2adc25665018aa1fe0e6bc666dac8fc2697ff9ba": { @@ -194,15 +194,15 @@ "storage": {} } }, - "lastblockhash": "0xfb5d1d0e218fa7873bc188f07f3e0a7c78027ff6e6e199c48ba1facd3c3726fd", - "genesisRLP": "0xf90262f9025ba00000000000000000000000000000000000000000000000000000000000000000a01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347940000000000000000000000000000000000000000a0beb30acb62768b375f7e7d36f6ba9240cb692ebd0ee04c9321c756cf4ff1c437a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421b9010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000808088016345785d8a0000808000a0000000000000000000000000000000000000000000000000000000000000000088000000000000000007a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b4218080a00000000000000000000000000000000000000000000000000000000000000000a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421c0c0c0c0", + "lastblockhash": "0x9ca58820df28ca6d09450fff5fdf93d39976e3aa098c6981ae08f391d44ffb3f", + "genesisRLP": "0xf90262f9025ba00000000000000000000000000000000000000000000000000000000000000000a01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347940000000000000000000000000000000000000000a06cb1761e069313d13f39d755da011dc921b1f0fe5c4c3e951891639e479b4cfba056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421b9010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000808088016345785d8a0000808000a0000000000000000000000000000000000000000000000000000000000000000088000000000000000007a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b4218080a00000000000000000000000000000000000000000000000000000000000000000a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421c0c0c0c0", "blocks": [ { "blockHeader": { - "parentHash": "0x367310df4a31070aa9a5c92cb61ab8bb2742db0162619ed77594fbec6f0ddbd9", + "parentHash": "0x67315ef3267f6f654068ccbd317423b1028fd5305b94a56d1f27e6651e06d678", "uncleHash": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347", "coinbase": "0x2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", - "stateRoot": "0x4ab70cbe1abe50d6bb3c8cdb3e9e66111f142cd68ab73870e9ce9e0dd1d6ead2", + "stateRoot": "0x61171b085ffd8d099ca59ba13164e8883d89c89d3298256aa229b03a6e33d246", "transactionsTrie": "0xec9d10cff79619f2df45db8c66526ef3fbd32d283fdd2dcc9b55c0efe643d8c3", "receiptTrie": "0x9593f56abf23bcbb26d27b0c6e46a56415d9103ed6b4d8ac7b4182f9f250cafa", "bloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", @@ -220,7 +220,7 @@ "excessBlobGas": "0x00", "parentBeaconBlockRoot": "0x0000000000000000000000000000000000000000000000000000000000000000", "requestsHash": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", - "hash": "0xfb5d1d0e218fa7873bc188f07f3e0a7c78027ff6e6e199c48ba1facd3c3726fd" + "hash": "0x9ca58820df28ca6d09450fff5fdf93d39976e3aa098c6981ae08f391d44ffb3f" }, "transactions": [ { @@ -243,7 +243,7 @@ "depositRequests": [], "withdrawalRequests": [], "consolidationRequests": [], - "rlp": "0xf902c9f9025fa0367310df4a31070aa9a5c92cb61ab8bb2742db0162619ed77594fbec6f0ddbd9a01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347942adc25665018aa1fe0e6bc666dac8fc2697ff9baa04ab70cbe1abe50d6bb3c8cdb3e9e66111f142cd68ab73870e9ce9e0dd1d6ead2a0ec9d10cff79619f2df45db8c66526ef3fbd32d283fdd2dcc9b55c0efe643d8c3a09593f56abf23bcbb26d27b0c6e46a56415d9103ed6b4d8ac7b4182f9f250cafab9010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000800188016345785d8a000082a8648203e800a0000000000000000000000000000000000000000000000000000000000000000088000000000000000007a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b4218080a00000000000000000000000000000000000000000000000000000000000000000a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421f862f860800a83989680940000000000000000000000000000000000001000808026a0e5d462429669f661291a8dc4c49a092cfd4922b6f3f31c9189a2f4adf5ecd730a001494afaf472fbb80bcb107ffeb918a2b9115f454027840615d6d20d63c69ac0c0c0c0", + "rlp": "0xf902c8f9025fa067315ef3267f6f654068ccbd317423b1028fd5305b94a56d1f27e6651e06d678a01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347942adc25665018aa1fe0e6bc666dac8fc2697ff9baa061171b085ffd8d099ca59ba13164e8883d89c89d3298256aa229b03a6e33d246a0ec9d10cff79619f2df45db8c66526ef3fbd32d283fdd2dcc9b55c0efe643d8c3a09593f56abf23bcbb26d27b0c6e46a56415d9103ed6b4d8ac7b4182f9f250cafab9010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000800188016345785d8a000082a8648203e800a0000000000000000000000000000000000000000000000000000000000000000088000000000000000007a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b4218080a00000000000000000000000000000000000000000000000000000000000000000a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421f862f860800a83989680940000000000000000000000000000000000001000808026a0e5d462429669f661291a8dc4c49a092cfd4922b6f3f31c9189a2f4adf5ecd730a001494afaf472fbb80bcb107ffeb918a2b9115f454027840615d6d20d63c69ac0c0c0", "blocknumber": "1" } ], @@ -259,5 +259,5 @@ } } }, - "stdout": "Considering tests/osaka/eip7692_eof_v1/eip4200_relative_jumps/test_rjump.py::test_rjump_zero[fork_Osaka-blockchain_test]\nBlock 1 (0xfb5d1d0e218fa7873bc188f07f3e0a7c78027ff6e6e199c48ba1facd3c3726fd) Imported\nChain import successful - tests/osaka/eip7692_eof_v1/eip4200_relative_jumps/test_rjump.py::test_rjump_zero[fork_Osaka-blockchain_test]\n" + "stdout": "Considering tests/osaka/eip7692_eof_v1/eip4200_relative_jumps/test_rjump.py::test_rjump_zero[fork_Osaka-blockchain_test]\nBlock 1 (0x9ca58820df28ca6d09450fff5fdf93d39976e3aa098c6981ae08f391d44ffb3f) Imported\nChain import successful - tests/osaka/eip7692_eof_v1/eip4200_relative_jumps/test_rjump.py::test_rjump_zero[fork_Osaka-blockchain_test]\n" } diff --git a/ethereum/evmtool/src/test/resources/org/hyperledger/besu/evmtool/t8n/prague-deposit.json b/ethereum/evmtool/src/test/resources/org/hyperledger/besu/evmtool/t8n/prague-deposit.json index 771dc870e66..f80771a85eb 100644 --- a/ethereum/evmtool/src/test/resources/org/hyperledger/besu/evmtool/t8n/prague-deposit.json +++ b/ethereum/evmtool/src/test/resources/org/hyperledger/besu/evmtool/t8n/prague-deposit.json @@ -63,8 +63,8 @@ "code": "0x3373fffffffffffffffffffffffffffffffffffffffe14604d57602036146024575f5ffd5b5f35801560495762001fff810690815414603c575f5ffd5b62001fff01545f5260205ff35b5f5ffd5b62001fff42064281555f359062001fff015500", "storage": {} }, - "0x0aae40965e6800cd9b1f4b05ff21581047e3f91e": { - "code": "0x3373fffffffffffffffffffffffffffffffffffffffe1460575767ffffffffffffffff5f3511605357600143035f3511604b575f35612000014311604b57611fff5f3516545f5260205ff35b5f5f5260205ff35b5f5ffd5b5f35611fff60014303165500", + "0x0f792be4b0c0cb4dae440ef133e90c0ecd48cccc": { + "code": "0x3373fffffffffffffffffffffffffffffffffffffffe14604657602036036042575f35600143038111604257611fff81430311604257611fff9006545f5260205ff35b5f5ffd5b5f35611fff60014303065500", "balance": "0x0", "nonce": "0x1" }, @@ -185,9 +185,9 @@ "code": "0x3373fffffffffffffffffffffffffffffffffffffffe146090573615156028575f545f5260205ff35b366038141561012e5760115f54600182026001905f5b5f82111560595781019083028483029004916001019190603e565b90939004341061012e57600154600101600155600354806003026004013381556001015f3581556001016020359055600101600355005b6003546002548082038060101160a4575060105b5f5b81811460dd5780604c02838201600302600401805490600101805490600101549160601b83528260140152906034015260010160a6565b910180921460ed579060025560f8565b90505f6002555f6003555b5f548061049d141561010757505f5b60015460028282011161011c5750505f610122565b01600290035b5f555f600155604c025ff35b5f5ffd", "nonce": "0x1" }, - "0x0aae40965e6800cd9b1f4b05ff21581047e3f91e": { + "0x0f792be4b0c0cb4dae440ef133e90c0ecd48cccc": { "balance": "0x0", - "code": "0x3373fffffffffffffffffffffffffffffffffffffffe1460575767ffffffffffffffff5f3511605357600143035f3511604b575f35612000014311604b57611fff5f3516545f5260205ff35b5f5f5260205ff35b5f5ffd5b5f35611fff60014303165500", + "code": "0x3373fffffffffffffffffffffffffffffffffffffffe14604657602036036042575f35600143038111604257611fff81430311604257611fff9006545f5260205ff35b5f5ffd5b5f35611fff60014303065500", "nonce": "0x1", "storage": { "0x0000000000000000000000000000000000000000000000000000000000000000": "0xe4fb5d47f70d54b4f36777ea4c882cf767f93d8f8170285d97a1b8275dfe4dbb" @@ -268,7 +268,7 @@ "0x" ], "requestsHash": "0x158ac6beda33cd9341831552555f64c95e074e7024f6c4553c1ed7557077b4c7", - "stateRoot": "0x3aa7839837ee1564276a0a05554e35215353a97c4e255c3aacbcd7c7819daefa", + "stateRoot": "0x6471f6d90b87f759176a0ad62a7096f69d0d24fd873bdb6b6ced57d04a71e274", "txRoot": "0x2b790bf82ef7259a0e4513d1b89a77d81e99672ba68758ef2ba3fde32851d023", "withdrawalsRoot": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421" } diff --git a/ethereum/evmtool/src/test/resources/org/hyperledger/besu/evmtool/t8n/prague-withdrawal-request.json b/ethereum/evmtool/src/test/resources/org/hyperledger/besu/evmtool/t8n/prague-withdrawal-request.json index 615161c88d8..38fd53da0ad 100644 --- a/ethereum/evmtool/src/test/resources/org/hyperledger/besu/evmtool/t8n/prague-withdrawal-request.json +++ b/ethereum/evmtool/src/test/resources/org/hyperledger/besu/evmtool/t8n/prague-withdrawal-request.json @@ -65,10 +65,10 @@ "code": "0x3373fffffffffffffffffffffffffffffffffffffffe1460d35760115f54807fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1461019a57600182026001905f5b5f82111560685781019083028483029004916001019190604d565b9093900492505050366060146088573661019a573461019a575f5260205ff35b341061019a57600154600101600155600354806004026004013381556001015f358155600101602035815560010160403590553360601b5f5260605f60143760745fa0600101600355005b6003546002548082038060021160e7575060025b5f5b8181146101295782810160040260040181607402815460601b815260140181600101548152602001816002015481526020019060030154905260010160e9565b910180921461013b5790600255610146565b90505f6002555f6003555b5f54807fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff141561017357505f5b6001546001828201116101885750505f61018e565b01600190035b5f555f6001556074025ff35b5f5ffd", "storage": {} }, - "0x0aae40965e6800cd9b1f4b05ff21581047e3f91e": { + "0x0f792be4b0c0cb4dae440ef133e90c0ecd48cccc": { "nonce": "0x01", "balance": "0x00", - "code": "0x3373fffffffffffffffffffffffffffffffffffffffe1460575767ffffffffffffffff5f3511605357600143035f3511604b575f35612000014311604b57611fff5f3516545f5260205ff35b5f5f5260205ff35b5f5ffd5b5f35611fff60014303165500", + "code": "0x3373fffffffffffffffffffffffffffffffffffffffe14604657602036036042575f35600143038111604257611fff81430311604257611fff9006545f5260205ff35b5f5ffd5b5f35611fff60014303065500", "storage": {} }, "0x000f3df6d732807ef1319fb7b8bb8522d0beac02": { @@ -189,8 +189,8 @@ "balance": "0x0", "nonce": "0x1" }, - "0x0aae40965e6800cd9b1f4b05ff21581047e3f91e":{ - "code":"0x3373fffffffffffffffffffffffffffffffffffffffe1460575767ffffffffffffffff5f3511605357600143035f3511604b575f35612000014311604b57611fff5f3516545f5260205ff35b5f5f5260205ff35b5f5ffd5b5f35611fff60014303165500", + "0x0f792be4b0c0cb4dae440ef133e90c0ecd48cccc":{ + "code":"0x3373fffffffffffffffffffffffffffffffffffffffe14604657602036036042575f35600143038111604257611fff81430311604257611fff9006545f5260205ff35b5f5ffd5b5f35611fff60014303065500", "storage":{ "0x0000000000000000000000000000000000000000000000000000000000000000":"0x10715cfbefdb8a0cb2f7d7ca5ee6d1ea65515ecb41cff0a22d1e11716a9d27fb" }, @@ -219,7 +219,7 @@ "0x00000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000", "0x" ], - "stateRoot": "0x575019750f84d65daf5469b26d05ad8e4335c63011dbca71ca97420cbd80d579", + "stateRoot": "0xc7b49e4aef4229962b94ec0a7c83a6fc0b4015f2573b9a85446ed434c823164e", "txRoot": "0x0d36638e52999b7beafa00eb94f7ca23139774cd14229c011d0edc1fc66125c9", "receiptsRoot": "0x2af83312a6aa55bd8f169e65eec48f92d6d6dc3398bc038d7ccfab5d9aa26b3f", "logsHash": "0xac344ad50aad544ec284bf76ac9b939f93e00f8fe16097a151df14bde2065f83",