Skip to content

Commit

Permalink
fix: test compile
Browse files Browse the repository at this point in the history
  • Loading branch information
thinkAfCod committed Jul 21, 2024
1 parent 6e0e364 commit a82b2b1
Show file tree
Hide file tree
Showing 8 changed files with 117 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,9 @@ public void coinbaseShouldMatchSuggestedFeeRecipient() {
Bytes32.ZERO,
suggestedFeeRecipient,
Optional.empty(),
Optional.empty(),
Optional.empty(),
Optional.empty(),
Optional.empty());

ArgumentCaptor<PayloadWrapper> payloadWrapper = ArgumentCaptor.forClass(PayloadWrapper.class);
Expand Down Expand Up @@ -322,6 +325,9 @@ public void exceptionDuringBuildingBlockShouldNotBeInvalid()
Bytes32.random(),
suggestedFeeRecipient,
Optional.empty(),
Optional.empty(),
Optional.empty(),
Optional.empty(),
Optional.empty());

blockCreationTask.get();
Expand Down Expand Up @@ -360,6 +366,9 @@ public void shouldNotRecordProposedBadBlockToBadBlockManager()
Bytes32.ZERO,
suggestedFeeRecipient,
Optional.empty(),
Optional.empty(),
Optional.empty(),
Optional.empty(),
Optional.empty());

verify(badBlockManager, never()).addBadBlock(any(), any());
Expand Down Expand Up @@ -393,6 +402,9 @@ public void shouldContinueBuildingBlocksUntilFinalizeIsCalled()
Bytes32.ZERO,
suggestedFeeRecipient,
Optional.empty(),
Optional.empty(),
Optional.empty(),
Optional.empty(),
Optional.empty());

blockCreationTask.get();
Expand Down Expand Up @@ -451,6 +463,9 @@ public void blockCreationRepetitionShouldTakeNotLessThanRepetitionMinDuration()
Bytes32.ZERO,
suggestedFeeRecipient,
Optional.empty(),
Optional.empty(),
Optional.empty(),
Optional.empty(),
Optional.empty());

blockCreationTask.get();
Expand Down Expand Up @@ -502,6 +517,9 @@ public void shouldRetryBlockCreationOnRecoverableError()
Bytes32.ZERO,
suggestedFeeRecipient,
Optional.empty(),
Optional.empty(),
Optional.empty(),
Optional.empty(),
Optional.empty());

blockCreationTask.get();
Expand Down Expand Up @@ -555,6 +573,9 @@ public void shouldStopRetryBlockCreationIfTimeExpired() throws InterruptedExcept
Bytes32.ZERO,
suggestedFeeRecipient,
Optional.empty(),
Optional.empty(),
Optional.empty(),
Optional.empty(),
Optional.empty());

try {
Expand Down Expand Up @@ -601,6 +622,9 @@ public void shouldStopInProgressBlockCreationIfFinalizedIsCalled()
Bytes32.ZERO,
suggestedFeeRecipient,
Optional.empty(),
Optional.empty(),
Optional.empty(),
Optional.empty(),
Optional.empty());

waitForBlockCreationInProgress.await();
Expand Down Expand Up @@ -655,6 +679,9 @@ public void shouldNotStartAnotherBlockCreationJobIfCalledAgainWithTheSamePayload
Bytes32.ZERO,
suggestedFeeRecipient,
Optional.empty(),
Optional.empty(),
Optional.empty(),
Optional.empty(),
Optional.empty());

final CompletableFuture<Void> task1 = blockCreationTask;
Expand All @@ -666,6 +693,9 @@ public void shouldNotStartAnotherBlockCreationJobIfCalledAgainWithTheSamePayload
Bytes32.ZERO,
suggestedFeeRecipient,
Optional.empty(),
Optional.empty(),
Optional.empty(),
Optional.empty(),
Optional.empty());

assertThat(payloadId1).isEqualTo(payloadId2);
Expand Down Expand Up @@ -707,6 +737,9 @@ public void shouldCancelPreviousBlockCreationJobIfCalledAgainWithNewPayloadId()
Bytes32.ZERO,
suggestedFeeRecipient,
Optional.empty(),
Optional.empty(),
Optional.empty(),
Optional.empty(),
Optional.empty());

