argotorg / argotorg/solidity

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

Open
#13,518 24 comments 36 reactions 0 assignees View on GitHub
high effort language design :rage4: low impact must have eventually
Dominant language
C++
Stars
25.7k
Forks
6.2k
Avg merge
2d 19h
Merged PRs (30d)
29

Description

## 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

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

// ...
}
```

## Backwards Compatibility

Contributor guide

Open the contributing guide

Research direction

Start by tracing the compiler's handling of abi.decode() for calldata input and output, using the specification's bytes calldata example as the target behavior. Done means the example decodes directly from calldata into address[] calldata and bytes[] calldata without copying the input to memory.

Written by the indexing model from the issue text.

Assessment

Tech stack
solidity
Domain
compilers
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.