mirror of
https://github.com/vacp2p/linea-besu.git
synced 2026-01-09 15:37:54 -05:00
Change execution requests to use flat encoding (#7771)
Signed-off-by: Jason Frame <jason.frame@consensys.net>
This commit is contained in:
@@ -18,12 +18,17 @@ import org.hyperledger.besu.consensus.merge.blockcreation.PayloadIdentifier;
|
||||
import org.hyperledger.besu.datatypes.Wei;
|
||||
import org.hyperledger.besu.ethereum.core.BlockValueCalculator;
|
||||
import org.hyperledger.besu.ethereum.core.BlockWithReceipts;
|
||||
import org.hyperledger.besu.ethereum.core.Request;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
/** Wrapper for payload plus extra info. */
|
||||
public class PayloadWrapper {
|
||||
private final PayloadIdentifier payloadIdentifier;
|
||||
private final BlockWithReceipts blockWithReceipts;
|
||||
private final Wei blockValue;
|
||||
private final Optional<List<Request>> requests;
|
||||
|
||||
/**
|
||||
* Construct a wrapper with the following fields.
|
||||
@@ -32,10 +37,13 @@ public class PayloadWrapper {
|
||||
* @param blockWithReceipts Block with receipts
|
||||
*/
|
||||
public PayloadWrapper(
|
||||
final PayloadIdentifier payloadIdentifier, final BlockWithReceipts blockWithReceipts) {
|
||||
final PayloadIdentifier payloadIdentifier,
|
||||
final BlockWithReceipts blockWithReceipts,
|
||||
final Optional<List<Request>> requests) {
|
||||
this.blockWithReceipts = blockWithReceipts;
|
||||
this.payloadIdentifier = payloadIdentifier;
|
||||
this.blockValue = BlockValueCalculator.calculateBlockValue(blockWithReceipts);
|
||||
this.requests = requests;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -64,4 +72,13 @@ public class PayloadWrapper {
|
||||
public BlockWithReceipts blockWithReceipts() {
|
||||
return blockWithReceipts;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the requests
|
||||
*
|
||||
* @return requests
|
||||
*/
|
||||
public Optional<List<Request>> requests() {
|
||||
return requests;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -302,7 +302,9 @@ public class MergeCoordinator implements MergeMiningCoordinator, BadChainListene
|
||||
if (result.isSuccessful()) {
|
||||
mergeContext.putPayloadById(
|
||||
new PayloadWrapper(
|
||||
payloadIdentifier, new BlockWithReceipts(emptyBlock, result.getReceipts())));
|
||||
payloadIdentifier,
|
||||
new BlockWithReceipts(emptyBlock, result.getReceipts()),
|
||||
result.getRequests()));
|
||||
LOG.info(
|
||||
"Start building proposals for block {} identified by {}",
|
||||
emptyBlock.getHeader().getNumber(),
|
||||
@@ -469,7 +471,9 @@ public class MergeCoordinator implements MergeMiningCoordinator, BadChainListene
|
||||
|
||||
mergeContext.putPayloadById(
|
||||
new PayloadWrapper(
|
||||
payloadIdentifier, new BlockWithReceipts(bestBlock, resultBest.getReceipts())));
|
||||
payloadIdentifier,
|
||||
new BlockWithReceipts(bestBlock, resultBest.getReceipts()),
|
||||
resultBest.getRequests()));
|
||||
LOG.atDebug()
|
||||
.setMessage(
|
||||
"Successfully built block {} for proposal identified by {}, with {} transactions, in {}ms")
|
||||
|
||||
@@ -54,8 +54,7 @@ public class ProposalTest {
|
||||
new BlockBody(
|
||||
Collections.emptyList(),
|
||||
Collections.emptyList(),
|
||||
Optional.of(Collections.emptyList()),
|
||||
Optional.empty()));
|
||||
Optional.of(Collections.emptyList())));
|
||||
|
||||
@Test
|
||||
public void canRoundTripProposalMessage() {
|
||||
|
||||
Reference in New Issue
Block a user