diff --git a/crates/sui-adapter-transactional-tests/tests/dev_inspect/reference_return_value.exp b/crates/sui-adapter-transactional-tests/tests/dev_inspect/reference_return_value.exp index ddb71637c7693..52bb5e03587f6 100644 --- a/crates/sui-adapter-transactional-tests/tests/dev_inspect/reference_return_value.exp +++ b/crates/sui-adapter-transactional-tests/tests/dev_inspect/reference_return_value.exp @@ -9,7 +9,7 @@ created: object(1,0) mutated: object(0,1) gas summary: computation_cost: 1000000, storage_cost: 3465600, storage_rebate: 0, non_refundable_storage_fee: 0 -task 2, lines 16-17: +task 2, lines 16-18: //# programmable --sender A --inputs 0 --dev-inspect //> 0: test::m::return_ref(Input(0)); mutated: object(_) diff --git a/crates/sui-adapter-transactional-tests/tests/dev_inspect/reference_return_value.move b/crates/sui-adapter-transactional-tests/tests/dev_inspect/reference_return_value.move index 24b1298379320..ce3a4cb2fdb52 100644 --- a/crates/sui-adapter-transactional-tests/tests/dev_inspect/reference_return_value.move +++ b/crates/sui-adapter-transactional-tests/tests/dev_inspect/reference_return_value.move @@ -14,4 +14,5 @@ module test::m { } //# programmable --sender A --inputs 0 --dev-inspect + //> 0: test::m::return_ref(Input(0)); \ No newline at end of file diff --git a/crates/sui-adapter-transactional-tests/tests/dry_run/reference_return_value.exp b/crates/sui-adapter-transactional-tests/tests/dry_run/reference_return_value.exp index 858cbad483f9f..d9abcbb2d0d9a 100644 --- a/crates/sui-adapter-transactional-tests/tests/dry_run/reference_return_value.exp +++ b/crates/sui-adapter-transactional-tests/tests/dry_run/reference_return_value.exp @@ -9,7 +9,7 @@ created: object(1,0) mutated: object(0,1) gas summary: computation_cost: 1000000, storage_cost: 3465600, storage_rebate: 0, non_refundable_storage_fee: 0 -task 2, lines 16-17: +task 2, lines 16-18: //# programmable --sender A --inputs 0 --dry-run //> 0: test::m::return_ref(Input(0)); Error: Transaction Effects Status: InvalidPublicFunctionReturnType { idx: 0 } in command 0 diff --git a/crates/sui-adapter-transactional-tests/tests/dry_run/reference_return_value.move b/crates/sui-adapter-transactional-tests/tests/dry_run/reference_return_value.move index c8a749a2bac3d..5bfc5b6e13346 100644 --- a/crates/sui-adapter-transactional-tests/tests/dry_run/reference_return_value.move +++ b/crates/sui-adapter-transactional-tests/tests/dry_run/reference_return_value.move @@ -14,4 +14,5 @@ module test::m { } //# programmable --sender A --inputs 0 --dry-run + //> 0: test::m::return_ref(Input(0)); \ No newline at end of file diff --git a/crates/sui-transactional-test-runner/src/test_adapter.rs b/crates/sui-transactional-test-runner/src/test_adapter.rs index 834b927033d45..d344654f88bc1 100644 --- a/crates/sui-transactional-test-runner/src/test_adapter.rs +++ b/crates/sui-transactional-test-runner/src/test_adapter.rs @@ -904,10 +904,14 @@ impl<'a> MoveTestAdapter<'a> for SuiTestAdapter { } else if dry_run { let gas_budget = gas_budget.unwrap_or(DEFAULT_GAS_BUDGET); let gas_price = gas_price.unwrap_or(self.gas_price); - let sender_address = self.get_sender(sender).address; + let sender = self.get_sender(sender); + let sponsor = sponsor.map_or(sender, |a| self.get_sender(Some(a))); + + let payment = self.get_payment(sponsor, gas_payment); + let transaction = TransactionData::new_programmable( - sender_address, - vec![], + sender.address, + vec![payment], ProgrammableTransaction { inputs, commands }, gas_budget, gas_price, @@ -1401,6 +1405,7 @@ impl<'a> SuiTestAdapter { gas_budget: Option, policy: u8, gas_price: u64, + // dry_run: bool, ) -> anyhow::Result> { let modules_bytes = modules .iter() @@ -1494,6 +1499,19 @@ impl<'a> SuiTestAdapter { }) } + fn get_payment(&self, sponsor: &TestAccount, payment: Option) -> ObjectRef { + let payment = if let Some(payment) = payment { + self.fake_to_real_object_id(payment) + .expect("Could not find specified payment object") + } else { + sponsor.gas + }; + + self.get_object(&payment, None) + .unwrap() + .compute_object_reference() + } + fn sign_sponsor_txn( &self, sender: Option, @@ -1508,17 +1526,7 @@ impl<'a> SuiTestAdapter { let sender = self.get_sender(sender); let sponsor = sponsor.map_or(sender, |a| self.get_sender(Some(a))); - let payment = if let Some(payment) = payment { - self.fake_to_real_object_id(payment) - .expect("Could not find specified payment object") - } else { - sponsor.gas - }; - - let payment_ref = self - .get_object(&payment, None) - .unwrap() - .compute_object_reference(); + let payment_ref = self.get_payment(sender, payment); let data = txn_data(sender.address, sponsor.address, payment_ref); if sender.address == sponsor.address {