assertThat(coordinator.isBlockCreationCancelled(payloadId1)).isFalse();
Expand All @@ -718,6 +751,9 @@ public void shouldCancelPreviousBlockCreationJobIfCalledAgainWithNewPayloadId()
Bytes32.ZERO,
suggestedFeeRecipient,
Optional.empty(),
Optional.empty(),
Optional.empty(),
Optional.empty(),
Optional.empty());

assertThat(payloadId1).isNotEqualTo(payloadId2);
Expand Down Expand Up @@ -751,6 +787,9 @@ public void shouldUseExtraDataFromMiningParameters() {
Bytes32.ZERO,
suggestedFeeRecipient,
Optional.empty(),
Optional.empty(),
Optional.empty(),
Optional.empty(),
Optional.empty());

ArgumentCaptor<PayloadWrapper> payloadWrapper = ArgumentCaptor.forClass(PayloadWrapper.class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
import org.hyperledger.besu.ethereum.api.jsonrpc.internal.methods.ExecutionEngineJsonRpcMethod.EngineStatus;
import org.hyperledger.besu.ethereum.api.jsonrpc.internal.parameters.EngineForkchoiceUpdatedParameter;
import org.hyperledger.besu.ethereum.api.jsonrpc.internal.parameters.EnginePayloadAttributesParameter;
import org.hyperledger.besu.ethereum.api.jsonrpc.internal.parameters.UnsignedLongParameter;
import org.hyperledger.besu.ethereum.api.jsonrpc.internal.parameters.WithdrawalParameter;
import org.hyperledger.besu.ethereum.api.jsonrpc.internal.response.JsonRpcErrorResponse;
import org.hyperledger.besu.ethereum.api.jsonrpc.internal.response.JsonRpcResponse;
Expand Down Expand Up @@ -241,7 +242,10 @@ public void shouldReturnValidWithoutFinalizedWithPayload() {
Bytes32.fromHexStringLenient("0xDEADBEEF").toHexString(),
Address.ECREC.toString(),
null,
null);
null,
null,
null,
new UnsignedLongParameter(0L));
var mockPayloadId =
PayloadIdentifier.forPayloadParams(
mockHeader.getHash(),
Expand All @@ -257,6 +261,9 @@ public void shouldReturnValidWithoutFinalizedWithPayload() {
payloadParams.getPrevRandao(),
Address.ECREC,
Optional.empty(),
Optional.empty(),
Optional.empty(),
Optional.empty(),
Optional.empty()))
.thenReturn(mockPayloadId);

Expand Down Expand Up @@ -430,7 +437,10 @@ public void shouldIgnoreUpdateToOldHeadAndNotPreparePayload() {
Bytes32.fromHexStringLenient("0xDEADBEEF").toHexString(),
Address.ECREC.toString(),
null,
null);
null,
null,
null,
new UnsignedLongParameter(0L));

var resp =
(JsonRpcSuccessResponse)
Expand All @@ -441,7 +451,7 @@ public void shouldIgnoreUpdateToOldHeadAndNotPreparePayload() {

var forkchoiceRes = (EngineUpdateForkchoiceResult) resp.getResult();

verify(mergeCoordinator, never()).preparePayload(any(), any(), any(), any(), any(), any());
verify(mergeCoordinator, never()).preparePayload(any(), any(), any(), any(), any(), any(), any(), any(), any());

assertThat(forkchoiceRes.getPayloadStatus().getStatus()).isEqualTo(VALID);
assertThat(forkchoiceRes.getPayloadStatus().getError()).isNull();
Expand All @@ -467,7 +477,10 @@ public void shouldReturnInvalidIfPayloadTimestampNotGreaterThanHead() {
Bytes32.fromHexStringLenient("0xDEADBEEF").toHexString(),
Address.ECREC.toString(),
emptyList(),
null);
null,
null,
null,
new UnsignedLongParameter(0L));

