"Import" storage slot from sibling account component
- Dominant language
- Rust
- Stars
- 115
- Forks
- 84
- Avg merge
- 1d 8h
- Merged PRs (30d)
- 15
Description
> Another thing that I was thinking for the future, we may want to "import" slots from other components. Maybe it could look like so:
> ```rust
> #[component_storage]
> struct MyComponentStorage {
> #[slot(description = "some field")]
> foo: StorageValue,
>
> /// Imports the `is_paused` storage slot from the `Pausable` component.
> #[import(pausable::Pausable)]
> is_paused: StorageValue,
> }
> ```
_Originally posted by @bobbinth in [#697](https://github.com/0xMiden/compiler/issues/697#issuecomment-4546357091)_
Contributor guide
Research direction
The issue references a comment about importing storage slots from sibling account components. Look at the component_storage macro and StorageValue types in the codebase. Understand how storage slots are currently defined and accessed. The goal is to allow a component to reference a slot defined in another component, likely involving macro expansion and type resolution. Check existing tests for component storage to see the current behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- compilers
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100