Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Holešky as predefined network name #5797

Merged
merged 10 commits into from
Aug 28, 2023
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

### Additions and Improvements
- Add new methods to `OperationTracer` to capture contexts enter/exit [#5756](https://github.com/hyperledger/besu/pull/5756)
- Add Holešky as predefined network name [#5797](https://github.com/hyperledger/besu/pull/5797)

### Breaking Changes
- Add ABI-decoded revert reason to `eth_call` and `eth_estimateGas` responses [#5705](https://github.com/hyperledger/besu/issues/5705)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ public enum NetworkName {
SEPOLIA("/sepolia.json", BigInteger.valueOf(11155111)),
/** Goerli network name. */
GOERLI("/goerli.json", BigInteger.valueOf(5)),
/** Holešky network name. */
HOLESKY("/holesky.json", BigInteger.valueOf(17000)),

/** Dev network name. */
DEV("/dev.json", BigInteger.valueOf(2018), false),
/** Future EIPs network name. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,14 @@ public static Collection<Object[]> parameters() {
new ForkId(Bytes.ofUnsignedInt(0xf7f9bc08L), 0L),
new ForkId(Bytes.ofUnsignedInt(0xf7f9bc08L), 0L))
},
new Object[] {
NetworkName.HOLESKY,
List.of(
new ForkId(Bytes.ofUnsignedInt(0xa200f558L), 1694790240L),
new ForkId(Bytes.ofUnsignedInt(0x840a3b53L), 2000000000L),
new ForkId(Bytes.ofUnsignedInt(0x30771f90), 0L),
new ForkId(Bytes.ofUnsignedInt(0x30771f90), 0L))
},
new Object[] {
NetworkName.GOERLI,
List.of(
Expand Down
28 changes: 28 additions & 0 deletions besu/src/test/java/org/hyperledger/besu/cli/BesuCommandTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import static org.hyperledger.besu.cli.config.NetworkName.EXPERIMENTAL_EIPS;
import static org.hyperledger.besu.cli.config.NetworkName.FUTURE_EIPS;
import static org.hyperledger.besu.cli.config.NetworkName.GOERLI;
import static org.hyperledger.besu.cli.config.NetworkName.HOLESKY;
import static org.hyperledger.besu.cli.config.NetworkName.KOTTI;
import static org.hyperledger.besu.cli.config.NetworkName.MAINNET;
import static org.hyperledger.besu.cli.config.NetworkName.MORDOR;
Expand Down Expand Up @@ -85,6 +86,7 @@
import org.hyperledger.besu.ethereum.worldstate.DataStorageConfiguration;
import org.hyperledger.besu.ethereum.worldstate.PrunerConfiguration;
import org.hyperledger.besu.evm.precompile.AbstractAltBnPrecompiledContract;
import org.hyperledger.besu.evm.precompile.KZGPointEvalPrecompiledContract;
import org.hyperledger.besu.metrics.StandardMetricCategory;
import org.hyperledger.besu.metrics.prometheus.MetricsConfiguration;
import org.hyperledger.besu.nat.NatMethod;
Expand Down Expand Up @@ -206,11 +208,19 @@ public class BesuCommandTest extends CommandTestAbstract {

@Before
public void setup() {
try {
// optimistically tear down a potential previous loaded trusted setup
KZGPointEvalPrecompiledContract.tearDown();
} catch (Throwable ignore) {
// and ignore errors in case no trusted setup was already loaded
}

MergeConfigOptions.setMergeEnabled(false);
}

@After
public void tearDown() {

MergeConfigOptions.setMergeEnabled(false);
}

Expand Down Expand Up @@ -4065,6 +4075,24 @@ public void sepoliaValuesAreUsed() {
verify(mockLogger, never()).warn(contains("Sepolia is deprecated and will be shutdown"));
}

@Test
public void holeskyValuesAreUsed() {
parseCommand("--network", "holesky");

final ArgumentCaptor<EthNetworkConfig> networkArg =
ArgumentCaptor.forClass(EthNetworkConfig.class);

verify(mockControllerBuilderFactory).fromEthNetworkConfig(networkArg.capture(), any(), any());
verify(mockControllerBuilder).build();

assertThat(networkArg.getValue()).isEqualTo(EthNetworkConfig.getNetworkConfig(HOLESKY));

assertThat(commandOutput.toString(UTF_8)).isEmpty();
assertThat(commandErrorOutput.toString(UTF_8)).isEmpty();

verify(mockLogger, never()).warn(contains("Holesky is deprecated and will be shutdown"));
}

@Test
public void classicValuesAreUsed() throws Exception {
parseCommand("--network", "classic");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ void shouldGenerateDeprecationMessageForDeprecatedNetworks(final NetworkName net
@EnumSource(
value = NetworkName.class,
names = {
"MAINNET", "SEPOLIA", "GOERLI", "DEV", "CLASSIC", "KOTTI", "MORDOR",
"MAINNET", "SEPOLIA", "GOERLI", "DEV", "CLASSIC", "KOTTI", "MORDOR", "HOLESKY",
})
void shouldThrowErrorForNonDeprecatedNetworks(final NetworkName network) {
assertThatThrownBy(() -> NetworkDeprecationMessage.generate(network))
Expand Down
Loading