var resp =
resp(
Expand All @@ -492,7 +505,10 @@ public void shouldReturnInvalidIfWithdrawalsIsNotNull_WhenWithdrawalsProhibited(
Bytes32.fromHexStringLenient("0xDEADBEEF").toHexString(),
Address.ECREC.toString(),
emptyList(),
null);
null,
null,
null,
new UnsignedLongParameter(0L));

var resp =
resp(
Expand All @@ -517,7 +533,10 @@ public void shouldReturnValidIfWithdrawalsIsNull_WhenWithdrawalsProhibited() {
Bytes32.fromHexStringLenient("0xDEADBEEF").toHexString(),
Address.ECREC.toString(),
null,
null);
null,
null,
null,
new UnsignedLongParameter(0L));

var mockPayloadId =
PayloadIdentifier.forPayloadParams(
Expand All @@ -534,6 +553,9 @@ public void shouldReturnValidIfWithdrawalsIsNull_WhenWithdrawalsProhibited() {
payloadParams.getPrevRandao(),
Address.ECREC,
Optional.empty(),
Optional.empty(),
Optional.empty(),
Optional.empty(),
Optional.empty()))
.thenReturn(mockPayloadId);

Expand Down Expand Up @@ -561,7 +583,10 @@ public void shouldReturnInvalidIfWithdrawalsIsNull_WhenWithdrawalsAllowed() {
Bytes32.fromHexStringLenient("0xDEADBEEF").toHexString(),
Address.ECREC.toString(),
null,
null);
null,
null,
null,
new UnsignedLongParameter(0L));

var resp =
resp(
Expand Down Expand Up @@ -597,7 +622,7 @@ public void shouldReturnValidIfWithdrawalsIsNotNull_WhenWithdrawalsAllowed() {
Bytes32.fromHexStringLenient("0xDEADBEEF").toHexString(),
Address.ECREC.toString(),
withdrawalParameters,
null);
null, null, null, new UnsignedLongParameter(0L));

final Optional<List<Withdrawal>> withdrawals =
Optional.of(
Expand All @@ -620,6 +645,9 @@ public void shouldReturnValidIfWithdrawalsIsNotNull_WhenWithdrawalsAllowed() {
payloadParams.getPrevRandao(),
Address.ECREC,
withdrawals,
Optional.empty(),
Optional.empty(),
Optional.empty(),
Optional.empty()))
.thenReturn(mockPayloadId);

Expand All @@ -646,7 +674,10 @@ public void shouldReturnValidIfProtocolScheduleIsEmpty() {
Bytes32.fromHexStringLenient("0xDEADBEEF").toHexString(),
Address.ECREC.toString(),
null,
null);
null,
null,
null,
new UnsignedLongParameter(0L));

var mockPayloadId =
PayloadIdentifier.forPayloadParams(
Expand All @@ -663,6 +694,9 @@ public void shouldReturnValidIfProtocolScheduleIsEmpty() {
payloadParams.getPrevRandao(),
Address.ECREC,
Optional.empty(),
Optional.empty(),
Optional.empty(),
Optional.empty(),
Optional.empty()))
.thenReturn(mockPayloadId);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,13 +98,13 @@ public void serialize_WithdrawalsPresent() {

private EnginePayloadAttributesParameter parameterWithdrawalsOmitted() {
return new EnginePayloadAttributesParameter(
TIMESTAMP, PREV_RANDAO, SUGGESTED_FEE_RECIPIENT_ADDRESS, null, null);
TIMESTAMP, PREV_RANDAO, SUGGESTED_FEE_RECIPIENT_ADDRESS, null, null, null, null, new UnsignedLongParameter(0L));
}

private EnginePayloadAttributesParameter parameterWithdrawalsPresent() {
final List<WithdrawalParameter> withdrawals = List.of(WITHDRAWAL_PARAM_1, WITHDRAWAL_PARAM_2);
return new EnginePayloadAttributesParameter(
TIMESTAMP, PREV_RANDAO, SUGGESTED_FEE_RECIPIENT_ADDRESS, withdrawals, null);
TIMESTAMP, PREV_RANDAO, SUGGESTED_FEE_RECIPIENT_ADDRESS, withdrawals, null, null, null, new UnsignedLongParameter(0L));
}

