Skip to content

Commit

Permalink
Merge branch 'release-21.7.0' of github.com:hyperledger/besu into rel…
Browse files Browse the repository at this point in the history
…ease-21.7.0
  • Loading branch information
RatanRSur committed Jul 8, 2021
2 parents 02b9783 + cc3b5ce commit b735981
Show file tree
Hide file tree
Showing 23 changed files with 437 additions and 197 deletions.
7 changes: 6 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
## 21.7.0

### Additions and Improvements
- `priv_call` now uses NO_TRACING OperationTracer implementation which improves memory usage [\#2482](https://github.com/hyperledger/besu/pull/2482)

### Bug Fixes
- Ibft2 could create invalid RoundChange messages in some circumstances containing duplicate prepares [\#2449](https://github.com/hyperledger/besu/pull/2449)
Expand All @@ -14,7 +15,11 @@ This release contains the activation blocks for London across all supported test
* Ropsten 10_499_401 (24 Jun 2021)
* Goerli 5_062_605 (30 Jun 2021)
* Rinkeby 8_897_988 (7 Jul 2021)

- QBFT is a Byzantine Fault Tolerant consensus algorithm, building on the capabilities of IBFT and IBFT 2.0. It aims to provide performance improvements in cases of excess round change, and provides interoperability with other EEA compliant clients, such as GoQuorum.
- Note: QBFT currently only supports new networks. Existing networks using IBFT2.0 cannot migrate to QBFT. This will become available in a future release.
- Note: QBFT is an early access feature pending community feedback. Please make use of QBFT in new development networks and reach out in case of issues or concerns
- GoQuorum-compatible privacy. This mode uses Tessera and is interoperable with GoQuorum.
- Note: GoQuorum-compatible privacy is an early access feature pending community feedback.

## 21.7.0-RC2

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public class PermissioningPluginTest extends AcceptanceTestBase {

@Before
public void setUp() throws Exception {
BesuNodeConfigurationBuilder builder =
final BesuNodeConfigurationBuilder builder =
new BesuNodeConfigurationBuilder()
.miningEnabled(false)
.plugins(Collections.singletonList("testPlugins"))
Expand Down Expand Up @@ -86,9 +86,9 @@ public void transactionsAreNotSendToBlockPendingTransactionsNode() {
final Account account = accounts.createAccount("account-one");
final Amount balance = Amount.ether(20);

TransferTransaction tx = accountTransactions.createTransfer(account, balance);
final TransferTransaction tx = accountTransactions.createTransfer(account, balance);

Hash txHash = aliceNode.execute(tx);
final Hash txHash = aliceNode.execute(tx);

aliceNode.verify(txPoolConditions.inTransactionPool(txHash));
bobNode.verify(txPoolConditions.inTransactionPool(txHash));
Expand Down
4 changes: 3 additions & 1 deletion besu/src/main/java/org/hyperledger/besu/RunnerBuilder.java
Original file line number Diff line number Diff line change
Expand Up @@ -568,7 +568,9 @@ public Runner build() {

Optional<GraphQLHttpService> graphQLHttpService = Optional.empty();
if (graphQLConfiguration.isEnabled()) {
final GraphQLDataFetchers fetchers = new GraphQLDataFetchers(supportedCapabilities);
final GraphQLDataFetchers fetchers =
new GraphQLDataFetchers(
supportedCapabilities, privacyParameters.getGoQuorumPrivacyParameters());
final GraphQLDataFetcherContextImpl dataFetcherContext =
new GraphQLDataFetcherContextImpl(
blockchainQueries,
Expand Down
67 changes: 22 additions & 45 deletions besu/src/main/java/org/hyperledger/besu/cli/BesuCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -393,6 +393,8 @@ public class BesuCommand implements DefaultCommandValues, Runnable {
"Allow for incoming connections to be prioritized randomly. This will prevent (typically small, stable) networks from forming impenetrable peer cliques. (default: ${DEFAULT-VALUE})")
private final Boolean randomPeerPriority = false;

private GenesisConfigOptions genesisConfigOptions;

@Option(
names = {"--banned-node-ids", "--banned-node-id"},
paramLabel = MANDATORY_NODE_ID_FORMAT_HELP,
Expand Down Expand Up @@ -1080,12 +1082,6 @@ void setBannedNodeIds(final List<String> values) {
description = "Maximum gas price for eth_gasPrice (default: ${DEFAULT-VALUE})")
private final Long apiGasPriceMax = 500_000_000_000L;

@Option(
names = {"--goquorum-compatibility-enabled"},
hidden = true,
description = "Start Besu in GoQuorum compatibility mode (default: ${DEFAULT-VALUE})")
private final Boolean isGoQuorumCompatibilityMode = false;

@CommandLine.Option(
names = {"--static-nodes-file"},
paramLabel = MANDATORY_FILE_FORMAT_HELP,
Expand Down Expand Up @@ -1114,6 +1110,7 @@ void setBannedNodeIds(final List<String> values) {
private Vertx vertx;
private EnodeDnsConfiguration enodeDnsConfiguration;
private KeyValueStorageProvider keyValueStorageProvider;
private Boolean isGoQuorumCompatibilityMode = false;

public BesuCommand(
final Logger logger,
Expand Down Expand Up @@ -1190,6 +1187,17 @@ public void run() {

try {
configureLogging(true);

// Set the goquorum compatibility mode based on the genesis file
if (genesisFile != null) {
genesisConfigOptions = readGenesisConfigOptions();
if (genesisConfigOptions.isQuorum()) {
// this static flag is read by the RLP decoder
GoQuorumOptions.goQuorumCompatibilityMode = true;
isGoQuorumCompatibilityMode = true;
}
}

instantiateSignatureAlgorithmFactory();
configureNativeLibs();
logger.info("Starting Besu version: {}", BesuInfo.nodeName(identityString));
Expand Down Expand Up @@ -1533,7 +1541,7 @@ private void issueOptionWarnings() {
CommandLineUtils.checkMultiOptionDependencies(
logger,
commandLine,
List.of("--miner-enabled", "--goquorum-compatibility-enabled"),
"--min-gas-price ignored because none of --miner-enabled or isQuorum (in genesis file) was defined.",
List.of(!isMiningEnabled, !isGoQuorumCompatibilityMode),
singletonList("--min-gas-price"));

Expand Down Expand Up @@ -1564,7 +1572,6 @@ private void configure() throws Exception {

ethNetworkConfig = updateNetworkConfig(getNetwork());

checkGoQuorumGenesisConfig();
checkGoQuorumCompatibilityConfig(ethNetworkConfig);

jsonRpcConfiguration = jsonRpcConfiguration();
Expand Down Expand Up @@ -1626,7 +1633,7 @@ private String readEnclaveKey() {
} catch (final Exception e) {
throw new ParameterException(
this.commandLine,
"--privacy-public-key-file must be set when --goquorum-compatibility-enabled is set to true.",
"--privacy-public-key-file must be set if isQuorum is set in the genesis file.",
e);
}
if (key.length() != 44) {
Expand Down Expand Up @@ -2050,7 +2057,6 @@ private Optional<GoQuorumPermissioningConfiguration> quorumPermissioningConfig()
}

try {
final GenesisConfigOptions genesisConfigOptions = readGenesisConfigOptions();
final OptionalLong qip714BlockNumber = genesisConfigOptions.getQip714BlockNumber();
return Optional.of(
GoQuorumPermissioningConfiguration.enabled(
Expand Down Expand Up @@ -2080,7 +2086,7 @@ private PrivacyParameters privacyParameters(final KeyValueStorageProvider storag
CommandLineUtils.checkMultiOptionDependencies(
logger,
commandLine,
List.of("--privacy-enabled", "--goquorum-compatibility-enabled"),
"--privacy-url and/or --privacy-public-key-file ignored because none of --privacy-enabled or isQuorum (in genesis file) was defined.",
List.of(!isPrivacyEnabled, !isGoQuorumCompatibilityMode),
List.of("--privacy-url", "--privacy-public-key-file"));

Expand Down Expand Up @@ -2597,42 +2603,16 @@ private void addPortIfEnabled(
}
}

private void checkGoQuorumGenesisConfig() {
if (genesisFile != null) {
if (readGenesisConfigOptions().isQuorum() && !isGoQuorumCompatibilityMode) {
throw new IllegalStateException(
"Cannot use GoQuorum genesis file without GoQuorum privacy enabled");
}
}
}

private void checkGoQuorumCompatibilityConfig(final EthNetworkConfig ethNetworkConfig) {
if (isGoQuorumCompatibilityMode) {
if (genesisFile == null) {
throw new ParameterException(
this.commandLine,
"--genesis-file must be specified if GoQuorum compatibility mode is enabled.");
}

final GenesisConfigOptions genesisConfigOptions = readGenesisConfigOptions();

// this static flag is read by the RLP decoder
GoQuorumOptions.goQuorumCompatibilityMode = true;

if (!genesisConfigOptions.isQuorum()) {
throw new IllegalStateException(
"GoQuorum compatibility mode (enabled) can only be used if genesis file has 'isQuorum' flag set to true.");
}

if (!minTransactionGasPrice.isZero()) {
throw new ParameterException(
this.commandLine,
"--min-gas-price must be set to zero if GoQuorum compatibility is enabled in the genesis config.");
"--min-gas-price must be set to zero if isQuorum mode is enabled in the genesis file.");
}

if (ensureGoQuorumCompatibilityModeNotUsedOnMainnet(genesisConfigOptions, ethNetworkConfig)) {
throw new ParameterException(
this.commandLine, "GoQuorum compatibility mode (enabled) cannot be used on Mainnet.");
throw new ParameterException(this.commandLine, "isQuorum mode cannot be used on Mainnet.");
}
}
}
Expand Down Expand Up @@ -2677,7 +2657,7 @@ private void instantiateSignatureAlgorithmFactory() {
return;
}

Optional<String> ecCurve = getEcCurveFromGenesisFile();
final Optional<String> ecCurve = getEcCurveFromGenesisFile();

if (ecCurve.isEmpty()) {
SignatureAlgorithmFactory.setDefaultInstance();
Expand All @@ -2686,7 +2666,7 @@ private void instantiateSignatureAlgorithmFactory() {

try {
SignatureAlgorithmFactory.setInstance(SignatureAlgorithmType.create(ecCurve.get()));
} catch (IllegalArgumentException e) {
} catch (final IllegalArgumentException e) {
throw new CommandLine.InitializationException(
new StringBuilder()
.append("Invalid genesis file configuration for ecCurve. ")
Expand All @@ -2699,9 +2679,6 @@ private Optional<String> getEcCurveFromGenesisFile() {
if (genesisFile == null) {
return Optional.empty();
}

GenesisConfigOptions options = readGenesisConfigOptions();

return options.getEcCurve();
return genesisConfigOptions.getEcCurve();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -70,28 +70,25 @@ public static void checkOptionDependencies(
* that could replace this. See https://github.com/remkop/picocli/issues/295
*
* @param logger the logger instance used to log the warning
* @param commandLine the command line containing the options we want to check
* @param mainOptions the names of the main options to test dependency against. Only used for
* display.
* @param commandLine the command line containing the options we want to check display.
* @param stringToLog the string that is going to be logged.
* @param isMainOptionCondition the conditions to test dependent options against. If all
* conditions are true, dependent options will be checked.
* @param dependentOptionsNames a list of option names that can't be used if condition is met.
* Example: if --min-gas-price is in the list and condition is that either --miner-enabled or
* --goquorum-compatibility-enabled should not be false, we log a warning.
* Example: if --min-gas-price is in the list and condition is that --miner-enabled should not
* be false, we log a warning.
*/
public static void checkMultiOptionDependencies(
final Logger logger,
final CommandLine commandLine,
final List<String> mainOptions,
final String stringToLog,
final List<Boolean> isMainOptionCondition,
final List<String> dependentOptionsNames) {
if (isMainOptionCondition.stream().allMatch(isTrue -> isTrue)) {
final String affectedOptions = getAffectedOptions(commandLine, dependentOptionsNames);

if (!affectedOptions.isEmpty()) {
final String joinedMainOptions =
StringUtils.joiningWithLastDelimiter(", ", " or ").apply(mainOptions);
logger.warn(MULTI_DEPENDENCY_WARNING_MSG, affectedOptions, joinedMainOptions);
logger.warn(stringToLog);
}
}
}
Expand Down
Loading

0 comments on commit b735981

Please sign in to comment.