I'm integrating a protocol but when I add dependency in the Nargo.toml file I get the following error at compilation:
error: Attempted to fetch storage size, but SharedMutable<HTLC_Public, 180, Context> does not implement the Storage trait
┌─ /nargo/github.com/AztecProtocol/aztec-packages/v1.1.2/noir-projects/aztec-nr/aztec/src/macros/utils.nr:282:9
│
282 │ typ.implements(quote { crate::state_vars::Storage<$storage_size> }.as_trait_constraint()),
│ ----------------------------------------------------------------------------------------- Assertion failed
│
= Call stack:
1. src/nr/train_bridge/src/main.nr:20:5
2. /nargo/github.com/AztecProtocol/aztec-packages/v1.1.2/noir-projects/aztec-nr/aztec/src/macros/storage.nr:50:13
3. /nargo/github.com/AztecProtocol/aztec-packages/v1.1.2/noir-projects/aztec-nr/aztec/src/macros/storage.nr:150:13
4. /nargo/github.com/AztecProtocol/aztec-packages/v1.1.2/noir-projects/aztec-nr/aztec/src/macros/storage.nr:158:19
#[aztec::macros::aztec]
pub contract Train {
use aztec::{
macros::{functions::{initializer, public}, storage::storage},
protocol_types::{address::AztecAddress, traits::{Deserialize, Packable, Serialize}},
state_vars::{map::Map, SharedMutable},
};
#[derive(Eq, Packable, Serialize, Deserialize)]
pub struct HTLC_Public {
src_receiver: AztecAddress,
amount: u128,
}
#[public]
#[initializer]
fn constructor() {}
#[storage]
struct Storage<Context> {
contracts_public: Map<Field, SharedMutable<HTLC_Public, 180, Context>, Context>,
}
}
What are you trying to do?
I'm integrating a protocol but when I add dependency in the Nargo.toml file I get the following error at compilation:
Code Reference
I have a reference repo: https://github.com/xorsal/train-example/tree/feat/minimal.
The
mainbranch also have the same problem but infeat/minimalI removed all references to Token, and it seems the mere inclusion of the dependency is enough to break compilation.Aztec Version
1.1.2
OS
Linux
Browser (if relevant)
No response
Node Version
22
Additional Context
No response