Signed-off-by: Karim Taam <karim.t2am@gmail.com>
pull/6209/head
Karim Taam 11 months ago
parent ccdb980692
commit 41fc466cd3
  1. 4
      besu/src/main/java/org/hyperledger/besu/cli/subcommands/operator/BackupState.java
  2. 2
      ethereum/core/src/main/java/org/hyperledger/besu/ethereum/trie/bonsai/worldview/BonsaiWorldState.java
  3. 4
      ethereum/core/src/main/java/org/hyperledger/besu/ethereum/trie/forest/pruner/Pruner.java
  4. 3
      ethereum/core/src/main/java/org/hyperledger/besu/ethereum/worldstate/WorldStateKeyValueStorage.java
  5. 2
      ethereum/core/src/main/java/org/hyperledger/besu/ethereum/worldstate/WorldStateStorageCoordinator.java
  6. 3
      ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/sync/snapsync/LoadLocalDataStep.java
  7. 1
      ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/sync/snapsync/request/heal/AccountTrieNodeHealingRequest.java
  8. 1
      ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/sync/snapsync/request/heal/StorageTrieNodeHealingRequest.java
  9. 1
      ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/sync/snapsync/request/heal/TrieNodeHealingRequest.java
  10. 3
      ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/sync/snapsync/AccountHealingTrackingTest.java
  11. 9
      ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/sync/snapsync/request/heal/StorageTrieNodeHealingRequestTest.java
  12. 2
      ethereum/rlp/src/main/java/org/hyperledger/besu/ethereum/rlp/RLPOutput.java

@ -81,7 +81,7 @@ public class BackupState implements Runnable {
final BesuController besuController = createBesuController();
final MutableBlockchain blockchain = besuController.getProtocolContext().getBlockchain();
final ForestWorldStateKeyValueStorage worldStateKeyValueStorage =
final ForestWorldStateKeyValueStorage forestWorldStateKeyValueStorage =
((ForestWorldStateArchive) besuController.getProtocolContext().getWorldStateArchive())
.getWorldStateStorage();
final EthScheduler scheduler = new EthScheduler(1, 1, 1, 1, new NoOpMetricsSystem());
@ -93,7 +93,7 @@ public class BackupState implements Runnable {
blockchain,
backupDir.toPath(),
scheduler,
worldStateKeyValueStorage);
forestWorldStateKeyValueStorage);
final BackupStatus status = backup.requestBackup(targetBlock, compress, Optional.empty());
final double refValue = Math.pow(2, 256) / 100.0d;

