From 3c379c9050f7eff3d0ad23c04ebea0015b43dbd5 Mon Sep 17 00:00:00 2001 From: YsielX <332494219@qq.com> Date: Wed, 11 Feb 2026 07:13:38 +0000 Subject: [PATCH 1/2] added non-testing std abi for mutators --- crates/movy-replay/src/env.rs | 23 +++++++++++++++++++++++ crates/movy-types/src/abi.rs | 4 ++-- crates/movy/src/sui/env.rs | 7 +------ crates/movy/src/sui/fuzz.rs | 13 ++++++++++--- 4 files changed, 36 insertions(+), 11 deletions(-) diff --git a/crates/movy-replay/src/env.rs b/crates/movy-replay/src/env.rs index b60f9a4..3356dbb 100644 --- a/crates/movy-replay/src/env.rs +++ b/crates/movy-replay/src/env.rs @@ -62,6 +62,20 @@ impl< Self { db } } + pub fn std_abi(&self, test: bool) -> Result, MovyError> { + let std = if test { + include_bytes!(concat!(env!("OUT_DIR"), "/std.testing")).to_vec() + } else { + include_bytes!(concat!(env!("OUT_DIR"), "/std")).to_vec() + }; + let stds: Vec = serde_json::from_slice(&std)?; + let mut out = BTreeMap::new(); + for std in stds { + out.insert(std.package_id.into(), std.abi()?); + } + Ok(out) + } + pub fn install_std(&self, test: bool) -> Result<(), MovyError> { // This is pretty hacky but works let stds = if test { @@ -164,6 +178,15 @@ impl< gas, None, )?; + if results.effects.status().is_err() { + let err = eyre!( + "movy_init failed at {}: {:?}", + md.module_id, + results.effects.status() + ); + log::warn!("{err}"); + continue; + } log::info!("Commiting movy_init effects..."); log::debug!( "Status: {:?} Changed Objects: {}, Removed Objects: {}", diff --git a/crates/movy-types/src/abi.rs b/crates/movy-types/src/abi.rs index 7c152eb..4507e20 100644 --- a/crates/movy-types/src/abi.rs +++ b/crates/movy-types/src/abi.rs @@ -550,7 +550,7 @@ impl MoveAbiSignatureToken { } pub fn is_balance(&self) -> bool { - let MoveAbiSignatureToken::Struct(inner) = self else { + let MoveAbiSignatureToken::StructInstantiation(inner, _) = self else { return false; }; inner.module_id.module_address == MoveAddress::two() @@ -559,7 +559,7 @@ impl MoveAbiSignatureToken { } pub fn is_coin(&self) -> bool { - let MoveAbiSignatureToken::Struct(inner) = self else { + let MoveAbiSignatureToken::StructInstantiation(inner, _) = self else { return false; }; inner.module_id.module_address == MoveAddress::two() diff --git a/crates/movy/src/sui/env.rs b/crates/movy/src/sui/env.rs index a76cd7b..c2c260e 100644 --- a/crates/movy/src/sui/env.rs +++ b/crates/movy/src/sui/env.rs @@ -21,12 +21,7 @@ use sui_types::storage::{BackingPackageStore, BackingStore, ObjectStore}; #[derive(Args, Clone, Debug, Serialize, Deserialize)] pub struct SuiTargetArgs { - #[arg( - short, - long, - value_delimiter = ',', - help = "The onchain packages to add." - )] + #[arg(long, value_delimiter = ',', help = "The onchain packages to add.")] pub onchains: Option>, #[arg( long, diff --git a/crates/movy/src/sui/fuzz.rs b/crates/movy/src/sui/fuzz.rs index f0803d2..503005c 100644 --- a/crates/movy/src/sui/fuzz.rs +++ b/crates/movy/src/sui/fuzz.rs @@ -196,10 +196,17 @@ impl SuiFuzzArgs { let gas_id = ObjectID::random_from_rng(&mut rand); env.mint_coin_id( MoveTypeTag::from_str("0x2::sui::SUI").unwrap(), - MoveOwner::AddressOwner(self.deployer), + MoveOwner::AddressOwner(self.attacker), gas_id.into(), 100_000_000_000, )?; + // Mint SUI to attacker for fuzzing + env.mint_coin_id( + MoveTypeTag::from_str("0x2::sui::SUI").unwrap(), + MoveOwner::AddressOwner(self.attacker), + ObjectID::random_from_rng(&mut rand).into(), + 100_000_000_000, + )?; let testing_env = SuiTestingEnv::new(env); testing_env.mock_testing_std()?; @@ -217,8 +224,8 @@ impl SuiFuzzArgs { &graphql, ) .await?; - let mut abis = BTreeMap::new(); - let mut testing_abis = BTreeMap::new(); + let mut abis = testing_env.std_abi(false)?; + let mut testing_abis = testing_env.std_abi(true)?; for (testing_abi, abi, names) in local_abis { let testing_pkg = testing_abi.package_id; From 15664b6b4449e7c74ee00636c8e6b3d18bd97c89 Mon Sep 17 00:00:00 2001 From: YsielX Date: Thu, 26 Feb 2026 16:59:50 +0800 Subject: [PATCH 2/2] removed 0xa in abis --- crates/movy-replay/src/meta.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/crates/movy-replay/src/meta.rs b/crates/movy-replay/src/meta.rs index 7aca14b..e966b6d 100644 --- a/crates/movy-replay/src/meta.rs +++ b/crates/movy-replay/src/meta.rs @@ -211,6 +211,7 @@ impl Metadata { for (addr, abi) in local_abis { abis.insert(addr, abi); } + abis.remove(&MoveAddress::from_str("0xa")?); // Map every module address back to its package id. let mut module_address_to_package = BTreeMap::new();