Use pallet_ethereum to calculate proof_size_base_cost< 10000 /bdi> #3279
There was a problem hiding this comment.
Pull Request Overview
This PR refactors the calculation of proof_size_base_cost by replacing the manual estimation logic and the GasWeightMapping call with the new pallet_ethereum::Pallet transaction_weight API. In addition, it updates the Cargo.toml to include the pallet-ethereum dependency along with required features.
- Replaces manual encoded transaction length estimation with a new TransactionData-based computation.
- Updates GasWeightMapping usage to rely on pallet_ethereum::Pallet::::transaction_weight.
- Introduces the pallet-ethereum dependency with the "forbid-evm-reentrancy" feature in Cargo.toml.
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
File | Description |
---|---|
runtime/common/src/apis.rs | Refactored proof_size_base_cost logic to utilize pallet_ethereum API. |
runtime/common/Cargo.toml | Added pallet-ethereum dependency and updated feature/std listings. |
Coverage Report@@ Coverage Diff @@
## master tarekkma/improve-base-cost-calc +/- ##
===================================================================
+ Coverage 74.76% 74.79% +0.03%
Files 400 400
- Lines 101272 101212 -60
===================================================================
- Hits 75712 75696 -16
- Misses 25560 25516 -44
|
To be honest, I don’t like the design of TransactionData, as it’s less accurate than using the TransactionV2 enum directly. It will overestimate the PoV base cost when you submit a Legacy or EIP‑2930 transaction. Fixing that would require substantial changes upstream in Frontier. However, it’s fine for new blocks, because nowadays everyone uses the EIP‑1559 transaction type, so we can merge it as is. |
Use
pallet_ethereum
'sTransactionData
struct andtransaction_weight(...)
function to calculateproof_size_base_cost
instead of using hardcoded numbers.