Update TODOs and some test infra

Signed-off-by: Simon Dudley <simon.dudley@consensys.net>
pull/7805/head
Simon Dudley 2 days ago
parent 7da64b6e56
commit 0a9ca671b7
  1. 3
      ethereum/api/src/integration-test/java/org/hyperledger/besu/ethereum/api/jsonrpc/JsonRpcResponseKey.java
  2. 7
      ethereum/api/src/integration-test/java/org/hyperledger/besu/ethereum/api/jsonrpc/JsonRpcResponseUtils.java
  3. 2
      ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/engine/AbstractEngineNewPayload.java
  4. 2
      ethereum/core/src/main/java/org/hyperledger/besu/ethereum/core/ProcessableBlockHeader.java
  5. 8
      ethereum/core/src/test-support/java/org/hyperledger/besu/ethereum/core/BlockHeaderTestFixture.java
  6. 2
      ethereum/referencetests/src/main/java/org/hyperledger/besu/ethereum/referencetests/BlockchainReferenceTestCaseSpec.java
  7. 2
      ethereum/referencetests/src/main/java/org/hyperledger/besu/ethereum/referencetests/ReferenceTestEnv.java
  8. 2
      plugin-api/build.gradle
  9. 2
      plugin-api/src/main/java/org/hyperledger/besu/plugin/data/ProcessableBlockHeader.java

@ -38,5 +38,6 @@ public enum JsonRpcResponseKey {
TRANSACTION_ROOT,
BASEFEE,
WITHDRAWALS_ROOT,
REQUESTS_HASH
REQUESTS_HASH,
TARGET_BLOB_COUNT
}

@ -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<JsonNode> 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(

@ -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

@ -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<UInt64>?
// TODO SLD Quantity or UInt64Value<UInt64> instead?
protected final UInt64 targetBlobCount;
protected ProcessableBlockHeader(

@ -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<BlobGas> excessBlobGas = Optional.empty();
private Optional<Long> blobGasUsed = Optional.empty();
private Optional<Bytes32> parentBeaconBlockRoot = Optional.empty();
private Optional<UInt64> 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;
}
}

@ -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) {

@ -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;

@ -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')

@ -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<UInt64> getTargetBlobCount() {
return Optional.empty();
}

Loading…
Cancel
Save