Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix BSC transaction submission errors: "transaction underpriced: tip needed 3000000000, tip permitted 1000000000" #3396

Closed
Tracked by #3321
tkporter opened this issue Mar 11, 2024 · 0 comments · Fixed by #3462
Assignees
Labels

Comments

@tkporter
Copy link
Collaborator

Problem

On BSC, we see an incredible amount of "transaction underpriced" errors when trying to submit a transaction. See https://cloudlogging.app.goo.gl/8WiUHMzj74sohor4A, e.g. "transaction underpriced: tip needed 3000000000, tip permitted 1000000000"

Initially, it seemed this was related to pending txs in the mempool a la #2959

However it seems like this specific error message where it says "tip needed 3000000000, tip permitted xxxxx", what's really happening is the BSC network requires a minimum gas price of 3 gwei, but we're trying to submit a transaction with a gas price of 1 gwei.

Proof:

Solution

  • Figure out why we're using 1 gwei gas prices - it's not clear to me. Both our RPC providers in the fallback provider set give high enough gas prices...
$ cast gas-price --rpc-url https://xxx.bsc.quiknode.pro/xxx
3000000000
$ cast gas-price --rpc-url https://rpc.ankr.com/bsc
5000000000
  • Fix this
@tkporter tkporter added the agent label Mar 11, 2024
@avious00 avious00 added the bug Something isn't working label Mar 11, 2024
@avious00 avious00 moved this to Next Sprint in Hyperlane Tasks Mar 11, 2024
@avious00 avious00 moved this from Next Sprint to Sprint in Hyperlane Tasks Mar 20, 2024
@tkporter tkporter assigned tkporter and unassigned daniel-savu Mar 21, 2024
@tkporter tkporter moved this from Sprint to In Progress in Hyperlane Tasks Mar 21, 2024
tkporter added a commit that referenced this issue Mar 21, 2024
…on-1559 (#3462)

### Description

- Fixes #3396 
- See v2 backport here #3463 

So turns out this is because:
- BSC nodes tend to enforce a minimum gas price of 3 gwei when you
submit a tx
- it's possible for validators to include privileged txs at a lower gas
price, so in practice (probably some mev stuff ?) there are a bunch of
txs in blocks with transactions lower than 3 gwei
- BSC's 1559 situation is they have a base fee of zero, so it's
basically like they just use legacy txs
- when we try to figure out what to pay in prio fees, we are suggested a
1 gwei priority fee:
```
$ cast rpc eth_feeHistory 10 latest "[5.0]" --rpc-url https://rpc.ankr.com/bsc
{"oldestBlock":"0x23706f7","reward":[["0x3b9aca00"]],"baseFeePerGas":["0x0","0x0"],"gasUsedRatio":[0.1149265]}

$ cast td 0x3b9aca00
1000000000
```

So options are:
1. tx overrides for bsc, set it to 3 gwei

2. use a different eip 1559 estimator and set the percentile used in
eth_feeHistory to something higher. Atm the percentile is 5%, if you
change this to 50% we seem to get 3 gwei. This would have consequences
for other chains tho

3. another heuristic, to fall back to legacy txs (where we can trust the
eth_gasPrice to give us an accurate price) whenever the base fee is 0


I'm a tx override hater and we don't have this in the agents so far so
I'm gonna go with 3. It's the least intrusive change
@github-project-automation github-project-automation bot moved this from In Progress to Done in Hyperlane Tasks Mar 21, 2024
tkporter added a commit that referenced this issue Mar 21, 2024
### Description

- Fixes #3396 
- Backport of #3462
yorhodes pushed a commit that referenced this issue Mar 22, 2024
…on-1559 (#3462)

### Description

- Fixes #3396 
- See v2 backport here #3463 

So turns out this is because:
- BSC nodes tend to enforce a minimum gas price of 3 gwei when you
submit a tx
- it's possible for validators to include privileged txs at a lower gas
price, so in practice (probably some mev stuff ?) there are a bunch of
txs in blocks with transactions lower than 3 gwei
- BSC's 1559 situation is they have a base fee of zero, so it's
basically like they just use legacy txs
- when we try to figure out what to pay in prio fees, we are suggested a
1 gwei priority fee:
```
$ cast rpc eth_feeHistory 10 latest "[5.0]" --rpc-url https://rpc.ankr.com/bsc
{"oldestBlock":"0x23706f7","reward":[["0x3b9aca00"]],"baseFeePerGas":["0x0","0x0"],"gasUsedRatio":[0.1149265]}

$ cast td 0x3b9aca00
1000000000
```

So options are:
1. tx overrides for bsc, set it to 3 gwei

2. use a different eip 1559 estimator and set the percentile used in
eth_feeHistory to something higher. Atm the percentile is 5%, if you
change this to 50% we seem to get 3 gwei. This would have consequences
for other chains tho

3. another heuristic, to fall back to legacy txs (where we can trust the
eth_gasPrice to give us an accurate price) whenever the base fee is 0


I'm a tx override hater and we don't have this in the agents so far so
I'm gonna go with 3. It's the least intrusive change
daniel-savu pushed a commit that referenced this issue Jun 5, 2024
### Description

- Fixes #3396 
- Backport of #3462
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Archived in project
3 participants