Skip to content

Commit

Permalink
Add Holešky as predefined network name (hyperledger#5797)
Browse files Browse the repository at this point in the history
* Add Holešky testnet network name

Signed-off-by: Fabio Di Fabio <[email protected]>

* CHANGELOG

Signed-off-by: Fabio Di Fabio <[email protected]>

* Add a fake KZG setup since Holesky define Cancun as future fork

Signed-off-by: Fabio Di Fabio <[email protected]>

* Tear down KZG trusted setup after each test

Signed-off-by: Fabio Di Fabio <[email protected]>

* Fix test

Signed-off-by: Fabio Di Fabio <[email protected]>

* Prevent another trusted setup already loaded error during tests

Signed-off-by: Fabio Di Fabio <[email protected]>

---------

Signed-off-by: Fabio Di Fabio <[email protected]>
Co-authored-by: Sally MacFarlane <[email protected]>
  • Loading branch information
2 people authored and eum602 committed Nov 3, 2023
1 parent 04f681f commit d078076
Show file tree
Hide file tree
Showing 10 changed files with 5,235 additions and 3 deletions.
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

0 comments on commit d078076

Please sign in to comment.