Do you have some specific new incompatibility which MIP3 would introduce if it exceptionally halted on OOM? Since the OOM is local to the call frame, it would have the same effect as calling Op.INVALID, so I don’t see memory limit giving more opportunity to DOS.
It would cause bundles to fail if a subcall used all the memory and the transaction was halted. This does not seem desirable if you are running a bundler.
Got it, I think including in the Rationale section would be nice for posterity. What about the latter EIP-7923, can you expand on how did it not fit our case, was it just the added complexity?
Benchmarks and rationale in EIP-7923 were not reproducible.
Got it, and to be extra clear, if caller allocates 1 bytes, MSIZE returns 32. If caller calls callee which calls MSIZE, the inner MSIZE returns 0. That on one hand makes sense, on the other it might provide lesser utility to those who would like to use MSIZE to check how much more mem they can use.
I think your point is that you would like a way to check how much memory could be used in child calls. I dont think an opcode is necessary for this corner case. Memory usage becomes more predictable.
MSIZE is meant to measure memory allocation within the current context. Not across the call stack. One could imagine an opcode that reports memory usage across all active call frames. In the current quadratic model, MSIZE already partially serves this purpose: the quadratic cost implicitly defines an upper bound on memory usage. the nonlinearity of this cost makes predicting memory usage across calls difficult. In the proposed linear model, memory usage in terms of gas becomes more predictable. This reduces the need for such an opcode.
The only practical use case for this hypothetical opcode would be dynamically measuring memory so that subcalls consuming large amounts could branch or revert intelligently. In practice, the only scenario where this matters is a contract deliberately allocating excessive memory to sabotage subcalls. Such contracts would naturally be avoided, making the opcode’s benefit negligible.
Note that checking ethereum history for memory usage, the peak amount of memory of a transaction was observed to be ~2MB and the average was ~2kb.