Open crystalin opened 2 weeks ago
@noandrea created an excel where we can check the MBIP5 behaviour.
For example, in this transaction, the PoV cost was higher than the standard evm execution.
let WEIGHT_TO_GAS_RATIO = 25_000;
let GAS_LIMIT_STORAGE_GROWTH_RATIO = 366;
let GAS_PER_POV_BYTES = 8;
let transaction_proof_size = 234669; // can be obtained from polkadot.js
let transaction_ref_time = 46933800000; // can be obtained from polkadot.js
let gas_by_ref_time = transaction_ref_time / WEIGHT_TO_GAS_RATIO; // 1_877_352
// curl -H "Content-Type: application/json" -d '{"jsonrpc": "2.0", "method":"debug_traceTransaction","params":["0x279f4c7fa5cf7f1920dcdcacd48e3782931bc833e1637762e597f7b7ff07ad90",{"tracer":"callTracer"}]}' https://trace.api.moonbeam.network
let gas_used = 310_489; // Obtained from tracing the transaction;
let bytes_used = if (gas_by_ref_time != gas_used) {
gas_by_ref_time / GAS_LIMIT_STORAGE_GROWTH_RATIO // 5_129
} else { 0 };
let pov = transaction_proof_size * GAS_PER_POV_BYTES;
let mbip5 = bytes_used * GAS_LIMIT_STORAGE_GROWTH_RATIO;
let effective_gas = max(gas_used, max(mbip5, pov));
Thank you @RomarQ but I don't think it works. This only reports the "extra" storage that is not covered by the gas paid for the transaction. Ex: If a transaction cost 100k gas of computation and has 100B storage used, it will appear as 100k gas used (because 100B cost < 100k gas)
[Feature request] What is an easy way to retrieve the storage growth (related to MBIP5) of a given block or transaction ?