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

Measure execution cost and transaction cost #619

Closed
clearloop opened this issue Aug 20, 2023 · 4 comments
Closed

Measure execution cost and transaction cost #619

clearloop opened this issue Aug 20, 2023 · 4 comments

Comments

@clearloop
Copy link

For the example storage IO contract running in remix, there will be logs about transaction cost and execution cost

status true Transaction mined and execution succeed
transaction hash 0x54a2cc464980e7cf39942ac89960e5b2ce4d8d3a1913182c23dbf2e0757a1b0d
block hash 0x9540c4cb821107d1c07d58214fb5e5f003007a4465be6a2891a521785291e3ce
block number 28
from 0x5B38Da6a701c568545dCfcB03FcB875f56beddC4
to Storage.sg(int256) 0x358AA13c52544ECCEF6B0ADD0f801012ADAD5eE3
gas 27752 gas
transaction cost 24132 gas
execution cost 2916 gas

However in the gas inspector of revm, we currently only has used + memory

https://github.com/bluealloy/revm/blob/main/crates/interpreter/src/gas.rs#L8

@rakita
Copy link
Member

rakita commented Aug 20, 2023

hm, I would have assumed that transaction cose + execution cost = gas

Can probably separate intrinsic gas calculation into the standalone function (gas needed before execution) which would solve some things.

@clearloop
Copy link
Author

just found an interesting comment on this: https://ethereum.stackexchange.com/a/29560/125158

gas

@rakita
Copy link
Member

rakita commented Aug 20, 2023

I know about it, this is kinda a ddos protection for txpool (and again checked inside execution) which is a minimal amount of gas that is spent by tx, and of course, the account would need to have enough fee for it. If account does not have enough balance to cover that intrinsic amount tx is considered invalid (and block too).

The spec is kinda not updated as it is missing tx access list.

In revm it is, in essence, this fn: https://github.com/bluealloy/revm/blob/9afe097881dc06f11075d57b761aceb5fdf18728/crates/interpreter/src/gas/calc.rs#L333C35-L333C35

@rakita
Copy link
Member

rakita commented Oct 11, 2023

Closing this as intrinsic gas can be fetched by different function

@rakita rakita closed this as completed Oct 11, 2023
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

No branches or pull requests

2 participants