api3dao / api3-docs

Documentation for the API3 Project

Home Page:https://docs.api3.org/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Gas price strategy examples in docs are misleading

bbenligiray opened this issue · comments

https://docs.api3.org/airnode/v0.9/reference/deployment-files/config-json.html#chains demos the usage of all gas price strategies at the same time.

  1. It doesn't make sense to mix and match eip1559 and non-eip1559 strategies
  2. latestBlockPercentileGasPrice fails with local hardhat nodes (because the chain doesn't have enough blocks). Users commonly copy paste config from the docs so it's better to have an example that just works.

This is what I recommended ChainAPI to use, I think it should also be used in the docs example

[
  {
    "gasPriceStrategy": "providerRecommendedGasPrice",
    "recommendedGasPriceMultiplier": 1.2
  },
  {
    "gasPriceStrategy": "constantGasPrice",
    "gasPrice": {
      "value": 10,
      "unit": "gwei"
    }
  }
]

@vponline @bbenligiray @dcroote

Burak said:

It doesn't make sense to mix and match eip1559 and non-eip1559 strategies

From the docs:

The strategies are attempted in the order that they are defined in config.json where the Airnode will move on to the next strategy in the list if the current fails. The only required strategy to be included is constantGasPrice which is intended to be used as the final fallback if all other strategies fail to return a gas price. Therefore, constantGasPrice should be set as the last strategy in the list.

So if the user did mix and match eip1559 and non-eip1559 strategies it would not matter if one or the other failed? It just does not make sense to do so for some chains?

Mixing them would work fine, the problem is it's hard to imagine a use-case where you would want to do this. They have very different characteristics so you would most likely want either one or the other, you wouldn't want to switch between them unpredictably.

The EIP1559 strategy was included just because Airnode used to have it as an option. It's is included in the detailed list so that should be enough if someone wanted to use it for some reason.