Skip to content

Commit

Permalink
fix some hive tests
Browse files Browse the repository at this point in the history
Signed-off-by: Stefan <[email protected]>
  • Loading branch information
pinges committed Aug 21, 2023
1 parent d5d7e7a commit 413e854
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,8 @@ public JsonRpcResponse syncResponse(final JsonRpcRequestContext requestContext)
maybeParentBeaconBlockRootParam.map(Bytes32::fromHexString);

ValidationResult<RpcErrorType> forkValidationResult =
validateForkSupported(reqId, blockParam, maybeParentBeaconBlockRoot);
validateParamsAndForkSupported(
reqId, blockParam, maybeVersionedHashParam, maybeParentBeaconBlockRoot);
if (!forkValidationResult.isValid()) {
return new JsonRpcErrorResponse(reqId, forkValidationResult);
}
Expand Down Expand Up @@ -397,9 +398,10 @@ protected EngineStatus getInvalidBlockHashStatus() {
return INVALID;
}

protected ValidationResult<RpcErrorType> validateForkSupported(
protected ValidationResult<RpcErrorType> validateParamsAndForkSupported(
final Object id,
final EnginePayloadParameter payloadParameter,
final Optional<List<String>> maybeVersionedHashParam,
final Optional<Bytes32> parentBeaconBlockRoot) {
return ValidationResult.valid();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import org.hyperledger.besu.ethereum.mainnet.ScheduledProtocolSpec;
import org.hyperledger.besu.ethereum.mainnet.ValidationResult;

import java.util.List;
import java.util.Optional;

import io.vertx.core.Vertx;
Expand Down Expand Up @@ -53,23 +54,24 @@ public String getName() {
}

@Override
protected ValidationResult<RpcErrorType> validateForkSupported(
protected ValidationResult<RpcErrorType> validateParamsAndForkSupported(
final Object reqId,
final EnginePayloadParameter payloadParameter,
final Optional<List<String>> maybeVersionedHashParam,
final Optional<Bytes32> maybeParentBeaconBlockRoot) {

if (payloadParameter.getTimestamp() >= cancunTimestamp) {
if (payloadParameter.getBlobGasUsed() == null
|| payloadParameter.getExcessBlobGas() == null) {
return ValidationResult.invalid(RpcErrorType.INVALID_PARAMS, "Missing blob gas fields");
} else if (maybeParentBeaconBlockRoot.isEmpty()) {
return ValidationResult.invalid(
RpcErrorType.INVALID_PARAMS, "Missing parent beacon block root");
} else {
return ValidationResult.valid();
}
} else {
if (payloadParameter.getBlobGasUsed() == null || payloadParameter.getExcessBlobGas() == null) {
return ValidationResult.invalid(RpcErrorType.INVALID_PARAMS, "Missing blob gas fields");
} else if (maybeVersionedHashParam == null) {
return ValidationResult.invalid(
RpcErrorType.INVALID_PARAMS, "Missing versioned hashes field");
} else if (maybeParentBeaconBlockRoot.isEmpty()) {
return ValidationResult.invalid(
RpcErrorType.INVALID_PARAMS, "Missing parent beacon block root field");
}
if (payloadParameter.getTimestamp() < cancunTimestamp) {
return ValidationResult.invalid(RpcErrorType.UNSUPPORTED_FORK, "Fork not supported");
}
return ValidationResult.valid();
}
}

0 comments on commit 413e854

Please sign in to comment.