public BesuControllerBuilder fromGenesisFile(
        final GenesisConfig genesisConfig, final SyncMode syncMode) {
      final BesuControllerBuilder builder;
      final var configOptions = genesisConfig.getConfigOptions();

      if (configOptions.isConsensusMigration()) {
        return createConsensusScheduleBesuControllerBuilder(genesisConfig);
      }

      if (configOptions.getPowAlgorithm() != PowAlgorithm.UNSUPPORTED) {
        builder = new MainnetBesuControllerBuilder();
      } else if (configOptions.isIbft2()) {
        builder = new IbftBesuControllerBuilder();
      } else if (configOptions.isIbftLegacy()) {
        throw new IllegalStateException(
            "IBFT1 (legacy) is no longer supported. Consider using IBFT2 or QBFT.");
      } else if (configOptions.isQbft()) {
        builder = new QbftBesuControllerBuilder();
      } else if (configOptions.isClique()) {
        builder = new CliqueBesuControllerBuilder();
      } else {
        throw new IllegalArgumentException("Unknown consensus mechanism defined");
      }

      // wrap with TransitionBesuControllerBuilder if we have a terminal total difficulty:
      if (configOptions.getTerminalTotalDifficulty().isPresent()) {
        // Enable start with vanilla MergeBesuControllerBuilder for PoS checkpoint block
        if (syncMode == SyncMode.CHECKPOINT && isCheckpointPoSBlock(configOptions)) {
          return new MergeBesuControllerBuilder().genesisConfig(genesisConfig);
        } else {
          // TODO this should be changed to vanilla MergeBesuControllerBuilder and the Transition*
          // series of classes removed after we successfully transition to PoS
          // https://github.com/hyperledger/besu/issues/2897
          return new TransitionBesuControllerBuilder(builder, new MergeBesuControllerBuilder())
              .genesisConfig(genesisConfig);
        }

      } else return builder.genesisConfig(genesisConfig);
    }
From genesis config besu controller builder.

@param genesisConfig the genesis config file
@param syncMode the sync mode
@return the besu controller builder
app/src/main/java/org/hyperledger/besu/controller/BesuController.java