VRFV2Plus L1 fee calculation updates for Optimism and Base
Motivation
Optimism provides a way of calculating L1 gas fees via a predeploy OracleGasPrice contract. Gas usage of this gas calculation function is too high. This is an attempt to reduce the cost for the customer, but also to provide several options to calculate L1 gas fees in the future (after the Fjord upgrade).
Overview of changes
The most major change for Optimism is incorporating three different versions of L1 fee calculation:
- using the
getL1Feefunction on predeploy OracleGasPrice contract (the most accurate one, but gas expensive) - using
getL1FeeUpperBoundgas cost approximation on predeploy OracleGasPrice contract (upper bound calculation available after Fjord upgrade), this is used with having a pricing coefficient in mind to reduce overcharging - using our estimation built on top of the
getL1Feecalculation for Ecotone (with average payload data layout taken into account), this is used with having a pricing coefficient in mind to reduce overcharging
The changes above inspired (and forced) some other necessary changes to existing contracts:
- extracted L1 fee calculation away from the
VRFCoordinatorV2_5andVRFV2PlusWrappercontract to separate abstract contractsOptimismL1FeesandAbritrumL1Fees - combining L1 fee calculations necessary for the
VRFV2PlusWrappercontract in a new singleVRFV2PlusWrapperL1Feescontract (replacingChainSpecificUtilused before), abstracting this calculation away from theVRFV2PlusWrapper - created new coordinator contracts specific for Optimism and Arbitrum (with L1 fee calculation and other L2 opcode specifics on top of the base
VRFCoordinatorV2_5contract) - applied several Coordinator contract size optimizations according to this branch so that
VRFCoordinatorV2_5_Optimismdoesn't break the contract size limit (thanks to @leeyikjiun) - recalibrated padding size on Optimism and resolved incorrect padding issues (thanks to @jinhoonbang)
Seems like we are breaking away from ChainSpecificUtils? We need to revert the changes in
ChainSpecificUtil.solThe
memorytocalldatachanges might break if there are existing contracts, for some weird reason, that are calling it withmemory,
Yeah, ChainSpecificUtil.sol is no longer used so I think it makes sense to revert back...
Quality Gate passed
Issues
0 New issues
0 Fixed issues
0 Accepted issues
Measures
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code