use sov_modules_api::default_context::ZkDefaultContext; use sov_modules_api::{Context, ModuleInfo, StateMap}; pub mod first_test_module { use super::*; #[derive(ModuleInfo)] pub(crate) struct FirstTestStruct where C: Context, { #[address] pub address: C::Address, #[state] pub state_in_first_struct_1: StateMap, #[state] pub state_in_first_struct_2: StateMap, } } mod second_test_module { use super::*; #[derive(ModuleInfo)] pub(crate) struct SecondTestStruct { #[address] pub address: C::Address, #[state] pub state_in_second_struct_1: StateMap, #[module] pub module_in_second_struct_1: first_test_module::FirstTestStruct, } } fn main() { type C = ZkDefaultContext; let second_test_struct = as std::default::Default>::default(); let prefix2 = second_test_struct.state_in_second_struct_1.prefix(); assert_eq!( *prefix2, sov_modules_api::Prefix::new_storage( // The tests compile inside trybuild. "trybuild001::second_test_module", "SecondTestStruct", "state_in_second_struct_1", ) .into() ); let prefix1 = second_test_struct .module_in_second_struct_1 .state_in_first_struct_1 .prefix(); assert_eq!( *prefix1, sov_modules_api::Prefix::new_storage( // The tests compile inside trybuild. "trybuild001::first_test_module", "FirstTestStruct", "state_in_first_struct_1" ) .into() ); assert_eq!(second_test_struct.dependencies(), [second_test_struct.module_in_second_struct_1.address()]); }