Add Hoodi as named network (#8428)

Signed-off-by: Daniel Lehrner <daniel.lehrner@consensys.net>
Co-authored-by: Simon Dudley <simon.dudley@consensys.net>
This commit is contained in:
daniellehrner
2025-03-17 21:47:14 +01:00
committed by GitHub
parent 552cb283f9
commit 54aaf3d2fc
12 changed files with 1210 additions and 2 deletions

View File

@@ -47,7 +47,7 @@
- Add era1 format to blocks import subcommand [#7935](https://github.com/hyperledger/besu/issues/7935)
- Replace tuweni libs with https://github.com/Consensys/tuweni
- Performance: Consensys/tuweni 2.6.0 reduces boxing/unboxing overhead on some EVM opcodes, like PushX and Caller
- Add Hoodi as new named testnet [#8428](https://github.com/hyperledger/besu/issues/8428)
### Bug fixes
- Add missing RPC method `debug_accountRange` to `RpcMethod.java` so this method can be used with `--rpc-http-api-method-no-auth` [#8153](https://github.com/hyperledger/besu/issues/8153)

View File

@@ -28,6 +28,8 @@ public enum NetworkName {
SEPOLIA("/sepolia.json", BigInteger.valueOf(11155111)),
/** Holešky network name. */
HOLESKY("/holesky.json", BigInteger.valueOf(17000)),
/** Hoodi network name. */
HOODI("/hoodi.json", BigInteger.valueOf(560048)),
/** LUKSO mainnet network name. */
LUKSO("/lukso.json", BigInteger.valueOf(42)),

View File

@@ -68,6 +68,13 @@ public class ForkIdsNetworkConfigTest {
new ForkId(Bytes.ofUnsignedInt(0xed88b5fdL), 0L),
new ForkId(Bytes.ofUnsignedInt(0xed88b5fdL), 0L))
},
new Object[] {
NetworkName.HOODI,
List.of(
new ForkId(Bytes.ofUnsignedInt(0xbef71d30L), 1742999832L),
new ForkId(Bytes.ofUnsignedInt(0x0929e24eL), 0L),
new ForkId(Bytes.ofUnsignedInt(0x0929e24eL), 0L))
},
new Object[] {
NetworkName.HOLESKY,
List.of(

View File

@@ -22,11 +22,13 @@ import static org.hyperledger.besu.cli.config.NetworkName.EPHEMERY;
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.HOLESKY;
import static org.hyperledger.besu.cli.config.NetworkName.HOODI;
import static org.hyperledger.besu.cli.config.NetworkName.LUKSO;
import static org.hyperledger.besu.cli.config.NetworkName.MAINNET;
import static org.hyperledger.besu.cli.config.NetworkName.MORDOR;
import static org.hyperledger.besu.cli.config.NetworkName.SEPOLIA;
import static org.hyperledger.besu.ethereum.api.jsonrpc.RpcApis.ENGINE;
import static org.hyperledger.besu.ethereum.p2p.config.DefaultDiscoveryConfiguration.HOODI_BOOTSTRAP_NODES;
import static org.hyperledger.besu.ethereum.p2p.config.DefaultDiscoveryConfiguration.MAINNET_BOOTSTRAP_NODES;
import static org.hyperledger.besu.ethereum.p2p.config.DefaultDiscoveryConfiguration.MAINNET_DISCOVERY_URL;
import static org.hyperledger.besu.ethereum.p2p.config.DefaultDiscoveryConfiguration.SEPOLIA_BOOTSTRAP_NODES;
@@ -527,6 +529,22 @@ public class BesuCommandTest extends CommandTestAbstract {
assertThat(config.networkId()).isEqualTo(BigInteger.valueOf(11155111));
}
@Test
public void testGenesisPathHoodiEthConfig() {
final ArgumentCaptor<EthNetworkConfig> networkArg =
ArgumentCaptor.forClass(EthNetworkConfig.class);
parseCommand("--network", "hoodi");
verify(mockControllerBuilderFactory).fromEthNetworkConfig(networkArg.capture(), any());
verify(mockControllerBuilder).build();
final EthNetworkConfig config = networkArg.getValue();
assertThat(config.bootNodes()).isEqualTo(HOODI_BOOTSTRAP_NODES);
assertThat(config.dnsDiscoveryUrl()).isNull();
assertThat(config.networkId()).isEqualTo(BigInteger.valueOf(560048));
}
@Test
public void testGenesisPathFutureEipsEthConfig() {
final ArgumentCaptor<EthNetworkConfig> networkArg =
@@ -1791,6 +1809,28 @@ public class BesuCommandTest extends CommandTestAbstract {
verify(mockLogger, never()).warn(contains("Sepolia is deprecated and will be shutdown"));
}
@Test
public void hoodiValuesAreUsed() {
parseCommand("--network", "hoodi");
final ArgumentCaptor<EthNetworkConfig> networkArg =
ArgumentCaptor.forClass(EthNetworkConfig.class);
final ArgumentCaptor<MiningConfiguration> miningArg =
ArgumentCaptor.forClass(MiningConfiguration.class);
verify(mockControllerBuilderFactory).fromEthNetworkConfig(networkArg.capture(), any());
verify(mockControllerBuilder).miningParameters(miningArg.capture());
verify(mockControllerBuilder).build();
assertThat(networkArg.getValue()).isEqualTo(EthNetworkConfig.getNetworkConfig(HOODI));
assertThat(commandOutput.toString(UTF_8)).isEmpty();
assertThat(commandErrorOutput.toString(UTF_8)).isEmpty();
assertThat(miningArg.getValue().getTargetGasLimit()).isEmpty();
verify(mockLogger, never()).warn(contains("Hoodi is deprecated and will be shutdown"));
}
@Test
public void holeskyValuesAreUsed() {
parseCommand("--network", "holesky");
@@ -1931,6 +1971,11 @@ public class BesuCommandTest extends CommandTestAbstract {
networkValuesCanBeOverridden("sepolia");
}
@Test
public void hoodiValuesCanBeOverridden() {
networkValuesCanBeOverridden("hoodi");
}
@Test
public void futureEipsValuesCanBeOverridden() {
networkValuesCanBeOverridden("future_eips");

View File

@@ -39,7 +39,17 @@ class NetworkDeprecationMessageTest {
@ParameterizedTest
@EnumSource(
value = NetworkName.class,
names = {"MAINNET", "SEPOLIA", "DEV", "CLASSIC", "MORDOR", "HOLESKY", "LUKSO", "EPHEMERY"})
names = {
"MAINNET",
"SEPOLIA",
"DEV",
"CLASSIC",
"MORDOR",
"HOLESKY",
"LUKSO",
"EPHEMERY",
"HOODI"
})
void shouldThrowErrorForNonDeprecatedNetworks(final NetworkName network) {
assertThatThrownBy(() -> NetworkDeprecationMessage.generate(network))
.isInstanceOf(AssertionError.class);

View File

@@ -16,6 +16,7 @@ package org.hyperledger.besu.cli.config;
import static org.assertj.core.api.Assertions.assertThat;
import static org.hyperledger.besu.cli.config.NetworkName.MAINNET;
import static org.hyperledger.besu.ethereum.p2p.config.DefaultDiscoveryConfiguration.HOODI_BOOTSTRAP_NODES;
import static org.hyperledger.besu.ethereum.p2p.config.DefaultDiscoveryConfiguration.MAINNET_BOOTSTRAP_NODES;
import static org.hyperledger.besu.ethereum.p2p.config.DefaultDiscoveryConfiguration.MAINNET_DISCOVERY_URL;
import static org.hyperledger.besu.ethereum.p2p.config.DefaultDiscoveryConfiguration.SEPOLIA_BOOTSTRAP_NODES;
@@ -48,6 +49,14 @@ public class EthNetworkConfigTest {
assertThat(config.networkId()).isEqualTo(BigInteger.valueOf(11155111));
}
@Test
public void testDefaultHoodiConfig() {
EthNetworkConfig config = EthNetworkConfig.getNetworkConfig(NetworkName.HOODI);
assertThat(config.dnsDiscoveryUrl()).isNull();
assertThat(config.bootNodes()).isEqualTo(HOODI_BOOTSTRAP_NODES);
assertThat(config.networkId()).isEqualTo(BigInteger.valueOf(560048));
}
@Test
public void testDefaultDevConfig() {
EthNetworkConfig config = EthNetworkConfig.getNetworkConfig(NetworkName.DEV);

View File

@@ -50,6 +50,14 @@ public class DefaultDiscoveryConfiguration {
"enode://9e9492e2e8836114cc75f5b929784f4f46c324ad01daf87d956f98b3b6c5fcba95524d6e5cf9861dc96a2c8a171ea7105bb554a197455058de185fa870970c7c@138.68.123.152:30303")
.map(EnodeURLImpl::fromString)
.collect(toList()));
public static final List<EnodeURL> HOODI_BOOTSTRAP_NODES =
Collections.unmodifiableList(
Stream.of(
"enode://2112dd3839dd752813d4df7f40936f06829fc54c0e051a93967c26e5f5d27d99d886b57b4ffcc3c475e930ec9e79c56ef1dbb7d86ca5ee83a9d2ccf36e5c240c@134.209.138.84:30303",
"enode://60203fcb3524e07c5df60a14ae1c9c5b24023ea5d47463dfae051d2c9f3219f309657537576090ca0ae641f73d419f53d8e8000d7a464319d4784acd7d2abc41@209.38.124.160:30303",
"enode://8ae4a48101b2299597341263da0deb47cc38aa4d3ef4b7430b897d49bfa10eb1ccfe1655679b1ed46928ef177fbf21b86837bd724400196c508427a6f41602cd@134.199.184.23:30303")
.map(EnodeURLImpl::fromString)
.collect(toList()));
public static final List<EnodeURL> CLASSIC_BOOTSTRAP_NODES =
Collections.unmodifiableList(
Stream.of(

File diff suppressed because one or more lines are too long

View File

@@ -88,6 +88,7 @@ public class MergeCoordinator implements MergeMiningCoordinator, BadChainListene
List.of(
BigInteger.valueOf(11155111), // Sepolia
BigInteger.valueOf(17000), // Holesky
BigInteger.valueOf(560048), // Hoodi
BigInteger.valueOf(39438135) // Ephemery
);

View File

@@ -1008,6 +1008,7 @@ public class MergeCoordinatorTest implements MergeGenesisConfigHelper {
Arguments.of("mainnet", 1L, 36_000_000L),
Arguments.of("holesky", 17_000L, 36_000_000L),
Arguments.of("sepolia", 11_155_111L, 36_000_000L),
Arguments.of("hoodi", 560_048L, 36_000_000L),
Arguments.of("ephemery", 39_438_135L, 36_000_000L));
}

View File

@@ -297,6 +297,15 @@ public class ForkIdTest {
ForkIdTestUtil.wantForkId("0xf7f9bc08", 0L),
Optional.of(ForkIds.SEPOLIA),
empty()),
// Hoodi
Arguments.of(
"Hoodi // Prague",
Network.HOODI,
0L,
1742999832L,
ForkIdTestUtil.wantForkId("0x0929e24e", 0L),
Optional.of(ForkIds.HOODI),
empty()),
// private
Arguments.of(
"Private // Unsynced",

View File

@@ -64,6 +64,8 @@ public class ForkIdTestUtil {
"0xd4e56740f876aef8c010b86a40d5f56745a118d0906a34e69aec8c0db1cb8fa3";
public static final String SEPOLIA =
"0x25a5cc106eea7138acab33231d7160d69cb777ee0c2c553fcddf5138993e6dd9";
public static final String HOODI =
"0xbbe312868b376a3001692a646dd2d7d1e4406380dfd86b98aa8a34d1557c971b";
public static final String PRIVATE =
"0x0000000000000000000000000000000000000000000000000000000000000000";
}
@@ -75,8 +77,11 @@ public class ForkIdTestUtil {
9069000L, 9200000L, 12244000L, 12965000L, 13773000L, 15050000L);
public static final List<Long> SEPOLIA_BLOCKNUMBERS =
Arrays.asList(0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 1735371L);
public static final List<Long> HOODI_BLOCKNUMBERS =
Arrays.asList(0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L);
public static final List<Long> SEPOLIA_TIMESTAMPS = Arrays.asList(1677557088L);
public static final List<Long> HOODI_TIMESTAMPS = Arrays.asList(1742999832L);
public static final List<Long> PRIVATE = Arrays.asList(0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L);
@@ -108,6 +113,10 @@ public class ForkIdTestUtil {
new ForkId(Bytes.fromHexString("0xfe3366e7"), 1735371L),
new ForkId(Bytes.fromHexString("0xb96cbd13"), 1677557088L),
new ForkId(Bytes.fromHexString("0xf7f9bc08"), 0L)); // First Shanghai block (timestamp)
public static final List<ForkId> HOODI =
List.of(
new ForkId(Bytes.fromHexString("0xbef71d30"), 1742999832L),
new ForkId(Bytes.fromHexString("0x0929e24e"), 0L));
public static final List<ForkId> WITHDRAWALS =
Arrays.asList(
@@ -134,6 +143,8 @@ public class ForkIdTestUtil {
public static final Network MAINNET = network(GenesisHash.MAINNET, Forks.MAINNET, emptyList());
public static final Network SEPOLIA =
network(GenesisHash.SEPOLIA, Forks.SEPOLIA_BLOCKNUMBERS, Forks.SEPOLIA_TIMESTAMPS);
public static final Network HOODI =
network(GenesisHash.HOODI, Forks.HOODI_BLOCKNUMBERS, Forks.HOODI_TIMESTAMPS);
public static final Network PRIVATE = network(GenesisHash.PRIVATE, Forks.PRIVATE, emptyList());
public static final Network MAINNET_WITH_SHANGHAI =