aztec-packages icon indicating copy to clipboard operation
aztec-packages copied to clipboard

Fix macros preventing imported constant storage slots

Open nventuro opened this issue 6 months ago • 0 comments

The registry in https://github.com/AztecProtocol/aztec-packages/pull/7523 must have a hardcoded storage slot, but we also need to know its value inside aztec-nr. Ideally the library would export this value and the contract would use it, but this results in macro errors (error: Could not assign storage slots, please provide a custom storage implementation):

use dep::aztec::keys::getters::KEY_REGISTRY_STORAGE_SLOT;

#[aztec(storage)]
struct Storage {
    current_keys: Map<AztecAddress, PublicMutable<StoredKeys>>,
}

impl<Context> Storage<Context> {
    fn init(context: Context) -> Self {
        Storage {
            current_keys: Map::new(
                context,
                KEY_REGISTRY_STORAGE_SLOT,
                |context, slot| { PublicMutable::new(context, slot) }
            )
        }
    }
}

nventuro avatar Aug 07 '24 21:08 nventuro