@@ -800,8 +800,9 @@ pub struct ExecutionEnv {
800800 pub expected_effects_digest : Option < TransactionEffectsDigest > ,
801801 /// The source of the scheduling of the transaction.
802802 pub scheduling_source : SchedulingSource ,
803- /// Status of the balance withdraw scheduling of the transaction.
804- pub withdraw_status : BalanceWithdrawStatus ,
803+ /// Status of the balance withdraw scheduling of the transaction,
804+ /// including both address and object balance withdraws.
805+ pub balance_withdraw_status : BalanceWithdrawStatus ,
805806 /// Transactions that must finish before this transaction can be executed.
806807 /// Used to schedule barrier transactions after non-exclusive writes.
807808 pub barrier_dependencies : Vec < TransactionDigest > ,
@@ -813,7 +814,7 @@ impl Default for ExecutionEnv {
813814 assigned_versions : Default :: default ( ) ,
814815 expected_effects_digest : None ,
815816 scheduling_source : SchedulingSource :: NonFastPath ,
816- withdraw_status : BalanceWithdrawStatus :: NoWithdraw ,
817+ balance_withdraw_status : BalanceWithdrawStatus :: Unknown ,
817818 barrier_dependencies : Default :: default ( ) ,
818819 }
819820 }
@@ -842,13 +843,8 @@ impl ExecutionEnv {
842843 self
843844 }
844845
845- pub fn with_sufficient_balance ( mut self ) -> Self {
846- self . withdraw_status = BalanceWithdrawStatus :: SufficientBalance ;
847- self
848- }
849-
850846 pub fn with_insufficient_balance ( mut self ) -> Self {
851- self . withdraw_status = BalanceWithdrawStatus :: InsufficientBalance ;
847+ self . balance_withdraw_status = BalanceWithdrawStatus :: InsufficientBalance ;
852848 self
853849 }
854850
@@ -1744,7 +1740,7 @@ impl AuthorityState {
17441740 & self ,
17451741 tx_lock : & CertLockGuard ,
17461742 certificate : & VerifiedExecutableTransaction ,
1747- assigned_shared_object_versions : AssignedVersions ,
1743+ assigned_shared_object_versions : & AssignedVersions ,
17481744 epoch_store : & Arc < AuthorityPerEpochStore > ,
17491745 ) -> SuiResult < InputObjects > {
17501746 let _scope = monitored_scope ( "Execution::load_input_objects" ) ;
@@ -1757,7 +1753,7 @@ impl AuthorityState {
17571753 & certificate. key ( ) ,
17581754 tx_lock,
17591755 input_objects,
1760- & assigned_shared_object_versions,
1756+ assigned_shared_object_versions,
17611757 epoch_store. epoch ( ) ,
17621758 )
17631759 }
@@ -1852,7 +1848,7 @@ impl AuthorityState {
18521848 let input_objects = match self . read_objects_for_execution (
18531849 tx_guard. as_lock_guard ( ) ,
18541850 certificate,
1855- execution_env. assigned_versions ,
1851+ & execution_env. assigned_versions ,
18561852 epoch_store,
18571853 ) {
18581854 Ok ( objects) => objects,
@@ -1888,7 +1884,7 @@ impl AuthorityState {
18881884 certificate,
18891885 input_objects,
18901886 expected_effects_digest,
1891- execution_env. withdraw_status ,
1887+ execution_env,
18921888 epoch_store,
18931889 )
18941890 }
@@ -2001,7 +1997,7 @@ impl AuthorityState {
20011997 certificate : & VerifiedExecutableTransaction ,
20021998 input_objects : InputObjects ,
20031999 expected_effects_digest : Option < TransactionEffectsDigest > ,
2004- withdraw_status : BalanceWithdrawStatus ,
2000+ execution_env : ExecutionEnv ,
20052001 epoch_store : & Arc < AuthorityPerEpochStore > ,
20062002 ) -> ExecutionOutput < (
20072003 TransactionOutputs ,
@@ -2043,7 +2039,7 @@ impl AuthorityState {
20432039 & tx_digest,
20442040 & input_objects,
20452041 self . config . certificate_deny_config . certificate_deny_set ( ) ,
2046- & withdraw_status ,
2042+ & execution_env . balance_withdraw_status ,
20472043 ) ;
20482044 let execution_params = match early_execution_error {
20492045 Some ( error) => ExecutionOrEarlyError :: Err ( error) ,
@@ -2052,8 +2048,7 @@ impl AuthorityState {
20522048
20532049 let tracking_store = TrackingBackingStore :: new ( self . get_backing_store ( ) . as_ref ( ) ) ;
20542050
2055- #[ allow( unused_mut) ]
2056- let ( inner_temp_store, _, mut effects, timings, execution_error_opt) =
2051+ let ( inner_temp_store, _, effects, timings, execution_error_opt) =
20572052 epoch_store. executor ( ) . execute_transaction_to_effects (
20582053 & tracking_store,
20592054 protocol_config,
@@ -2078,6 +2073,13 @@ impl AuthorityState {
20782073 & mut None ,
20792074 ) ;
20802075
2076+ if !self
2077+ . execution_scheduler
2078+ . should_commit_object_balance_withdraws ( certificate, & effects, & execution_env)
2079+ {
2080+ return ExecutionOutput :: RetryLater ;
2081+ }
2082+
20812083 if let Some ( expected_effects_digest) = expected_effects_digest
20822084 && effects. digest ( ) != expected_effects_digest
20832085 {
@@ -2213,7 +2215,7 @@ impl AuthorityState {
22132215 certificate,
22142216 input_objects,
22152217 None ,
2216- BalanceWithdrawStatus :: NoWithdraw ,
2218+ ExecutionEnv :: default ( ) ,
22172219 epoch_store,
22182220 )
22192221 . unwrap ( ) ;
@@ -2357,7 +2359,7 @@ impl AuthorityState {
23572359 & checked_input_objects,
23582360 self . config . certificate_deny_config . certificate_deny_set ( ) ,
23592361 // TODO(address-balances): Mimic withdraw scheduling and pass the result.
2360- & BalanceWithdrawStatus :: NoWithdraw ,
2362+ & BalanceWithdrawStatus :: Unknown ,
23612363 ) ;
23622364 let execution_params = match early_execution_error {
23632365 Some ( error) => ExecutionOrEarlyError :: Err ( error) ,
@@ -2565,7 +2567,7 @@ impl AuthorityState {
25652567 & checked_input_objects,
25662568 self . config . certificate_deny_config . certificate_deny_set ( ) ,
25672569 // TODO(address-balances): Mimic withdraw scheduling and pass the result.
2568- & BalanceWithdrawStatus :: NoWithdraw ,
2570+ & BalanceWithdrawStatus :: Unknown ,
25692571 ) ;
25702572 let execution_params = match early_execution_error {
25712573 Some ( error) => ExecutionOrEarlyError :: Err ( error) ,
@@ -2810,7 +2812,7 @@ impl AuthorityState {
28102812 & checked_input_objects,
28112813 self . config . certificate_deny_config . certificate_deny_set ( ) ,
28122814 // TODO(address-balances): Mimic withdraw scheduling and pass the result.
2813- & BalanceWithdrawStatus :: NoWithdraw ,
2815+ & BalanceWithdrawStatus :: Unknown ,
28142816 ) ;
28152817 let execution_params = match early_execution_error {
28162818 Some ( error) => ExecutionOrEarlyError :: Err ( error) ,
@@ -5950,7 +5952,7 @@ impl AuthorityState {
59505952 let input_objects = self . read_objects_for_execution (
59515953 & tx_lock,
59525954 & executable_tx,
5953- assigned_versions,
5955+ & assigned_versions,
59545956 epoch_store,
59555957 ) ?;
59565958
@@ -5960,7 +5962,7 @@ impl AuthorityState {
59605962 & executable_tx,
59615963 input_objects,
59625964 None ,
5963- BalanceWithdrawStatus :: NoWithdraw ,
5965+ ExecutionEnv :: default ( ) ,
59645966 epoch_store,
59655967 )
59665968 . unwrap ( ) ;
0 commit comments