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(tx-builder): get actual gas price from node #1884

Merged
merged 1 commit into from Mar 13, 2024

Conversation

davidyuk
Copy link
Member

@davidyuk davidyuk commented Aug 23, 2023

closes #1786

This PR is supported by the Æternity Foundation

To protect from funds loss in case of a bug/misusage, I propose to add an upper limit for the gas price substituted by default. Known issues:

A single active client would compete with himself

If somebody posts transactions from a single client with high blockchain utilization, the gas price will increase for no reason. This is a special use case, I'm adding a note to batch-requests.md.

Overall solution doesn't protect from mining time fluctuation

With a low utilization, it is expected to get a transaction mined within 3 seconds. Currently, it is cheap to increase utilization at any moment. The current solution would reflect utilization change in a minute. So, a user may experience arbitrary changes of mining time.

Screenshot 2024-03-12 at 14 57 57

I've wrote a script to create several clients pushing transactions one by one and to visualize that gathered data. On the screenshot, I've added about 5 dynamic price clients and removed all of them with an interval from the middle to the end. It looks +/- as expected.

Copy link

codecov bot commented Mar 12, 2024

Codecov Report

Attention: Patch coverage is 90.16393% with 6 lines in your changes are missing coverage. Please review.

Project coverage is 80.18%. Comparing base (ad859ae) to head (09d19bf).
Report is 1 commits behind head on develop.

Files Patch % Lines
src/tx/builder/field-types/gas-price.ts 84.61% 2 Missing and 2 partials ⚠️
src/tx/builder/field-types/fee.ts 91.30% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #1884      +/-   ##
===========================================
+ Coverage    80.07%   80.18%   +0.11%     
===========================================
  Files          103      103              
  Lines         3468     3503      +35     
  Branches       738      750      +12     
===========================================
+ Hits          2777     2809      +32     
- Misses         383      384       +1     
- Partials       308      310       +2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@davidyuk davidyuk requested a review from dincho March 12, 2024 13:50
@davidyuk davidyuk marked this pull request as ready for review March 12, 2024 13:51
Copy link
Member

@dincho dincho left a comment

Choose a reason for hiding this comment

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

Better than static. The test included in this PR would be very helpful in future too.

@davidyuk davidyuk merged commit 4abbb2a into develop Mar 13, 2024
5 checks passed
@davidyuk davidyuk deleted the feature/node-gas-price branch March 13, 2024 14:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

A way to estimate transaction fee to get a reasonable mining time in a high blockchain load
2 participants