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 bf5d12804b..045b4ad02d 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,5 +38,6 @@ public enum JsonRpcResponseKey { TRANSACTION_ROOT, BASEFEE, WITHDRAWALS_ROOT, - REQUESTS_HASH + REQUESTS_HASH, + TARGET_BLOB_COUNT } 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 755260cd08..7e5e08aa7b 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,6 +63,7 @@ import java.util.Optional; 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 { @@ -106,6 +107,10 @@ public class JsonRpcResponseUtils { 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 targetBlobCount = + values.containsKey(JsonRpcResponseKey.TARGET_BLOB_COUNT) + ? UInt64.fromHexString(values.get(JsonRpcResponseKey.TARGET_BLOB_COUNT)) + : null; final List ommers = new ArrayList<>(); final BlockHeader header = @@ -131,7 +136,7 @@ public class JsonRpcResponseUtils { 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, - null, // TODO SLD EIP-7742 targetBlobCount + targetBlobCount, 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 66cdecb5aa..8562e140f5 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 @@ -279,7 +279,7 @@ public abstract class AbstractEngineNewPayload extends ExecutionEngineJsonRpcMet : BlobGas.fromHexString(blockParam.getExcessBlobGas()), maybeParentBeaconBlockRoot.orElse(null), maybeRequests.map(BodyValidation::requestsHash).orElse(null), - null, // TODO SLD EIP-7742 + null, // TODO SLD EIP-7742 wiring in future PR headerFunctions); // ensure the block hash matches the blockParam hash 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 33d76f4b04..7e037dff3a 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 @@ -47,7 +47,7 @@ public class ProcessableBlockHeader protected final Bytes32 mixHashOrPrevRandao; // parentBeaconBlockRoot is included for Cancun protected final Bytes32 parentBeaconBlockRoot; - // TODO SLD Quantity or UInt64Value? + // TODO SLD Quantity or UInt64Value instead? protected final UInt64 targetBlobCount; protected ProcessableBlockHeader( 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 99cf2407b8..b0b9aa6497 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,6 +25,7 @@ import java.util.Optional; import org.apache.tuweni.bytes.Bytes; import org.apache.tuweni.bytes.Bytes32; +import org.apache.tuweni.units.bigints.UInt64; public class BlockHeaderTestFixture { @@ -55,6 +56,7 @@ public class BlockHeaderTestFixture { private Optional excessBlobGas = Optional.empty(); private Optional blobGasUsed = Optional.empty(); private Optional parentBeaconBlockRoot = Optional.empty(); + private Optional targetBlobCount = Optional.empty(); public BlockHeader buildHeader() { final BlockHeaderBuilder builder = BlockHeaderBuilder.create(); @@ -80,6 +82,7 @@ public class BlockHeaderTestFixture { blobGasUsed.ifPresent(builder::blobGasUsed); requestsHash.ifPresent(builder::requestsHash); parentBeaconBlockRoot.ifPresent(builder::parentBeaconBlockRoot); + targetBlobCount.ifPresent(builder::targetBlobCount); builder.blockHeaderFunctions(blockHeaderFunctions); return builder.buildBlockHeader(); @@ -201,4 +204,9 @@ public class BlockHeaderTestFixture { this.parentBeaconBlockRoot = parentBeaconBlockRoot; return this; } + + public BlockHeaderTestFixture targetBlobCount(final UInt64 targetBlobCount) { + this.targetBlobCount = Optional.of(targetBlobCount); + return this; + } } diff --git a/ethereum/referencetests/src/main/java/org/hyperledger/besu/ethereum/referencetests/BlockchainReferenceTestCaseSpec.java b/ethereum/referencetests/src/main/java/org/hyperledger/besu/ethereum/referencetests/BlockchainReferenceTestCaseSpec.java index cf124152b5..7ab0091090 100644 --- a/ethereum/referencetests/src/main/java/org/hyperledger/besu/ethereum/referencetests/BlockchainReferenceTestCaseSpec.java +++ b/ethereum/referencetests/src/main/java/org/hyperledger/besu/ethereum/referencetests/BlockchainReferenceTestCaseSpec.java @@ -195,7 +195,7 @@ public class BlockchainReferenceTestCaseSpec { excessBlobGas != null ? BlobGas.fromHexString(excessBlobGas) : null, parentBeaconBlockRoot != null ? Bytes32.fromHexString(parentBeaconBlockRoot) : null, requestsHash != null ? Hash.fromHexString(requestsHash) : null, - null, // TODO SLD EIP-7742 targetBlobCount + null, // TODO SLD EIP-7742 use targetBlobCount when reference tests are updated new BlockHeaderFunctions() { @Override public Hash hash(final BlockHeader header) { diff --git a/ethereum/referencetests/src/main/java/org/hyperledger/besu/ethereum/referencetests/ReferenceTestEnv.java b/ethereum/referencetests/src/main/java/org/hyperledger/besu/ethereum/referencetests/ReferenceTestEnv.java index dd88b93574..25c0cd2484 100644 --- a/ethereum/referencetests/src/main/java/org/hyperledger/besu/ethereum/referencetests/ReferenceTestEnv.java +++ b/ethereum/referencetests/src/main/java/org/hyperledger/besu/ethereum/referencetests/ReferenceTestEnv.java @@ -146,7 +146,7 @@ public class ReferenceTestEnv extends BlockHeader { currentExcessBlobGas == null ? null : BlobGas.of(Long.decode(currentExcessBlobGas)), beaconRoot == null ? null : Bytes32.fromHexString(beaconRoot), null, // requestsHash - null, // TODO SLD EIP-7742 targetBlobCount + null, // TODO SLD EIP-7742 use targetBlobCount when reference tests are updated new MainnetBlockHeaderFunctions()); this.parentDifficulty = parentDifficulty; this.parentBaseFee = parentBaseFee; diff --git a/plugin-api/build.gradle b/plugin-api/build.gradle index 53baa05e7c..2de2e5a4ec 100644 --- a/plugin-api/build.gradle +++ b/plugin-api/build.gradle @@ -71,7 +71,7 @@ Calculated : ${currentHash} tasks.register('checkAPIChanges', FileStateChecker) { description = "Checks that the API for the Plugin-API project does not change without deliberate thought" files = sourceSets.main.allJava.files - knownHash = 'noYVewx7Uk2MEwE97D61jtlTsxA9AjW+f5m5kxDL7Wg=' + knownHash = 'oPhKFq7zvol5TueYQNo49RLhkKss691ONNhM2cu4E2w=' } check.dependsOn('checkAPIChanges') diff --git a/plugin-api/src/main/java/org/hyperledger/besu/plugin/data/ProcessableBlockHeader.java b/plugin-api/src/main/java/org/hyperledger/besu/plugin/data/ProcessableBlockHeader.java index d568efb393..c7a1c5b99e 100644 --- a/plugin-api/src/main/java/org/hyperledger/besu/plugin/data/ProcessableBlockHeader.java +++ b/plugin-api/src/main/java/org/hyperledger/besu/plugin/data/ProcessableBlockHeader.java @@ -113,7 +113,7 @@ public interface ProcessableBlockHeader { * @return The target blob count of this header. */ @Unstable - // TODO SLD should be Quantity? + // TODO SLD should be Quantity or new subclass of Quantity? default Optional getTargetBlobCount() { return Optional.empty(); }