diff --git a/types/src/state_store/state_key.rs b/types/src/state_store/state_key.rs index 7953b2c1ac1353..cf207a84dbfecb 100644 --- a/types/src/state_store/state_key.rs +++ b/types/src/state_store/state_key.rs @@ -202,10 +202,10 @@ impl Drop for Entry { .lock_and_remove(&module_id.address, &module_id.name), Path::Resource(struct_tag) => GLOBAL_REGISTRY .resource_keys - .lock_and_remove(address, struct_tag), + .lock_and_remove(struct_tag, address), Path::ResourceGroup(struct_tag) => GLOBAL_REGISTRY .resource_group_keys - .lock_and_remove(address, struct_tag), + .lock_and_remove(struct_tag, address), } }, StateKeyInner::TableItem { handle, key } => { @@ -332,8 +332,8 @@ static GLOBAL_REGISTRY: Lazy = Lazy::new(StateKeyRegistry::new pub struct StateKeyRegistry { // FIXME(aldenhu): reverse dimensions to save memory? - resource_keys: TwoLevelRegistry, - resource_group_keys: TwoLevelRegistry, + resource_keys: TwoLevelRegistry, + resource_group_keys: TwoLevelRegistry, module_keys: TwoLevelRegistry, table_item_keys: TwoLevelRegistry>, raw_keys: TwoLevelRegistry, ()>, // for tests only @@ -400,7 +400,7 @@ impl StateKey { } pub fn resource(address: &AccountAddress, struct_tag: &StructTag) -> Self { - if let Some(entry) = GLOBAL_REGISTRY.resource_keys.try_get(address, struct_tag) { + if let Some(entry) = GLOBAL_REGISTRY.resource_keys.try_get(struct_tag, address) { return Self(entry); } @@ -412,7 +412,7 @@ impl StateKey { let entry = GLOBAL_REGISTRY .resource_keys - .lock_and_get_or_add(address, struct_tag, maybe_add); + .lock_and_get_or_add(struct_tag, address, maybe_add); Self(entry) } @@ -427,7 +427,7 @@ impl StateKey { pub fn resource_group(address: &AccountAddress, struct_tag: &StructTag) -> Self { if let Some(entry) = GLOBAL_REGISTRY .resource_group_keys - .try_get(address, struct_tag) + .try_get(struct_tag, address) { return Self(entry); } @@ -440,7 +440,7 @@ impl StateKey { let entry = GLOBAL_REGISTRY .resource_group_keys - .lock_and_get_or_add(address, struct_tag, maybe_add); + .lock_and_get_or_add(struct_tag, address, maybe_add); Self(entry) }