Log blob count when importing a block via Engine API (#6466)

Signed-off-by: Fabio Di Fabio <fabio.difabio@consensys.net>
pull/6467/head
Fabio Di Fabio 10 months ago committed by GitHub
parent 16016ece0a
commit efbd840747
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 2
      CHANGELOG.md
  2. 22
      ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/engine/AbstractEngineNewPayload.java
  3. 5
      ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/engine/EngineNewPayloadV1.java

@ -10,7 +10,7 @@
### Additions and Improvements
- Add `OperationTracer.tracePrepareTransaction`, where the sender account has not yet been altered[#6453](https://github.com/hyperledger/besu/pull/6453)
- Improve the high spec flag by limiting it to a few column families [#6354](https://github.com/hyperledger/besu/pull/6354)
- Log blob count when importing a block via Engine API [#6466](https://github.com/hyperledger/besu/pull/6466)
### Bug fixes
- Fix the way an advertised host configured with `--p2p-host` is treated when communicating with the originator of a PING packet [#6225](https://github.com/hyperledger/besu/pull/6225)

@ -234,9 +234,12 @@ public abstract class AbstractEngineNewPayload extends ExecutionEngineJsonRpcMet
return respondWithInvalid(reqId, blockParam, null, getInvalidBlockHashStatus(), errorMessage);
}
final var blobTransactions =
transactions.stream().filter(transaction -> transaction.getType().supportsBlob()).toList();
ValidationResult<RpcErrorType> blobValidationResult =
validateBlobs(
transactions,
blobTransactions,
newBlockHeader,
maybeParentHeader,
maybeVersionedHashes,
@ -302,7 +305,8 @@ public abstract class AbstractEngineNewPayload extends ExecutionEngineJsonRpcMet
final BlockProcessingResult executionResult = mergeCoordinator.rememberBlock(block);
if (executionResult.isSuccessful()) {
logImportedBlockInfo(block, (System.currentTimeMillis() - startTimeMs) / 1000.0);
logImportedBlockInfo(
block, blobTransactions.size(), (System.currentTimeMillis() - startTimeMs) / 1000.0);
return respondWith(reqId, blockParam, newBlockHeader.getHash(), VALID);
} else {
if (executionResult.causedBy().isPresent()) {
@ -380,10 +384,6 @@ public abstract class AbstractEngineNewPayload extends ExecutionEngineJsonRpcMet
invalidStatus, latestValidHash, Optional.of(validationError)));
}
protected boolean requireTerminalPoWBlockValidation() {
return false;
}
protected EngineStatus getInvalidBlockHashStatus() {
return INVALID;
}
@ -396,15 +396,12 @@ public abstract class AbstractEngineNewPayload extends ExecutionEngineJsonRpcMet
}
protected ValidationResult<RpcErrorType> validateBlobs(
final List<Transaction> transactions,
final List<Transaction> blobTransactions,
final BlockHeader header,
final Optional<BlockHeader> maybeParentHeader,
final Optional<List<VersionedHash>> maybeVersionedHashes,
final ProtocolSpec protocolSpec) {
var blobTransactions =
transactions.stream().filter(transaction -> transaction.getType().supportsBlob()).toList();
final List<VersionedHash> transactionVersionedHashes = new ArrayList<>();
for (Transaction transaction : blobTransactions) {
var versionedHashes = transaction.getVersionedHashes();
@ -489,7 +486,7 @@ public abstract class AbstractEngineNewPayload extends ExecutionEngineJsonRpcMet
.collect(Collectors.toList()));
}
private void logImportedBlockInfo(final Block block, final double timeInS) {
private void logImportedBlockInfo(final Block block, final int blobCount, final double timeInS) {
final StringBuilder message = new StringBuilder();
message.append("Imported #%,d / %d tx");
final List<Object> messageArgs =
@ -503,9 +500,10 @@ public abstract class AbstractEngineNewPayload extends ExecutionEngineJsonRpcMet
message.append(" / %d ds");
messageArgs.add(block.getBody().getDeposits().get().size());
}
message.append(" / base fee %s / %,d (%01.1f%%) gas / (%s) in %01.3fs. Peers: %d");
message.append(" / %d blobs / base fee %s / %,d (%01.1f%%) gas / (%s) in %01.3fs. Peers: %d");
messageArgs.addAll(
List.of(
blobCount,
block.getHeader().getBaseFee().map(Wei::toHumanReadableString).orElse("N/A"),
block.getHeader().getGasUsed(),
(block.getHeader().getGasUsed() * 100.0) / block.getHeader().getGasLimit(),

@ -50,11 +50,6 @@ public class EngineNewPayloadV1 extends AbstractEngineNewPayload {
return RpcMethod.ENGINE_NEW_PAYLOAD_V1.getMethodName();
}
@Override
protected boolean requireTerminalPoWBlockValidation() {
return true;
}
@Override
protected EngineStatus getInvalidBlockHashStatus() {
return INVALID_BLOCK_HASH;

Loading…
Cancel
Save