WorldStateArchive createWorldStateArchive(
      final WorldStateStorageCoordinator worldStateStorageCoordinator,
      final Blockchain blockchain,
      final BonsaiCachedMerkleTrieLoader bonsaiCachedMerkleTrieLoader,
      final Supplier<WorldStateHealer> worldStateHealerSupplier) {
    return switch (dataStorageConfiguration.getDataStorageFormat()) {
      case BONSAI -> {
        final BonsaiWorldStateKeyValueStorage worldStateKeyValueStorage =
            worldStateStorageCoordinator.getStrategy(BonsaiWorldStateKeyValueStorage.class);

        yield new BonsaiWorldStateProvider(
            worldStateKeyValueStorage,
            blockchain,
            Optional.of(
                dataStorageConfiguration
                    .getPathBasedExtraStorageConfiguration()
                    .getMaxLayersToLoad()),
            bonsaiCachedMerkleTrieLoader,
            besuComponent.map(BesuComponent::getBesuPluginContext).orElse(null),
            evmConfiguration,
            worldStateHealerSupplier);
      }
      case FOREST -> {
        final WorldStatePreimageStorage preimageStorage =
            storageProvider.createWorldStatePreimageStorage();
        yield new ForestWorldStateArchive(
            worldStateStorageCoordinator, preimageStorage, evmConfiguration);
      }
      default ->
          throw new IllegalStateException(
              "Unexpected value: " + dataStorageConfiguration.getDataStorageFormat());
    };
  }
Create protocol context protocol context.

@param blockchain the blockchain
@param worldStateArchive the world state archive
@param consensusContext the consensus context
@param serviceManager plugin service manager
@return the protocol context
app/src/main/java/org/hyperledger/besu/controller/BesuControllerBuilder.java