Load Mainnet ProtocolSchedule Faster and With Less Memory Usage (#1688)

The change from create to DEFAULT was something that I saw was needed 
to keep the reference tests performant in the upcoming EIP-2718 changes.

The change from reading the whole mainnet genesis to reading just the 
config portion came from OutOfMemoryErrors in the reference tests when 
running normalizeKeys.

Also moved them to ProtocolTestFixture since they're only used by tests.

Signed-off-by: Ratan Rai Sur <ratan.r.sur@gmail.com>
pull/1690/head
Ratan (Rai) Sur 4 years ago committed by GitHub
parent 99dcf50ee5
commit f78476a4e6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      ethereum/api/src/integration-test/java/org/hyperledger/besu/ethereum/api/jsonrpc/JsonRpcTestMethodsFactory.java
  2. 4
      ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/graphql/AbstractEthGraphQLHttpServiceTest.java
  3. 6
      ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/JsonRpcHttpServiceRpcApisTest.java
  4. 6
      ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/MainnetProtocolSchedule.java
  5. 55
      ethereum/core/src/test-support/java/org/hyperledger/besu/ethereum/core/ProtocolScheduleFixture.java
  6. 12
      ethereum/core/src/test/java/org/hyperledger/besu/ethereum/chain/GenesisStateTest.java
  7. 3
      ethereum/core/src/test/java/org/hyperledger/besu/ethereum/mainnet/MainnetProtocolScheduleTest.java
  8. 4
      ethereum/core/src/test/java/org/hyperledger/besu/ethereum/mainnet/headervalidationrules/ProofOfWorkValidationRuleTest.java
  9. 4
      ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/manager/EthProtocolManagerTest.java
  10. 4
      ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/manager/EthProtocolManagerTestUtil.java
  11. 4
      ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/messages/NewBlockMessageTest.java
  12. 8
      ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/peervalidation/DaoForkPeerValidatorTest.java
  13. 8
      ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/peervalidation/RequiredBlocksPeerValidatorTest.java
  14. 4
      ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/sync/fullsync/FullSyncTargetManagerTest.java
  15. 4
      ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/sync/tasks/DetermineCommonAncestorTaskParameterizedTest.java
  16. 4
      ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/sync/tasks/DetermineCommonAncestorTaskTest.java
  17. 4
      ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/sync/worldstate/WorldStateDownloaderTest.java
  18. 4
      ethereum/permissioning/src/test/java/org/hyperledger/besu/ethereum/permissioning/NodeSmartContractPermissioningControllerTest.java
  19. 4
      ethereum/permissioning/src/test/java/org/hyperledger/besu/ethereum/permissioning/TransactionSmartContractPermissioningControllerTest.java

@ -31,11 +31,11 @@ import org.hyperledger.besu.ethereum.chain.MutableBlockchain;
import org.hyperledger.besu.ethereum.core.Block;
import org.hyperledger.besu.ethereum.core.BlockImporter;
import org.hyperledger.besu.ethereum.core.PrivacyParameters;
import org.hyperledger.besu.ethereum.core.ProtocolScheduleFixture;
import org.hyperledger.besu.ethereum.core.Synchronizer;
import org.hyperledger.besu.ethereum.eth.manager.EthPeers;
import org.hyperledger.besu.ethereum.eth.transactions.TransactionPool;
import org.hyperledger.besu.ethereum.mainnet.HeaderValidationMode;
import org.hyperledger.besu.ethereum.mainnet.MainnetProtocolSchedule;
import org.hyperledger.besu.ethereum.mainnet.ProtocolSchedule;
import org.hyperledger.besu.ethereum.mainnet.ProtocolSpec;
import org.hyperledger.besu.ethereum.p2p.network.P2PNetwork;
@ -127,7 +127,7 @@ public class JsonRpcTestMethodsFactory {
peerDiscovery,
blockchainQueries,
synchronizer,
MainnetProtocolSchedule.create(),
ProtocolScheduleFixture.MAINNET,
filterManager,
transactionPool,
miningCoordinator,

@ -25,6 +25,7 @@ import org.hyperledger.besu.ethereum.core.BlockHeader;
import org.hyperledger.besu.ethereum.core.BlockImporter;
import org.hyperledger.besu.ethereum.core.DefaultSyncStatus;
import org.hyperledger.besu.ethereum.core.InMemoryStorageProvider;
import org.hyperledger.besu.ethereum.core.ProtocolScheduleFixture;
import org.hyperledger.besu.ethereum.core.Synchronizer;
import org.hyperledger.besu.ethereum.core.Transaction;
import org.hyperledger.besu.ethereum.core.Wei;
@ -34,7 +35,6 @@ import org.hyperledger.besu.ethereum.eth.transactions.PendingTransactions;
import org.hyperledger.besu.ethereum.eth.transactions.TransactionPool;
import org.hyperledger.besu.ethereum.mainnet.HeaderValidationMode;
import org.hyperledger.besu.ethereum.mainnet.MainnetBlockHeaderFunctions;
import org.hyperledger.besu.ethereum.mainnet.MainnetProtocolSchedule;
import org.hyperledger.besu.ethereum.mainnet.ProtocolSchedule;
import org.hyperledger.besu.ethereum.mainnet.ProtocolSpec;
import org.hyperledger.besu.ethereum.mainnet.ValidationResult;
@ -95,7 +95,7 @@ public abstract class AbstractEthGraphQLHttpServiceTest {
@BeforeClass
public static void setupConstants() throws Exception {
PROTOCOL_SCHEDULE = MainnetProtocolSchedule.create();
PROTOCOL_SCHEDULE = ProtocolScheduleFixture.MAINNET;
final URL blocksUrl = BlockTestUtil.getTestBlockchainUrl();

@ -31,11 +31,11 @@ import org.hyperledger.besu.ethereum.api.query.BlockchainQueries;
import org.hyperledger.besu.ethereum.blockcreation.EthHashMiningCoordinator;
import org.hyperledger.besu.ethereum.core.InMemoryStorageProvider;
import org.hyperledger.besu.ethereum.core.PrivacyParameters;
import org.hyperledger.besu.ethereum.core.ProtocolScheduleFixture;
import org.hyperledger.besu.ethereum.core.Synchronizer;
import org.hyperledger.besu.ethereum.eth.EthProtocol;
import org.hyperledger.besu.ethereum.eth.manager.EthPeers;
import org.hyperledger.besu.ethereum.eth.transactions.TransactionPool;
import org.hyperledger.besu.ethereum.mainnet.MainnetProtocolSchedule;
import org.hyperledger.besu.ethereum.p2p.config.DiscoveryConfiguration;
import org.hyperledger.besu.ethereum.p2p.config.NetworkingConfiguration;
import org.hyperledger.besu.ethereum.p2p.config.RlpxConfiguration;
@ -200,7 +200,7 @@ public class JsonRpcHttpServiceRpcApisTest {
mock(P2PNetwork.class),
blockchainQueries,
mock(Synchronizer.class),
MainnetProtocolSchedule.create(),
ProtocolScheduleFixture.MAINNET,
mock(FilterManager.class),
mock(TransactionPool.class),
mock(EthHashMiningCoordinator.class),
@ -296,7 +296,7 @@ public class JsonRpcHttpServiceRpcApisTest {
p2pNetwork,
blockchainQueries,
mock(Synchronizer.class),
MainnetProtocolSchedule.create(),
ProtocolScheduleFixture.MAINNET,
mock(FilterManager.class),
mock(TransactionPool.class),
mock(EthHashMiningCoordinator.class),

@ -14,7 +14,6 @@
*/
package org.hyperledger.besu.ethereum.mainnet;
import org.hyperledger.besu.config.GenesisConfigFile;
import org.hyperledger.besu.config.GenesisConfigOptions;
import org.hyperledger.besu.ethereum.core.PrivacyParameters;
import org.hyperledger.besu.ethereum.difficulty.fixed.FixedDifficultyCalculators;
@ -28,11 +27,6 @@ public class MainnetProtocolSchedule {
public static final BigInteger DEFAULT_CHAIN_ID = BigInteger.ONE;
public static ProtocolSchedule create() {
return fromConfig(
GenesisConfigFile.mainnet().getConfigOptions(), PrivacyParameters.DEFAULT, false);
}
/**
* Create a Mainnet protocol schedule from a config object
*

@ -0,0 +1,55 @@
/*
* Copyright ConsenSys AG.
*
* 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
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
* specific language governing permissions and limitations under the License.
*
* SPDX-License-Identifier: Apache-2.0
*/
package org.hyperledger.besu.ethereum.core;
import static org.hyperledger.besu.config.JsonUtil.normalizeKeys;
import org.hyperledger.besu.config.GenesisConfigFile;
import org.hyperledger.besu.config.GenesisConfigOptions;
import org.hyperledger.besu.config.JsonGenesisConfigOptions;
import org.hyperledger.besu.ethereum.mainnet.MainnetProtocolSchedule;
import org.hyperledger.besu.ethereum.mainnet.ProtocolSchedule;
import java.io.IOException;
import com.fasterxml.jackson.core.JsonFactory;
import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.core.JsonToken;
import com.fasterxml.jackson.databind.ObjectMapper;
public class ProtocolScheduleFixture {
public static final ProtocolSchedule MAINNET =
MainnetProtocolSchedule.fromConfig(
getMainnetConfigOptions(), PrivacyParameters.DEFAULT, false);
private static GenesisConfigOptions getMainnetConfigOptions() {
// this method avoids reading all the alloc accounts when all we want is the "config" section
try (final JsonParser jsonParser =
new JsonFactory().createParser(GenesisConfigFile.class.getResource("/mainnet.json"))) {
while (jsonParser.nextToken() != JsonToken.END_OBJECT) {
if ("config".equals(jsonParser.getCurrentName())) {
jsonParser.nextToken();
return JsonGenesisConfigOptions.fromJsonObject(
normalizeKeys(new ObjectMapper().readTree(jsonParser)));
}
}
} catch (IOException e) {
throw new RuntimeException("Failed open or parse mainnet genesis json", e);
}
throw new IllegalArgumentException("mainnet json file had no config section");
}
}

@ -23,7 +23,7 @@ import org.hyperledger.besu.ethereum.core.BlockHeader;
import org.hyperledger.besu.ethereum.core.Hash;
import org.hyperledger.besu.ethereum.core.InMemoryStorageProvider;
import org.hyperledger.besu.ethereum.core.MutableWorldState;
import org.hyperledger.besu.ethereum.mainnet.MainnetProtocolSchedule;
import org.hyperledger.besu.ethereum.core.ProtocolScheduleFixture;
import org.hyperledger.besu.ethereum.rlp.BytesValueRLPOutput;
import com.google.common.base.Charsets;
@ -63,7 +63,7 @@ public final class GenesisStateTest {
final GenesisState genesisState =
GenesisState.fromJson(
Resources.toString(GenesisStateTest.class.getResource("genesis1.json"), Charsets.UTF_8),
MainnetProtocolSchedule.create());
ProtocolScheduleFixture.MAINNET);
final BlockHeader header = genesisState.getBlock().getHeader();
assertThat(header.getStateRoot())
.isEqualTo(
@ -91,7 +91,7 @@ public final class GenesisStateTest {
final GenesisState genesisState =
GenesisState.fromJson(
Resources.toString(GenesisStateTest.class.getResource("genesis2.json"), Charsets.UTF_8),
MainnetProtocolSchedule.create());
ProtocolScheduleFixture.MAINNET);
final BlockHeader header = genesisState.getBlock().getHeader();
assertThat(header.getStateRoot()).isEqualTo(Hash.EMPTY_TRIE_HASH);
assertThat(header.getTransactionsRoot()).isEqualTo(Hash.EMPTY_TRIE_HASH);
@ -106,7 +106,7 @@ public final class GenesisStateTest {
final GenesisState genesisState =
GenesisState.fromJson(
Resources.toString(GenesisStateTest.class.getResource(sourceFile), Charsets.UTF_8),
MainnetProtocolSchedule.create());
ProtocolScheduleFixture.MAINNET);
final BlockHeader header = genesisState.getBlock().getHeader();
assertThat(header.getHash()).isEqualTo(Hash.fromHexString(blockHash));
@ -144,7 +144,7 @@ public final class GenesisStateTest {
GenesisState.fromJson(
Resources.toString(
GenesisStateTest.class.getResource("genesisNonce.json"), Charsets.UTF_8),
MainnetProtocolSchedule.create());
ProtocolScheduleFixture.MAINNET);
final BlockHeader header = genesisState.getBlock().getHeader();
assertThat(header.getHash())
.isEqualTo(
@ -158,7 +158,7 @@ public final class GenesisStateTest {
GenesisState.fromJson(
Resources.toString(
GenesisStateTest.class.getResource("genesis-olympic.json"), Charsets.UTF_8),
MainnetProtocolSchedule.create());
ProtocolScheduleFixture.MAINNET);
final BytesValueRLPOutput tmp = new BytesValueRLPOutput();
genesisState.getBlock().writeTo(tmp);
assertThat(Hex.toHexString(genesisState.getBlock().getHeader().getHash().toArray()))

@ -15,6 +15,7 @@
package org.hyperledger.besu.ethereum.mainnet;
import org.hyperledger.besu.config.GenesisConfigFile;
import org.hyperledger.besu.ethereum.core.ProtocolScheduleFixture;
import java.nio.charset.StandardCharsets;
@ -26,7 +27,7 @@ public class MainnetProtocolScheduleTest {
@Test
public void shouldReturnDefaultProtocolSpecsWhenCustomNumbersAreNotUsed() {
final ProtocolSchedule sched = MainnetProtocolSchedule.create();
final ProtocolSchedule sched = ProtocolScheduleFixture.MAINNET;
Assertions.assertThat(sched.getByBlockNumber(1L).getName()).isEqualTo("Frontier");
Assertions.assertThat(sched.getByBlockNumber(1_150_000L).getName()).isEqualTo("Homestead");
Assertions.assertThat(sched.getByBlockNumber(1_920_000L).getName())

@ -21,8 +21,8 @@ import org.hyperledger.besu.ethereum.core.BlockHeaderBuilder;
import org.hyperledger.besu.ethereum.core.BlockHeaderFunctions;
import org.hyperledger.besu.ethereum.core.Difficulty;
import org.hyperledger.besu.ethereum.core.Hash;
import org.hyperledger.besu.ethereum.core.ProtocolScheduleFixture;
import org.hyperledger.besu.ethereum.mainnet.EpochCalculator;
import org.hyperledger.besu.ethereum.mainnet.MainnetProtocolSchedule;
import org.hyperledger.besu.ethereum.mainnet.ProtocolSchedule;
import org.hyperledger.besu.ethereum.mainnet.ScheduleBasedBlockHeaderFunctions;
import org.hyperledger.besu.ethereum.mainnet.ValidationTestUtils;
@ -142,7 +142,7 @@ public class ProofOfWorkValidationRuleTest {
}
private BlockHeaderFunctions mainnetBlockHashFunction() {
final ProtocolSchedule protocolSchedule = MainnetProtocolSchedule.create();
final ProtocolSchedule protocolSchedule = ProtocolScheduleFixture.MAINNET;
return ScheduleBasedBlockHeaderFunctions.create(protocolSchedule);
}
}

@ -33,6 +33,7 @@ import org.hyperledger.besu.ethereum.core.BlockHeader;
import org.hyperledger.besu.ethereum.core.BlockchainSetupUtil;
import org.hyperledger.besu.ethereum.core.Difficulty;
import org.hyperledger.besu.ethereum.core.Hash;
import org.hyperledger.besu.ethereum.core.ProtocolScheduleFixture;
import org.hyperledger.besu.ethereum.core.Transaction;
import org.hyperledger.besu.ethereum.core.TransactionReceipt;
import org.hyperledger.besu.ethereum.core.Wei;
@ -56,7 +57,6 @@ import org.hyperledger.besu.ethereum.eth.sync.state.SyncState;
import org.hyperledger.besu.ethereum.eth.transactions.TransactionPool;
import org.hyperledger.besu.ethereum.eth.transactions.TransactionPoolConfiguration;
import org.hyperledger.besu.ethereum.eth.transactions.TransactionPoolFactory;
import org.hyperledger.besu.ethereum.mainnet.MainnetProtocolSchedule;
import org.hyperledger.besu.ethereum.mainnet.ProtocolSchedule;
import org.hyperledger.besu.ethereum.p2p.rlpx.connections.PeerConnection;
import org.hyperledger.besu.ethereum.p2p.rlpx.wire.Capability;
@ -880,7 +880,7 @@ public final class EthProtocolManagerTest {
.isEqualTo(Collections.singletonList(EthProtocol.ETH63));
// assert that all messages transmitted contain the expected block & total difficulty.
final ProtocolSchedule protocolSchdeule = MainnetProtocolSchedule.create();
final ProtocolSchedule protocolSchdeule = ProtocolScheduleFixture.MAINNET;
for (final NewBlockMessage msg : messageSentCaptor.getAllValues()) {
assertThat(msg.block(protocolSchdeule)).isEqualTo(minedBlock);
assertThat(msg.totalDifficulty(protocolSchdeule)).isEqualTo(expectedTotalDifficulty);

@ -24,12 +24,12 @@ import org.hyperledger.besu.ethereum.chain.ChainHead;
import org.hyperledger.besu.ethereum.chain.GenesisState;
import org.hyperledger.besu.ethereum.core.BlockchainSetupUtil;
import org.hyperledger.besu.ethereum.core.Difficulty;
import org.hyperledger.besu.ethereum.core.ProtocolScheduleFixture;
import org.hyperledger.besu.ethereum.eth.EthProtocol;
import org.hyperledger.besu.ethereum.eth.EthProtocolConfiguration;
import org.hyperledger.besu.ethereum.eth.manager.DeterministicEthScheduler.TimeoutPolicy;
import org.hyperledger.besu.ethereum.eth.peervalidation.PeerValidator;
import org.hyperledger.besu.ethereum.eth.transactions.TransactionPool;
import org.hyperledger.besu.ethereum.mainnet.MainnetProtocolSchedule;
import org.hyperledger.besu.ethereum.mainnet.ProtocolSchedule;
import org.hyperledger.besu.ethereum.p2p.rlpx.wire.DefaultMessage;
import org.hyperledger.besu.ethereum.p2p.rlpx.wire.MessageData;
@ -100,7 +100,7 @@ public class EthProtocolManagerTestUtil {
}
public static EthProtocolManager create(final EthScheduler ethScheduler) {
final ProtocolSchedule protocolSchedule = MainnetProtocolSchedule.create();
final ProtocolSchedule protocolSchedule = ProtocolScheduleFixture.MAINNET;
final GenesisConfigFile config = GenesisConfigFile.mainnet();
final GenesisState genesisState = GenesisState.fromConfig(config, protocolSchedule);
final Blockchain blockchain = createInMemoryBlockchain(genesisState.getBlock());

@ -20,7 +20,7 @@ import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
import org.hyperledger.besu.ethereum.core.Block;
import org.hyperledger.besu.ethereum.core.BlockDataGenerator;
import org.hyperledger.besu.ethereum.core.Difficulty;
import org.hyperledger.besu.ethereum.mainnet.MainnetProtocolSchedule;
import org.hyperledger.besu.ethereum.core.ProtocolScheduleFixture;
import org.hyperledger.besu.ethereum.mainnet.ProtocolSchedule;
import org.hyperledger.besu.ethereum.p2p.rlpx.wire.RawMessage;
import org.hyperledger.besu.ethereum.rlp.BytesValueRLPOutput;
@ -29,7 +29,7 @@ import org.apache.tuweni.bytes.Bytes;
import org.junit.Test;
public class NewBlockMessageTest {
private static final ProtocolSchedule protocolSchedule = MainnetProtocolSchedule.create();
private static final ProtocolSchedule protocolSchedule = ProtocolScheduleFixture.MAINNET;
@Test
public void roundTripNewBlockMessage() {

@ -19,11 +19,11 @@ import static org.assertj.core.api.Assertions.assertThat;
import org.hyperledger.besu.ethereum.core.Block;
import org.hyperledger.besu.ethereum.core.BlockDataGenerator;
import org.hyperledger.besu.ethereum.core.BlockDataGenerator.BlockOptions;
import org.hyperledger.besu.ethereum.core.ProtocolScheduleFixture;
import org.hyperledger.besu.ethereum.eth.manager.EthProtocolManager;
import org.hyperledger.besu.ethereum.eth.manager.EthProtocolManagerTestUtil;
import org.hyperledger.besu.ethereum.eth.manager.RespondingEthPeer;
import org.hyperledger.besu.ethereum.mainnet.MainnetBlockHeaderValidator;
import org.hyperledger.besu.ethereum.mainnet.MainnetProtocolSchedule;
import org.hyperledger.besu.metrics.noop.NoOpMetricsSystem;
import java.util.concurrent.CompletableFuture;
@ -37,7 +37,7 @@ public class DaoForkPeerValidatorTest extends AbstractPeerBlockValidatorTest {
@Override
AbstractPeerBlockValidator createValidator(final long blockNumber, final long buffer) {
return new DaoForkPeerValidator(
MainnetProtocolSchedule.create(), new NoOpMetricsSystem(), blockNumber, buffer);
ProtocolScheduleFixture.MAINNET, new NoOpMetricsSystem(), blockNumber, buffer);
}
@Test
@ -53,7 +53,7 @@ public class DaoForkPeerValidatorTest extends AbstractPeerBlockValidatorTest {
final PeerValidator validator =
new DaoForkPeerValidator(
MainnetProtocolSchedule.create(), new NoOpMetricsSystem(), daoBlockNumber, 0);
ProtocolScheduleFixture.MAINNET, new NoOpMetricsSystem(), daoBlockNumber, 0);
final RespondingEthPeer peer =
EthProtocolManagerTestUtil.createPeer(ethProtocolManager, daoBlockNumber);
@ -81,7 +81,7 @@ public class DaoForkPeerValidatorTest extends AbstractPeerBlockValidatorTest {
final PeerValidator validator =
new DaoForkPeerValidator(
MainnetProtocolSchedule.create(), new NoOpMetricsSystem(), daoBlockNumber, 0);
ProtocolScheduleFixture.MAINNET, new NoOpMetricsSystem(), daoBlockNumber, 0);
final RespondingEthPeer peer =
EthProtocolManagerTestUtil.createPeer(ethProtocolManager, daoBlockNumber);

@ -22,10 +22,10 @@ import org.hyperledger.besu.ethereum.core.Block;
import org.hyperledger.besu.ethereum.core.BlockDataGenerator;
import org.hyperledger.besu.ethereum.core.BlockDataGenerator.BlockOptions;
import org.hyperledger.besu.ethereum.core.Hash;
import org.hyperledger.besu.ethereum.core.ProtocolScheduleFixture;
import org.hyperledger.besu.ethereum.eth.manager.EthProtocolManager;
import org.hyperledger.besu.ethereum.eth.manager.EthProtocolManagerTestUtil;
import org.hyperledger.besu.ethereum.eth.manager.RespondingEthPeer;
import org.hyperledger.besu.ethereum.mainnet.MainnetProtocolSchedule;
import org.hyperledger.besu.metrics.noop.NoOpMetricsSystem;
import java.util.concurrent.CompletableFuture;
@ -38,7 +38,7 @@ public class RequiredBlocksPeerValidatorTest extends AbstractPeerBlockValidatorT
@Override
AbstractPeerBlockValidator createValidator(final long blockNumber, final long buffer) {
return new RequiredBlocksPeerValidator(
MainnetProtocolSchedule.create(), new NoOpMetricsSystem(), blockNumber, Hash.ZERO, buffer);
ProtocolScheduleFixture.MAINNET, new NoOpMetricsSystem(), blockNumber, Hash.ZERO, buffer);
}
@Test
@ -51,7 +51,7 @@ public class RequiredBlocksPeerValidatorTest extends AbstractPeerBlockValidatorT
final PeerValidator validator =
new RequiredBlocksPeerValidator(
MainnetProtocolSchedule.create(),
ProtocolScheduleFixture.MAINNET,
new NoOpMetricsSystem(),
requiredBlockNumber,
requiredBlock.getHash(),
@ -83,7 +83,7 @@ public class RequiredBlocksPeerValidatorTest extends AbstractPeerBlockValidatorT
final PeerValidator validator =
new RequiredBlocksPeerValidator(
MainnetProtocolSchedule.create(),
ProtocolScheduleFixture.MAINNET,
new NoOpMetricsSystem(),
requiredBlockNumber,
Hash.ZERO,

@ -23,6 +23,7 @@ import org.hyperledger.besu.ethereum.chain.Blockchain;
import org.hyperledger.besu.ethereum.chain.MutableBlockchain;
import org.hyperledger.besu.ethereum.core.BlockchainSetupUtil;
import org.hyperledger.besu.ethereum.core.Difficulty;
import org.hyperledger.besu.ethereum.core.ProtocolScheduleFixture;
import org.hyperledger.besu.ethereum.eth.EthProtocolConfiguration;
import org.hyperledger.besu.ethereum.eth.manager.EthContext;
import org.hyperledger.besu.ethereum.eth.manager.EthProtocolManager;
@ -31,7 +32,6 @@ import org.hyperledger.besu.ethereum.eth.manager.EthScheduler;
import org.hyperledger.besu.ethereum.eth.manager.RespondingEthPeer;
import org.hyperledger.besu.ethereum.eth.sync.SynchronizerConfiguration;
import org.hyperledger.besu.ethereum.eth.sync.state.SyncTarget;
import org.hyperledger.besu.ethereum.mainnet.MainnetProtocolSchedule;
import org.hyperledger.besu.ethereum.mainnet.ProtocolSchedule;
import org.hyperledger.besu.ethereum.worldstate.WorldStateArchive;
import org.hyperledger.besu.metrics.noop.NoOpMetricsSystem;
@ -61,7 +61,7 @@ public class FullSyncTargetManagerTest {
final BlockchainSetupUtil localBlockchainSetup = BlockchainSetupUtil.forTesting();
localBlockchain = localBlockchainSetup.getBlockchain();
final ProtocolSchedule protocolSchedule = MainnetProtocolSchedule.create();
final ProtocolSchedule protocolSchedule = ProtocolScheduleFixture.MAINNET;
final ProtocolContext protocolContext =
new ProtocolContext(localBlockchain, localWorldState, null);
ethProtocolManager =

@ -26,6 +26,7 @@ import org.hyperledger.besu.ethereum.core.BlockBody;
import org.hyperledger.besu.ethereum.core.BlockDataGenerator;
import org.hyperledger.besu.ethereum.core.BlockHeader;
import org.hyperledger.besu.ethereum.core.Difficulty;
import org.hyperledger.besu.ethereum.core.ProtocolScheduleFixture;
import org.hyperledger.besu.ethereum.core.TransactionReceipt;
import org.hyperledger.besu.ethereum.eth.EthProtocolConfiguration;
import org.hyperledger.besu.ethereum.eth.manager.EthContext;
@ -35,7 +36,6 @@ import org.hyperledger.besu.ethereum.eth.manager.RespondingEthPeer;
import org.hyperledger.besu.ethereum.eth.manager.task.EthTask;
import org.hyperledger.besu.ethereum.eth.transactions.TransactionPool;
import org.hyperledger.besu.ethereum.mainnet.MainnetBlockHeaderFunctions;
import org.hyperledger.besu.ethereum.mainnet.MainnetProtocolSchedule;
import org.hyperledger.besu.ethereum.mainnet.ProtocolSchedule;
import org.hyperledger.besu.ethereum.worldstate.WorldStateArchive;
import org.hyperledger.besu.metrics.noop.NoOpMetricsSystem;
@ -58,7 +58,7 @@ import org.junit.runners.Parameterized.Parameters;
@RunWith(Parameterized.class)
public class DetermineCommonAncestorTaskParameterizedTest {
private final ProtocolSchedule protocolSchedule = MainnetProtocolSchedule.create();
private final ProtocolSchedule protocolSchedule = ProtocolScheduleFixture.MAINNET;
private static final BlockDataGenerator blockDataGenerator = new BlockDataGenerator();
private final MetricsSystem metricsSystem = new NoOpMetricsSystem();

@ -33,6 +33,7 @@ import org.hyperledger.besu.ethereum.chain.MutableBlockchain;
import org.hyperledger.besu.ethereum.core.Block;
import org.hyperledger.besu.ethereum.core.BlockDataGenerator;
import org.hyperledger.besu.ethereum.core.BlockHeader;
import org.hyperledger.besu.ethereum.core.ProtocolScheduleFixture;
import org.hyperledger.besu.ethereum.core.TransactionReceipt;
import org.hyperledger.besu.ethereum.eth.EthProtocolConfiguration;
import org.hyperledger.besu.ethereum.eth.manager.EthContext;
@ -44,7 +45,6 @@ import org.hyperledger.besu.ethereum.eth.manager.exceptions.EthTaskException;
import org.hyperledger.besu.ethereum.eth.manager.task.EthTask;
import org.hyperledger.besu.ethereum.eth.transactions.TransactionPool;
import org.hyperledger.besu.ethereum.mainnet.MainnetBlockHeaderFunctions;
import org.hyperledger.besu.ethereum.mainnet.MainnetProtocolSchedule;
import org.hyperledger.besu.ethereum.mainnet.ProtocolSchedule;
import org.hyperledger.besu.ethereum.p2p.rlpx.wire.messages.DisconnectMessage.DisconnectReason;
import org.hyperledger.besu.ethereum.worldstate.WorldStateArchive;
@ -62,7 +62,7 @@ import org.junit.Test;
public class DetermineCommonAncestorTaskTest {
private final ProtocolSchedule protocolSchedule = MainnetProtocolSchedule.create();
private final ProtocolSchedule protocolSchedule = ProtocolScheduleFixture.MAINNET;
private final BlockDataGenerator blockDataGenerator = new BlockDataGenerator();
private final MetricsSystem metricsSystem = new NoOpMetricsSystem();
private final int defaultHeaderRequestSize = 10;

@ -35,6 +35,7 @@ import org.hyperledger.besu.ethereum.core.BlockHeader;
import org.hyperledger.besu.ethereum.core.BlockHeaderTestFixture;
import org.hyperledger.besu.ethereum.core.Hash;
import org.hyperledger.besu.ethereum.core.MutableWorldState;
import org.hyperledger.besu.ethereum.core.ProtocolScheduleFixture;
import org.hyperledger.besu.ethereum.core.WorldState;
import org.hyperledger.besu.ethereum.eth.manager.DeterministicEthScheduler;
import org.hyperledger.besu.ethereum.eth.manager.EthContext;
@ -46,7 +47,6 @@ import org.hyperledger.besu.ethereum.eth.messages.EthPV63;
import org.hyperledger.besu.ethereum.eth.messages.GetNodeDataMessage;
import org.hyperledger.besu.ethereum.eth.sync.SynchronizerConfiguration;
import org.hyperledger.besu.ethereum.eth.transactions.TransactionPool;
import org.hyperledger.besu.ethereum.mainnet.MainnetProtocolSchedule;
import org.hyperledger.besu.ethereum.p2p.rlpx.wire.MessageData;
import org.hyperledger.besu.ethereum.rlp.RLP;
import org.hyperledger.besu.ethereum.storage.keyvalue.WorldStateKeyValueStorage;
@ -907,7 +907,7 @@ public class WorldStateDownloaderTest {
mock(Blockchain.class),
remoteWorldStateArchive,
mock(TransactionPool.class),
MainnetProtocolSchedule.create(),
ProtocolScheduleFixture.MAINNET,
.5f);
final RespondingEthPeer.Responder emptyResponder = RespondingEthPeer.emptyResponder();

@ -28,7 +28,7 @@ import org.hyperledger.besu.config.JsonUtil;
import org.hyperledger.besu.ethereum.chain.GenesisState;
import org.hyperledger.besu.ethereum.chain.MutableBlockchain;
import org.hyperledger.besu.ethereum.core.Address;
import org.hyperledger.besu.ethereum.mainnet.MainnetProtocolSchedule;
import org.hyperledger.besu.ethereum.core.ProtocolScheduleFixture;
import org.hyperledger.besu.ethereum.mainnet.ProtocolSchedule;
import org.hyperledger.besu.ethereum.p2p.peers.EnodeURL;
import org.hyperledger.besu.ethereum.transaction.TransactionSimulator;
@ -55,7 +55,7 @@ public class NodeSmartContractPermissioningControllerTest {
private NodeSmartContractPermissioningController setupController(
final String resourceName, final String contractAddressString) throws IOException {
final ProtocolSchedule protocolSchedule = MainnetProtocolSchedule.create();
final ProtocolSchedule protocolSchedule = ProtocolScheduleFixture.MAINNET;
final String emptyContractFile =
Resources.toString(this.getClass().getResource(resourceName), UTF_8);

@ -28,9 +28,9 @@ import org.hyperledger.besu.crypto.SECP256K1.Signature;
import org.hyperledger.besu.ethereum.chain.GenesisState;
import org.hyperledger.besu.ethereum.chain.MutableBlockchain;
import org.hyperledger.besu.ethereum.core.Address;
import org.hyperledger.besu.ethereum.core.ProtocolScheduleFixture;
import org.hyperledger.besu.ethereum.core.Transaction;
import org.hyperledger.besu.ethereum.core.Wei;
import org.hyperledger.besu.ethereum.mainnet.MainnetProtocolSchedule;
import org.hyperledger.besu.ethereum.mainnet.ProtocolSchedule;
import org.hyperledger.besu.ethereum.transaction.TransactionSimulator;
import org.hyperledger.besu.ethereum.worldstate.WorldStateArchive;
@ -57,7 +57,7 @@ public class TransactionSmartContractPermissioningControllerTest {
private TransactionSmartContractPermissioningController setupController(
final String resourceName, final String contractAddressString) throws IOException {
final ProtocolSchedule protocolSchedule = MainnetProtocolSchedule.create();
final ProtocolSchedule protocolSchedule = ProtocolScheduleFixture.MAINNET;
final String emptyContractFile =
Resources.toString(this.getClass().getResource(resourceName), UTF_8);

Loading…
Cancel
Save