Search in sources :

Example 1 with TransactionReceiptFactory

use of org.hyperledger.besu.ethereum.mainnet.AbstractBlockProcessor.TransactionReceiptFactory 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);
}
Also used : PrivateStateRootResolver(org.hyperledger.besu.ethereum.privacy.PrivateStateRootResolver) Arrays(java.util.Arrays) PrivateTransactionMetadata(org.hyperledger.besu.ethereum.privacy.storage.PrivateTransactionMetadata) ArgumentMatchers.eq(org.mockito.ArgumentMatchers.eq) Assertions.assertThat(org.assertj.core.api.Assertions.assertThat) Mockito.verifyNoInteractions(org.mockito.Mockito.verifyNoInteractions) BlockDataGenerator(org.hyperledger.besu.ethereum.core.BlockDataGenerator) DEFAULT_PRIVACY(org.hyperledger.besu.ethereum.core.PrivacyParameters.DEFAULT_PRIVACY) Map(java.util.Map) BigInteger(java.math.BigInteger) Block(org.hyperledger.besu.ethereum.core.Block) Bytes32(org.apache.tuweni.bytes.Bytes32) Blockchain(org.hyperledger.besu.ethereum.chain.Blockchain) List(java.util.List) PrivateBlockMetadata(org.hyperledger.besu.ethereum.privacy.storage.PrivateBlockMetadata) InMemoryKeyValueStorage(org.hyperledger.besu.services.kvstore.InMemoryKeyValueStorage) Optional(java.util.Optional) ProtocolSpec(org.hyperledger.besu.ethereum.mainnet.ProtocolSpec) TransactionType(org.hyperledger.besu.plugin.data.TransactionType) MockitoJUnitRunner(org.mockito.junit.MockitoJUnitRunner) Hash(org.hyperledger.besu.datatypes.Hash) ArgumentMatchers.any(org.mockito.ArgumentMatchers.any) EMPTY_ROOT_HASH(org.hyperledger.besu.ethereum.privacy.PrivateStateRootResolver.EMPTY_ROOT_HASH) ArgumentMatchers.anyLong(org.mockito.ArgumentMatchers.anyLong) Mock(org.mockito.Mock) RunWith(org.junit.runner.RunWith) Bytes(org.apache.tuweni.bytes.Bytes) Mockito.lenient(org.mockito.Mockito.lenient) Address(org.hyperledger.besu.datatypes.Address) ArrayList(java.util.ArrayList) TransactionReceiptFactory(org.hyperledger.besu.ethereum.mainnet.AbstractBlockProcessor.TransactionReceiptFactory) ProtocolSchedule(org.hyperledger.besu.ethereum.mainnet.ProtocolSchedule) SCHEMA_VERSION_1_0_0(org.hyperledger.besu.ethereum.privacy.storage.PrivateStateKeyValueStorage.SCHEMA_VERSION_1_0_0) ArgumentCaptor(org.mockito.ArgumentCaptor) Assertions.assertThatThrownBy(org.assertj.core.api.Assertions.assertThatThrownBy) SCHEMA_VERSION_1_4_0(org.hyperledger.besu.ethereum.privacy.storage.PrivateStateKeyValueStorage.SCHEMA_VERSION_1_4_0) WorldStateArchive(org.hyperledger.besu.ethereum.worldstate.WorldStateArchive) Wei(org.hyperledger.besu.datatypes.Wei) Before(org.junit.Before) PrivateTransactionDataFixture.privateMarkerTransaction(org.hyperledger.besu.ethereum.core.PrivateTransactionDataFixture.privateMarkerTransaction) BlockHeader(org.hyperledger.besu.ethereum.core.BlockHeader) MutableWorldState(org.hyperledger.besu.ethereum.core.MutableWorldState) MainnetTransactionProcessor(org.hyperledger.besu.ethereum.mainnet.MainnetTransactionProcessor) PrivateStateStorage(org.hyperledger.besu.ethereum.privacy.storage.PrivateStateStorage) Test(org.junit.Test) Mockito.when(org.mockito.Mockito.when) SignatureAlgorithmFactory(org.hyperledger.besu.crypto.SignatureAlgorithmFactory) PrivateStateKeyValueStorage(org.hyperledger.besu.ethereum.privacy.storage.PrivateStateKeyValueStorage) Mockito.verify(org.mockito.Mockito.verify) LegacyPrivateStateStorage(org.hyperledger.besu.ethereum.privacy.storage.LegacyPrivateStateStorage) KeyValueStorage(org.hyperledger.besu.plugin.services.storage.KeyValueStorage) MiningBeneficiaryCalculator(org.hyperledger.besu.ethereum.mainnet.MiningBeneficiaryCalculator) Transaction(org.hyperledger.besu.ethereum.core.Transaction) PrivacyGroupHeadBlockMap(org.hyperledger.besu.ethereum.privacy.storage.PrivacyGroupHeadBlockMap) InMemoryKeyValueStorage(org.hyperledger.besu.services.kvstore.InMemoryKeyValueStorage) InMemoryKeyValueStorage(org.hyperledger.besu.services.kvstore.InMemoryKeyValueStorage) PrivateStateKeyValueStorage(org.hyperledger.besu.ethereum.privacy.storage.PrivateStateKeyValueStorage) KeyValueStorage(org.hyperledger.besu.plugin.services.storage.KeyValueStorage) PrivateStateRootResolver(org.hyperledger.besu.ethereum.privacy.PrivateStateRootResolver) PrivateStateKeyValueStorage(org.hyperledger.besu.ethereum.privacy.storage.PrivateStateKeyValueStorage) Before(org.junit.Before)

Aggregations

BigInteger (java.math.BigInteger)1 ArrayList (java.util.ArrayList)1 Arrays (java.util.Arrays)1 List (java.util.List)1 Map (java.util.Map)1 Optional (java.util.Optional)1 Bytes (org.apache.tuweni.bytes.Bytes)1 Bytes32 (org.apache.tuweni.bytes.Bytes32)1 Assertions.assertThat (org.assertj.core.api.Assertions.assertThat)1 Assertions.assertThatThrownBy (org.assertj.core.api.Assertions.assertThatThrownBy)1 SignatureAlgorithmFactory (org.hyperledger.besu.crypto.SignatureAlgorithmFactory)1 Address (org.hyperledger.besu.datatypes.Address)1 Hash (org.hyperledger.besu.datatypes.Hash)1 Wei (org.hyperledger.besu.datatypes.Wei)1 Blockchain (org.hyperledger.besu.ethereum.chain.Blockchain)1 Block (org.hyperledger.besu.ethereum.core.Block)1 BlockDataGenerator (org.hyperledger.besu.ethereum.core.BlockDataGenerator)1 BlockHeader (org.hyperledger.besu.ethereum.core.BlockHeader)1 MutableWorldState (org.hyperledger.besu.ethereum.core.MutableWorldState)1 DEFAULT_PRIVACY (org.hyperledger.besu.ethereum.core.PrivacyParameters.DEFAULT_PRIVACY)1