From e8bca6101c5d84c4501dda13b92420e44138a91b Mon Sep 17 00:00:00 2001 From: Sally MacFarlane Date: Thu, 19 Oct 2023 15:39:10 +1000 Subject: [PATCH 1/3] [MINOR] ux improvements (#6049) * log command line option that is affected * made plugins summary log part of config overview * check for null plugin context Signed-off-by: Sally MacFarlane --------- Signed-off-by: Sally MacFarlane --- .../org/hyperledger/besu/cli/BesuCommand.java | 2 ++ .../cli/ConfigurationOverviewBuilder.java | 17 ++++++++++++ .../besu/cli/util/CommandLineUtils.java | 5 ++-- .../besu/services/BesuPluginContextImpl.java | 26 +++++++++++++------ .../besu/services/RpcEndpointServiceImpl.java | 2 +- 5 files changed, 41 insertions(+), 11 deletions(-) diff --git a/besu/src/main/java/org/hyperledger/besu/cli/BesuCommand.java b/besu/src/main/java/org/hyperledger/besu/cli/BesuCommand.java index 47463d2c997..d7ce4dfa539 100644 --- a/besu/src/main/java/org/hyperledger/besu/cli/BesuCommand.java +++ b/besu/src/main/java/org/hyperledger/besu/cli/BesuCommand.java @@ -3555,6 +3555,8 @@ private String generateConfigurationOverview() { builder.setTxPoolImplementation(buildTransactionPoolConfiguration().getTxPoolImplementation()); + builder.setPluginContext(besuComponent.getBesuPluginContext()); + return builder.build(); } } diff --git a/besu/src/main/java/org/hyperledger/besu/cli/ConfigurationOverviewBuilder.java b/besu/src/main/java/org/hyperledger/besu/cli/ConfigurationOverviewBuilder.java index e017caa9ddf..508b195a8eb 100644 --- a/besu/src/main/java/org/hyperledger/besu/cli/ConfigurationOverviewBuilder.java +++ b/besu/src/main/java/org/hyperledger/besu/cli/ConfigurationOverviewBuilder.java @@ -16,6 +16,7 @@ import org.hyperledger.besu.BesuInfo; import org.hyperledger.besu.ethereum.eth.transactions.TransactionPoolConfiguration; +import org.hyperledger.besu.services.BesuPluginContextImpl; import org.hyperledger.besu.util.log.FramedLogMessage; import org.hyperledger.besu.util.platform.PlatformDetector; @@ -50,6 +51,7 @@ public class ConfigurationOverviewBuilder { private boolean isHighSpec = false; private TransactionPoolConfiguration.Implementation txPoolImplementation; private Map environment; + private BesuPluginContextImpl besuPluginContext; /** * @param logger the logger @@ -277,6 +279,12 @@ public String build() { lines.add("Total memory: " + normalizeSize(hardwareInfo.getMemory().getTotal())); lines.add("CPU cores: " + hardwareInfo.getProcessor().getLogicalProcessorCount()); + lines.add(""); + + if (besuPluginContext != null) { + lines.addAll(besuPluginContext.getPluginsSummaryLog()); + } + return FramedLogMessage.generate(lines); } @@ -308,4 +316,13 @@ private void detectJemalloc(final List lines) { private String normalizeSize(final long size) { return String.format("%.02f", (double) (size) / 1024 / 1024 / 1024) + " GB"; } + + /** + * set the plugin context + * + * @param besuPluginContext the plugin context + */ + public void setPluginContext(final BesuPluginContextImpl besuPluginContext) { + this.besuPluginContext = besuPluginContext; + } } diff --git a/besu/src/main/java/org/hyperledger/besu/cli/util/CommandLineUtils.java b/besu/src/main/java/org/hyperledger/besu/cli/util/CommandLineUtils.java index 0115420005e..a44e616bd3d 100644 --- a/besu/src/main/java/org/hyperledger/besu/cli/util/CommandLineUtils.java +++ b/besu/src/main/java/org/hyperledger/besu/cli/util/CommandLineUtils.java @@ -110,7 +110,7 @@ public static void checkMultiOptionDependencies( } /** - * Fail if option doesnt meet requirement. + * Fail if option doesn't meet requirement. * * @param commandLine the command line * @param errorMessage the error message @@ -126,7 +126,8 @@ public static void failIfOptionDoesntMeetRequirement( final String affectedOptions = getAffectedOptions(commandLine, dependentOptionsNames); if (!affectedOptions.isEmpty()) { - throw new CommandLine.ParameterException(commandLine, errorMessage); + throw new CommandLine.ParameterException( + commandLine, errorMessage + " [" + affectedOptions + "]"); } } } diff --git a/besu/src/main/java/org/hyperledger/besu/services/BesuPluginContextImpl.java b/besu/src/main/java/org/hyperledger/besu/services/BesuPluginContextImpl.java index 0a0f5019a52..184c85f45de 100644 --- a/besu/src/main/java/org/hyperledger/besu/services/BesuPluginContextImpl.java +++ b/besu/src/main/java/org/hyperledger/besu/services/BesuPluginContextImpl.java @@ -21,7 +21,6 @@ import org.hyperledger.besu.plugin.BesuPlugin; import org.hyperledger.besu.plugin.services.BesuService; import org.hyperledger.besu.plugin.services.PluginVersionsProvider; -import org.hyperledger.besu.util.log.FramedLogMessage; import java.io.IOException; import java.net.MalformedURLException; @@ -76,6 +75,7 @@ private enum Lifecycle { private final Map, ? super BesuService> serviceRegistry = new HashMap<>(); private final List plugins = new ArrayList<>(); private final List pluginVersions = new ArrayList<>(); + final List lines = new ArrayList<>(); /** * Add service. @@ -105,9 +105,7 @@ public Optional getService(final Class serviceType * @param pluginsDir the plugins dir */ public void registerPlugins(final Path pluginsDir) { - final List lines = new ArrayList<>(); - lines.add("plugins dir " + pluginsDir.toAbsolutePath()); - lines.add(""); + lines.add("Plugins:"); checkState( state == Lifecycle.UNINITIALIZED, "Besu plugins have already been registered. Cannot register additional plugins."); @@ -120,11 +118,13 @@ public void registerPlugins(final Path pluginsDir) { final ServiceLoader serviceLoader = ServiceLoader.load(BesuPlugin.class, pluginLoader); + int pluginsCount = 0; for (final BesuPlugin plugin : serviceLoader) { + pluginsCount++; try { plugin.register(this); LOG.info("Registered plugin of type {}.", plugin.getClass().getName()); - lines.add(String.format("SUCCESS %s", plugin.getClass().getSimpleName())); + lines.add(String.format(plugin.getClass().getSimpleName())); addPluginVersion(plugin); } catch (final Exception e) { LOG.error( @@ -139,13 +139,23 @@ public void registerPlugins(final Path pluginsDir) { } LOG.debug("Plugin registration complete."); - lines.add(""); - lines.add("TOTAL = " + plugins.size()); - LOG.debug(FramedLogMessage.generate(lines)); + lines.add( + String.format( + "TOTAL = %d of %d plugins successfully loaded", plugins.size(), pluginsCount)); + lines.add(String.format("from %s", pluginsDir.toAbsolutePath())); state = Lifecycle.REGISTERED; } + /** + * get the summary log, as a list of string lines + * + * @return the summary + */ + public List getPluginsSummaryLog() { + return lines; + } + private void addPluginVersion(final BesuPlugin plugin) { final Package pluginPackage = plugin.getClass().getPackage(); final String implTitle = diff --git a/besu/src/main/java/org/hyperledger/besu/services/RpcEndpointServiceImpl.java b/besu/src/main/java/org/hyperledger/besu/services/RpcEndpointServiceImpl.java index 4513bf0bf39..94bb5560839 100644 --- a/besu/src/main/java/org/hyperledger/besu/services/RpcEndpointServiceImpl.java +++ b/besu/src/main/java/org/hyperledger/besu/services/RpcEndpointServiceImpl.java @@ -28,7 +28,7 @@ import java.util.function.Function; import java.util.stream.Collectors; -/** The Rpc endpoint service implementation. */ +/** The RPC endpoint service implementation. */ public class RpcEndpointServiceImpl implements RpcEndpointService { private final Map> rpcMethods = new HashMap<>(); From f81088789eeea6fc2479393087bd5791f2e70ece Mon Sep 17 00:00:00 2001 From: Gabriel-Trintinalia Date: Fri, 20 Oct 2023 12:02:52 +1100 Subject: [PATCH 2/3] Update changelog release (#6062) Signed-off-by: Gabriel-Trintinalia --- CHANGELOG.md | 16 +++++++++++++--- gradle.properties | 2 +- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c849de7c608..787ff1d137d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,8 +1,18 @@ # Changelog -## Next release -- Cache last n blocks by using a new Besu flag --cache-last-blocks=n -- Optimize performances of RPC method Eth_feeHistory +### Breaking Changes + +### Deprecations + +### Additions and Improvements + +### Bug Fixes + +### Download Links + +## 23.10.1 +- Cache last n blocks by using a new Besu flag --cache-last-blocks=n [#6009](https://github.com/hyperledger/besu/pull/6009) +- Optimize performances of RPC method Eth_feeHistory [#6011](https://github.com/hyperledger/besu/pull/6011) ### Breaking Changes diff --git a/gradle.properties b/gradle.properties index f277c752a98..e94b9a26b5d 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,4 +1,4 @@ -version=23.10.1-SNAPSHOT +version=23.10.2-SNAPSHOT org.gradle.welcome=never # Set exports/opens flags required by Google Java Format and ErrorProne plugins. (JEP-396) From 9d9fe8c201daf4a386457794a57d0776e6a91437 Mon Sep 17 00:00:00 2001 From: Sally MacFarlane Date: Fri, 20 Oct 2023 11:43:26 +1000 Subject: [PATCH 3/3] Dencun corner cases (#6060) * cherry pick changes from https://github.com/hyperledger/besu/pull/6054/files\#diff-22b78733e37a697fa8d1d8a02d2a87fe5ccea9cf67c34ce5e6311f024c14abd6L643-R738 Signed-off-by: Sally MacFarlane * cherry pick changes from https://github.com/hyperledger/besu/pull/6054/files\#diff-61db834b59eae5ce5c438462505de1add8fa244deda830742060d15f668a9806R39-R44 Signed-off-by: Sally MacFarlane * formatting Signed-off-by: Sally MacFarlane * update the EIP-6110 acceptance tests Signed-off-by: Danno Ferrin --------- Signed-off-by: Sally MacFarlane Signed-off-by: Danno Ferrin Co-authored-by: Danno Ferrin --- .../test-cases/02_cancun_getPayloadV3.json | 20 ++++++------- .../test-cases/03_cancun_newPayloadV3.json | 10 +++---- .../04_cancun_forkchoiceUpdatedV3.json | 8 ++--- .../05_eip6110_forkchoiceUpdatedV3.json | 10 +++---- .../06_eip6110_getPayloadV6110.json | 26 ++++++++--------- ...invalid_null_deposits_execute_payload.json | 10 +++---- .../09_eip6110_newPayloadV6110.json | 12 ++++---- .../10_eip6110_forkchoiceUpdatedV3.json | 8 ++--- .../11_eip6110_getPayloadV6110.json | 26 ++++++++--------- .../mainnet/MainnetProtocolSpecs.java | 29 ++++++++++--------- .../mainnet/ParentBeaconBlockRootHelper.java | 12 ++++++-- 11 files changed, 89 insertions(+), 82 deletions(-) diff --git a/acceptance-tests/tests/src/test/resources/jsonrpc/engine/eip6110/test-cases/02_cancun_getPayloadV3.json b/acceptance-tests/tests/src/test/resources/jsonrpc/engine/eip6110/test-cases/02_cancun_getPayloadV3.json index 805709fe86f..73cbe51bdeb 100644 --- a/acceptance-tests/tests/src/test/resources/jsonrpc/engine/eip6110/test-cases/02_cancun_getPayloadV3.json +++ b/acceptance-tests/tests/src/test/resources/jsonrpc/engine/eip6110/test-cases/02_cancun_getPayloadV3.json @@ -14,7 +14,7 @@ "executionPayload": { "parentHash": "0x26118cf71453320edcebbc4ebb34af5b578087a32385b80108bf691fa23efc42", "feeRecipient": "0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b", - "stateRoot": "0x23e3e21a839dbba902efaad82e5c3e1ddd64ea067ce0f979a68dabcc46be4e8b", + "stateRoot": "0x9b8c4a9a86cb49252075c0db2f0e72fb1e49350a0f70ea36f26f700201961e62", "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", "prevRandao": "0x0000000000000000000000000000000000000000000000000000000000000000", "gasLimit": "0x1c9c380", @@ -22,22 +22,22 @@ "timestamp": "0x10", "extraData": "0x", "baseFeePerGas": "0x7", - "excessBlobGas" : "0x0", - "parentBeaconBlockRoot" : "0x0000000000000000000000000000000000000000000000000000000000000000", + "excessBlobGas": "0x0", + "parentBeaconBlockRoot": "0x0000000000000000000000000000000000000000000000000000000000000000", "transactions": [], "withdrawals": [], "blockNumber": "0x1", "receiptsRoot": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", - "blockHash": "0x17da7aea0f4e4ba1d905dbb7d60f6ab4133f3009ae1a1ba99e6e9cb37c15412c", - "blobGasUsed" : "0x0" + "blockHash": "0x45811fa27a100ce9035e5e086b9669275041a4ec0ebbd920be028fd7b0aa2356", + "blobGasUsed": "0x0" }, "blockValue": "0x0", - "blobsBundle" : { - "commitments" : [], - "proofs" : [], - "blobs" : [] + "blobsBundle": { + "commitments": [], + "proofs": [], + "blobs": [] }, - "shouldOverrideBuilder" : false + "shouldOverrideBuilder": false } }, "statusCode": 200 diff --git a/acceptance-tests/tests/src/test/resources/jsonrpc/engine/eip6110/test-cases/03_cancun_newPayloadV3.json b/acceptance-tests/tests/src/test/resources/jsonrpc/engine/eip6110/test-cases/03_cancun_newPayloadV3.json index ba9f69b47ae..d4d76df31de 100644 --- a/acceptance-tests/tests/src/test/resources/jsonrpc/engine/eip6110/test-cases/03_cancun_newPayloadV3.json +++ b/acceptance-tests/tests/src/test/resources/jsonrpc/engine/eip6110/test-cases/03_cancun_newPayloadV3.json @@ -6,7 +6,7 @@ { "parentHash": "0x26118cf71453320edcebbc4ebb34af5b578087a32385b80108bf691fa23efc42", "feeRecipient": "0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b", - "stateRoot": "0x23e3e21a839dbba902efaad82e5c3e1ddd64ea067ce0f979a68dabcc46be4e8b", + "stateRoot": "0x9b8c4a9a86cb49252075c0db2f0e72fb1e49350a0f70ea36f26f700201961e62", "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", "prevRandao": "0x0000000000000000000000000000000000000000000000000000000000000000", "gasLimit": "0x1c9c380", @@ -17,10 +17,10 @@ "transactions": [], "withdrawals": [], "blockNumber": "0x1", - "blockHash": "0x17da7aea0f4e4ba1d905dbb7d60f6ab4133f3009ae1a1ba99e6e9cb37c15412c", + "blockHash": "0x45811fa27a100ce9035e5e086b9669275041a4ec0ebbd920be028fd7b0aa2356", "receiptsRoot": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", - "excessBlobGas" : "0x0", - "blobGasUsed" : "0x0" + "excessBlobGas": "0x0", + "blobGasUsed": "0x0" }, [], "0x0000000000000000000000000000000000000000000000000000000000000000" @@ -32,7 +32,7 @@ "id": 67, "result": { "status": "VALID", - "latestValidHash": "0x17da7aea0f4e4ba1d905dbb7d60f6ab4133f3009ae1a1ba99e6e9cb37c15412c", + "latestValidHash": "0x45811fa27a100ce9035e5e086b9669275041a4ec0ebbd920be028fd7b0aa2356", "validationError": null } }, diff --git a/acceptance-tests/tests/src/test/resources/jsonrpc/engine/eip6110/test-cases/04_cancun_forkchoiceUpdatedV3.json b/acceptance-tests/tests/src/test/resources/jsonrpc/engine/eip6110/test-cases/04_cancun_forkchoiceUpdatedV3.json index 49e803ecc03..80610561a0f 100644 --- a/acceptance-tests/tests/src/test/resources/jsonrpc/engine/eip6110/test-cases/04_cancun_forkchoiceUpdatedV3.json +++ b/acceptance-tests/tests/src/test/resources/jsonrpc/engine/eip6110/test-cases/04_cancun_forkchoiceUpdatedV3.json @@ -4,9 +4,9 @@ "method": "engine_forkchoiceUpdatedV3", "params": [ { - "headBlockHash": "0x17da7aea0f4e4ba1d905dbb7d60f6ab4133f3009ae1a1ba99e6e9cb37c15412c", - "safeBlockHash": "0x17da7aea0f4e4ba1d905dbb7d60f6ab4133f3009ae1a1ba99e6e9cb37c15412c", - "finalizedBlockHash": "0x17da7aea0f4e4ba1d905dbb7d60f6ab4133f3009ae1a1ba99e6e9cb37c15412c" + "headBlockHash": "0x45811fa27a100ce9035e5e086b9669275041a4ec0ebbd920be028fd7b0aa2356", + "safeBlockHash": "0x45811fa27a100ce9035e5e086b9669275041a4ec0ebbd920be028fd7b0aa2356", + "finalizedBlockHash": "0x45811fa27a100ce9035e5e086b9669275041a4ec0ebbd920be028fd7b0aa2356" }, null ], @@ -18,7 +18,7 @@ "result": { "payloadStatus": { "status": "VALID", - "latestValidHash": "0x17da7aea0f4e4ba1d905dbb7d60f6ab4133f3009ae1a1ba99e6e9cb37c15412c", + "latestValidHash": "0x45811fa27a100ce9035e5e086b9669275041a4ec0ebbd920be028fd7b0aa2356", "validationError": null }, "payloadId": null diff --git a/acceptance-tests/tests/src/test/resources/jsonrpc/engine/eip6110/test-cases/05_eip6110_forkchoiceUpdatedV3.json b/acceptance-tests/tests/src/test/resources/jsonrpc/engine/eip6110/test-cases/05_eip6110_forkchoiceUpdatedV3.json index e47346cc308..4f83ac7dcee 100644 --- a/acceptance-tests/tests/src/test/resources/jsonrpc/engine/eip6110/test-cases/05_eip6110_forkchoiceUpdatedV3.json +++ b/acceptance-tests/tests/src/test/resources/jsonrpc/engine/eip6110/test-cases/05_eip6110_forkchoiceUpdatedV3.json @@ -4,8 +4,8 @@ "method": "engine_forkchoiceUpdatedV3", "params": [ { - "headBlockHash": "0x17da7aea0f4e4ba1d905dbb7d60f6ab4133f3009ae1a1ba99e6e9cb37c15412c", - "safeBlockHash": "0x17da7aea0f4e4ba1d905dbb7d60f6ab4133f3009ae1a1ba99e6e9cb37c15412c", + "headBlockHash": "0x45811fa27a100ce9035e5e086b9669275041a4ec0ebbd920be028fd7b0aa2356", + "safeBlockHash": "0x45811fa27a100ce9035e5e086b9669275041a4ec0ebbd920be028fd7b0aa2356", "finalizedBlockHash": "0x0000000000000000000000000000000000000000000000000000000000000000" }, { @@ -24,11 +24,11 @@ "result": { "payloadStatus": { "status": "VALID", - "latestValidHash": "0x17da7aea0f4e4ba1d905dbb7d60f6ab4133f3009ae1a1ba99e6e9cb37c15412c", + "latestValidHash": "0x45811fa27a100ce9035e5e086b9669275041a4ec0ebbd920be028fd7b0aa2356", "validationError": null }, - "payloadId": "0x282643962616abdf" + "payloadId": "0x282643b9c2d2a4df" } }, - "statusCode" : 200 + "statusCode": 200 } \ No newline at end of file diff --git a/acceptance-tests/tests/src/test/resources/jsonrpc/engine/eip6110/test-cases/06_eip6110_getPayloadV6110.json b/acceptance-tests/tests/src/test/resources/jsonrpc/engine/eip6110/test-cases/06_eip6110_getPayloadV6110.json index eb1bf8a5f80..9b1653a198d 100644 --- a/acceptance-tests/tests/src/test/resources/jsonrpc/engine/eip6110/test-cases/06_eip6110_getPayloadV6110.json +++ b/acceptance-tests/tests/src/test/resources/jsonrpc/engine/eip6110/test-cases/06_eip6110_getPayloadV6110.json @@ -3,7 +3,7 @@ "jsonrpc": "2.0", "method": "engine_getPayloadV6110", "params": [ - "0x282643962616abdf" + "0x282643b9c2d2a4df" ], "id": 67 }, @@ -12,9 +12,9 @@ "id": 67, "result": { "executionPayload": { - "parentHash": "0x17da7aea0f4e4ba1d905dbb7d60f6ab4133f3009ae1a1ba99e6e9cb37c15412c", + "parentHash": "0x45811fa27a100ce9035e5e086b9669275041a4ec0ebbd920be028fd7b0aa2356", "feeRecipient": "0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b", - "stateRoot": "0x6a88816cf7e94f1f44cf82c63521bb7f2e49e99ab0ad2e4e46ef1ab8f6ccad84", + "stateRoot": "0x9b8c4a9a86cb49252075c0db2f0e72fb1e49350a0f70ea36f26f700201961e62", "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", "prevRandao": "0x0000000000000000000000000000000000000000000000000000000000000000", "gasLimit": "0x1c9c380", @@ -22,23 +22,23 @@ "timestamp": "0x20", "extraData": "0x", "baseFeePerGas": "0x7", - "excessBlobGas" : "0x0", - "parentBeaconBlockRoot" : "0x0000000000000000000000000000000000000000000000000000000000000000", + "excessBlobGas": "0x0", + "parentBeaconBlockRoot": "0x0000000000000000000000000000000000000000000000000000000000000000", "transactions": [], "withdrawals": [], - "depositReceipts" : [], + "depositReceipts": [], "blockNumber": "0x2", - "blockHash": "0x6d4f567f7afe59226a1400fd0c11797f0bb69bec74b8eb99a066f899e0bd1d0f", + "blockHash": "0xf6c3f1180ba58d6ea4c69c9328c7afb1fda41df06c368741c1f8310567879de7", "receiptsRoot": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", - "blobGasUsed" : "0x0" + "blobGasUsed": "0x0" }, "blockValue": "0x0", - "blobsBundle" : { - "commitments" : [], - "proofs" : [], - "blobs" : [] + "blobsBundle": { + "commitments": [], + "proofs": [], + "blobs": [] }, - "shouldOverrideBuilder" : false + "shouldOverrideBuilder": false } }, "statusCode": 200 diff --git a/acceptance-tests/tests/src/test/resources/jsonrpc/engine/eip6110/test-cases/08_eip6110_invalid_null_deposits_execute_payload.json b/acceptance-tests/tests/src/test/resources/jsonrpc/engine/eip6110/test-cases/08_eip6110_invalid_null_deposits_execute_payload.json index e19897ff471..ebf5de77500 100644 --- a/acceptance-tests/tests/src/test/resources/jsonrpc/engine/eip6110/test-cases/08_eip6110_invalid_null_deposits_execute_payload.json +++ b/acceptance-tests/tests/src/test/resources/jsonrpc/engine/eip6110/test-cases/08_eip6110_invalid_null_deposits_execute_payload.json @@ -4,9 +4,9 @@ "method": "engine_newPayloadV6110", "params": [ { - "parentHash": "0x17da7aea0f4e4ba1d905dbb7d60f6ab4133f3009ae1a1ba99e6e9cb37c15412c", + "parentHash": "0x45811fa27a100ce9035e5e086b9669275041a4ec0ebbd920be028fd7b0aa2356", "feeRecipient": "0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b", - "stateRoot": "0x6a88816cf7e94f1f44cf82c63521bb7f2e49e99ab0ad2e4e46ef1ab8f6ccad84", + "stateRoot": "0x9b8c4a9a86cb49252075c0db2f0e72fb1e49350a0f70ea36f26f700201961e62", "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", "prevRandao": "0x0000000000000000000000000000000000000000000000000000000000000000", "gasLimit": "0x1c9c380", @@ -14,14 +14,14 @@ "timestamp": "0x20", "extraData": "0x", "baseFeePerGas": "0x7", - "excessBlobGas" : "0x0", + "excessBlobGas": "0x0", "transactions": [], "withdrawals": [], "depositReceipts" : null, "blockNumber": "0x2", - "blockHash": "0x6d4f567f7afe59226a1400fd0c11797f0bb69bec74b8eb99a066f899e0bd1d0f", + "blockHash": "0xf6c3f1180ba58d6ea4c69c9328c7afb1fda41df06c368741c1f8310567879de7", "receiptsRoot": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", - "blobGasUsed" : "0x0" + "blobGasUsed": "0x0" }, [], "0x0000000000000000000000000000000000000000000000000000000000000000" diff --git a/acceptance-tests/tests/src/test/resources/jsonrpc/engine/eip6110/test-cases/09_eip6110_newPayloadV6110.json b/acceptance-tests/tests/src/test/resources/jsonrpc/engine/eip6110/test-cases/09_eip6110_newPayloadV6110.json index d0a4c229044..0964114e62c 100644 --- a/acceptance-tests/tests/src/test/resources/jsonrpc/engine/eip6110/test-cases/09_eip6110_newPayloadV6110.json +++ b/acceptance-tests/tests/src/test/resources/jsonrpc/engine/eip6110/test-cases/09_eip6110_newPayloadV6110.json @@ -4,9 +4,9 @@ "method": "engine_newPayloadV6110", "params": [ { - "parentHash": "0x17da7aea0f4e4ba1d905dbb7d60f6ab4133f3009ae1a1ba99e6e9cb37c15412c", + "parentHash": "0x45811fa27a100ce9035e5e086b9669275041a4ec0ebbd920be028fd7b0aa2356", "feeRecipient": "0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b", - "stateRoot": "0x7ffa22d9c7d856687bbec0700c17288ee6aff2bfd14e92a8921b08ed1d0c6030", + "stateRoot": "0x14208ac0e218167936e220b72d5d5887a963cb858ea2f2d268518f014a3da3fa", "logsBloom": "0x10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000400000000000000000000000020000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008000000000000000000000000", "prevRandao": "0x0000000000000000000000000000000000000000000000000000000000000000", "gasLimit": "0x1c9c380", @@ -14,7 +14,7 @@ "timestamp": "0x20", "extraData": "0x", "baseFeePerGas": "0x7", - "excessBlobGas" : "0x0", + "excessBlobGas": "0x0", "transactions": [ "0x02f9021c8217de808459682f008459682f0e830271009442424242424242424242424242424242424242428901bc16d674ec800000b901a422895118000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000e00000000000000000000000000000000000000000000000000000000000000120749715de5d1226545c6b3790f515d551a5cc5bf1d49c87a696860554d2fc4f14000000000000000000000000000000000000000000000000000000000000003096a96086cff07df17668f35f7418ef8798079167e3f4f9b72ecde17b28226137cf454ab1dd20ef5d924786ab3483c2f9000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000020003f5102dabe0a27b1746098d1dc17a5d3fbd478759fea9287e4e419b3c3cef20000000000000000000000000000000000000000000000000000000000000060b1acdb2c4d3df3f1b8d3bfd33421660df358d84d78d16c4603551935f4b67643373e7eb63dcb16ec359be0ec41fee33b03a16e80745f2374ff1d3c352508ac5d857c6476d3c3bcf7e6ca37427c9209f17be3af5264c0e2132b3dd1156c28b4e9c080a09f597089338d7f44f5c59f8230bb38f243849228a8d4e9d2e2956e6050f5b2c7a076486996c7e62802b8f95eee114783e4b403fd11093ba96286ff42c595f24452" ], @@ -23,9 +23,9 @@ {"amount":"0x773594000","index":"0x0","pubkey":"0x96a96086cff07df17668f35f7418ef8798079167e3f4f9b72ecde17b28226137cf454ab1dd20ef5d924786ab3483c2f9","signature":"0xb1acdb2c4d3df3f1b8d3bfd33421660df358d84d78d16c4603551935f4b67643373e7eb63dcb16ec359be0ec41fee33b03a16e80745f2374ff1d3c352508ac5d857c6476d3c3bcf7e6ca37427c9209f17be3af5264c0e2132b3dd1156c28b4e9","withdrawalCredentials":"0x003f5102dabe0a27b1746098d1dc17a5d3fbd478759fea9287e4e419b3c3cef2"} ], "blockNumber": "0x2", - "blockHash": "0xe6763c709abac0b477073c1efd980e12728c1ea22361c03e41db6fbd6a271832", + "blockHash": "0xb3b483867217b83b1e4a2f95c84d2da30cbff12eb8636f2becbcc05f4507fa7a", "receiptsRoot": "0x79ee3424eb720a3ad4b1c5a372bb8160580cbe4d893778660f34213c685627a9", - "blobGasUsed" : "0x0" + "blobGasUsed": "0x0" }, [], "0x0000000000000000000000000000000000000000000000000000000000000000" @@ -37,7 +37,7 @@ "id": 67, "result": { "status": "VALID", - "latestValidHash": "0xe6763c709abac0b477073c1efd980e12728c1ea22361c03e41db6fbd6a271832", + "latestValidHash": "0xb3b483867217b83b1e4a2f95c84d2da30cbff12eb8636f2becbcc05f4507fa7a", "validationError": null } }, diff --git a/acceptance-tests/tests/src/test/resources/jsonrpc/engine/eip6110/test-cases/10_eip6110_forkchoiceUpdatedV3.json b/acceptance-tests/tests/src/test/resources/jsonrpc/engine/eip6110/test-cases/10_eip6110_forkchoiceUpdatedV3.json index 9b1c62070bb..5a32569d611 100644 --- a/acceptance-tests/tests/src/test/resources/jsonrpc/engine/eip6110/test-cases/10_eip6110_forkchoiceUpdatedV3.json +++ b/acceptance-tests/tests/src/test/resources/jsonrpc/engine/eip6110/test-cases/10_eip6110_forkchoiceUpdatedV3.json @@ -4,8 +4,8 @@ "method": "engine_forkchoiceUpdatedV3", "params": [ { - "headBlockHash": "0xe6763c709abac0b477073c1efd980e12728c1ea22361c03e41db6fbd6a271832", - "safeBlockHash": "0xe6763c709abac0b477073c1efd980e12728c1ea22361c03e41db6fbd6a271832", + "headBlockHash": "0xb3b483867217b83b1e4a2f95c84d2da30cbff12eb8636f2becbcc05f4507fa7a", + "safeBlockHash": "0xb3b483867217b83b1e4a2f95c84d2da30cbff12eb8636f2becbcc05f4507fa7a", "finalizedBlockHash": "0x0000000000000000000000000000000000000000000000000000000000000000" }, { @@ -24,10 +24,10 @@ "result": { "payloadStatus": { "status": "VALID", - "latestValidHash": "0xe6763c709abac0b477073c1efd980e12728c1ea22361c03e41db6fbd6a271832", + "latestValidHash": "0xb3b483867217b83b1e4a2f95c84d2da30cbff12eb8636f2becbcc05f4507fa7a", "validationError": null }, - "payloadId": "0x28264382a1f291cf" + "payloadId": "0x282643daa04b7631" } }, "statusCode" : 200 diff --git a/acceptance-tests/tests/src/test/resources/jsonrpc/engine/eip6110/test-cases/11_eip6110_getPayloadV6110.json b/acceptance-tests/tests/src/test/resources/jsonrpc/engine/eip6110/test-cases/11_eip6110_getPayloadV6110.json index 3aff1f3e40f..6c546cd267d 100644 --- a/acceptance-tests/tests/src/test/resources/jsonrpc/engine/eip6110/test-cases/11_eip6110_getPayloadV6110.json +++ b/acceptance-tests/tests/src/test/resources/jsonrpc/engine/eip6110/test-cases/11_eip6110_getPayloadV6110.json @@ -3,7 +3,7 @@ "jsonrpc": "2.0", "method": "engine_getPayloadV6110", "params": [ - "0x28264382a1f291cf" + "0x282643daa04b7631" ], "id": 67 }, @@ -12,9 +12,9 @@ "id": 67, "result": { "executionPayload": { - "parentHash": "0xe6763c709abac0b477073c1efd980e12728c1ea22361c03e41db6fbd6a271832", + "parentHash": "0xb3b483867217b83b1e4a2f95c84d2da30cbff12eb8636f2becbcc05f4507fa7a", "feeRecipient": "0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b", - "stateRoot": "0x2d60598bb65d4a9451c097884d1fb07e015c242e2a3475f4ef902ed23e319d3b", + "stateRoot": "0x14208ac0e218167936e220b72d5d5887a963cb858ea2f2d268518f014a3da3fa", "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", "prevRandao": "0x0000000000000000000000000000000000000000000000000000000000000000", "gasLimit": "0x1c9c380", @@ -22,23 +22,23 @@ "timestamp": "0x30", "extraData": "0x", "baseFeePerGas": "0x7", - "excessBlobGas" : "0x0", - "parentBeaconBlockRoot" : "0x0000000000000000000000000000000000000000000000000000000000000000", + "excessBlobGas": "0x0", + "parentBeaconBlockRoot": "0x0000000000000000000000000000000000000000000000000000000000000000", "transactions": [], "withdrawals": [], - "depositReceipts" : [], + "depositReceipts": [], "blockNumber": "0x3", - "blockHash": "0xa489adae4826ac6a342c382243e8841d3e3b33168e7fd6e31b2c36c17a25f702", + "blockHash": "0xa28bf4db3363ce5b67848eb2ad52dbfead62ddb2287ae7eed36daa002528d1af", "receiptsRoot": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", - "blobGasUsed" : "0x0" + "blobGasUsed": "0x0" }, "blockValue": "0x0", - "blobsBundle" : { - "commitments" : [], - "proofs" : [], - "blobs" : [] + "blobsBundle": { + "commitments": [], + "proofs": [], + "blobs": [] }, - "shouldOverrideBuilder" : false + "shouldOverrideBuilder": false } }, "statusCode": 200 diff --git a/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/MainnetProtocolSpecs.java b/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/MainnetProtocolSpecs.java index 02f757483df..e477bf6f75e 100644 --- a/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/MainnetProtocolSpecs.java +++ b/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/MainnetProtocolSpecs.java @@ -640,8 +640,6 @@ static ProtocolSpecBuilder cancunDefinition( final EvmConfiguration evmConfiguration) { final int stackSizeLimit = configStackSizeLimit.orElse(MessageFrame.DEFAULT_MAX_STACK_SIZE); - final int contractSizeLimit = - configContractSizeLimit.orElse(SPURIOUS_DRAGON_CONTRACT_SIZE_LIMIT); final long londonForkBlockNumber = genesisConfigOptions.getLondonBlockNumber().orElse(0L); final BaseFeeMarket cancunFeeMarket = genesisConfigOptions.isZeroBaseFee() @@ -668,17 +666,6 @@ static ProtocolSpecBuilder cancunDefinition( (gasCalculator, jdCacheConfig) -> MainnetEVMs.cancun( gasCalculator, chainId.orElse(BigInteger.ZERO), evmConfiguration)) - // change contract call creator to accept EOF code - .contractCreationProcessorBuilder( - (gasCalculator, evm) -> - new ContractCreationProcessor( - gasCalculator, - evm, - true, - List.of( - MaxCodeSizeRule.of(contractSizeLimit), EOFValidationCodeRule.of(1, false)), - 1, - SPURIOUS_DRAGON_FORCE_DELETE_WHEN_EMPTY_ADDRESSES)) // use Cancun fee market .transactionProcessorBuilder( (gasCalculator, @@ -723,7 +710,8 @@ static ProtocolSpecBuilder futureEipsDefinition( final boolean enableRevertReason, final GenesisConfigOptions genesisConfigOptions, final EvmConfiguration evmConfiguration) { - + final int contractSizeLimit = + configContractSizeLimit.orElse(SPURIOUS_DRAGON_CONTRACT_SIZE_LIMIT); return cancunDefinition( chainId, configContractSizeLimit, @@ -731,10 +719,23 @@ static ProtocolSpecBuilder futureEipsDefinition( enableRevertReason, genesisConfigOptions, evmConfiguration) + // Use Future EIP configured EVM .evmBuilder( (gasCalculator, jdCacheConfig) -> MainnetEVMs.futureEips( gasCalculator, chainId.orElse(BigInteger.ZERO), evmConfiguration)) + // change contract call creator to accept EOF code + .contractCreationProcessorBuilder( + (gasCalculator, evm) -> + new ContractCreationProcessor( + gasCalculator, + evm, + true, + List.of( + MaxCodeSizeRule.of(contractSizeLimit), EOFValidationCodeRule.of(1, false)), + 1, + SPURIOUS_DRAGON_FORCE_DELETE_WHEN_EMPTY_ADDRESSES)) + // use future configured precompiled contracts .precompileContractRegistryBuilder(MainnetPrecompiledContractRegistries::futureEips) .name("FutureEips"); } diff --git a/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/ParentBeaconBlockRootHelper.java b/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/ParentBeaconBlockRootHelper.java index 2c863add026..5f257c3dd32 100644 --- a/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/ParentBeaconBlockRootHelper.java +++ b/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/ParentBeaconBlockRootHelper.java @@ -15,6 +15,7 @@ package org.hyperledger.besu.ethereum.mainnet; import org.hyperledger.besu.datatypes.Address; +import org.hyperledger.besu.datatypes.Hash; import org.hyperledger.besu.evm.account.MutableAccount; import org.hyperledger.besu.evm.worldstate.WorldUpdater; @@ -27,8 +28,8 @@ public interface ParentBeaconBlockRootHelper { // Modulus to use for the timestamp to store the root - public static final long HISTORY_BUFFER_LENGTH = 8191; - public static final Address BEACON_ROOTS_ADDRESS = + long HISTORY_BUFFER_LENGTH = 8191; + Address BEACON_ROOTS_ADDRESS = Address.fromHexString("0x000F3df6D732807Ef1319fB7B8bB8522d0Beac02"); static void storeParentBeaconBlockRoot( @@ -36,13 +37,18 @@ static void storeParentBeaconBlockRoot( /* see EIP-4788: https://github.com/ethereum/EIPs/blob/master/EIPS/eip-4788.md */ + // If code is not deployed don't do anything + final MutableAccount account = worldUpdater.getOrCreate(BEACON_ROOTS_ADDRESS); + if (Hash.EMPTY.equals(account.getCodeHash())) { + return; + } + final long timestampReduced = Long.remainderUnsigned(timestamp, HISTORY_BUFFER_LENGTH); final long timestampExtended = timestampReduced + HISTORY_BUFFER_LENGTH; final UInt256 timestampIndex = UInt256.valueOf(timestampReduced); final UInt256 rootIndex = UInt256.valueOf(timestampExtended); - final MutableAccount account = worldUpdater.getOrCreate(BEACON_ROOTS_ADDRESS); account.setStorageValue( timestampIndex, UInt256.fromBytes(Bytes.of(Longs.toByteArray(timestamp)))); account.setStorageValue(rootIndex, UInt256.fromBytes(root));