From ec60bdb18d3ec2156dbd4da2676066f958717a49 Mon Sep 17 00:00:00 2001 From: mkolosick Date: Wed, 25 Feb 2026 15:10:27 -0500 Subject: [PATCH] add cost and error message to MIP-4 --- MIPS/MIP-4.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/MIPS/MIP-4.md b/MIPS/MIP-4.md index b35d23a..79d26fd 100644 --- a/MIPS/MIP-4.md +++ b/MIPS/MIP-4.md @@ -33,9 +33,7 @@ The Solidity selector for `dippedIntoReserve` is `0x3a61584e`. ### Gas Cost -The gas cost of calling `dippedIntoReserve()` should be constant. Implementations should incrementally update their violation state, rather than iterating over the set of modified accounts in the current transaction on each call to the precompile. - -A precise gas cost for the method is TBD pending benchmarking. +Calling `dippedIntoReserve()` has a gas cost equivalent to one warm `sload`. Implementations should incrementally update their violation state, rather than iterating over the set of modified accounts in the current transaction on each call to the precompile. ### Semantics @@ -43,7 +41,9 @@ The method `dippedIntoReserve()` evaluates the condition that `DippedIntoReserve The return value is ABI-encoded as a Solidity `bool`—i.e., a 32-byte word in returndata, consistent with standard Solidity ABI encoding. This means callers can invoke the precompile via a normal contract call and decode the result using standard ABI decoding. -Calldata must consist of exactly the 4-byte function selector (`0x3a61584e`). Any other calldata is invalid: if the selector does not match `dippedIntoReserve()` (i.e. the selector is unrecognized), or if extra calldata is appended beyond the selector, the precompile must revert. +Calldata must consist of exactly the 4-byte function selector (`0x3a61584e`). Any other calldata is invalid: if the selector does not match `dippedIntoReserve()` (i.e. the selector is unrecognized) the contract must revert with the error message "method not supported". If extra calldata is appended beyond the selector, the precompile must revert with the error message "input is invalid". + +The method `dippedIntoReserve()` is not payable and must revert with the error message "value is nonzero" when called with a nonzero value. The precompile must be invoked via `CALL`. Invocations via `STATICCALL`, `DELEGATECALL`, or `CALLCODE` must revert. @@ -53,7 +53,7 @@ Reverts consume all gas provided to the call frame. This is consistent with the A previous design proposed adding a new opcode with similar semantics. Since this introspection feature is intended for direct use by smart contract developers (e.g., in bundler entrypoint contracts), a precompile was chosen because it can be called immediately without requiring compiler or toolchain updates. -The semantics described above (strict calldata validation, ABI-encoded return values, and all-gas-consuming reverts) are chosen for explicit consistency with the existing Monad staking precompile. +The semantics described above (strict calldata validation, ABI-encoded return values, rejecting calls with value, revert messages, and all-gas-consuming reverts) are chosen for explicit consistency with the existing Monad staking precompile. ## Backwards Compatibility