MIP-20: Linear Code-Loading Costs

In Monad, operations that load code (calls, EXTCODESIZE, EXTCODECOPY, etc.) from the database are priced at a flat rate, independent of code size, intended to cover both the database I/O and the cost of jumpdest analysis on the loaded code: contract size is capped at 128KiB (MIP-2), so any such operation performs a bounded amount of work.

This MIP proposes a change to gas pricing for these operations that replaces constant pricing with a linear regime, where the cost to load cold contract code from the database is linear in the size of the contract code. Because this cost is charged before the code is loaded, clients must be able to determine the size of contract code without loading it; EXTCODESIZE, which requires only the size, is therefore priced independently of code size.

Hey @baltoli, nice proposal!

I have a question (and please ignore any misunderstandings here, I used AI to understand more about MIP-20!):
As I understand it, every tx to a contract now pays “G_code” up front, but intrinsic gas stays at 21,000, even though part of that 21,000 is the cold access to “to” that’s getting repriced. So I’d expect a plain ERC-20 transfer might cost more than today, depending on where the constants land. Is that the case? I’d find a before/after for a few common txs (ERC-20 transfer, swap, etc ) really helpful here!

Thanks!

1 Like

The pricing schedule is all pending benchmarking on the CL side; we’ll provide a more detailed analysis of common case changes when we have results. If it’s the case that keeping intrinsic gas the same is an undue penalisation for (say) ERC-20 transfers, I’ll revisit that part of the spec.

1 Like