argotorg / argotorg/solidity

Data locations should be tied to types, not variable declarations.

Open
#13,730 5 comments 0 reactions 0 assignees View on GitHub
challenging difficulty high effort high impact needs design roadmap
Dominant language
C++
Stars
25.7k
Forks
6.2k
Avg merge
1d 11h
Merged PRs (30d)
21

Description

## Abstract

Solidity could allow to have `storage` references in `memory` structures or even `memory` arrays.

## Motivation

Sometimes it is handy to have memory structure with some storage refs. Now we can use this trick, uncomfortable but works:
```solidity
type DataPtr is uint256;

function get(DataPtr ptr) internal pure returns(Data storage data) {
assembly {
data.slot := ptr
}
}
```

## Specification

It would be convenient to have `storage` refs in `memory` struct by allowing following syntax:

```solidity
struct Data {
// ...
}

struct Object {
Data storage data; // <- allow storage keyword here
bytes32 context;
}
```

Contributor guide

Open the contributing guide

Research direction

No repository file, test, or entry point is named. Start by reviewing the compiler's existing type-system and data-location handling, then trace how struct member declarations are parsed and validated. Done would require a decided design for storage references in memory structures or arrays, support for the specified syntax, and tests covering the resulting semantics.

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
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.