public static PrecompileContractRegistry overridePrecompileAddresses(
      final PrecompileContractRegistry originalRegistry,
      final Map<Address, Address> precompileOverrides) {

    PrecompileContractRegistry newRegistry = new PrecompileContractRegistry();
    Set<Address> originalAddresses = originalRegistry.getPrecompileAddresses();

    precompileOverrides.forEach(
        (oldAddress, newAddress) -> {
          if (!originalAddresses.contains(oldAddress)) {
            throw new IllegalArgumentException("Address " + oldAddress + " is not a precompile.");
          }
          if (newRegistry.getPrecompileAddresses().contains(newAddress)) {
            throw new IllegalArgumentException("Duplicate precompile address: " + newAddress);
          }
          newRegistry.put(newAddress, originalRegistry.get(oldAddress));
        });

    originalAddresses.stream()
        .filter(originalAddress -> !precompileOverrides.containsKey(originalAddress))
        .forEach(
            originalAddress -> {
              if (newRegistry.getPrecompileAddresses().contains(originalAddress)) {
                throw new IllegalArgumentException(
                    "Duplicate precompile address: " + originalAddress);
              }
              newRegistry.put(originalAddress, originalRegistry.get(originalAddress));
            });

    return newRegistry;
  }
Creates a new PrecompileContractRegistry with the specified address overrides.

@param originalRegistry the original precompile contract registry
@param precompileOverrides the address overrides
@return a new PrecompileContractRegistry with the overrides applied
@throws IllegalArgumentException if an override address does not exist in the original registry
ethereum/core/src/main/java/org/hyperledger/besu/ethereum/transaction/SimulationTransactionProcessorFactory.java