fremantle-industries / slurp

An EVM block ingestion toolkit for Elixir
MIT License
28 stars 3 forks source link

Use alternate RPC providers on error #10

Open rupurt opened 3 years ago

rupurt commented 3 years ago

Given a blockchain adapter When it receives errors from an RPC call Then it should try the alternate RPC providers according to the configured strategy

The venue configuration DSL will need an additional option

config :slurp,
  blockchains: %{
    "ethereum-mainnet" => %{
      start_on_boot: false,
      name: "Ethereum Mainnet",
      adapter: Slurp.Adapters.Evm,
      network_id: 1,
      chain_id: 1,
      chain: "ETH",
      testnet: false,
      timeout: 5000,
      new_head_initial_history: 128,
      poll_interval_ms: 2_500,
      rpc: [
        "https://cloudflare-eth.com",
        # This can take N extra RPC providers
        "https://main-light.eth.linkpool.io"
      ],
      # Optionally add RPC strategy. Defaults to `nil`
      rpc_strategy: {Slurp.RpcStrategies.RoundRobinOnError, :next, [[count: 5, per: 1, unit: :minute]]}
    },
  }
rupurt commented 3 years ago

@AwaitFuture ^