From d39f4c55718a083fed006104e68331990a50c2e7 Mon Sep 17 00:00:00 2001 From: Sally MacFarlane Date: Thu, 14 Dec 2023 16:23:36 +1000 Subject: [PATCH 1/2] add genesis file name to config overview Signed-off-by: Sally MacFarlane --- besu/build.gradle | 1 - .../org/hyperledger/besu/cli/BesuCommand.java | 3 +++ .../besu/cli/ConfigurationOverviewBuilder.java | 16 +++++++++++++++- .../cli/ConfigurationOverviewBuilderTest.java | 3 ++- 4 files changed, 20 insertions(+), 3 deletions(-) diff --git a/besu/build.gradle b/besu/build.gradle index fe5bb45c30d..a7c6d3bef7a 100644 --- a/besu/build.gradle +++ b/besu/build.gradle @@ -103,6 +103,5 @@ dependencies { testImplementation 'org.testcontainers:testcontainers' testImplementation 'tech.pegasys.discovery:discovery' - testRuntimeOnly 'org.junit.vintage:junit-vintage-engine' annotationProcessor 'com.google.dagger:dagger-compiler' } diff --git a/besu/src/main/java/org/hyperledger/besu/cli/BesuCommand.java b/besu/src/main/java/org/hyperledger/besu/cli/BesuCommand.java index abd9ac90cf5..d61f9e73f1d 100644 --- a/besu/src/main/java/org/hyperledger/besu/cli/BesuCommand.java +++ b/besu/src/main/java/org/hyperledger/besu/cli/BesuCommand.java @@ -3526,6 +3526,9 @@ private String generateConfigurationOverview() { } builder.setHasCustomGenesis(genesisFile != null); + if (genesisFile != null) { + builder.setCustomGenesis(genesisFile.getAbsolutePath()); + } builder.setNetworkId(ethNetworkConfig.getNetworkId()); builder diff --git a/besu/src/main/java/org/hyperledger/besu/cli/ConfigurationOverviewBuilder.java b/besu/src/main/java/org/hyperledger/besu/cli/ConfigurationOverviewBuilder.java index 5ed209ca311..4fd870e99ce 100644 --- a/besu/src/main/java/org/hyperledger/besu/cli/ConfigurationOverviewBuilder.java +++ b/besu/src/main/java/org/hyperledger/besu/cli/ConfigurationOverviewBuilder.java @@ -42,6 +42,7 @@ public class ConfigurationOverviewBuilder { private String network; private BigInteger networkId; private boolean hasCustomGenesis; + private String customGenesisFileName; private String dataStorage; private String syncMode; private Integer rpcPort; @@ -98,6 +99,17 @@ public ConfigurationOverviewBuilder setHasCustomGenesis(final boolean hasCustomG return this; } + /** + * Sets location of custom genesis file specified. + * + * @param customGenesisFileName the filename of the custom genesis file, only set if specified + * @return the builder + */ + public ConfigurationOverviewBuilder setCustomGenesis(final String customGenesisFileName) { + this.customGenesisFileName = customGenesisFileName; + return this; + } + /** * Sets data storage. * @@ -269,7 +281,9 @@ public String build() { } if (hasCustomGenesis) { - lines.add("Network: Custom genesis file specified"); + lines.add("Network: Custom genesis file"); + lines.add( + customGenesisFileName == null ? "Custom genesis file is null" : customGenesisFileName); } if (networkId != null) { diff --git a/besu/src/test/java/org/hyperledger/besu/cli/ConfigurationOverviewBuilderTest.java b/besu/src/test/java/org/hyperledger/besu/cli/ConfigurationOverviewBuilderTest.java index ae00587c04d..eee55c3975b 100644 --- a/besu/src/test/java/org/hyperledger/besu/cli/ConfigurationOverviewBuilderTest.java +++ b/besu/src/test/java/org/hyperledger/besu/cli/ConfigurationOverviewBuilderTest.java @@ -58,8 +58,9 @@ void setGenesisFile() { assertThat(networkSet).contains("Network: foobar"); builder.setHasCustomGenesis(true); + builder.setCustomGenesis("file.name"); final String genesisSet = builder.build(); - assertThat(genesisSet).contains("Network: Custom genesis file specified"); + assertThat(genesisSet).contains("Network: Custom genesis file"); assertThat(genesisSet).doesNotContain("Network: foobar"); } From e5ce40f91069def00466ae5ad929e72cb26e39e8 Mon Sep 17 00:00:00 2001 From: Sally MacFarlane Date: Thu, 14 Dec 2023 22:22:28 +1000 Subject: [PATCH 2/2] changelog entry Signed-off-by: Sally MacFarlane --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index b3a16d30983..cb62bc847cd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ - Add error messages on authentication failures with username and password [#6212](https://github.com/hyperledger/besu/pull/6212) - New `Sequenced` transaction pool. The pool is an evolution of the `legacy` pool and is likely to be more suitable to enterprise or permissioned chains than the `layered` transaction pool. Select to use this pool with `--tx-pool=sequenced`. Supports the same options as the `legacy` pool [#6211](https://github.com/hyperledger/besu/issues/6211) - Set Ethereum Classic mainnet activation block for Spiral network upgrade [#6267](https://github.com/hyperledger/besu/pull/6267) +- Add custom genesis file name to config overview if specified [#6297](https://github.com/hyperledger/besu/pull/6297) ### Bug fixes