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

feat: add a tx gasPrice Buffer to reduce INSUFFICIENT_TX_FEE cases #2692

Conversation

natanasow
Copy link
Collaborator

@natanasow natanasow commented Jul 10, 2024

Description:

Occasionally users observe an INSUFFICIENT_TX_FEE.
This may be for insufficient gasLimit supply but occasionally it's due to a change in the exchange rate that results in the converted hbar value of the gasLimit not being sufficient.
This is hard to determine as it changes infrequently but also due to caching optimizations the relay may miss this.

Solution:
Add a configureable setting GAS_PRICE_PERCENTAGE_BUFFER that adds a percentage on top of the calculated network gasPrice.

Note: This may be a band-aid option to improve user experience while exploring other longer-term options.

Related issue(s):

Fixes #2674

Notes for reviewer:

Checklist

  • Documented (Code comments, README, etc.)
  • Tested (unit, integration, etc.)

Signed-off-by: nikolay <n.atanasow94@gmail.com>
@natanasow natanasow self-assigned this Jul 10, 2024
@natanasow natanasow added the enhancement New feature or request label Jul 10, 2024
@natanasow natanasow added this to the 0.52.0 milestone Jul 10, 2024
Copy link

github-actions bot commented Jul 10, 2024

Tests

    2 files  161 suites   14s ⏱️
866 tests 865 ✔️ 1 💤 0
878 runs  877 ✔️ 1 💤 0

Results for commit d423127.

♻️ This comment has been updated with latest results.

Signed-off-by: nikolay <n.atanasow94@gmail.com>
Copy link

github-actions bot commented Jul 10, 2024

Acceptance Tests

  17 files  213 suites   29m 20s ⏱️
605 tests 599 ✔️ 4 💤 2
645 runs  639 ✔️ 4 💤 2

Results for commit d423127.

♻️ This comment has been updated with latest results.

@natanasow natanasow marked this pull request as ready for review July 10, 2024 15:20
@natanasow natanasow requested a review from Nana-EC July 10, 2024 15:32
Copy link
Collaborator

@Nana-EC Nana-EC left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good.
One recommendation for coverage

packages/relay/src/lib/eth.ts Outdated Show resolved Hide resolved
Signed-off-by: nikolay <n.atanasow94@gmail.com>
docs/configuration.md Outdated Show resolved Hide resolved
Nana-EC
Nana-EC previously approved these changes Jul 11, 2024
Copy link
Collaborator

@Nana-EC Nana-EC left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good change.
None blocking suggestions that can be done in future PRs

  1. Move the addPercentageBufferToGasPrice() to a different util class (new one if necessary). formatter.ts doesn't seem like the right location
  2. Adopt the README suggestion

Signed-off-by: nikolay <n.atanasow94@gmail.com>
Signed-off-by: nikolay <n.atanasow94@gmail.com>
Signed-off-by: nikolay <n.atanasow94@gmail.com>
Copy link

sonarcloud bot commented Jul 12, 2024

Copy link
Collaborator

@ebadiere ebadiere left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LG.

Copy link
Member

@quiet-node quiet-node left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@natanasow natanasow merged commit 0d7e180 into main Jul 16, 2024
33 checks passed
@natanasow natanasow deleted the 2674-add-a-tx-gasprice-buffer-to-reduce-insufficient-tx-fee-cases branch July 16, 2024 05:52
ebadiere pushed a commit that referenced this pull request Aug 1, 2024
…2692)

* chore: add buffer

Signed-off-by: nikolay <n.atanasow94@gmail.com>

* chore: edit tests in order to fix code duplication warning

Signed-off-by: nikolay <n.atanasow94@gmail.com>

* chore: move the calculations to formatter.ts

Signed-off-by: nikolay <n.atanasow94@gmail.com>

* chore: fix readme

Signed-off-by: nikolay <n.atanasow94@gmail.com>

* chore: add utils class

Signed-off-by: nikolay <n.atanasow94@gmail.com>

* chore: fix sonarcloud issue

Signed-off-by: nikolay <n.atanasow94@gmail.com>

---------

Signed-off-by: nikolay <n.atanasow94@gmail.com>
Signed-off-by: ebadiere <ebadiere@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add a tx gasPrice Buffer to reduce INSUFFICIENT_TX_FEE cases
4 participants