hashgraph / hedera-services

Crypto, token, consensus, file, and smart contract services for the Hedera public ledger
Apache License 2.0
310 stars 136 forks source link

feat: Support injecting EVM-version specific `GasCalculator`s in smart contract service #12991

Open david-bakin-sl opened 6 months ago

david-bakin-sl commented 6 months ago

BESU's GasCalculator interface gets a new implementation with every EVM version. (Usually just small changes.). We subclass one of those implementations in CustomGasCalculator. But that's currently a singleton with only one version allowed. It should be a thing that can have per-EVM-version implementations, akin to the EVM modules we currently have (e.g., V046Module, V050Module, etc.)

At the same time ... the Cancun version added an overload to GasCalculator.callOperationGasCost which has an additional argument accountIsWarm (a boolean). The previously existing method without that argument is deprecated. We need to support that. It also surfaces in the same way at Besu's AbstractCallOperation.cost() which we override at HederaDelegateCallOperation.

(See // FUTURE: comments in both CustomGasCalculator.java and HederaDelegateCallOperation.java.)

hendrikebbers commented 1 week ago

@david-bakin-sl can we split that up in like 3 issues to have good first issues?

david-bakin-sl commented 1 week ago

I'm not sure how to split it up. I'd also suggest it isn't necessarily a good "first issue" since you have to know a lot about how we're using Dagger + BESU. (Maybe It's just that I'm still not sure how we're using Dagger ...). Let me think about it and get back to you. Perhaps I could just add additional information to the issue.