Skip to content

Commit 710b25f

Browse files
committed
fix: test case
1 parent cf77337 commit 710b25f

25 files changed

Lines changed: 170 additions & 71 deletions

File tree

besu/src/main/java/org/hyperledger/besu/cli/config/EthNetworkConfig.java

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
import java.net.URL;
2727
import java.nio.charset.StandardCharsets;
2828
import java.util.Collections;
29+
import java.util.HashMap;
2930
import java.util.List;
3031
import java.util.Map;
3132
import java.util.Objects;
@@ -88,7 +89,7 @@ public static EthNetworkConfig getNetworkConfig(final NetworkName networkName) {
8889
.orElse(Collections.emptyList());
8990
return new EthNetworkConfig(
9091
genesisConfigFile,
91-
null,
92+
new HashMap<>(),
9293
networkName.getNetworkId(),
9394
bootNodes,
9495
genesisConfigOptions.getDiscoveryOptions().getDiscoveryDnsUrl().orElse(null));
@@ -119,7 +120,7 @@ public static class Builder {
119120
private String dnsDiscoveryUrl;
120121
private GenesisConfigFile genesisConfigFile;
121122
private BigInteger networkId;
122-
private final List<EnodeURL> bootNodes;
123+
private List<EnodeURL> bootNodes;
123124
private Map<String, String> genesisConfigOverrides;
124125

125126
/**
@@ -132,6 +133,7 @@ public Builder(final EthNetworkConfig ethNetworkConfig) {
132133
this.networkId = ethNetworkConfig.networkId;
133134
this.bootNodes = ethNetworkConfig.bootNodes;
134135
this.dnsDiscoveryUrl = ethNetworkConfig.dnsDiscoveryUrl;
136+
this.genesisConfigOverrides = ethNetworkConfig.genesisConfigOverrides;
135137
}
136138

137139
/**
@@ -174,15 +176,7 @@ public Builder setNetworkId(final BigInteger networkId) {
174176
* @return this builder
175177
*/
176178
public Builder setBootNodes(final List<EnodeURL> bootNodes) {
177-
if (bootNodes == null) {
178-
return this;
179-
}
180-
bootNodes.forEach(
181-
bootNode -> {
182-
if (!this.bootNodes.contains(bootNode)) {
183-
this.bootNodes.add(bootNode);
184-
}
185-
});
179+
this.bootNodes = bootNodes;
186180
return this;
187181
}
188182

besu/src/test/java/org/hyperledger/besu/cli/CascadingDefaultProviderTest.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,7 @@ public void overrideDefaultValuesIfKeyIsPresentInConfigFile(final @TempDir File
133133
GenesisConfigFile.fromConfig(encodeJsonGenesis(GENESIS_VALID_JSON)))
134134
.setBootNodes(nodes)
135135
.setDnsDiscoveryUrl(null)
136+
.setGenesisConfigOverrides(new HashMap<>())
136137
.build();
137138
verify(mockControllerBuilder).dataDirectory(eq(dataFolder.toPath()));
138139
verify(mockControllerBuilderFactory).fromEthNetworkConfig(eq(networkConfig), any());

besu/src/test/java/org/hyperledger/besu/cli/options/TransactionPoolOptionsTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -413,7 +413,7 @@ public void maxPrioritizedTxsPerTypeConfigFile() throws IOException {
413413
@Test
414414
public void maxPrioritizedTxsPerTypeWrongTxType() {
415415
internalTestFailure(
416-
"Invalid value for option '--tx-pool-max-prioritized-by-type' (MAP<TYPE,INTEGER>): expected one of [FRONTIER, ACCESS_LIST, EIP1559, BLOB, SET_CODE] (case-insensitive) but was 'WRONG_TYPE'",
416+
"Invalid value for option '--tx-pool-max-prioritized-by-type' (MAP<TYPE,INTEGER>): expected one of [FRONTIER, ACCESS_LIST, EIP1559, BLOB, SET_CODE, OPTIMISM_DEPOSIT] (case-insensitive) but was 'WRONG_TYPE'",
417417
"--tx-pool-max-prioritized-by-type",
418418
"WRONG_TYPE=1");
419419
}

besu/src/test/java/org/hyperledger/besu/services/BesuEventsImplTest.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
import static org.assertj.core.api.Assertions.assertThat;
1818
import static org.mockito.ArgumentMatchers.any;
1919
import static org.mockito.ArgumentMatchers.anyBoolean;
20-
import static org.mockito.ArgumentMatchers.anyLong;
2120
import static org.mockito.Mockito.lenient;
2221
import static org.mockito.Mockito.mock;
2322
import static org.mockito.Mockito.when;
@@ -146,7 +145,7 @@ public void setUp() {
146145
.when(
147146
mockTransactionValidatorFactory
148147
.get()
149-
.validate(any(), anyLong(), any(Optional.class), any(Optional.class), any()))
148+
.validate(any(), any(), any(Optional.class), any(Optional.class), any()))
150149
.thenReturn(ValidationResult.valid());
151150
lenient()
152151
.when(mockTransactionValidatorFactory.get().validateForSender(any(), any(), any()))

ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/parameters/EnginePayloadAttributesParameter.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ public EnginePayloadAttributesParameter(
5555
parentBeaconBlockRoot == null ? null : Bytes32.fromHexString(parentBeaconBlockRoot);
5656
this.noTxPool = noTxPool;
5757
this.transactions = transactions;
58-
this.gasLimit = gasLimit.getValue();
58+
this.gasLimit = gasLimit == null ? null : gasLimit.getValue();
5959
}
6060

6161
public Long getTimestamp() {

ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/engine/AbstractEngineForkchoiceUpdatedTest.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ public void shouldReturnValidWithoutFinalizedWithPayload() {
248248
null,
249249
null,
250250
null,
251-
new UnsignedLongParameter(0L));
251+
null);
252252
var mockPayloadId =
253253
PayloadIdentifier.forPayloadParams(
254254
mockHeader.getHash(),
@@ -512,7 +512,7 @@ public void shouldReturnInvalidIfWithdrawalsIsNotNull_WhenWithdrawalsProhibited(
512512
null,
513513
null,
514514
null,
515-
new UnsignedLongParameter(0L));
515+
null);
516516

517517
var resp =
518518
resp(
@@ -540,7 +540,7 @@ public void shouldReturnValidIfWithdrawalsIsNull_WhenWithdrawalsProhibited() {
540540
null,
541541
null,
542542
null,
543-
new UnsignedLongParameter(0L));
543+
null);
544544

545545
var mockPayloadId =
546546
PayloadIdentifier.forPayloadParams(
@@ -629,7 +629,7 @@ public void shouldReturnValidIfWithdrawalsIsNotNull_WhenWithdrawalsAllowed() {
629629
null,
630630
null,
631631
null,
632-
new UnsignedLongParameter(0L));
632+
null);
633633

634634
final Optional<List<Withdrawal>> withdrawals =
635635
Optional.of(
@@ -684,7 +684,7 @@ public void shouldReturnValidIfProtocolScheduleIsEmpty() {
684684
null,
685685
null,
686686
null,
687-
new UnsignedLongParameter(0L));
687+
null);
688688

689689
var mockPayloadId =
690690
PayloadIdentifier.forPayloadParams(

ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/engine/EngineForkchoiceUpdatedV2Test.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,9 @@ public void shouldReturnUnsupportedForkIfBlockTimestampIsAfterCancunMilestone()
7373
Bytes32.fromHexStringLenient("0xDEADBEEF").toHexString(),
7474
Address.ECREC.toString(),
7575
null,
76+
null,
77+
false,
78+
null,
7679
null);
7780

7881
final JsonRpcResponse resp = resp(param, Optional.of(payloadParams));

ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/parameters/EnginePayloadAttributesParameterTest.java

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -98,14 +98,7 @@ public void serialize_WithdrawalsPresent() {
9898

9999
private EnginePayloadAttributesParameter parameterWithdrawalsOmitted() {
100100
return new EnginePayloadAttributesParameter(
101-
TIMESTAMP,
102-
PREV_RANDAO,
103-
SUGGESTED_FEE_RECIPIENT_ADDRESS,
104-
null,
105-
null,
106-
null,
107-
null,
108-
new UnsignedLongParameter(0L));
101+
TIMESTAMP, PREV_RANDAO, SUGGESTED_FEE_RECIPIENT_ADDRESS, null, null, null, null, null);
109102
}
110103

111104
private EnginePayloadAttributesParameter parameterWithdrawalsPresent() {
@@ -118,7 +111,7 @@ private EnginePayloadAttributesParameter parameterWithdrawalsPresent() {
118111
null,
119112
null,
120113
null,
121-
new UnsignedLongParameter(0L));
114+
null);
122115
}
123116

124117
// TODO: add a parent beacon block root test here

ethereum/blockcreation/src/test/java/org/hyperledger/besu/ethereum/blockcreation/AbstractBlockCreatorTest.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@
9696
import java.time.Clock;
9797
import java.util.List;
9898
import java.util.Optional;
99+
import java.util.OptionalLong;
99100

100101
import com.google.common.base.Supplier;
101102
import com.google.common.base.Suppliers;
@@ -499,6 +500,7 @@ static class AlwaysValidTransactionValidator implements TransactionValidator {
499500
@Override
500501
public ValidationResult<TransactionInvalidReason> validate(
501502
final Transaction transaction,
503+
final OptionalLong blockTimestamp,
502504
final Optional<Wei> baseFee,
503505
final Optional<Wei> blobBaseFee,
504506
final TransactionValidationParams transactionValidationParams) {

ethereum/core/src/main/java/org/hyperledger/besu/ethereum/core/TransactionReceipt.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -370,7 +370,7 @@ public static TransactionReceipt readFrom(
370370
return new TransactionReceipt(
371371
transactionType,
372372
stateRoot,
373-
0,
373+
-1,
374374
cumulativeGas,
375375
logs,
376376
bloomFilter,

0 commit comments

Comments
 (0)