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

The field naming gas_price and gas_used is confusing #6623

Open
telezhnaya opened this issue Apr 18, 2022 · 0 comments
Open

The field naming gas_price and gas_used is confusing #6623

telezhnaya opened this issue Apr 18, 2022 · 0 comments
Labels
C-enhancement Category: An issue proposing an enhancement or a PR with one.

Comments

@telezhnaya
Copy link
Contributor

telezhnaya commented Apr 18, 2022

I've audited the data around non-constant gas_price in the system.

block.gas_price should be actually gas_price_for_next_block
https://github.com/near/nearcore/blob/master/core/primitives/src/views.rs#L470

chunk.gas_used should be called gas_used_at_previous_chunk
https://github.com/near/nearcore/blob/master/core/primitives/src/views.rs#L729

See the details here near/near-analytics#19 (comment)

Another confusing field is receipt.gas_price
https://github.com/near/nearcore/blob/master/core/primitives/src/views.rs#L1379
As I understand, it's the value of how much gas will be blocked for this receipt until we finish processing the whole transaction. It's not equal to any of block.gas_price in the corresponding area. Moreover, in the final computations, we will not use receipt.gas_price, we will take the price from block.gas_price. So, I guess the naming should tell the user that it's only about the sum that should be frozen.

@bowenwang1996 bowenwang1996 added the C-enhancement Category: An issue proposing an enhancement or a PR with one. label Apr 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-enhancement Category: An issue proposing an enhancement or a PR with one.
Projects
None yet
Development

No branches or pull requests

2 participants