Skip to content

Commit bdfede5

Browse files
Merge branch 'main' into improve-performance-of-peerselector-peers
2 parents 88e0428 + ce0222b commit bdfede5

31 files changed

+1654
-624
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
### Additions and Improvements
1717
- Performance: Optimise EIP-196 AltBn128: EcAdd 33-128% faster, EcMul 8% faster [#9570](https://github.com/hyperledger/besu/pull/9570)
1818
- Update to Netty 4.2.9.Final [#9587](https://github.com/hyperledger/besu/pull/9587)
19+
- Update to log4j 2.25.3 [#9600](https://github.com/hyperledger/besu/pull/9600)
1920

2021
## 25.12.0
2122

app/src/main/java/org/hyperledger/besu/cli/options/BalConfigurationOptions.java

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,13 @@ public BalConfigurationOptions() {}
3232
description = "Allows disabling BAL-based optimizations.")
3333
boolean balOptimizationEnabled = true;
3434

35+
@CommandLine.Option(
36+
names = {"--Xbal-perfect-parallelization-enabled"},
37+
hidden = true,
38+
description =
39+
"Allows disabling BAL-based perfect parallelization even when BALs are present.")
40+
boolean balPerfectParallelizationEnabled = true;
41+
3542
@CommandLine.Option(
3643
names = {"--Xbal-lenient-on-state-root-mismatch"},
3744
hidden = true,
@@ -65,6 +72,13 @@ public BalConfigurationOptions() {}
6572
description = "Timeout in milliseconds when waiting for the BAL-computed state root.")
6673
private long balStateRootTimeoutMs = Duration.ofSeconds(1).toMillis();
6774

75+
@CommandLine.Option(
76+
names = {"--Xbal-processing-timeout"},
77+
hidden = true,
78+
paramLabel = "<INTEGER>",
79+
description = "Timeout in milliseconds when waiting for BAL transaction processing results.")
80+
private long balProcessingTimeoutMs = Duration.ofSeconds(1).toMillis();
81+
6882
/**
6983
* Builds the immutable {@link BalConfiguration} corresponding to the parsed CLI options.
7084
*
@@ -74,10 +88,12 @@ public BalConfiguration toDomainObject() {
7488
return ImmutableBalConfiguration.builder()
7589
.isBalApiEnabled(balApiEnabled)
7690
.isBalOptimisationEnabled(balOptimizationEnabled)
91+
.isPerfectParallelizationEnabled(balPerfectParallelizationEnabled)
7792
.shouldLogBalsOnMismatch(balLogBalsOnMismatch)
7893
.isBalLenientOnStateRootMismatch(balLenientOnStateRootMismatch)
7994
.isBalStateRootTrusted(balTrustStateRoot)
8095
.balStateRootTimeout(Duration.ofMillis(balStateRootTimeoutMs))
96+
.balProcessingTimeout(Duration.ofMillis(balProcessingTimeoutMs))
8197
.build();
8298
}
8399
}

config/src/main/java/org/hyperledger/besu/config/CheckpointConfigOptions.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,13 @@ Map<String, Object> asMap() {
9090

9191
@Override
9292
public String toString() {
93-
return "CheckpointConfigOptions{" + "checkpointConfigRoot=" + checkpointConfigRoot + '}';
93+
return "CheckpointConfigOptions{"
94+
+ "totaldifficulty="
95+
+ getTotalDifficulty().orElse("empty")
96+
+ ", number="
97+
+ (getNumber().isPresent() ? getNumber().getAsLong() : "empty")
98+
+ ", hash="
99+
+ getHash().orElse("empty")
100+
+ '}';
94101
}
95102
}

ethereum/core/src/jmh/java/org/hyperledger/besu/ethereum/vm/operations/AddOperationBenchmark.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,13 @@
1515
package org.hyperledger.besu.ethereum.vm.operations;
1616

1717
import org.hyperledger.besu.evm.frame.MessageFrame;
18-
import org.hyperledger.besu.evm.operation.AddOperation;
18+
import org.hyperledger.besu.evm.operation.AddOperationOptimized;
1919
import org.hyperledger.besu.evm.operation.Operation;
2020

2121
public class AddOperationBenchmark extends BinaryOperationBenchmark {
2222

2323
@Override
2424
protected Operation.OperationResult invoke(final MessageFrame frame) {
25-
return AddOperation.staticOperation(frame);
25+
return AddOperationOptimized.staticOperation(frame);
2626
}
2727
}

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,7 @@ public static BlockHeaderBuilder fromBuilder(final BlockHeaderBuilder fromBuilde
186186
.baseFee(fromBuilder.baseFee)
187187
.prevRandao(fromBuilder.mixHashOrPrevRandao)
188188
.withdrawalsRoot(fromBuilder.withdrawalsRoot)
189+
.blobGasUsed(fromBuilder.blobGasUsed)
189190
.excessBlobGas(fromBuilder.excessBlobGas)
190191
.parentBeaconBlockRoot(fromBuilder.parentBeaconBlockRoot)
191192
.requestsHash(fromBuilder.requestsHash)

ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/AbstractBlockProcessor.java

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
import org.hyperledger.besu.ethereum.mainnet.block.access.list.BlockAccessList.BlockAccessListBuilder;
3737
import org.hyperledger.besu.ethereum.mainnet.block.access.list.BlockAccessListFactory;
3838
import org.hyperledger.besu.ethereum.mainnet.block.access.list.PartialBlockAccessView;
39+
import org.hyperledger.besu.ethereum.mainnet.parallelization.PreprocessingContext;
3940
import org.hyperledger.besu.ethereum.mainnet.requests.RequestProcessingContext;
4041
import org.hyperledger.besu.ethereum.mainnet.requests.RequestProcessorCoordinator;
4142
import org.hyperledger.besu.ethereum.mainnet.staterootcommitter.StateRootCommitter;
@@ -85,7 +86,7 @@ TransactionReceipt create(
8586

8687
protected final boolean skipZeroBlockRewards;
8788
private final ProtocolSchedule protocolSchedule;
88-
private final BalConfiguration balConfiguration;
89+
protected final BalConfiguration balConfiguration;
8990

9091
protected final MiningBeneficiaryCalculator miningBeneficiaryCalculator;
9192
private BlockImportTracerProvider blockImportTracerProvider = null;
@@ -232,7 +233,8 @@ public BlockProcessingResult processBlock(
232233
miningBeneficiary,
233234
blockHashLookup,
234235
blobGasPrice,
235-
blockAccessListBuilder);
236+
blockAccessListBuilder,
237+
maybeBlockBal);
236238

237239
boolean parallelizedTxFound = false;
238240
int nbParallelTx = 0;
@@ -558,8 +560,6 @@ abstract boolean rewardCoinbase(
558560
final List<BlockHeader> ommers,
559561
final boolean skipZeroBlockRewards);
560562

561-
public interface PreprocessingContext {}
562-
563563
public interface PreprocessingFunction {
564564
Optional<PreprocessingContext> run(
565565
final ProtocolContext protocolContext,
@@ -568,7 +568,8 @@ Optional<PreprocessingContext> run(
568568
final Address miningBeneficiary,
569569
final BlockHashLookup blockHashLookup,
570570
final Wei blobGasPrice,
571-
final Optional<BlockAccessListBuilder> blockAccessListBuilder);
571+
final Optional<BlockAccessListBuilder> blockAccessListBuilder,
572+
final Optional<BlockAccessList> maybeBlockBal);
572573

573574
class NoPreprocessing implements PreprocessingFunction {
574575

@@ -580,7 +581,8 @@ public Optional<PreprocessingContext> run(
580581
final Address miningBeneficiary,
581582
final BlockHashLookup blockHashLookup,
582583
final Wei blobGasPrice,
583-
final Optional<BlockAccessListBuilder> blockAccessListBuilder) {
584+
final Optional<BlockAccessListBuilder> blockAccessListBuilder,
585+
final Optional<BlockAccessList> maybeBlockBal) {
584586
return Optional.empty();
585587
}
586588
}

ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/BalConfiguration.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,12 @@ default boolean isBalStateRootTrusted() {
4242
return false;
4343
}
4444

45+
/** Returns whether BAL perfect parallelization is enabled. */
46+
@Value.Default
47+
default boolean isPerfectParallelizationEnabled() {
48+
return true;
49+
}
50+
4551
/**
4652
* Returns whether mismatches between BAL and synchronously computed state roots should only log
4753
* an error instead of throwing an exception.
@@ -62,4 +68,10 @@ default boolean shouldLogBalsOnMismatch() {
6268
default Duration getBalStateRootTimeout() {
6369
return Duration.ofSeconds(1);
6470
}
71+
72+
/** Returns the timeout to use when waiting for BAL transaction processing results. */
73+
@Value.Default
74+
default Duration getBalProcessingTimeout() {
75+
return Duration.ofSeconds(1);
76+
}
6577
}

ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/block/access/list/PartialBlockAccessView.java

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,24 @@ public List<StorageSlotKey> getStorageReads() {
144144
public List<SlotChange> getStorageChanges() {
145145
return storageChanges;
146146
}
147+
148+
@Override
149+
public String toString() {
150+
return "AccountChanges{"
151+
+ "address="
152+
+ address
153+
+ ", storageChanges="
154+
+ storageChanges
155+
+ ", storageReads="
156+
+ storageReads
157+
+ ", postBalance="
158+
+ postBalance
159+
+ ", postBalance="
160+
+ postBalance
161+
+ ", newCode="
162+
+ newCode
163+
+ '}';
164+
}
147165
}
148166

149167
/** Builder for PartialBlockAccessView. */

0 commit comments

Comments
 (0)