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

[23.4] Remove GoQuorum privacy #5303

Merged
merged 30 commits into from
Apr 13, 2023
Merged
Show file tree
Hide file tree
Changes from 20 commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
c847bd8
fail startup with goQuorum mode
macfarla Apr 4, 2023
509a6ff
removed separate decoding logic
macfarla Apr 4, 2023
14259e1
remove goQuorum flag
macfarla Apr 4, 2023
c31b0e0
run non-mainnet ATs to make sure
macfarla Apr 4, 2023
821b025
remove goQuorum flag from everywhere
macfarla Apr 4, 2023
e09b5aa
removed some GoQuorum cli tests
macfarla Apr 4, 2023
70e96c7
remove GOQUORUM api group
macfarla Apr 4, 2023
42c9d73
removed unnecessary mockito stubbings
macfarla Apr 4, 2023
5309e86
text
macfarla Apr 4, 2023
a39f096
merge
macfarla Apr 4, 2023
67b6f13
Merge branch 'main' of github.com:hyperledger/besu into gq-priv-rm
macfarla Apr 4, 2023
34bbeba
changelog pr
macfarla Apr 5, 2023
7757754
remove GoQuorum enclave, privacy params, RPCs and other related config
macfarla Apr 5, 2023
ae77352
formatting
macfarla Apr 5, 2023
85d7848
Merge branch 'main' of github.com:hyperledger/besu into gq-priv-rm
macfarla Apr 5, 2023
e34de24
remove test that doesn't make sense
macfarla Apr 5, 2023
82c9f90
formatting
macfarla Apr 5, 2023
199c3e1
Merge branch 'main' of github.com:hyperledger/besu into gq-priv-rm
macfarla Apr 5, 2023
a11be72
merge main
macfarla Apr 11, 2023
8962e1f
removed acceptanceTestNonMainnet run on PR
macfarla Apr 11, 2023
f7544c2
removed Goquorum related error codes, rpcMethod codes, privateBloom
macfarla Apr 11, 2023
1561c2b
removed ibftlegacy that snuck back via merge conflict
macfarla Apr 11, 2023
f181f06
removed v from transaction
macfarla Apr 11, 2023
9fd953d
removed private GoQuorum storage provider
macfarla Apr 11, 2023
ece694d
add back in non mainnet ATs
macfarla Apr 11, 2023
82ba790
removed the v param
macfarla Apr 11, 2023
1f01a51
merge main
macfarla Apr 11, 2023
3f73e4a
formatting
macfarla Apr 11, 2023
14a93a5
removed nonMainnetATs run
macfarla Apr 11, 2023
05218d6
Merge branch 'main' into gq-priv-rm
macfarla Apr 13, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
## 23.4-RC

