Skip to content

Add "unchecked" modifier to disable msg.data length checks #5612

Closed
@Agusx1211

Description

@Agusx1211

Abstract

Solidity 5 introduces a new sanity-check on the msg.data of a function if the msg.data length differs from the defined by the signature the transaction fails. Some mainstream contract implementations perform custom calls without taking into consideration this rule, those implementations are not able to interact with newly compiled Solidity 5 contracts.

Ej: The reference implementation for introspection of an ERC165 compliant contract sends the wrong msg.data size ethereum/EIPs#1640

Motivation

Adding an unchecked function modifier would disable the check on the msg.data bounds, allowing broken contract callers (as ERC165) to interact with these new contracts.

interface ERC165 {
    function supportsInterface(bytes4 interfaceID) unchecked external view returns (bool);
}

Specification

Any function containing the unchecked should ignore any validation on the msg.data size, functions without unchecked should behave as described on the Solidity 5 changelog

Code Generator: Revert at runtime if calldata is too short or points out of bounds. This is done inside the ABI decoder and therefore also applies to abi.decode().

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions