vechain / thor

A general purpose blockchain highly compatible with Ethereum's ecosystem
GNU Lesser General Public License v3.0
791 stars 247 forks source link

Fix gas estimation #776

Open darrenvechain opened 2 weeks ago

darrenvechain commented 2 weeks ago

Description

using the best block + 1 when estimating

Type of change

Please delete options that are not relevant.

How Has This Been Tested?

Checklist:

libotony commented 2 weeks ago

Should be mention that the following parameters will be used during the execution: number, timestamp,total score, gas limit, beneficiary and signer, due to the implementation solution, signer will be zero address

darrenvechain commented 2 weeks ago

beneficiary

You mean something like this @libotony ?

image
libotony commented 2 weeks ago

beneficiary

You mean something like this @libotony ?

image

Was just spreading the info to the team, but this one looks good!

codecov-commenter commented 1 week ago

Codecov Report

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

Project coverage is 62.60%. Comparing base (c23c19a) to head (9535b6d). Report is 1 commits behind head on master.

Files Patch % Lines
api/utils/revisions.go 89.28% 3 Missing and 3 partials :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #776 +/- ## ========================================== - Coverage 62.62% 62.60% -0.02% ========================================== Files 199 199 Lines 18118 18172 +54 ========================================== + Hits 11346 11377 +31 - Misses 5690 5713 +23 Partials 1082 1082 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

libotony commented 1 week ago

Minor bits that were mostly captured in the offline discussing.

I'm starting to think the next revision should be operational across all of our endpoints, to avoid creating edge cases. It seems to me fair to assume that if someone is requesting the "next" block they know what is that they are receiveing.

With that in mind a superset o GetSummary would probably consolidate the api flows.

There are two parts using revision, Call/Simulate and Get /blocks/{revsion}, next will only apply to the Call/Simulate, the latter won't work with next(I don't see the necessity for returning a mocked next block in get blocks API). The GetSummaryAndState function can be used to simplify the process, but allowNext is essential to control whether the next is supported.