### Breaking Changes
- Removed IBFT1 feature [#5302](https://github.com/hyperledger/besu/pull/5302)
- Removed IBFT 1.0 feature (deprecated in 23.1.0-beta) [#5302](https://github.com/hyperledger/besu/pull/5302)
- Removed GoQuorum-compatible privacy feature (deprecated in 23.1.0-beta) [#5303](https://github.com/hyperledger/besu/pull/5303)

### Additions and Improvements
- Update most dependencies to latest version [#5269](https://github.com/hyperledger/besu/pull/5269)
Expand Down
4 changes: 1 addition & 3 deletions besu/src/main/java/org/hyperledger/besu/RunnerBuilder.java
Original file line number Diff line number Diff line change
Expand Up @@ -936,9 +936,7 @@ public Runner build() {

Optional<GraphQLHttpService> graphQLHttpService = Optional.empty();
if (graphQLConfiguration.isEnabled()) {
final GraphQLDataFetchers fetchers =
new GraphQLDataFetchers(
supportedCapabilities, privacyParameters.getGoQuorumPrivacyParameters());
final GraphQLDataFetchers fetchers = new GraphQLDataFetchers(supportedCapabilities);
final Map<GraphQLContextType, Object> graphQlContextMap = new ConcurrentHashMap<>();
graphQlContextMap.putIfAbsent(GraphQLContextType.BLOCKCHAIN_QUERIES, blockchainQueries);
graphQlContextMap.putIfAbsent(GraphQLContextType.PROTOCOL_SCHEDULE, protocolSchedule);
Expand Down
74 changes: 4 additions & 70 deletions besu/src/main/java/org/hyperledger/besu/cli/BesuCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,6 @@
import org.hyperledger.besu.config.CheckpointConfigOptions;
import org.hyperledger.besu.config.GenesisConfigFile;
import org.hyperledger.besu.config.GenesisConfigOptions;
import org.hyperledger.besu.config.GoQuorumOptions;
import org.hyperledger.besu.config.MergeConfigOptions;
import org.hyperledger.besu.consensus.qbft.pki.PkiBlockCreationConfiguration;
import org.hyperledger.besu.consensus.qbft.pki.PkiBlockCreationConfigurationProvider;
Expand All @@ -106,7 +105,6 @@
import org.hyperledger.besu.datatypes.Hash;
import org.hyperledger.besu.datatypes.Wei;
import org.hyperledger.besu.enclave.EnclaveFactory;
import org.hyperledger.besu.enclave.GoQuorumEnclave;
import org.hyperledger.besu.ethereum.GasLimitCalculator;
import org.hyperledger.besu.ethereum.api.ApiConfiguration;
import org.hyperledger.besu.ethereum.api.ImmutableApiConfiguration;
Expand All @@ -122,7 +120,6 @@
import org.hyperledger.besu.ethereum.api.tls.TlsClientAuthConfiguration;
import org.hyperledger.besu.ethereum.api.tls.TlsConfiguration;
import org.hyperledger.besu.ethereum.chain.Blockchain;
import org.hyperledger.besu.ethereum.core.GoQuorumPrivacyParameters;
import org.hyperledger.besu.ethereum.core.MiningParameters;
import org.hyperledger.besu.ethereum.core.PrivacyParameters;
import org.hyperledger.besu.ethereum.eth.sync.SyncMode;
Expand All @@ -141,15 +138,10 @@
import org.hyperledger.besu.ethereum.permissioning.SmartContractPermissioningConfiguration;
import org.hyperledger.besu.ethereum.privacy.storage.keyvalue.PrivacyKeyValueStorageProvider;
import org.hyperledger.besu.ethereum.privacy.storage.keyvalue.PrivacyKeyValueStorageProviderBuilder;
import org.hyperledger.besu.ethereum.storage.StorageProvider;
import org.hyperledger.besu.ethereum.storage.keyvalue.KeyValueSegmentIdentifier;
import org.hyperledger.besu.ethereum.storage.keyvalue.KeyValueStorageProvider;
import org.hyperledger.besu.ethereum.storage.keyvalue.KeyValueStorageProviderBuilder;
import org.hyperledger.besu.ethereum.worldstate.DefaultWorldStateArchive;
import org.hyperledger.besu.ethereum.worldstate.PrunerConfiguration;
import org.hyperledger.besu.ethereum.worldstate.WorldStateArchive;
import org.hyperledger.besu.ethereum.worldstate.WorldStatePreimageStorage;
import org.hyperledger.besu.ethereum.worldstate.WorldStateStorage;
import org.hyperledger.besu.evm.precompile.AbstractAltBnPrecompiledContract;
import org.hyperledger.besu.evm.precompile.BigIntegerModularExponentiationPrecompiledContract;
import org.hyperledger.besu.evm.precompile.KZGPointEvalPrecompiledContract;
Expand Down Expand Up @@ -214,7 +206,6 @@
import java.time.Clock;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Base64;
import java.util.Collection;
import java.util.HashMap;
import java.util.HashSet;
Expand All @@ -236,7 +227,6 @@
import com.google.common.base.Strings;
import com.google.common.base.Suppliers;
import com.google.common.collect.ImmutableMap;
import com.google.common.io.Files;
import com.google.common.io.Resources;
import io.vertx.core.Vertx;
import io.vertx.core.VertxOptions;
Expand Down Expand Up @@ -2225,44 +2215,6 @@ private JsonRpcIpcConfiguration jsonRpcIpcConfiguration(
vertx.isNativeTransportEnabled() && enabled, actualPath, rpcIpcApis);
}

private GoQuorumPrivacyParameters configureGoQuorumPrivacy(
final KeyValueStorageProvider storageProvider) {
return new GoQuorumPrivacyParameters(
createGoQuorumEnclave(),
readEnclaveKey(),
storageProvider.createGoQuorumPrivateStorage(),
createPrivateWorldStateArchive(storageProvider));
}

private GoQuorumEnclave createGoQuorumEnclave() {
final EnclaveFactory enclaveFactory = new EnclaveFactory(Vertx.vertx());
if (privacyOptionGroup.privacyKeyStoreFile != null) {
return enclaveFactory.createGoQuorumEnclave(
privacyOptionGroup.privacyUrl,
privacyOptionGroup.privacyKeyStoreFile,
privacyOptionGroup.privacyKeyStorePasswordFile,
privacyOptionGroup.privacyTlsKnownEnclaveFile);
} else {
return enclaveFactory.createGoQuorumEnclave(privacyOptionGroup.privacyUrl);
}
}

private String readEnclaveKey() {
final String key;
try {
key = Files.asCharSource(privacyOptionGroup.privacyPublicKeyFile, UTF_8).read();
} catch (final Exception e) {
throw new ParameterException(
this.commandLine,
"--privacy-public-key-file must be set if isQuorum is set in the genesis file.",
e);
}
// throws exception if invalid base 64
Base64.getDecoder().decode(key);

return key;
}

private void ensureAllNodesAreInAllowlist(
final Collection<EnodeURL> enodeAddresses,
final LocalPermissioningConfiguration permissioningConfiguration) {
Expand Down Expand Up @@ -2328,7 +2280,7 @@ public BesuControllerBuilder getControllerBuilder() {
.nodeKey(new NodeKey(securityModule()))
.metricsSystem(metricsSystem.get())
.messagePermissioningProviders(permissioningService.getMessagePermissioningProviders())
.privacyParameters(privacyParameters(storageProvider))
.privacyParameters(privacyParameters())
.pkiBlockCreationConfiguration(maybePkiBlockCreationConfiguration())
.clock(Clock.systemUTC())
.isRevertReasonEnabled(isRevertReasonEnabled)
Expand Down Expand Up @@ -2821,7 +2773,7 @@ private boolean contractPermissionsEnabled() {
|| permissionsOptionGroup.permissionsAccountsContractEnabled;
}

private PrivacyParameters privacyParameters(final KeyValueStorageProvider storageProvider) {
private PrivacyParameters privacyParameters() {

CommandLineUtils.checkOptionDependencies(
logger,
Expand Down Expand Up @@ -2850,7 +2802,7 @@ private PrivacyParameters privacyParameters(final KeyValueStorageProvider storag
}
if (isGoQuorumCompatibilityMode) {
throw new ParameterException(
commandLine, String.format("%s %s", "GoQuorum mode", errorSuffix));
commandLine, String.format("GoQuorum privacy is no longer supported in Besu"));
}

if (Boolean.TRUE.equals(privacyOptionGroup.isPrivacyMultiTenancyEnabled)
Expand Down Expand Up @@ -2912,20 +2864,12 @@ private PrivacyParameters privacyParameters(final KeyValueStorageProvider storag
privacyOptionGroup.privacyTlsKnownEnclaveFile);
}
privacyParametersBuilder.setEnclaveFactory(new EnclaveFactory(vertx));
} else if (isGoQuorumCompatibilityMode) {
privacyParametersBuilder.setGoQuorumPrivacyParameters(
Optional.of(configureGoQuorumPrivacy(storageProvider)));
}

if (Boolean.FALSE.equals(privacyOptionGroup.isPrivacyEnabled) && anyPrivacyApiEnabled()) {
logger.warn("Privacy is disabled. Cannot use EEA/PRIV API methods when not using Privacy.");
}

if (!isGoQuorumCompatibilityMode
&& (jsonRPCHttpOptionGroup.rpcHttpApis.contains(RpcApis.GOQUORUM.name())
|| jsonRPCWebsocketOptionGroup.rpcWsApis.contains(RpcApis.GOQUORUM.name()))) {
logger.warn("Cannot use GOQUORUM API methods when not in GoQuorum mode.");
}
privacyParametersBuilder.setPrivacyService(privacyPluginService);
final PrivacyParameters privacyParameters = privacyParametersBuilder.build();

Expand All @@ -2938,14 +2882,6 @@ private PrivacyParameters privacyParameters(final KeyValueStorageProvider storag
return privacyParameters;
}

private WorldStateArchive createPrivateWorldStateArchive(final StorageProvider storageProvider) {
final WorldStateStorage privateWorldStateStorage =
storageProvider.createPrivateWorldStateStorage();
final WorldStatePreimageStorage preimageStorage =
storageProvider.createPrivateWorldStatePreimageStorage();
return new DefaultWorldStateArchive(privateWorldStateStorage, preimageStorage);
}

private boolean anyPrivacyApiEnabled() {
return jsonRPCHttpOptionGroup.rpcHttpApis.contains(RpcApis.EEA.name())
|| jsonRPCWebsocketOptionGroup.rpcWsApis.contains(RpcApis.EEA.name())
Expand Down Expand Up @@ -2982,7 +2918,6 @@ private KeyValueStorageProvider keyValueStorageProvider(final String name) {
"No KeyValueStorageFactory found for key: " + name)))
.withCommonConfiguration(pluginCommonConfiguration)
.withMetricsSystem(getMetricsSystem())
.isGoQuorumCompatibilityMode(isGoQuorumCompatibilityMode.booleanValue())
.build();
}
return this.keyValueStorageProvider;
Expand Down Expand Up @@ -3522,8 +3457,7 @@ private Optional<String> getEcCurveFromGenesisFile() {
/** Enables Go Quorum Compatibility mode. Visible for testing. */
@VisibleForTesting
protected void enableGoQuorumCompatibilityMode() {
// this static flag is read by the RLP decoder
GoQuorumOptions.setGoQuorumCompatibilityMode(true);
// this static flag is still used for GoQuorum permissioning compatibility
isGoQuorumCompatibilityMode = true;
}

Expand Down
54 changes: 1 addition & 53 deletions besu/src/test/java/org/hyperledger/besu/cli/BesuCommandTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -4545,13 +4545,7 @@ public void privacyWithGoQuorumModeMustError() throws IOException {
"--privacy-enabled", "--genesis-file", genesisFile.toString(), "--min-gas-price", "0");

assertThat(commandErrorOutput.toString(UTF_8))
.contains("GoQuorum mode cannot be enabled with privacy.");
assertThat(commandOutput.toString(UTF_8)).isEmpty();
verify(mockLogger, atLeast(1))
.warn(
DEPRECATION_WARNING_MSG,
"isQuorum mode in genesis file (GoQuorum-compatible privacy mode)",
"--privacy-enabled");
.contains("GoQuorum privacy is no longer supported in Besu");
}

@Rule public TemporaryFolder testFolder = new TemporaryFolder();
Expand Down Expand Up @@ -5142,52 +5136,6 @@ public void quorumInteropEnabledFailsWithoutGasPriceSetToZero() throws IOExcepti
"--min-gas-price must be set to zero if isQuorum mode is enabled in the genesis file.");
}

@Test
public void quorumInteropEnabledSucceedsWithGasPriceSetToZero() throws IOException {
final Path genesisFile =
createFakeGenesisFile(VALID_GENESIS_QUORUM_INTEROP_ENABLED_WITH_CHAINID);
parseCommand(
"--genesis-file",
genesisFile.toString(),
"--min-gas-price",
"0",
"--privacy-public-key-file",
ENCLAVE_PUBLIC_KEY_PATH);
assertThat(commandErrorOutput.toString(UTF_8)).isEmpty();
}

@Test
public void quorumInteropEnabledFailsIfEnclaveKeyFileDoesNotExist() throws IOException {
final Path genesisFile =
createFakeGenesisFile(VALID_GENESIS_QUORUM_INTEROP_ENABLED_WITH_CHAINID);
parseCommand(
"--genesis-file",
genesisFile.toString(),
"--min-gas-price",
"0",
"--privacy-public-key-file",
"ThisFileDoesNotExist");
assertThat(commandErrorOutput.toString(UTF_8))
.contains("--privacy-public-key-file must be set if isQuorum is set in the genesis file.");
}

@Test
public void quorumInteropEnabledFailsIfEnclaveKeyFileIsNotSet() throws IOException {
final Path genesisFile =
createFakeGenesisFile(VALID_GENESIS_QUORUM_INTEROP_ENABLED_WITH_CHAINID);
parseCommand("--genesis-file", genesisFile.toString(), "--min-gas-price", "0");
assertThat(commandErrorOutput.toString(UTF_8))
.contains("--privacy-public-key-file must be set if isQuorum is set in the genesis file.");
}

@Test
public void quorumInteropEnabledFailsWithMainnetDefaultNetwork() throws IOException {
final Path genesisFile = createFakeGenesisFile(INVALID_GENESIS_QUORUM_INTEROP_ENABLED_MAINNET);
parseCommand("--genesis-file", genesisFile.toString(), "--min-gas-price", "0");
assertThat(commandErrorOutput.toString(UTF_8))
.contains("isQuorum mode cannot be used on Mainnet.");
}

@Test
public void quorumInteropEnabledFailsWithMainnetChainId() throws IOException {
final Path genesisFile =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -495,14 +495,6 @@ protected Vertx createVertx(final VertxOptions vertxOptions) {
return vertx;
}

@Override
protected void enableGoQuorumCompatibilityMode() {
// We do *not* set the static GoQuorumOptions for test runs as
// these are only allowed to be set once during the program
// runtime.
isGoQuorumCompatibilityMode = true;
}

public CommandSpec getSpec() {
return spec;
}
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -79,11 +79,9 @@ public static ProtocolSchedule create(
epochManager,
cliqueConfig.getBlockPeriodSeconds(),
localNodeAddress,
builder,
privacyParameters.getGoQuorumPrivacyParameters().isPresent())),
builder)),
privacyParameters,
isRevertReasonEnabled,
config.isQuorum(),
evmConfiguration)
.createProtocolSchedule();
}
Expand All @@ -110,8 +108,7 @@ private static ProtocolSpecBuilder applyCliqueSpecificModifications(
final EpochManager epochManager,
final long secondsBetweenBlocks,
final Address localNodeAddress,
final ProtocolSpecBuilder specBuilder,
final boolean goQuorumMode) {
final ProtocolSpecBuilder specBuilder) {

return specBuilder
.blockHeaderValidatorBuilder(
Expand All @@ -121,7 +118,7 @@ private static ProtocolSpecBuilder applyCliqueSpecificModifications(
baseFeeMarket ->
getBlockHeaderValidator(epochManager, secondsBetweenBlocks, baseFeeMarket))
.blockBodyValidatorBuilder(MainnetBlockBodyValidator::new)
.blockValidatorBuilder(MainnetProtocolSpecs.blockValidatorBuilder(goQuorumMode))
.blockValidatorBuilder(MainnetProtocolSpecs.blockValidatorBuilder())
.blockImporterBuilder(MainnetBlockImporter::new)
.difficultyCalculator(new CliqueDifficultyCalculator(localNodeAddress))
.blockReward(Wei.ZERO)
Expand Down
Loading