Skip to content

Commit 3915b86

Browse files
Merge branch 'main' into issue-10115
Signed-off-by: Sagar Khandagre <sagar.khandagre998@gmail.com>
2 parents b5de795 + a594202 commit 3915b86

File tree

216 files changed

+8560
-1630
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

216 files changed

+8560
-1630
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ are provided with different values, using input as per the execution-apis spec i
4141
- Upgrade besu-native libraries version to 1.5.0. This fixes the issue of besu-native/secp256r1 exporting OpenSSL symbols in JVM space. [besu-native #308](https://github.com/besu-eth/besu-native/pull/308)
4242

4343
### Additions and Improvements
44+
- Add `transactionReceipts` subscription type to `eth_subscribe` that pushes all transaction receipts when a new block is added, with optional `transactionHashes` filter to receive receipts for specific transactions only [#10190](https://github.com/besu-eth/besu/pull/10190)
4445
- `--net-restrict` now supports IPv6 CIDR notation (e.g. `fd00::/64`) in addition to IPv4, enabling subnet-based peer filtering in IPv6 and dual-stack deployments [#10028](https://github.com/besu-eth/besu/pull/10028)
4546
- Stop EngineQosTimer as part of shutdown [#9903](https://github.com/hyperledger/besu/pull/9903)
4647
- Add `--max-blobs-per-transaction` CLI option to configure the maximum number of blobs per transaction [#9912](https://github.com/hyperledger/besu/pull/9912)
@@ -51,6 +52,7 @@ are provided with different values, using input as per the execution-apis spec i
5152
- Support [EIP-8189](https://eips.ethereum.org/EIPS/eip-8189): snap/2 - block access list exchange
5253
- Limit pooled tx requests by size and remove pre-eth/68 transaction announcement support [#9990](https://github.com/besu-eth/besu/pull/9990)
5354
- Reduce tx p2p broadcast bandwidth and memory used [#9937](https://github.com/besu-eth/besu/pull/9937)
55+
- Improve syncing time of the experimental Bonsai Archive storage by migrating after a Bonsai full sync [#9979](https://github.com/besu-eth/besu/pull/9997)
5456

5557
### Plugin API
5658
- Plugin API: Allow the registration of multiple PluginTransactionPoolValidatorFactory [#9964](https://github.com/hyperledger/besu/pull/9964)
@@ -127,6 +129,7 @@ are provided with different values, using input as per the execution-apis spec i
127129
- Add ability to pass a custom tracer to block simulation [#9708](https://github.com/hyperledger/besu/pull/9708)
128130
- Add support for `4byteTracer` in `debug_trace*` methods to collect function selectors from internal calls via PR [#9642](https://github.com/hyperledger/besu/pull/9642). Thanks to [@JukLee0ira](https://github.com/JukLee0ira).
129131
- Update assertj to v3.27.7 [#9710](https://github.com/hyperledger/besu/pull/9710)
132+
- Update rocksdbjni lib version from 9.7.3 to 10.6.2 [#9767](https://github.com/hyperledger/besu/pull/9767)
130133
- Update vertx to 4.5.24 [#9645](https://github.com/hyperledger/besu/pull/9645)
131134
- Add byte-level metrics for P2P message exchange [#9666](https://github.com/hyperledger/besu/pull/9666)
132135
- Add IPv6 dual-stack support for DiscV5 peer discovery (enabled via `--Xv5-discovery-enabled`): new `--p2p-host-ipv6`, `--p2p-interface-ipv6`, and `--p2p-port-ipv6` CLI options enable a second UDP discovery socket; `--p2p-ipv6-outbound-enabled` controls whether IPv6 is preferred for outbound connections when a peer advertises both address families [#9763](https://github.com/hyperledger/besu/pull/9763); RLPx now also binds a second TCP socket on the IPv6 interface so IPv6-only peers can establish connections [#9873](https://github.com/hyperledger/besu/pull/9873)

acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/AcceptanceTestBase.java

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,6 @@
6262
import org.awaitility.Awaitility;
6363
import org.junit.jupiter.api.AfterEach;
6464
import org.junit.jupiter.api.BeforeEach;
65-
import org.junit.jupiter.api.Test;
6665
import org.junit.jupiter.api.TestInfo;
6766
import org.junit.jupiter.api.extension.ExtendWith;
6867
import org.slf4j.Logger;
@@ -210,11 +209,4 @@ protected void waitForFile(final Path path) {
210209
}
211210
});
212211
}
213-
214-
@Test
215-
public void dryRunDetector() {
216-
assertThat(true)
217-
.withFailMessage("This test is here so gradle --dry-run executes this class")
218-
.isTrue();
219-
}
220212
}

acceptance-tests/tests/src/acceptanceTest/java/org/hyperledger/besu/tests/acceptance/jsonrpc/AbstractJsonRpcTest.java

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@
4040
import okhttp3.Request;
4141
import okhttp3.RequestBody;
4242
import okhttp3.Response;
43-
import org.junit.jupiter.api.Test;
4443
import org.junit.jupiter.params.ParameterizedTest;
4544
import org.junit.jupiter.params.provider.Arguments;
4645
import org.junit.jupiter.params.provider.MethodSource;
@@ -148,11 +147,4 @@ public static Stream<Arguments> testCasesFromPath(final String testCasesPath)
148147

149148
return Arrays.stream(testCasesList).sorted().map(File::toURI).map(Arguments::of);
150149
}
151-
152-
@Test
153-
void dryRunDetector() {
154-
assertThat(true)
155-
.withFailMessage("This test is here so gradle --dry-run executes this class")
156-
.isTrue();
157-
}
158150
}

acceptance-tests/tests/src/acceptanceTest/resources/jsonrpc/engine/paris/test-cases/08_unknown_payload.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111
"jsonrpc": "2.0",
1212
"id": 67,
1313
"error": {
14-
"code": -32001,
15-
"message": "Payload does not exist / is not available"
14+
"code": -38001,
15+
"message": "Unknown payload"
1616
}
1717
},
1818
"statusCode": 200

app/src/main/java/org/hyperledger/besu/RunnerBuilder.java

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@
6161
import org.hyperledger.besu.ethereum.api.jsonrpc.websocket.subscription.pending.PendingTransactionDroppedSubscriptionService;
6262
import org.hyperledger.besu.ethereum.api.jsonrpc.websocket.subscription.pending.PendingTransactionSubscriptionService;
6363
import org.hyperledger.besu.ethereum.api.jsonrpc.websocket.subscription.syncing.SyncingSubscriptionService;
64+
import org.hyperledger.besu.ethereum.api.jsonrpc.websocket.subscription.transactionreceipts.TransactionReceiptsSubscriptionService;
6465
import org.hyperledger.besu.ethereum.api.query.BlockchainQueries;
6566
import org.hyperledger.besu.ethereum.blockcreation.MiningCoordinator;
6667
import org.hyperledger.besu.ethereum.chain.Blockchain;
@@ -934,6 +935,9 @@ public Runner build() {
934935
context.getBlockchain(), blockchainQueries, subscriptionManager);
935936

936937
createSyncingSubscriptionService(synchronizer, subscriptionManager);
938+
939+
createTransactionReceiptsSubscriptionService(
940+
context.getBlockchain(), blockchainQueries, subscriptionManager, protocolSchedule);
937941
}
938942

939943
Optional<EngineJsonRpcService> engineJsonRpcService = Optional.empty();
@@ -1435,6 +1439,18 @@ private void createNewBlockHeadersSubscriptionService(
14351439
blockchain.observeBlockAdded(newBlockHeadersSubscriptionService);
14361440
}
14371441

1442+
private void createTransactionReceiptsSubscriptionService(
1443+
final Blockchain blockchain,
1444+
final BlockchainQueries blockchainQueries,
1445+
final SubscriptionManager subscriptionManager,
1446+
final ProtocolSchedule protocolSchedule) {
1447+
final TransactionReceiptsSubscriptionService transactionReceiptsSubscriptionService =
1448+
new TransactionReceiptsSubscriptionService(
1449+
subscriptionManager, blockchainQueries, protocolSchedule);
1450+
1451+
blockchain.observeBlockAdded(transactionReceiptsSubscriptionService);
1452+
}
1453+
14381454
private WebSocketService createWebsocketService(
14391455
final Vertx vertx,
14401456
final WebSocketConfiguration configuration,

app/src/main/java/org/hyperledger/besu/cli/BesuCommand.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1917,7 +1917,10 @@ private void configure() throws Exception {
19171917

19181918
jsonRpcConfiguration =
19191919
jsonRpcHttpOptions.jsonRpcConfiguration(
1920-
hostsAllowlist, p2PDiscoveryConfig.p2pHost(), unstableRPCOptions.getHttpTimeoutSec());
1920+
hostsAllowlist,
1921+
p2PDiscoveryConfig.p2pHost(),
1922+
unstableRPCOptions.getHttpTimeoutSec(),
1923+
unstableRPCOptions.getHttpStreamingTimeoutSec());
19211924
logger.info("RPC HTTP JSON-RPC config: {}", jsonRpcConfiguration);
19221925
if (isEngineApiEnabled()) {
19231926
engineJsonRpcConfiguration = createEngineJsonRpcConfiguration();
@@ -2086,7 +2089,8 @@ private JsonRpcConfiguration createEngineJsonRpcConfiguration() {
20862089
jsonRpcHttpOptions.jsonRpcConfiguration(
20872090
engineRPCConfig.engineHostsAllowlist(),
20882091
p2PDiscoveryConfig.p2pHost(),
2089-
unstableRPCOptions.getHttpTimeoutSec());
2092+
unstableRPCOptions.getHttpTimeoutSec(),
2093+
unstableRPCOptions.getHttpStreamingTimeoutSec());
20902094
engineConfig.setPort(engineRPCConfig.engineRpcPort());
20912095
engineConfig.setRpcApis(Arrays.asList("ENGINE", "ETH"));
20922096
engineConfig.setEnabled(isEngineApiEnabled());

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

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -302,17 +302,22 @@ public JsonRpcConfiguration jsonRpcConfiguration() {
302302
* @param hostsAllowlist List of hosts allowed
303303
* @param defaultHostAddress Default host address
304304
* @param timeoutSec timeout in seconds
305+
* @param streamingTimeoutSec timeout in seconds for streaming methods
305306
* @return A JsonRpcConfiguration instance
306307
*/
307308
public JsonRpcConfiguration jsonRpcConfiguration(
308-
final List<String> hostsAllowlist, final String defaultHostAddress, final Long timeoutSec) {
309+
final List<String> hostsAllowlist,
310+
final String defaultHostAddress,
311+
final Long timeoutSec,
312+
final Long streamingTimeoutSec) {
309313

310314
final JsonRpcConfiguration jsonRpcConfiguration = this.jsonRpcConfiguration();
311315

312316
jsonRpcConfiguration.setHost(
313317
Strings.isNullOrEmpty(rpcHttpHost) ? defaultHostAddress : rpcHttpHost);
314318
jsonRpcConfiguration.setHostsAllowlist(hostsAllowlist);
315319
jsonRpcConfiguration.setHttpTimeoutSec(timeoutSec);
320+
jsonRpcConfiguration.setHttpStreamingTimeoutSec(streamingTimeoutSec);
316321
return jsonRpcConfiguration;
317322
}
318323

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

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
package org.hyperledger.besu.cli.options;
1616

1717
import org.hyperledger.besu.ethereum.api.handlers.TimeoutOptions;
18+
import org.hyperledger.besu.ethereum.api.jsonrpc.JsonRpcConfiguration;
1819

1920
import picocli.CommandLine;
2021

@@ -27,6 +28,14 @@ public class RPCOptions {
2728
description = "HTTP timeout in seconds (default: ${DEFAULT-VALUE})")
2829
private final Long httpTimeoutSec = TimeoutOptions.defaultOptions().getTimeoutSeconds();
2930

31+
@CommandLine.Option(
32+
hidden = true,
33+
names = {"--Xhttp-streaming-timeout-seconds"},
34+
description =
35+
"HTTP timeout in seconds for streaming methods like debug_traceBlock (default: ${DEFAULT-VALUE})")
36+
private final Long httpStreamingTimeoutSec =
37+
JsonRpcConfiguration.DEFAULT_HTTP_STREAMING_TIMEOUT_SEC;
38+
3039
@CommandLine.Option(
3140
hidden = true,
3241
names = {"--Xws-timeout-seconds"},
@@ -54,6 +63,15 @@ public Long getHttpTimeoutSec() {
5463
return httpTimeoutSec;
5564
}
5665

66+
/**
67+
* Gets http streaming timeout sec.
68+
*
69+
* @return the http streaming timeout sec
70+
*/
71+
public Long getHttpStreamingTimeoutSec() {
72+
return httpStreamingTimeoutSec;
73+
}
74+
5775
/**
5876
* Gets WebSocket timeout sec.
5977
*

app/src/main/java/org/hyperledger/besu/controller/BesuControllerBuilder.java

Lines changed: 62 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -92,11 +92,15 @@
9292
import org.hyperledger.besu.ethereum.trie.pathbased.bonsai.cache.BonsaiCachedMerkleTrieLoader;
9393
import org.hyperledger.besu.ethereum.trie.pathbased.bonsai.cache.CodeCache;
9494
import org.hyperledger.besu.ethereum.trie.pathbased.bonsai.storage.BonsaiWorldStateKeyValueStorage;
95+
import org.hyperledger.besu.ethereum.trie.pathbased.bonsai.storage.flat.BonsaiArchiveFlatDbStrategy;
9596
import org.hyperledger.besu.ethereum.trie.pathbased.bonsai.worldview.BonsaiArchiver;
97+
import org.hyperledger.besu.ethereum.trie.pathbased.bonsaiarchive.BonsaiFlatDbToArchiveMigrator;
9698
import org.hyperledger.besu.ethereum.trie.pathbased.common.storage.PathBasedWorldStateKeyValueStorage;
99+
import org.hyperledger.besu.ethereum.trie.pathbased.common.storage.flat.CodeHashCodeStorageStrategy;
97100
import org.hyperledger.besu.ethereum.trie.pathbased.common.trielog.TrieLogManager;
98101
import org.hyperledger.besu.ethereum.trie.pathbased.common.trielog.TrieLogPruner;
99102
import org.hyperledger.besu.ethereum.worldstate.DataStorageConfiguration;
103+
import org.hyperledger.besu.ethereum.worldstate.FlatDbMode;
100104
import org.hyperledger.besu.ethereum.worldstate.PathBasedExtraStorageConfiguration;
101105
import org.hyperledger.besu.ethereum.worldstate.WorldStateArchive;
102106
import org.hyperledger.besu.ethereum.worldstate.WorldStateArchive.WorldStateHealer;
@@ -121,6 +125,8 @@
121125
import java.util.Map;
122126
import java.util.Optional;
123127
import java.util.OptionalLong;
128+
import java.util.concurrent.ScheduledExecutorService;
129+
import java.util.concurrent.atomic.AtomicBoolean;
124130
import java.util.concurrent.atomic.AtomicLong;
125131
import java.util.concurrent.atomic.AtomicReference;
126132
import java.util.function.Supplier;
@@ -888,6 +894,10 @@ public BesuController build() {
888894
}
889895
}
890896

897+
final List<Closeable> closeables = new ArrayList<>();
898+
closeables.add(protocolContext.getWorldStateArchive());
899+
closeables.add(storageProvider);
900+
891901
if (DataStorageFormat.X_BONSAI_ARCHIVE.equals(
892902
dataStorageConfiguration.getDataStorageFormat())) {
893903
final BonsaiWorldStateKeyValueStorage worldStateKeyValueStorage =
@@ -898,12 +908,38 @@ public BesuController build() {
898908
blockchain,
899909
scheduler,
900910
((BonsaiWorldStateProvider) worldStateArchive).getTrieLogManager());
901-
blockchain.observeBlockAdded(archiver);
902-
}
903911

904-
final List<Closeable> closeables = new ArrayList<>();
905-
closeables.add(protocolContext.getWorldStateArchive());
906-
closeables.add(storageProvider);
912+
if (worldStateStorageCoordinator.isMatchingFlatMode(FlatDbMode.FULL)
913+
|| worldStateStorageCoordinator.isMatchingFlatMode(FlatDbMode.PARTIAL)) {
914+
final BonsaiFlatDbToArchiveMigrator archiveMigrator =
915+
createArchiveMigrator(worldStateStorageCoordinator, worldStateArchive, blockchain);
916+
closeables.add(archiveMigrator);
917+
918+
final AtomicBoolean migrationStarted = new AtomicBoolean(false);
919+
final AtomicLong syncSubscriptionId = new AtomicLong();
920+
syncSubscriptionId.set(
921+
synchronizer.subscribeInSync(
922+
(inSync) -> {
923+
if (inSync && migrationStarted.compareAndSet(false, true)) {
924+
synchronizer.unsubscribeInSync(syncSubscriptionId.get());
925+
LOG.info("Node is in sync, starting Bonsai archive migration");
926+
archiveMigrator
927+
.migrate()
928+
.thenRun(() -> blockchain.observeBlockAdded(archiver))
929+
.exceptionally(
930+
error -> {
931+
LOG.error(
932+
"Archive migration failed, archiver will remain disabled until restart",
933+
error);
934+
return null;
935+
});
936+
}
937+
},
938+
0));
939+
} else {
940+
blockchain.observeBlockAdded(archiver);
941+
}
942+
}
907943

908944
return new BesuController(
909945
protocolSchedule,
@@ -1011,6 +1047,27 @@ private BonsaiArchiver createBonsaiArchiver(
10111047
return archiver;
10121048
}
10131049

1050+
private BonsaiFlatDbToArchiveMigrator createArchiveMigrator(
1051+
final WorldStateStorageCoordinator worldStateStorageCoordinator,
1052+
final WorldStateArchive worldStateArchive,
1053+
final Blockchain blockchain) {
1054+
final BonsaiWorldStateKeyValueStorage worldStateKeyValueStorage =
1055+
worldStateStorageCoordinator.getStrategy(BonsaiWorldStateKeyValueStorage.class);
1056+
final TrieLogManager trieLogManager =
1057+
((BonsaiWorldStateProvider) worldStateArchive).getTrieLogManager();
1058+
final ScheduledExecutorService migrationExecutor =
1059+
MonitoredExecutors.newScheduledThreadPool("archive-migrator", 1, metricsSystem);
1060+
final BonsaiArchiveFlatDbStrategy archiveStrategy =
1061+
new BonsaiArchiveFlatDbStrategy(metricsSystem, new CodeHashCodeStorageStrategy());
1062+
return new BonsaiFlatDbToArchiveMigrator(
1063+
worldStateKeyValueStorage,
1064+
trieLogManager,
1065+
blockchain,
1066+
migrationExecutor,
1067+
metricsSystem,
1068+
archiveStrategy);
1069+
}
1070+
10141071
/**
10151072
* Create synchronizer synchronizer.
10161073
*

app/src/test/java/org/hyperledger/besu/ForkIdsNetworkConfigTest.java

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@
4949

5050
import com.google.common.collect.Streams;
5151
import org.apache.tuweni.bytes.Bytes;
52-
import org.junit.jupiter.api.Test;
5352
import org.junit.jupiter.api.extension.ExtendWith;
5453
import org.junit.jupiter.params.ParameterizedTest;
5554
import org.junit.jupiter.params.provider.MethodSource;
@@ -207,11 +206,4 @@ public Stream<Long> streamMilestoneBlocks() {
207206
MilestoneStreamingProtocolSchedule::streamMilestoneBlocks);
208207
}
209208
}
210-
211-
@Test
212-
void dryRunDetector() {
213-
assertThat(true)
214-
.withFailMessage("This test is here so gradle --dry-run executes this class")
215-
.isTrue();
216-
}
217209
}

0 commit comments

Comments
 (0)