-
Notifications
You must be signed in to change notification settings - Fork 5.8k
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
Copying of type struct memory[] memory to storage not yet supported #3446
Comments
Without this function, arrays of structures can hardly be used. |
Note that an extremely high amount of gas is hidden behind this simple assignment. We recommend using a loop to perform the assignment anyway. An even more efficient way to write the function above is to not use a memory array at all and directly work on storage. |
@chriseth |
@hunjixin you can copy employing a loop. We are actually considering removing copy operations that require unbounded costs alltogether from the language. |
Closing since it seems answered. Please feel free to reopen with more questions. |
Would be nice to get a line number from this error. |
Some extra info for anyone annoyed by this not being allowed: we do plan to make expensive copy operations like this possible and easy but we want the user to be aware the this is not something to be done lightly. The |
Seconded! I just ran into this issue in a Foundry repo with 250+ Solidity files and I've no idea where to start debugging. |
@Reopening. |
Hi, Team. Thanks for your kind answers. But I have not found answers yet.Please consider this code bases. // IBlueprintData.sol // SPDX-License-Identifier: MIT interface IBlueprintData{
} // BluePrint.sol(Method 1) This codebase occured this error: "Copying of type struct IBlueprintData.ERC20Data memory[] memory to storage not yet supported."So I modified like this.// BluePrint.sol(Method 2)
And this code base is occured this error: "Member "push" is not available in struct IBlueprintData.ERC20Data[] memory outside of storage." Also I cannot find the solution this error.Please help me. |
Just to clarify, since my comment above is quite outdated and I was not aware of this at the time: this is actually already implemented, but only in the IR codegen. It won't be implemented in the legacy codegen, but if you're running into this, you can get around it by compiling with |
If we have the following:
It will got some error
Copying of type struct memory[] memory to storage not yet supported
When will this being support in the future in order for saving gas for array manipulate.
The text was updated successfully, but these errors were encountered: