Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disallow mappings in memory and copying mappings #7739

Closed
chriseth opened this issue Nov 19, 2019 · 4 comments
Closed

Disallow mappings in memory and copying mappings #7739

chriseth opened this issue Nov 19, 2019 · 4 comments

Comments

@chriseth
Copy link
Contributor

chriseth commented Nov 19, 2019

Related to #6444 and #6282

Due to the fact that mappings are silently skipped, we should disallow the following operations on any data that contains a mapping:

  • copy from storage (to storage or memory)
  • declare as memory type
  • declare as calldata type

(delete part moved to #8535 )

all code generator parts that currently skip mapping should be changed to assertions

@chriseth chriseth added this to Inbox in 0.7.0 via automation Nov 19, 2019
@chriseth chriseth moved this from Inbox to Accepted in 0.7.0 Nov 25, 2019
@erak
Copy link
Collaborator

erak commented Jan 15, 2020

There's a PR (#6282) already that partially implements this.

@erak erak moved this from Accepted to In progress in 0.7.0 Jan 15, 2020
@elenadimitrova elenadimitrova removed this from In progress in 0.7.0 Feb 19, 2020
@chriseth chriseth changed the title Disallow mappings in memory, deleting and copying mappings Disallow mappings in memory and copying mappings Mar 25, 2020
@elenadimitrova elenadimitrova added this to New issues in Solidity via automation May 14, 2020
@elenadimitrova elenadimitrova moved this from New issues to Implementation Backlog in Solidity May 14, 2020
@aarlt aarlt closed this as completed May 18, 2020
Solidity automation moved this from Implementation Backlog to Done May 18, 2020
@aarlt aarlt reopened this May 18, 2020
Solidity automation moved this from Done to In progress May 18, 2020
@hrkrshnn hrkrshnn moved this from In progress to Implementation Backlog in Solidity May 19, 2020
@chriseth chriseth moved this from Implementation Backlog to Design Backlog in Solidity May 19, 2020
@chriseth chriseth moved this from Design Backlog to In progress in Solidity May 20, 2020
@hrkrshnn
Copy link
Member

Regarding "declare as calldata type"

Currently, in develop, the following contract:

contract test {
    function f(mapping(uint => uint) calldata b) external {
    }
}

would produce:

Error: Mapping types can only have a data location of "storage" and thus only be parameters or return variables for internal or library functions.
 --> /tmp/calldata.sol:2:16:
  |
2 |     function f(mapping(uint => uint) calldata b) external {
  |                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Is this what you wanted?

@chriseth
Copy link
Contributor Author

Yes

@chriseth
Copy link
Contributor Author

Closed by #9146

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
Solidity
  
Done
Development

No branches or pull requests

4 participants