class CliqueProtocolSchedule {

  public static ProtocolSchedule create(
      final GenesisConfigOptions config,
      final NodeKey nodeKey,
      final PrivacyParameters privacyParameters,
      final boolean isRevertReasonEnabled) {

    final CliqueConfigOptions cliqueConfig = config.getCliqueConfigOptions();

    final Address localNodeAddress = Util.publicKeyToAddress(nodeKey.getPublicKey());

    if (cliqueConfig.getEpochLength() <= 0) {
      throw new IllegalArgumentException("Epoch length in config must be greater than zero");
    }

    final EpochManager epochManager = new EpochManager(cliqueConfig.getEpochLength());

    final Optional<EIP1559> eip1559 =
        ExperimentalEIPs.eip1559Enabled
            ? Optional.of(new EIP1559(config.getEIP1559BlockNumber().orElse(0)))
            : Optional.empty();

    return new ProtocolScheduleBuilder(
            config,
            DEFAULT_CHAIN_ID,
            builder ->
                applyCliqueSpecificModifications(
                    epochManager,
                    cliqueConfig.getBlockPeriodSeconds(),
                    localNodeAddress,
                    builder,
                    eip1559),
            privacyParameters,
            isRevertReasonEnabled)
        .createProtocolSchedule();
  }

}