Expand description
@title IKeylessDeploy @notice Interface for the KeylessDeploy system contract. @dev This contract enables deploying contracts using pre-EIP-155 transactions (Nick’s Method) with custom gas limits, solving the problem of contracts failing to deploy on MegaETH due to the different gas model.
interface IKeylessDeploy {
error MalformedEncoding();
error NotContractCreation();
error NotPreEIP155();
error NonZeroTxNonce(uint64 txNonce);
error NoEtherTransfer();
error InvalidSignature();
error InsufficientBalance();
error ContractAlreadyExists();
error SignerNonceTooHigh(uint64 signerNonce);
error ExecutionReverted(uint64 gasUsed, bytes output);
error ExecutionHalted(uint64 gasUsed);
error ParentBudgetExceeded(uint8 kind, uint64 limit, uint64 used);
error EmptyCodeDeployed(uint64 gasUsed);
error NoContractCreated();
error AddressMismatch();
error GasLimitTooLow(uint64 txGasLimit, uint64 providedGasLimit);
error InsufficientComputeGas(uint64 limit, uint64 used);
error InitCodeTooLarge(uint64 size, uint64 max);
error SignerHasCode();
error InternalError();
error InvalidTransaction();
error NotIntercepted();
function keylessDeploy(bytes calldata keylessDeploymentTransaction, uint256 gasLimitOverride) external returns (uint64 gasUsed, address deployedAddress, bytes memory errorData);
}Structs§
- Address
Mismatch - @notice The created contract address doesn’t match the expected address.
@dev This is a defensive check that should never occur. It would indicate the EVM computed
a different CREATE address than keccak256(rlp([signer, 0])). If encountered, report to MegaETH team.
Custom error with signature
AddressMismatch()and selector0x4cd87fb5. - Contract
Already Exists - @notice The deploy address already has code (contract already exists).
Custom error with signature
ContractAlreadyExists()and selector0xe8dc2ba5. - Empty
Code Deployed - @notice Contract creation succeeded but returned empty bytecode.
@param gasUsed The amount of gas used.
Custom error with signature
EmptyCodeDeployed(uint64)and selector0x56119d3c. - Execution
Halted - @notice The sandbox execution halted (out of gas, stack overflow, etc.).
@param gasUsed The amount of gas used before halting.
Custom error with signature
ExecutionHalted(uint64)and selector0xde972b6e. - Execution
Reverted - @notice The sandbox execution reverted.
@param gasUsed The amount of gas used before reverting.
@param output The revert output data.
Custom error with signature
ExecutionReverted(uint64,bytes)and selector0xad2bd1d9. - GasLimit
TooLow - @notice The gas limit override is less than the gas limit in the keyless transaction.
@param txGasLimit The gas limit from the keyless transaction.
@param providedGasLimit The gas limit override provided by the caller.
Custom error with signature
GasLimitTooLow(uint64,uint64)and selector0xca79dfc8. - Init
Code TooLarge - @notice The init code of the keyless deployment transaction exceeds the configured
maximum initcode size for the current spec.
@dev REX5+: enforced by the Rust interceptor before the sandbox is constructed, because
the deposit-style sandbox bypasses op-revm’s
validate_env(which would otherwise apply the same limit via revm’s EIP-3860 check). @param size The init code length in bytes. @param max The configured maximum init code size (fromcfg().max_initcode_size()). Custom error with signatureInitCodeTooLarge(uint64,uint64)and selector0x577f7120. - Insufficient
Balance - @notice The signer does not have enough balance to cover the sandbox transaction’s
pre-execution debit. Pre-Rex5 specs require
gas_limit × gas_price + value; Rex5+ requiresvalueonly because the sandbox transaction runs fee-free. Custom error with signatureInsufficientBalance()and selector0xf4d678b8. - Insufficient
Compute Gas - @notice The remaining compute gas is insufficient to pay for the keyless deploy overhead.
@param limit The configured compute gas limit.
@param used The compute gas usage.
Custom error with signature
InsufficientComputeGas(uint64,uint64)and selector0x3961c2b6. - Internal
Error - @notice Internal sandbox failure (DB I/O, header validation, etc.).
@dev Selector-only: precompile return data is consensus-affecting, so the wire
must not pin consensus to upstream revm/op-revm
Displayimpls. Custom error with signatureInternalError()and selector0xfe835e35. - Invalid
Signature - @notice Failed to recover signer from signature (invalid signature).
Custom error with signature
InvalidSignature()and selector0x8baa579f. - Invalid
Transaction - @notice Sandbox rejected the inner transaction as a tx-validation error — any
IsTxError::is_tx_error() == trueoutcome of the sandboxtransact_rawcall. Behaviorally identical toInternalError(outer call reverts, signer is not charged becausepre_execution()never ran); a dedicated selector lets relayer-side decoders distinguish this from a genuine internal failure. @dev Selector-only for the same consensus-decoupling reason asInternalError. Custom error with signatureInvalidTransaction()and selector0x500a07ce. - Malformed
Encoding - @notice The transaction data is not valid RLP encoding.
Custom error with signature
MalformedEncoding()and selector0xae1270d3. - NoContract
Created - @notice Contract creation succeeded but no address was returned.
@dev This is a defensive check that should never occur. It indicates an EVM implementation
bug where CREATE returned success without an address. If encountered, report to MegaETH team.
Custom error with signature
NoContractCreated()and selector0x27ba908e. - NoEther
Transfer - @notice The caller tried to transfer ether to this contract.
Custom error with signature
NoEtherTransfer()and selector0xd253a2b0. - NonZero
TxNonce - @notice The nonce in the signed transaction is not zero.
@param txNonce The nonce value in the signed transaction.
Custom error with signature
NonZeroTxNonce(uint64)and selector0x0e0beabf. - NotContract
Creation - @notice The transaction is not a contract creation (to address is not empty).
Custom error with signature
NotContractCreation()and selector0xa54ffa77. - NotIntercepted
- @notice The call was not intercepted by the EVM (called on unsupported network).
Custom error with signature
NotIntercepted()and selector0x1894f076. - NotPreEI
P155 - @notice The transaction is not pre-EIP-155 (v must be 27 or 28).
Custom error with signature
NotPreEIP155()and selector0x7831fd0b. - Parent
Budget Exceeded - @notice Rex5 preflight rejected the call because the parent transaction’s remaining budget
for a resource dimension is smaller than the sandbox’s known pre-frame intrinsic usage.
@dev Emitted as a Revert by the Rust interceptor when the preflight check fails.
Not used by the on-chain KeylessDeploy bytecode.
@param kind The resource dimension that exceeded (0=DataSize, 1=KVUpdate, 2=ComputeGas,
3=StateGrowth).
@param limit The parent’s remaining limit for that dimension.
@param used The sandbox’s known pre-frame intrinsic usage for that dimension.
Custom error with signature
ParentBudgetExceeded(uint8,uint64,uint64)and selector0x15dbc304. - Signer
HasCode - @notice The recovered signer of the keyless deployment transaction has non-empty,
non-EIP-7702 code in parent state, so it cannot originate transactions per
EIP-3607.
@dev REX5+: enforced by the Rust interceptor because the deposit-style sandbox
bypasses op-revm’s
validate_account_nonce_and_codecheck. Custom error with signatureSignerHasCode()and selector0x00cb584f. - Signer
Nonce TooHigh - @notice The signer nonce is higher than allowed for keyless deploy.
@param signerNonce The on-chain nonce of the recovered signer.
Custom error with signature
SignerNonceTooHigh(uint64)and selector0xdc77000b. - keyless
Deploy Call - @notice Deploys a contract using a pre-EIP-155 signed transaction with a custom gas limit.
@dev The keyless deployment transaction must be a valid RLP-encoded legacy transaction:
- nonce: any value
- gasPrice: any value (typically 100 gwei for Nick’s Method)
- gasLimit: any value (must be <= gasLimitOverride)
- to: must be empty (contract creation)
- value: any value (typically 0)
- data: contract creation bytecode
- v: must be 27 or 28 (pre-EIP-155, no chain ID)
- r: signature component
- s: signature component
@param keylessDeploymentTransaction The RLP-encoded pre-EIP-155 signed transaction.
@param gasLimitOverride The gas limit for the inner deployment transaction.
Must be >= the gas limit in the keyless transaction.
@return gasUsed The amount of gas used by the deployment transaction execution.
Uses uint64 to match the EVM’s native gas accounting type (max ~18 exagas).
@return deployedAddress The address of the deployed contract (zero if execution failed).
@return errorData ABI-encoded error if execution failed, empty bytes on success.
Execution errors (ExecutionReverted, ExecutionHalted, EmptyCodeDeployed) return
success with errorData populated. Validation errors revert the entire call.
Function with signature
keylessDeploy(bytes,uint256)and selector0x846365d5. - keyless
Deploy Return - @notice Deploys a contract using a pre-EIP-155 signed transaction with a custom gas limit.
@dev The keyless deployment transaction must be a valid RLP-encoded legacy transaction:
- nonce: any value
- gasPrice: any value (typically 100 gwei for Nick’s Method)
- gasLimit: any value (must be <= gasLimitOverride)
- to: must be empty (contract creation)
- value: any value (typically 0)
- data: contract creation bytecode
- v: must be 27 or 28 (pre-EIP-155, no chain ID)
- r: signature component
- s: signature component
@param keylessDeploymentTransaction The RLP-encoded pre-EIP-155 signed transaction.
@param gasLimitOverride The gas limit for the inner deployment transaction.
Must be >= the gas limit in the keyless transaction.
@return gasUsed The amount of gas used by the deployment transaction execution.
Uses uint64 to match the EVM’s native gas accounting type (max ~18 exagas).
@return deployedAddress The address of the deployed contract (zero if execution failed).
@return errorData ABI-encoded error if execution failed, empty bytes on success.
Execution errors (ExecutionReverted, ExecutionHalted, EmptyCodeDeployed) return
success with errorData populated. Validation errors revert the entire call.
Container type for the return parameters of the
keylessDeploy(bytes,uint256)function.
Enums§
- IKeyless
Deploy Calls - Container for all the
IKeylessDeployfunction calls. - IKeyless
Deploy Errors - Container for all the
IKeylessDeploycustom errors.