Skip to content

Commit

Permalink
Change StorageProvider to take DataStorageConfiguration instead of re…
Browse files Browse the repository at this point in the history
…ceipt compaction flag

Signed-off-by: Jason Frame <[email protected]>
  • Loading branch information
jframe committed Mar 14, 2024
1 parent 85ebf6e commit 1da59c0
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -579,9 +579,7 @@ public BesuController build() {

final BlockchainStorage blockchainStorage =
storageProvider.createBlockchainStorage(
protocolSchedule,
variablesStorage,
dataStorageConfiguration.getReceiptCompactionEnabled());
protocolSchedule, variablesStorage, dataStorageConfiguration);

final MutableBlockchain blockchain =
DefaultBlockchain.createMutable(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
package org.hyperledger.besu.controller;

import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyBoolean;
import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.lenient;
import static org.mockito.Mockito.mock;
Expand Down Expand Up @@ -119,7 +118,7 @@ public void setup() {
when(ethashConfigOptions.getFixedDifficulty()).thenReturn(OptionalLong.empty());
when(storageProvider.getStorageBySegmentIdentifier(any()))
.thenReturn(new InMemoryKeyValueStorage());
when(storageProvider.createBlockchainStorage(any(), any(), anyBoolean()))
when(storageProvider.createBlockchainStorage(any(), any(), any()))
.thenReturn(
new KeyValueStoragePrefixedKeyBlockchainStorage(
new InMemoryKeyValueStorage(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
import static org.assertj.core.api.Assertions.assertThat;
import static org.hyperledger.besu.ethereum.core.InMemoryKeyValueStorageProvider.createInMemoryBlockchain;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyBoolean;
import static org.mockito.ArgumentMatchers.anyLong;
import static org.mockito.Mockito.lenient;
import static org.mockito.Mockito.mock;
Expand Down Expand Up @@ -128,7 +127,7 @@ public void setup() {
when(genesisConfigOptions.getTerminalBlockHash()).thenReturn(Optional.of(Hash.ZERO));
lenient().when(genesisConfigOptions.getTerminalBlockNumber()).thenReturn(OptionalLong.of(1L));
lenient()
.when(storageProvider.createBlockchainStorage(any(), any(), anyBoolean()))
.when(storageProvider.createBlockchainStorage(any(), any(), any()))
.thenReturn(
new KeyValueStoragePrefixedKeyBlockchainStorage(
new InMemoryKeyValueStorage(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyBoolean;
import static org.mockito.Mockito.lenient;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
Expand Down Expand Up @@ -108,7 +107,7 @@ public void setup() {
lenient().when(genesisConfigFile.getConfigOptions()).thenReturn(genesisConfigOptions);
lenient().when(genesisConfigOptions.getCheckpointOptions()).thenReturn(checkpointConfigOptions);
lenient()
.when(storageProvider.createBlockchainStorage(any(), any(), anyBoolean()))
.when(storageProvider.createBlockchainStorage(any(), any(), any()))
.thenReturn(
new KeyValueStoragePrefixedKeyBlockchainStorage(
new InMemoryKeyValueStorage(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ public interface StorageProvider extends Closeable {
BlockchainStorage createBlockchainStorage(
ProtocolSchedule protocolSchedule,
VariablesStorage variablesStorage,
final boolean receiptCompaction);
DataStorageConfiguration storageConfiguration);

WorldStateStorage createWorldStateStorage(DataStorageConfiguration dataStorageFormat);
WorldStateStorage createWorldStateStorage(DataStorageConfiguration dataStorageConfiguration);

WorldStatePreimageStorage createWorldStatePreimageStorage();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,12 +70,12 @@ public VariablesStorage createVariablesStorage() {
public BlockchainStorage createBlockchainStorage(
final ProtocolSchedule protocolSchedule,
final VariablesStorage variablesStorage,
final boolean receiptCompaction) {
final DataStorageConfiguration dataStorageConfiguration) {
return new KeyValueStoragePrefixedKeyBlockchainStorage(
getStorageBySegmentIdentifier(KeyValueSegmentIdentifier.BLOCKCHAIN),
variablesStorage,
ScheduleBasedBlockHeaderFunctions.create(protocolSchedule),
receiptCompaction);
dataStorageConfiguration.getReceiptCompactionEnabled());
}

@Override
Expand Down

0 comments on commit 1da59c0

Please sign in to comment.