Skip to content

Add support for calldata input and output in abi.decode() #13518

Open
@k06a

Description

@k06a

Abstract

Currently abi.decode() works with memory argument and not with calldata, if calldata is provided it is being copied to memory and then decoded. Let's make abi.decode() to support both arguments and returns as calldata.

Motivation

Calldata abstraction is cool, slicing is cool. We need abi.decode() to fully support decoding from calldata to calldata!

Specification

function f(bytes calldata data) external {
    (
        address[] calldata targets,
        bytes[] calldata calldatas
    ) = abi.decode(data[1:], (address[], bytes[]));

    // ...
}

Backwards Compatibility

Metadata

Metadata

Assignees

No one assigned

    Labels

    high effortA lot to implement but still doable by a single person. The task is large or difficult.language design :rage4:Any changes to the language, e.g. new featureslow impactChanges are not very noticeable or potential benefits are limited.must have eventuallySomething we consider essential but not enough to prevent us from releasing Solidity 1.0 without it.

    Type

    No type

    Projects

    Status

    ICE-Box

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions