mds1 / evm-diff

Diff EVM-compatible chains in a friendly format
https://evmdiff.com
MIT License
272 stars 27 forks source link

feat: gas costs #31

Open mds1 opened 11 months ago

mds1 commented 11 months ago

Data to include

There's a lot here, so consider splitting this into multiple PRs for simplicity. There also might be some duplicate data from #35 so consider how to reuse the data

Between #35, #37, and the existing opcode data, I think this PR will add little new data and simply reformat existing data

PaulRBerg commented 1 month ago

This would be so, so helpful.

There are several configuration parameters in Sablier that depend on (i) the block gas limit and (ii) the EVM execution costs.

We are currently relying on several heuristics to estimate the proper config values for L2s, one of which is to assume that the block gas limit is lower than what it actually is.

The 21,000 intrinsic gas cost

Any thoughts on referring to this as the Minimum Transaction Gas?

PaulRBerg commented 1 month ago

Sharing some relevant documentation sites:

And some relevant findings:

Related:

PaulRBerg commented 1 month ago

More references from the Sablier code base:

mds1 commented 1 month ago

Notes:

fvictorio commented 1 month ago

From #4:

1559 data is tracked as part of https://github.com/mds1/evm-diff/issues/31, unsure yet if its feasible to detect parameter values automatically.

While I suspect that 1559 parameters are hard to detect automatically, it would be relatively easy to check that some given parameters are correct, right? We can fetch the last n blocks ans assert that the sequence of basefees behave as expected.

mds1 commented 1 month ago

That's true. I plan to refactor things a bit so each chain has an input file, and 1559 parameters could be an input. But then the question becomes: What to report when the check fails? These parameters are not always well documented, so manually finding and updating them might be hard.

Actually, maybe the 1559 params can be backed out by looking at the last n blocks by rearranging the equation used to compute the next basefee? Some chains like arbitrum and polygon PoS behave a differently though, so we might need to use the chain input files to describe their deviations

koonopek commented 1 month ago

When I was writing about gas diffs on evm I was thinking about models - how gas is calculated and passed into transactions.

There are currently two models:

Additionally some of the L2s uses two dimension gas prices

At Redstone we are currently maintaining list of fee models per evm network (not all, but many). You can find it here: https://github.com/redstone-finance/redstone-oracles-monorepo/blob/4bcf002f7fd907e596b2bb1fe327710dfdd3bd6e/packages/rpc-providers/src/chains-configs/index.ts#L42 (there is already PR which will convert it to json format)

Two variables that should be interesting are:

However, there are many edge cases like arbitrum is supporting eip1559 but the priority fee, in reality, is constant 0.1gwei. Nevertheless, displaying in the table would be super helpful for projects integrating them. We will be for sure mainating our list so you can use info from there.

Love your work!