use of org.hyperledger.besu.ethereum.privacy.storage.LegacyPrivateStateStorage in project besu by hyperledger.
the class PrivateStorageMigrationBuilder method build.
public PrivateStorageMigration build() {
final Blockchain blockchain = besuController.getProtocolContext().getBlockchain();
final Address privacyPrecompileAddress = privacyParameters.getPrivacyAddress();
final ProtocolSchedule protocolSchedule = besuController.getProtocolSchedule();
final WorldStateArchive publicWorldStateArchive = besuController.getProtocolContext().getWorldStateArchive();
final PrivateStateStorage privateStateStorage = privacyParameters.getPrivateStateStorage();
final LegacyPrivateStateStorage legacyPrivateStateStorage = privacyParameters.getPrivateStorageProvider().createLegacyPrivateStateStorage();
final PrivateStateRootResolver privateStateRootResolver = privacyParameters.getPrivateStateRootResolver();
return new PrivateStorageMigration(blockchain, privacyPrecompileAddress, protocolSchedule, publicWorldStateArchive, privateStateStorage, privateStateRootResolver, legacyPrivateStateStorage, PrivateMigrationBlockProcessor::new);
}
use of org.hyperledger.besu.ethereum.privacy.storage.LegacyPrivateStateStorage in project besu by hyperledger.
the class PrivateStorageMigrationTest method setUp.
@Before
public void setUp() {
final KeyValueStorage kvStorage = new InMemoryKeyValueStorage();
privateStateStorage = new PrivateStateKeyValueStorage(kvStorage);
privateStateRootResolver = new PrivateStateRootResolver(privateStateStorage);
lenient().when(protocolSchedule.getByBlockNumber(anyLong())).thenReturn(protocolSpec);
lenient().when(protocolSpec.getTransactionProcessor()).thenReturn(transactionProcessor);
lenient().when(protocolSpec.getTransactionReceiptFactory()).thenReturn(transactionReceiptFactory);
lenient().when(protocolSpec.getBlockReward()).thenReturn(Wei.ZERO);
lenient().when(protocolSpec.getMiningBeneficiaryCalculator()).thenReturn(miningBeneficiaryCalculator);
lenient().when(protocolSpec.isSkipZeroBlockRewards()).thenReturn(false);
migration = new PrivateStorageMigration(blockchain, PRIVACY_ADDRESS, protocolSchedule, publicWorldStateArchive, privateStateStorage, privateStateRootResolver, legacyPrivateStateStorage, (protocolSpec) -> privateMigrationBlockProcessor);
}
Aggregations