// TODO: add a parent beacon block root test here
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,9 @@ void withAllowedDepositRequestsAndContractAddress_DepositRequestsAreParsed() {
Optional.empty(),
Optional.empty(),
1L,
false);
false,
Optional.empty(),
Optional.empty());

List<Request> depositRequests = emptyList();
final Hash requestsRoot = BodyValidation.requestsRoot(depositRequests);
Expand All @@ -172,7 +174,9 @@ void withAllowedDepositRequestsAndNoContractAddress_DepositRequestsAreNotParsed(
Optional.empty(),
Optional.empty(),
1L,
false);
false,
Optional.empty(),
Optional.empty());

assertThat(blockCreationResult.getBlock().getHeader().getRequestsRoot()).isEmpty();
assertThat(blockCreationResult.getBlock().getBody().getRequests()).isEmpty();
Expand All @@ -190,7 +194,9 @@ void withProhibitedDepositRequests_DepositRequestsAreNotParsed() {
Optional.empty(),
Optional.empty(),
1L,
false);
false,
Optional.empty(),
Optional.empty());

assertThat(blockCreationResult.getBlock().getHeader().getRequestsRoot()).isEmpty();
assertThat(blockCreationResult.getBlock().getBody().getRequests()).isEmpty();
Expand Down Expand Up @@ -235,7 +241,9 @@ void withProcessorAndEmptyWithdrawals_NoWithdrawalsAreProcessed() {
Optional.empty(),
Optional.empty(),
1L,
false);
false,
Optional.empty(),
Optional.empty());
verify(withdrawalsProcessor, never()).processWithdrawals(any(), any());
assertThat(blockCreationResult.getBlock().getHeader().getWithdrawalsRoot()).isEmpty();
assertThat(blockCreationResult.getBlock().getBody().getWithdrawals()).isEmpty();
Expand All @@ -252,7 +260,9 @@ void withNoProcessorAndEmptyWithdrawals_NoWithdrawalsAreNotProcessed() {
Optional.empty(),
Optional.empty(),
1L,
false);
false,
Optional.empty(),
Optional.empty());
verify(withdrawalsProcessor, never()).processWithdrawals(any(), any());
assertThat(blockCreationResult.getBlock().getHeader().getWithdrawalsRoot()).isEmpty();
assertThat(blockCreationResult.getBlock().getBody().getWithdrawals()).isEmpty();
Expand All @@ -271,7 +281,9 @@ void withProcessorAndWithdrawals_WithdrawalsAreProcessed() {
Optional.empty(),
Optional.empty(),
1L,
false);
false,
Optional.empty(),
Optional.empty());

final Hash withdrawalsRoot = BodyValidation.withdrawalsRoot(withdrawals);
verify(withdrawalsProcessor).processWithdrawals(eq(withdrawals), any());
Expand All @@ -293,7 +305,9 @@ void withNoProcessorAndWithdrawals_WithdrawalsAreNotProcessed() {
Optional.empty(),
Optional.empty(),
1L,
false);
false,
Optional.empty(),
Optional.empty());
verify(withdrawalsProcessor, never()).processWithdrawals(any(), any());
assertThat(blockCreationResult.getBlock().getHeader().getWithdrawalsRoot()).isEmpty();
assertThat(blockCreationResult.getBlock().getBody().getWithdrawals()).isEmpty();
Expand Down Expand Up @@ -326,7 +340,9 @@ public void computesGasUsageFromIncludedTransactions() {
Optional.empty(),
Optional.empty(),
1L,
false);
false,
Optional.empty(),
Optional.empty());
long blobGasUsage = blockCreationResult.getBlock().getHeader().getGasUsed();
assertThat(blobGasUsage).isNotZero();
BlobGas excessBlobGas = blockCreationResult.getBlock().getHeader().getExcessBlobGas().get();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1274,7 +1274,8 @@ protected BlockTransactionSelector createBlockSelector(
GasLimitCalculator.constant(),
protocolSchedule.getByBlockHeader(blockHeader).getBlockHashProcessor(),
transactionSelectionService.createPluginTransactionSelector(),
ethScheduler);
ethScheduler,
Optional.empty());

return selector;
}
Expand Down
Loading

0 comments on commit a82b2b1

Please sign in to comment.