@ -557,7 +557,7 @@ public class BonsaiWorldState
return worldStateKeyValueStorage.getAccountStateTrieNode(location, nodeHash);
}
protected void writeTrieNode(
private void writeTrieNode(
final SegmentIdentifier segmentId,
final SegmentedKeyValueStorageTransaction tx,
final Bytes location,

@ -179,11 +179,11 @@ public class Pruner {
}
}
public PruningPhase getPruningPhase() {
PruningPhase getPruningPhase() {
return pruningPhase.get();
}
public enum PruningPhase {
enum PruningPhase {
IDLE,
MARK_BLOCK_CONFIRMATIONS_AWAITING,
MARKING,

@ -1,5 +1,5 @@
/*
* Copyright ConsenSys AG.
* Copyright Hyperledger Besu Contributors.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
@ -11,7 +11,6 @@
* specific language governing permissions and limitations under the License.
*
* SPDX-License-Identifier: Apache-2.0
*
*/
package org.hyperledger.besu.ethereum.worldstate;

@ -1,5 +1,5 @@
/*
* Copyright ConsenSys AG.
* Copyright Hyperledger Besu Contributors.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at

@ -69,8 +69,7 @@ public class LoadLocalDataStep {
// check if node is already stored in the worldstate
try {
if (snapSyncState.hasPivotBlockHeader()) {
Optional<Bytes> existingData =
request.getExistingData(downloadState, worldStateStorageCoordinator);
Optional<Bytes> existingData = request.getExistingData(worldStateStorageCoordinator);
if (existingData.isPresent()) {
existingNodeCounter.inc();
request.setData(existingData.get());

@ -77,7 +77,6 @@ public class AccountTrieNodeHealingRequest extends TrieNodeHealingRequest {
@Override
public Optional<Bytes> getExistingData(
final SnapWorldDownloadState downloadState,
final WorldStateStorageCoordinator worldStateStorageCoordinator) {
return worldStateStorageCoordinator
.getAccountStateTrieNode(getLocation(), getNodeHash())

@ -64,7 +64,6 @@ public class StorageTrieNodeHealingRequest extends TrieNodeHealingRequest {
@Override
public Optional<Bytes> getExistingData(
final SnapWorldDownloadState downloadState,
final WorldStateStorageCoordinator worldStateStorageCoordinator) {
return worldStateStorageCoordinator.getAccountStorageTrieNode(
getAccountHash(), getLocation(), getNodeHash());

@ -181,7 +181,6 @@ public abstract class TrieNodeHealingRequest extends SnapDataRequest
}
public abstract Optional<Bytes> getExistingData(
final SnapWorldDownloadState downloadState,
final WorldStateStorageCoordinator worldStateStorageCoordinator);
public abstract List<Bytes> getTrieNodePath();

@ -219,8 +219,7 @@ public class AccountHealingTrackingTest {
accountHash,
Hash.wrap(accountStateTrie.getRootHash()),
Bytes.EMPTY);
storageTrieNodeHealingRequest.getExistingData(
snapWorldDownloadState, worldStateStorageCoordinator);
storageTrieNodeHealingRequest.getExistingData(worldStateStorageCoordinator);
verify(snapWorldDownloadState, never()).addAccountToHealingList(any(Bytes.class));
}
}

@ -18,7 +18,6 @@ import org.hyperledger.besu.datatypes.Address;
import org.hyperledger.besu.datatypes.Hash;
import org.hyperledger.besu.ethereum.core.InMemoryKeyValueStorageProvider;
import org.hyperledger.besu.ethereum.core.TrieGenerator;
import org.hyperledger.besu.ethereum.eth.sync.snapsync.SnapWorldDownloadState;
import org.hyperledger.besu.ethereum.rlp.RLP;
import org.hyperledger.besu.ethereum.storage.StorageProvider;
import org.hyperledger.besu.ethereum.trie.MerkleTrie;
@ -42,13 +41,11 @@ import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.Arguments;
import org.junit.jupiter.params.provider.ArgumentsProvider;
import org.junit.jupiter.params.provider.ArgumentsSource;
import org.mockito.Mock;
import org.mockito.junit.jupiter.MockitoExtension;
@ExtendWith(MockitoExtension.class)
class StorageTrieNodeHealingRequestTest {
@Mock private SnapWorldDownloadState downloadState;
final List<Address> accounts =
List.of(
Address.fromHexString("0xdeadbeef"),
@ -102,8 +99,7 @@ class StorageTrieNodeHealingRequestTest {
new StorageTrieNodeHealingRequest(
account0StorageRoot, account0Hash, Hash.EMPTY, Bytes.EMPTY);
Assertions.assertThat(request.getExistingData(downloadState, worldStateStorageCoordinator))
.isPresent();
Assertions.assertThat(request.getExistingData(worldStateStorageCoordinator)).isPresent();
}
@ParameterizedTest
@ -113,7 +109,6 @@ class StorageTrieNodeHealingRequestTest {
final StorageTrieNodeHealingRequest request =
new StorageTrieNodeHealingRequest(Hash.EMPTY, account0Hash, Hash.EMPTY, Bytes.EMPTY);
Assertions.assertThat(request.getExistingData(downloadState, worldStateStorageCoordinator))
.isEmpty();
Assertions.assertThat(request.getExistingData(worldStateStorageCoordinator)).isEmpty();
}
}

@ -92,7 +92,7 @@ public interface RLPOutput {
/**
* Writes a RLP "null", that is an empty value.
*
* <p>This is a shortcut for writeUInt256Scalar{@code writeBytes(Bytes.EMPTY)}.
* <p>This is a shortcut for {@code writeBytes(Bytes.EMPTY)}.
*/
default void writeNull() {
writeBytes(Bytes.EMPTY);

Loading…
Cancel
Save