mirror of
https://github.com/vacp2p/linea-besu.git
synced 2026-01-09 15:37:54 -05:00
rename GenesisConfigFile because it's not a file at all (#8050)
Signed-off-by: jflo <justin+github@florentine.us>
This commit is contained in:
committed by
GitHub
parent
d3773d9e33
commit
3b4136dac5
@@ -20,7 +20,7 @@ import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
import org.hyperledger.besu.config.CliqueConfigOptions;
|
||||
import org.hyperledger.besu.config.GenesisConfigFile;
|
||||
import org.hyperledger.besu.config.GenesisConfig;
|
||||
import org.hyperledger.besu.config.GenesisConfigOptions;
|
||||
import org.hyperledger.besu.config.JsonCliqueConfigOptions;
|
||||
import org.hyperledger.besu.consensus.common.ForkSpec;
|
||||
@@ -61,7 +61,7 @@ public class CliqueProtocolScheduleTest {
|
||||
+ "\"byzantiumBlock\": 1035301}"
|
||||
+ "}";
|
||||
|
||||
final GenesisConfigOptions config = GenesisConfigFile.fromConfig(jsonInput).getConfigOptions();
|
||||
final GenesisConfigOptions config = GenesisConfig.fromConfig(jsonInput).getConfigOptions();
|
||||
final ProtocolSchedule protocolSchedule =
|
||||
CliqueProtocolSchedule.create(
|
||||
config,
|
||||
@@ -91,7 +91,7 @@ public class CliqueProtocolScheduleTest {
|
||||
new ForksSchedule<>(List.of(new ForkSpec<>(0, JsonCliqueConfigOptions.DEFAULT)));
|
||||
final ProtocolSpec homestead =
|
||||
CliqueProtocolSchedule.create(
|
||||
GenesisConfigFile.DEFAULT.getConfigOptions(),
|
||||
GenesisConfig.DEFAULT.getConfigOptions(),
|
||||
forksSchedule,
|
||||
NODE_KEY,
|
||||
PrivacyParameters.DEFAULT,
|
||||
@@ -163,7 +163,7 @@ public class CliqueProtocolScheduleTest {
|
||||
final String jsonInput =
|
||||
"{\"config\": " + "\t{\"chainId\": 1337,\n" + "\t\"londonBlock\": 2}\n" + "}";
|
||||
|
||||
final GenesisConfigOptions config = GenesisConfigFile.fromConfig(jsonInput).getConfigOptions();
|
||||
final GenesisConfigOptions config = GenesisConfig.fromConfig(jsonInput).getConfigOptions();
|
||||
final ForksSchedule<CliqueConfigOptions> forksSchedule =
|
||||
new ForksSchedule<>(List.of(new ForkSpec<>(0, JsonCliqueConfigOptions.DEFAULT)));
|
||||
final ProtocolSchedule protocolSchedule =
|
||||
|
||||
@@ -22,7 +22,7 @@ import static org.mockito.Mockito.RETURNS_DEEP_STUBS;
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
import org.hyperledger.besu.config.GenesisConfigFile;
|
||||
import org.hyperledger.besu.config.GenesisConfig;
|
||||
import org.hyperledger.besu.consensus.clique.CliqueBlockInterface;
|
||||
import org.hyperledger.besu.consensus.clique.CliqueContext;
|
||||
import org.hyperledger.besu.consensus.clique.CliqueExtraData;
|
||||
@@ -110,7 +110,7 @@ public class CliqueBlockCreatorTest {
|
||||
|
||||
protocolSchedule =
|
||||
CliqueProtocolSchedule.create(
|
||||
GenesisConfigFile.DEFAULT.getConfigOptions(),
|
||||
GenesisConfig.DEFAULT.getConfigOptions(),
|
||||
new ForksSchedule<>(List.of()),
|
||||
proposerNodeKey,
|
||||
PrivacyParameters.DEFAULT,
|
||||
@@ -125,7 +125,7 @@ public class CliqueBlockCreatorTest {
|
||||
CliqueHelpers.setCliqueContext(cliqueContext);
|
||||
|
||||
final Block genesis =
|
||||
GenesisState.fromConfig(GenesisConfigFile.mainnet(), protocolSchedule).getBlock();
|
||||
GenesisState.fromConfig(GenesisConfig.mainnet(), protocolSchedule).getBlock();
|
||||
blockchain = createInMemoryBlockchain(genesis);
|
||||
protocolContext =
|
||||
new ProtocolContext(blockchain, stateArchive, cliqueContext, new BadBlockManager());
|
||||
|
||||
@@ -20,7 +20,7 @@ import static org.mockito.Mockito.RETURNS_DEEP_STUBS;
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
import org.hyperledger.besu.config.GenesisConfigFile;
|
||||
import org.hyperledger.besu.config.GenesisConfig;
|
||||
import org.hyperledger.besu.config.GenesisConfigOptions;
|
||||
import org.hyperledger.besu.consensus.clique.CliqueBlockHeaderFunctions;
|
||||
import org.hyperledger.besu.consensus.clique.CliqueBlockInterface;
|
||||
@@ -74,7 +74,7 @@ public class CliqueMinerExecutorTest {
|
||||
|
||||
private static final int EPOCH_LENGTH = 10;
|
||||
private static final GenesisConfigOptions GENESIS_CONFIG_OPTIONS =
|
||||
GenesisConfigFile.fromConfig("{}").getConfigOptions();
|
||||
GenesisConfig.fromConfig("{}").getConfigOptions();
|
||||
private final NodeKey proposerNodeKey = NodeKeyUtils.generate();
|
||||
private final Random random = new Random(21341234L);
|
||||
private Address localAddress;
|
||||
|
||||
@@ -23,7 +23,7 @@ import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
import org.hyperledger.besu.config.BftConfigOptions;
|
||||
import org.hyperledger.besu.config.GenesisConfigFile;
|
||||
import org.hyperledger.besu.config.GenesisConfig;
|
||||
import org.hyperledger.besu.config.GenesisConfigOptions;
|
||||
import org.hyperledger.besu.consensus.common.ForkSpec;
|
||||
import org.hyperledger.besu.consensus.common.ForksSchedule;
|
||||
@@ -110,8 +110,7 @@ public class BftBlockCreatorTest {
|
||||
}
|
||||
};
|
||||
final GenesisConfigOptions configOptions =
|
||||
GenesisConfigFile.fromConfig("{\"config\": {\"spuriousDragonBlock\":0}}")
|
||||
.getConfigOptions();
|
||||
GenesisConfig.fromConfig("{\"config\": {\"spuriousDragonBlock\":0}}").getConfigOptions();
|
||||
final ForksSchedule<BftConfigOptions> forksSchedule =
|
||||
new ForksSchedule<>(List.of(new ForkSpec<>(0, configOptions.getBftConfigOptions())));
|
||||
final ProtocolSchedule protocolSchedule =
|
||||
|
||||
@@ -16,7 +16,7 @@ package org.hyperledger.besu.consensus.merge;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
import org.hyperledger.besu.config.GenesisConfigFile;
|
||||
import org.hyperledger.besu.config.GenesisConfig;
|
||||
import org.hyperledger.besu.config.GenesisConfigOptions;
|
||||
import org.hyperledger.besu.datatypes.Wei;
|
||||
import org.hyperledger.besu.ethereum.chain.BadBlockManager;
|
||||
@@ -46,7 +46,7 @@ public class MergeProtocolScheduleTest {
|
||||
+ "\"LondonBlock\": 1559}"
|
||||
+ "}";
|
||||
|
||||
final GenesisConfigOptions config = GenesisConfigFile.fromConfig(jsonInput).getConfigOptions();
|
||||
final GenesisConfigOptions config = GenesisConfig.fromConfig(jsonInput).getConfigOptions();
|
||||
final ProtocolSchedule protocolSchedule =
|
||||
MergeProtocolSchedule.create(
|
||||
config,
|
||||
@@ -67,7 +67,7 @@ public class MergeProtocolScheduleTest {
|
||||
@Test
|
||||
public void mergeSpecificModificationsAreUnappliedForShanghai() {
|
||||
|
||||
final GenesisConfigOptions config = GenesisConfigFile.mainnet().getConfigOptions();
|
||||
final GenesisConfigOptions config = GenesisConfig.mainnet().getConfigOptions();
|
||||
final ProtocolSchedule protocolSchedule =
|
||||
MergeProtocolSchedule.create(
|
||||
config,
|
||||
@@ -108,7 +108,7 @@ public class MergeProtocolScheduleTest {
|
||||
+ "\"cancunTime\": 1000}"
|
||||
+ "}";
|
||||
|
||||
final GenesisConfigOptions config = GenesisConfigFile.fromConfig(jsonInput).getConfigOptions();
|
||||
final GenesisConfigOptions config = GenesisConfig.fromConfig(jsonInput).getConfigOptions();
|
||||
final ProtocolSchedule protocolSchedule =
|
||||
MergeProtocolSchedule.create(
|
||||
config,
|
||||
@@ -141,7 +141,7 @@ public class MergeProtocolScheduleTest {
|
||||
|
||||
@Test
|
||||
public void mergeSpecificModificationsAreUnappliedForAllMainnetForksAfterParis() {
|
||||
final GenesisConfigOptions config = GenesisConfigFile.mainnet().getConfigOptions();
|
||||
final GenesisConfigOptions config = GenesisConfig.mainnet().getConfigOptions();
|
||||
final ProtocolSchedule protocolSchedule =
|
||||
MergeProtocolSchedule.create(
|
||||
config,
|
||||
@@ -178,7 +178,7 @@ public class MergeProtocolScheduleTest {
|
||||
public void parametersAlignWithMainnetWithAdjustments() {
|
||||
final ProtocolSpec london =
|
||||
MergeProtocolSchedule.create(
|
||||
GenesisConfigFile.DEFAULT.getConfigOptions(),
|
||||
GenesisConfig.DEFAULT.getConfigOptions(),
|
||||
false,
|
||||
MiningConfiguration.MINING_DISABLED,
|
||||
new BadBlockManager(),
|
||||
|
||||
@@ -132,7 +132,7 @@ public class MergeCoordinatorTest implements MergeGenesisConfigHelper {
|
||||
|
||||
@Mock EthScheduler ethScheduler;
|
||||
|
||||
private final Address coinbase = genesisAllocations(getPosGenesisConfigFile()).findFirst().get();
|
||||
private final Address coinbase = genesisAllocations(getPosGenesisConfig()).findFirst().get();
|
||||
|
||||
private MiningConfiguration miningConfiguration =
|
||||
ImmutableMiningConfiguration.builder()
|
||||
@@ -148,7 +148,7 @@ public class MergeCoordinatorTest implements MergeGenesisConfigHelper {
|
||||
|
||||
private final ProtocolSchedule protocolSchedule = spy(getMergeProtocolSchedule());
|
||||
private final GenesisState genesisState =
|
||||
GenesisState.fromConfig(getPosGenesisConfigFile(), protocolSchedule);
|
||||
GenesisState.fromConfig(getPosGenesisConfig(), protocolSchedule);
|
||||
|
||||
private final WorldStateArchive worldStateArchive = createInMemoryWorldStateArchive();
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
package org.hyperledger.besu.consensus.merge.blockcreation;
|
||||
|
||||
import org.hyperledger.besu.config.GenesisAccount;
|
||||
import org.hyperledger.besu.config.GenesisConfigFile;
|
||||
import org.hyperledger.besu.config.GenesisConfig;
|
||||
import org.hyperledger.besu.consensus.merge.MergeProtocolSchedule;
|
||||
import org.hyperledger.besu.datatypes.Address;
|
||||
import org.hyperledger.besu.ethereum.chain.BadBlockManager;
|
||||
@@ -30,31 +30,31 @@ import java.util.stream.Stream;
|
||||
|
||||
public interface MergeGenesisConfigHelper {
|
||||
|
||||
default GenesisConfigFile getPosGenesisConfigFile() {
|
||||
default GenesisConfig getPosGenesisConfig() {
|
||||
try {
|
||||
final URI uri = MergeGenesisConfigHelper.class.getResource("/posAtGenesis.json").toURI();
|
||||
return GenesisConfigFile.fromSource(uri.toURL());
|
||||
return GenesisConfig.fromSource(uri.toURL());
|
||||
} catch (final URISyntaxException | IOException e) {
|
||||
throw new IllegalStateException(e);
|
||||
}
|
||||
}
|
||||
|
||||
default GenesisConfigFile getPowGenesisConfigFile() {
|
||||
default GenesisConfig getPowGenesisConfig() {
|
||||
try {
|
||||
final URI uri = MergeGenesisConfigHelper.class.getResource("/powAtGenesis.json").toURI();
|
||||
return GenesisConfigFile.fromSource(uri.toURL());
|
||||
return GenesisConfig.fromSource(uri.toURL());
|
||||
} catch (final URISyntaxException | IOException e) {
|
||||
throw new IllegalStateException(e);
|
||||
}
|
||||
}
|
||||
|
||||
default Stream<Address> genesisAllocations(final GenesisConfigFile configFile) {
|
||||
default Stream<Address> genesisAllocations(final GenesisConfig configFile) {
|
||||
return configFile.streamAllocations().map(GenesisAccount::address);
|
||||
}
|
||||
|
||||
default ProtocolSchedule getMergeProtocolSchedule() {
|
||||
return MergeProtocolSchedule.create(
|
||||
getPosGenesisConfigFile().getConfigOptions(),
|
||||
getPosGenesisConfig().getConfigOptions(),
|
||||
false,
|
||||
MiningConfiguration.MINING_DISABLED,
|
||||
new BadBlockManager(),
|
||||
|
||||
@@ -70,7 +70,7 @@ public class MergeReorgTest implements MergeGenesisConfigHelper {
|
||||
private final MergeContext mergeContext = PostMergeContext.get();
|
||||
private final ProtocolSchedule mockProtocolSchedule = getMergeProtocolSchedule();
|
||||
private final GenesisState genesisState =
|
||||
GenesisState.fromConfig(getPowGenesisConfigFile(), mockProtocolSchedule);
|
||||
GenesisState.fromConfig(getPowGenesisConfig(), mockProtocolSchedule);
|
||||
|
||||
private final WorldStateArchive worldStateArchive = createInMemoryWorldStateArchive();
|
||||
private final MutableBlockchain blockchain = createInMemoryBlockchain(genesisState.getBlock());
|
||||
@@ -78,7 +78,7 @@ public class MergeReorgTest implements MergeGenesisConfigHelper {
|
||||
private final ProtocolContext protocolContext =
|
||||
new ProtocolContext(blockchain, worldStateArchive, mergeContext, new BadBlockManager());
|
||||
|
||||
private final Address coinbase = genesisAllocations(getPowGenesisConfigFile()).findFirst().get();
|
||||
private final Address coinbase = genesisAllocations(getPowGenesisConfig()).findFirst().get();
|
||||
private final BlockHeaderTestFixture headerGenerator = new BlockHeaderTestFixture();
|
||||
private final BaseFeeMarket feeMarket =
|
||||
new LondonFeeMarket(0, genesisState.getBlock().getHeader().getBaseFee());
|
||||
@@ -132,7 +132,7 @@ public class MergeReorgTest implements MergeGenesisConfigHelper {
|
||||
Difficulty tdd = blockchain.getTotalDifficultyByHash(ttdA.getHash()).get();
|
||||
assertThat(tdd.getAsBigInteger())
|
||||
.isGreaterThan(
|
||||
getPosGenesisConfigFile()
|
||||
getPosGenesisConfig()
|
||||
.getConfigOptions()
|
||||
.getTerminalTotalDifficulty()
|
||||
.get()
|
||||
|
||||
@@ -23,7 +23,7 @@ import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
import org.hyperledger.besu.config.BftFork;
|
||||
import org.hyperledger.besu.config.GenesisConfigFile;
|
||||
import org.hyperledger.besu.config.GenesisConfig;
|
||||
import org.hyperledger.besu.config.JsonQbftConfigOptions;
|
||||
import org.hyperledger.besu.config.JsonUtil;
|
||||
import org.hyperledger.besu.config.QbftConfigOptions;
|
||||
@@ -367,7 +367,7 @@ public class TestContextBuilder {
|
||||
|
||||
private GenesisState createGenesisBlock(final String genesisFile) throws IOException {
|
||||
return GenesisState.fromConfig(
|
||||
GenesisConfigFile.fromSource(Path.of(genesisFile).toUri().toURL()),
|
||||
GenesisConfig.fromSource(Path.of(genesisFile).toUri().toURL()),
|
||||
ProtocolScheduleFixture.MAINNET);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user