From 769b99fc9481fa6712f3c7b891326913d0785fd5 Mon Sep 17 00:00:00 2001 From: jewelzms Date: Sat, 31 Aug 2024 18:36:55 +0800 Subject: [PATCH] fix #1037: Abi cannot be generated when the script function name is different from the file name --- language/move-prover/move-abigen/src/abigen.rs | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/language/move-prover/move-abigen/src/abigen.rs b/language/move-prover/move-abigen/src/abigen.rs index c2cc0e4df8..ae935ef8e7 100644 --- a/language/move-prover/move-abigen/src/abigen.rs +++ b/language/move-prover/move-abigen/src/abigen.rs @@ -229,13 +229,10 @@ impl<'env> Abigen<'env> { fn load_compiled_bytes(&self, module_env: &ModuleEnv<'env>) -> anyhow::Result> { match &self.options.in_memory_bytes { Some(map) => { - let path = - PathBuf::from(module_env.get_source_path().to_string_lossy().to_string()) - .file_stem() - .expect("file stem") - .to_string_lossy() - .to_string(); - Ok(map.get(&path).unwrap().clone()) + Some(map) => { + let name = module_env.get_full_name_str(); + Ok(map.get(&name).unwrap().clone()) + } } None => { let mut path = PathBuf::from(&self.options.compiled_script_directory);