Move gas refund calculation from MainnetTransactionProcessor to GasCalculator#8106
Conversation
6118848 to
0b3870e
Compare
There was a problem hiding this comment.
There's already several pieces of refund logic scattered across the GasCalculators, most recently calculateDelegateCodeGasRefund.
I think it's confusing to have refund logic both in RefundCalculator classes and in the GasCalculator classes, would prefer one or the other.
I have a slight preference for putting this logic into the GasCalculator classes since it's a smaller change than extracting all the other refund logic.
Won't block the PR on it.
There was a problem hiding this comment.
Alternatively, if it makes sense to make this a very precise type of RefundCalculator with a precise name, then maybe it works. Not sure what that name would be and if this is sufficiently isolated enough from the other refund logic.
There was a problem hiding this comment.
@siladu I think you are right, I've moved the logic to the GasCalculator and got rid of the RefundCalculator
…dCalculator Signed-off-by: Daniel Lehrner <daniel.lehrner@consensys.net>
Signed-off-by: Daniel Lehrner <daniel.lehrner@consensys.net>
Signed-off-by: Daniel Lehrner <daniel.lehrner@consensys.net>
Signed-off-by: Daniel Lehrner <daniel.lehrner@consensys.net>
Signed-off-by: Daniel Lehrner <daniel.lehrner@consensys.net>
Signed-off-by: Daniel Lehrner <daniel.lehrner@consensys.net>
0b3870e to
894d7b2
Compare
…lculator (besu-eth#8106) * move gas refund calculation from MainnetTransactionProcessor to RefundCalculator Signed-off-by: Daniel Lehrner <daniel.lehrner@consensys.net> * fix MainnetTransactionProcessorTest Signed-off-by: Daniel Lehrner <daniel.lehrner@consensys.net> * add test for FrontierRefundCalculator Signed-off-by: Daniel Lehrner <daniel.lehrner@consensys.net> * add test for FrontierRefundCalculator Signed-off-by: Daniel Lehrner <daniel.lehrner@consensys.net> * add PragueRefundCalculator dummy Signed-off-by: Daniel Lehrner <daniel.lehrner@consensys.net> * move refund logic to gas calculator, delete RefundCalculator Signed-off-by: Daniel Lehrner <daniel.lehrner@consensys.net> --------- Signed-off-by: Daniel Lehrner <daniel.lehrner@consensys.net> Signed-off-by: Bhanu Pulluri <bhanu.pulluri@kaleido.io>
PR description
Because of EIP-7623 the gas refund calculation will change with the upcoming Prague hard fork. Right now this calculation is hardcoded in
MainnetTransactionProcessor. This PR moves this calculation to theGasCalculator, which allows to change the refund calculation with a new hardfork.Thanks for sending a pull request! Have you done the following?
doc-change-requiredlabel to this PR if updates are required.Locally, you can run these tests to catch failures early:
./gradlew build./gradlew acceptanceTest./gradlew integrationTest./gradlew ethereum:referenceTests:referenceTests