@@ -13,7 +13,7 @@ use casper_types::{
1313 runtime_args,
1414 system:: mint:: { ARG_AMOUNT , ARG_TARGET } ,
1515 AccessRights , AddressableEntity , Digest , EntityAddr , ExecutableDeployItem , ExecutionInfo ,
16- TransactionRuntimeParams , URef , URefAddr ,
16+ TransactionRuntimeParams , URef , URefAddr , DEFAULT_TRANSFER_COST ,
1717} ;
1818use once_cell:: sync:: Lazy ;
1919use std:: collections:: BTreeMap ;
@@ -3723,17 +3723,15 @@ async fn insufficient_funds_transfer_from_account() {
37233723 . with_initiator_addr ( PublicKey :: from ( & * * BOB_SECRET_KEY ) )
37243724 . build ( )
37253725 . unwrap ( ) ;
3726- let price = txn_v1
3727- . payment_amount ( )
3728- . expect ( "must have payment amount as txns are using payment_limited" ) ;
3726+
37293727 let mut txn = Transaction :: from ( txn_v1) ;
37303728 txn. sign ( & BOB_SECRET_KEY ) ;
37313729
37323730 let ( _txn_hash, _block_height, exec_result) = test. send_transaction ( txn) . await ;
37333731 let ExecutionResult :: V2 ( result) = exec_result else {
37343732 panic ! ( "Expected ExecutionResult::V2 but got {:?}" , exec_result) ;
37353733 } ;
3736- let expected_cost: U512 = U512 :: from ( price ) * MIN_GAS_PRICE ;
3734+ let expected_cost: U512 = U512 :: from ( DEFAULT_TRANSFER_COST ) ;
37373735
37383736 assert_eq ! ( result. error_message. as_deref( ) , Some ( "Insufficient funds" ) ) ;
37393737 assert_eq ! ( result. cost, expected_cost) ;
@@ -3857,18 +3855,18 @@ async fn insufficient_funds_transfer_from_purse() {
38573855 . with_initiator_addr ( PublicKey :: from ( & * * BOB_SECRET_KEY ) )
38583856 . build ( )
38593857 . unwrap ( ) ;
3860- let price = txn . payment_amount ( ) . expect ( "must get payment amount" ) ;
3858+
38613859 let mut txn = Transaction :: from ( txn) ;
38623860 txn. sign ( & BOB_SECRET_KEY ) ;
38633861
38643862 let ( _txn_hash, _block_height, exec_result) = test. send_transaction ( txn) . await ;
38653863 let ExecutionResult :: V2 ( result) = exec_result else {
38663864 panic ! ( "Expected ExecutionResult::V2 but got {:?}" , exec_result) ;
38673865 } ;
3868- let transfer_cost : U512 = U512 :: from ( price ) * MIN_GAS_PRICE ;
3866+ let expected_cost : U512 = U512 :: from ( DEFAULT_TRANSFER_COST ) ;
38693867
38703868 assert_eq ! ( result. error_message. as_deref( ) , Some ( "Insufficient funds" ) ) ;
3871- assert_eq ! ( result. cost, transfer_cost ) ;
3869+ assert_eq ! ( result. cost, expected_cost ) ;
38723870}
38733871
38743872#[ tokio:: test]
@@ -3900,18 +3898,18 @@ async fn insufficient_funds_when_caller_lacks_minimum_balance() {
39003898 . with_initiator_addr ( PublicKey :: from ( & * * BOB_SECRET_KEY ) )
39013899 . build ( )
39023900 . unwrap ( ) ;
3903- let price = txn . payment_amount ( ) . expect ( "must get payment amount" ) ;
3901+
39043902 let mut txn = Transaction :: from ( txn) ;
39053903 txn. sign ( & BOB_SECRET_KEY ) ;
39063904
39073905 let ( _txn_hash, _block_height, exec_result) = test. send_transaction ( txn) . await ;
39083906 let ExecutionResult :: V2 ( result) = exec_result else {
39093907 panic ! ( "Expected ExecutionResult::V2 but got {:?}" , exec_result) ;
39103908 } ;
3911- let transfer_cost : U512 = U512 :: from ( price ) * MIN_GAS_PRICE ;
3909+ let expected_cost : U512 = U512 :: from ( DEFAULT_TRANSFER_COST ) ;
39123910
39133911 assert_eq ! ( result. error_message. as_deref( ) , Some ( "Insufficient funds" ) ) ;
3914- assert_eq ! ( result. cost, transfer_cost ) ;
3912+ assert_eq ! ( result. cost, expected_cost ) ;
39153913}
39163914
39173915#[ tokio:: test]
@@ -4430,8 +4428,9 @@ async fn should_charge_for_insufficient_funds_deploy_payment_limited_refund_fee(
44304428 . expect ( "should have charlie balance" )
44314429 . available ;
44324430
4433- assert ! (
4434- charlie_balance == U512 :: from( u32 :: MAX - 1 ) ,
4431+ assert_eq ! (
4432+ charlie_balance,
4433+ U512 :: from( u32 :: MAX - 1 ) ,
44354434 "charlie balance should be u32::MAX - 1"
44364435 ) ;
44374436 let payment_amount = charlie_balance. saturating_add ( U512 :: from ( 1 ) ) . as_u64 ( ) ;
@@ -4510,8 +4509,9 @@ async fn should_charge_for_marginal_insufficient_funds_deploy_payment_limited_re
45104509 . expect ( "should have charlie balance" )
45114510 . available ;
45124511
4513- assert ! (
4514- charlie_balance == U512 :: from( charlie_base_amount) ,
4512+ assert_eq ! (
4513+ charlie_balance,
4514+ U512 :: from( charlie_base_amount) ,
45154515 "charlie balance should be charlie_base_amount"
45164516 ) ;
45174517 // make payment 1 more than charlie has
@@ -5269,7 +5269,13 @@ async fn should_allow_native_transfer_v1() {
52695269 let ExecutionResult :: V2 ( result) = exec_result else {
52705270 panic ! ( "Expected ExecutionResult::V2 but got {:?}" , exec_result) ;
52715271 } ;
5272- let expected_cost: U512 = U512 :: from ( payment) * MIN_GAS_PRICE ;
5272+
5273+ assert_ne ! (
5274+ U512 :: from( payment) ,
5275+ result. cost,
5276+ "native transfer costing is system limited"
5277+ ) ;
5278+ let expected_cost: U512 = U512 :: from ( DEFAULT_TRANSFER_COST ) ;
52735279 assert_eq ! ( result. error_message. as_deref( ) , None ) ;
52745280 assert_eq ! ( result. cost, expected_cost) ;
52755281 assert_eq ! ( result. transfers. len( ) , 1 , "should have exactly 1 transfer" ) ;
0 commit comments