use of org.hyperledger.besu.ethereum.api.jsonrpc.JsonRpcTestMethodsFactory in project besu by hyperledger.
the class EthGetBlockByNumberLatestDesyncIntegrationTest method setUpOnce.
@BeforeAll
public static void setUpOnce() throws Exception {
final String genesisJson = Resources.toString(BlockTestUtil.getTestGenesisUrl(), Charsets.UTF_8);
BlockchainImporter importer = new BlockchainImporter(BlockTestUtil.getTestBlockchainUrl(), genesisJson);
MutableBlockchain chain = InMemoryKeyValueStorageProvider.createInMemoryBlockchain(importer.getGenesisBlock());
WorldStateArchive state = InMemoryKeyValueStorageProvider.createInMemoryWorldStateArchive();
importer.getGenesisState().writeStateTo(state.getMutable());
ProtocolContext context = new ProtocolContext(chain, state, null);
for (final Block block : importer.getBlocks()) {
final ProtocolSchedule protocolSchedule = importer.getProtocolSchedule();
final ProtocolSpec protocolSpec = protocolSchedule.getByBlockNumber(block.getHeader().getNumber());
final BlockImporter blockImporter = protocolSpec.getBlockImporter();
blockImporter.importBlock(context, block, HeaderValidationMode.FULL);
}
methodsFactorySynced = new JsonRpcTestMethodsFactory(importer, chain, state, context);
WorldStateArchive unsynced = mock(WorldStateArchive.class);
when(unsynced.isWorldStateAvailable(any(Hash.class), any(Hash.class))).thenReturn(false);
methodsFactoryDesynced = new JsonRpcTestMethodsFactory(importer, chain, unsynced, context);
WorldStateArchive midSync = mock(WorldStateArchive.class);
when(midSync.isWorldStateAvailable(any(Hash.class), any(Hash.class))).thenReturn(true);
Synchronizer synchronizer = mock(Synchronizer.class);
SyncStatus status = mock(SyncStatus.class);
when(status.getCurrentBlock()).thenReturn(// random choice for current sync state.
ARBITRARY_SYNC_BLOCK);
when(synchronizer.getSyncStatus()).thenReturn(Optional.of(status));
methodsFactoryMidDownload = new JsonRpcTestMethodsFactory(importer, chain, midSync, context, synchronizer);
}
use of org.hyperledger.besu.ethereum.api.jsonrpc.JsonRpcTestMethodsFactory in project besu by hyperledger.
the class EthCallIntegrationTest method setUpOnce.
@BeforeAll
public static void setUpOnce() throws Exception {
final String genesisJson = Resources.toString(BlockTestUtil.getTestGenesisUrl(), Charsets.UTF_8);
BLOCKCHAIN = new JsonRpcTestMethodsFactory(new BlockchainImporter(BlockTestUtil.getTestBlockchainUrl(), genesisJson));
}
use of org.hyperledger.besu.ethereum.api.jsonrpc.JsonRpcTestMethodsFactory in project besu by hyperledger.
the class EthGetBlockByNumberIntegrationTest method setUpOnce.
@BeforeAll
public static void setUpOnce() throws Exception {
final String genesisJson = Resources.toString(BlockTestUtil.getTestGenesisUrl(), Charsets.UTF_8);
BLOCKCHAIN = new JsonRpcTestMethodsFactory(new BlockchainImporter(BlockTestUtil.getTestBlockchainUrl(), genesisJson));
}
use of org.hyperledger.besu.ethereum.api.jsonrpc.JsonRpcTestMethodsFactory in project besu by hyperledger.
the class EthGetUncleByBlockNumberAndIndexIntegrationTest method setUpOnce.
@BeforeAll
public static void setUpOnce() throws Exception {
final String genesisJson = Resources.toString(BlockTestUtil.getTestGenesisUrl(), Charsets.UTF_8);
BLOCKCHAIN = new JsonRpcTestMethodsFactory(new BlockchainImporter(BlockTestUtil.getTestBlockchainUrl(), genesisJson));
}
use of org.hyperledger.besu.ethereum.api.jsonrpc.JsonRpcTestMethodsFactory in project besu by hyperledger.
the class EthCallIntegrationTest method setUpOnce.
@BeforeAll
public static void setUpOnce() throws Exception {
final String genesisJson = Resources.toString(BlockTestUtil.getTestLondonGenesisUrl(), Charsets.UTF_8);
BLOCKCHAIN = new JsonRpcTestMethodsFactory(new BlockchainImporter(BlockTestUtil.getTestLondonBlockchainUrl(), genesisJson));
}
Aggregations