Skip to content

Automatically implement SpreadAllocate for ink! storage struct if all fields implement SpreadAllocate #991

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

Closed
Robbepop opened this issue Oct 30, 2021 · 4 comments
Labels
A-ink_lang [ink_lang] Work item

Comments

@Robbepop
Copy link
Collaborator

Robbepop commented Oct 30, 2021

Currently the ink! codegen does not implement SpreadAllocate for the #[ink(storage)] struct.

This leads to us having to implement it manually in the adjusted ERC-20 example contract here: #979

Since ink! codegen already by default produces implementations for SpreadLayout for the #[ink(storage)] struct it would be natural to produce a SpreadAllocate implementation as well.
The only downside is that while we enforce that all fields of the #[ink(storage)] struct implement SpreadLayout we cannot enforce the same for SpreadAllocate since that is more strict and not always needed for every ink! smart contract.
Therefore we need to only implement SpreadAllocate automatically if all fields of the #[ink(storage)] struct implement it.

This issue requires adjustments in the ink_lang_codegen module.

@Robbepop Robbepop added the A-ink_lang [ink_lang] Work item label Oct 30, 2021
@HCastano
Copy link
Contributor

Close by #995.

@Robbepop
Copy link
Collaborator Author

Close by #995.

Nope!
This has not yet been implemented becaues rustc lacks the features to do so.

@Robbepop Robbepop reopened this Nov 24, 2021
@HCastano
Copy link
Contributor

The description of #995 should be updated to reflect that then

@cmichi
Copy link
Collaborator

cmichi commented Feb 17, 2023

Closing, as we removed anything SpreadLayout for ink! 4.0.

@cmichi cmichi closed this as completed Feb 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-ink_lang [ink_lang] Work item
Projects
None yet
Development

No branches or pull requests

3 participants