Skip to content

Commit

Permalink
debugging tests
Browse files Browse the repository at this point in the history
Signed-off-by: Simon Dudley <simon.dudley@consensys.net>
  • Loading branch information
siladu committed Oct 25, 2024
1 parent 4c23b65 commit b50d653
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,8 @@ public String getParentBeaconBlockRoot() {
* @return the target blob count
*/
public Optional<String> getTargetBlobCount() {
// 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, "targetblobcount");
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand Down Expand Up @@ -132,7 +131,7 @@ 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,
UInt64.ZERO, // TODO SLD EIP-7742 targetBlobCount
null, // TODO SLD EIP-7742 targetBlobCount
blockHeaderFunctions);

return new JsonRpcSuccessResponse(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ public JsonRpcResponse syncResponse(final JsonRpcRequestContext requestContext)
: BlobGas.fromHexString(blockParam.getExcessBlobGas()),
maybeParentBeaconBlockRoot.orElse(null),
maybeRequests.map(BodyValidation::requestsHash).orElse(null),
UInt64.ZERO, // TODO SLD EIP-7742
null, // TODO SLD EIP-7742
headerFunctions);

// ensure the block hash matches the blockParam hash
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ public class BlockResult implements JsonRpcResult {
private final String blobGasUsed;
private final String excessBlobGas;
private final String parentBeaconBlockRoot;
private final String targetBlobCount;

public BlockResult(
final BlockHeader header,
Expand Down Expand Up @@ -138,6 +139,7 @@ public BlockResult(
this.excessBlobGas = header.getExcessBlobGas().map(Quantity::create).orElse(null);
this.parentBeaconBlockRoot =
header.getParentBeaconBlockRoot().map(Bytes32::toHexString).orElse(null);
this.targetBlobCount = header.getTargetBlobCount().map(Quantity::create).orElse(null);
}

@JsonGetter(value = "number")
Expand Down Expand Up @@ -275,4 +277,9 @@ public String getExcessBlobGas() {
public String getParentBeaconBlockRoot() {
return parentBeaconBlockRoot;
}

@JsonGetter(value = "targetBlobCount")
public String getTargetBlobCount() {
return targetBlobCount;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,9 @@ private static BlockHeader buildHeader(
.requestsHash(isPragueAtGenesis(genesis) ? Hash.EMPTY_REQUESTS_HASH : null)
.targetBlobCount(
isPragueAtGenesis(genesis)
? genesis.getTargetBlobCount().map(UInt64::fromHexString).orElseThrow()
// TODO SLD EIP-7742 Currently defaulting to null due to dependency on web3j
// BlockHeader in CodeDelegationTransactionAcceptanceTest
? genesis.getTargetBlobCount().map(UInt64::fromHexString).orElse(null)
: null)
.buildBlockHeader();
}
Expand Down

0 comments on commit b50d653

Please sign in to comment.