Add Holešky as predefined network name (#5797)

* Add Holešky testnet network name

Signed-off-by: Fabio Di Fabio <fabio.difabio@consensys.net>

* CHANGELOG

Signed-off-by: Fabio Di Fabio <fabio.difabio@consensys.net>

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

Signed-off-by: Fabio Di Fabio <fabio.difabio@consensys.net>

* Tear down KZG trusted setup after each test

Signed-off-by: Fabio Di Fabio <fabio.difabio@consensys.net>

* Fix test

Signed-off-by: Fabio Di Fabio <fabio.difabio@consensys.net>

* Prevent another trusted setup already loaded error during tests

Signed-off-by: Fabio Di Fabio <fabio.difabio@consensys.net>

---------

Signed-off-by: Fabio Di Fabio <fabio.difabio@consensys.net>
Co-authored-by: Sally MacFarlane <macfarla.github@gmail.com>
pull/5816/head
Fabio Di Fabio 1 year ago committed by GitHub
parent c265fe4440
commit eb60c06772
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 1
      CHANGELOG.md
  2. 3
      besu/src/main/java/org/hyperledger/besu/cli/config/NetworkName.java
  3. 8
      besu/src/test/java/org/hyperledger/besu/ForkIdsNetworkConfigTest.java
  4. 28
      besu/src/test/java/org/hyperledger/besu/cli/BesuCommandTest.java
  5. 2
      besu/src/test/java/org/hyperledger/besu/cli/NetworkDeprecationMessageTest.java
  6. 1022
      config/src/main/resources/holesky.json
  7. 4163
      config/src/main/resources/kzg-trusted-setups/holesky.txt
  8. 7
      ethereum/core/src/test-support/java/org/hyperledger/besu/ethereum/core/BlobTestFixture.java
  9. 2
      evm/src/main/java/org/hyperledger/besu/evm/precompile/KZGPointEvalPrecompiledContract.java
  10. 2
      evm/src/test/java/org/hyperledger/besu/evm/precompile/KZGPointEvalPrecompileContractTest.java

@ -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)

@ -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. */

@ -81,6 +81,14 @@ public class ForkIdsNetworkConfigTest {
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(

@ -24,6 +24,7 @@ import static org.hyperledger.besu.cli.config.NetworkName.DEV;
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;
@ -85,6 +86,7 @@ import org.hyperledger.besu.ethereum.permissioning.SmartContractPermissioningCon
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;
@ -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);
}
@ -4065,6 +4075,24 @@ public class BesuCommandTest extends CommandTestAbstract {
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");

@ -39,7 +39,7 @@ class NetworkDeprecationMessageTest {
@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))

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

@ -23,6 +23,7 @@ import org.hyperledger.besu.datatypes.BlobsWithCommitments;
import org.hyperledger.besu.datatypes.KZGCommitment;
import org.hyperledger.besu.datatypes.KZGProof;
import org.hyperledger.besu.datatypes.VersionedHash;
import org.hyperledger.besu.evm.precompile.KZGPointEvalPrecompiledContract;
import java.io.IOException;
import java.io.InputStream;
@ -37,6 +38,12 @@ import org.bouncycastle.crypto.digests.SHA256Digest;
public class BlobTestFixture {
public BlobTestFixture() {
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
}
try {
CKZG4844JNI.loadNativeLibrary(CKZG4844JNI.Preset.MAINNET);
CKZG4844JNI.loadTrustedSetupFromResource(

@ -81,7 +81,7 @@ public class KZGPointEvalPrecompiledContract implements PrecompiledContract {
/** free up resources. */
@VisibleForTesting
void tearDown() {
public static void tearDown() {
CKZG4844JNI.freeTrustedSetup();
loaded.set(false);
}

@ -50,7 +50,7 @@ public class KZGPointEvalPrecompileContractTest {
@AfterAll
public static void tearDown() {
contract.tearDown();
KZGPointEvalPrecompiledContract.tearDown();
}
@ParameterizedTest(name = "{index}")

Loading…
Cancel
Save