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

Add QBFT support for evmtool #2807

Merged
merged 10 commits into from
Oct 8, 2021
Prev Previous commit
Next Next commit
Overload create method
Signed-off-by: Usman Saleem <usman@usmans.info>
  • Loading branch information
usmansaleem committed Oct 6, 2021
commit 064b8a166b6945d0d270c55386f14c8caa753e5e
Original file line number Diff line number Diff line change
Expand Up @@ -439,6 +439,9 @@ public Map<String, Object> asMap() {
if (isIbft2()) {
builder.put("ibft2", getBftConfigOptions().asMap());
}
if (isQbft()) {
builder.put("qbft", getQbftConfigOptions().asMap());
}

if (isQuorum()) {
builder.put("isQuorum", true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,18 @@ public static ProtocolSchedule create(
return create(config, PrivacyParameters.DEFAULT, false, bftExtraDataCodec, evmConfiguration);
}

public static ProtocolSchedule create(
final GenesisConfigOptions config,
final boolean isRevertReasonEnabled,
final BftExtraDataCodec bftExtraDataCodec) {
return create(
config,
PrivacyParameters.DEFAULT,
isRevertReasonEnabled,
bftExtraDataCodec,
EvmConfiguration.DEFAULT);
}

@Override
protected Supplier<BlockHeaderValidator.Builder> createForkBlockHeaderRuleset(
final GenesisConfigOptions config, final BftFork fork) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,29 +19,23 @@
import org.hyperledger.besu.consensus.qbft.QbftExtraDataCodec;
import org.hyperledger.besu.consensus.qbft.QbftProtocolSchedule;
import org.hyperledger.besu.ethereum.core.BlockHeaderFunctions;
import org.hyperledger.besu.ethereum.core.PrivacyParameters;
import org.hyperledger.besu.ethereum.mainnet.ProtocolSchedule;
import org.hyperledger.besu.evm.internal.EvmConfiguration;

import javax.inject.Named;

class QBFTGenesisFileModule extends GenesisFileModule {
final QbftExtraDataCodec bftExtraDataEncoder = new QbftExtraDataCodec();
final QbftExtraDataCodec bftExtraDataEncoder;

QBFTGenesisFileModule(final String genesisConfig) {
super(genesisConfig);
bftExtraDataEncoder = new QbftExtraDataCodec();
}

@Override
ProtocolSchedule provideProtocolSchedule(
final GenesisConfigOptions configOptions,
@Named("RevertReasonEnabled") final boolean revertReasonEnabled) {
return QbftProtocolSchedule.create(
configOptions,
PrivacyParameters.DEFAULT,
revertReasonEnabled,
bftExtraDataEncoder,
EvmConfiguration.DEFAULT);
return QbftProtocolSchedule.create(configOptions, revertReasonEnabled, bftExtraDataEncoder);
jframe marked this conversation as resolved.
Show resolved Hide resolved
}

@Override
Expand Down