@@ -317,7 +317,7 @@ VM_SYSCALL_CPI_TRANSLATE_AND_UPDATE_ACCOUNTS_FUNC(
317317 fd_vm_cpi_caller_account_t * caller_account = caller_accounts + * out_len ;
318318 /* Record the indicies of this account */
319319 ushort index_in_caller = instruction_accounts [i ].index_in_caller ;
320- if ( instruction_accounts [i ].is_writable ) {
320+ if ( vm -> stricter_abi_and_runtime_constraints || instruction_accounts [i ].is_writable ) {
321321 out_callee_indices [* out_len ] = index_in_caller ;
322322 out_caller_indices [* out_len ] = j ;
323323 (* out_len )++ ;
@@ -480,12 +480,14 @@ VM_SYSCALL_CPI_TRANSLATE_AND_UPDATE_ACCOUNTS_FUNC(
480480 ////// END from_account_info
481481
482482 // TODO We should be able to cache the results of translation and reuse them in the update function.
483- /* Update the callee account to reflect any changes the caller has made
484- https://github.com/anza-xyz/agave/blob/v3.0.4/syscalls/src/cpi.rs#L863-L873 */
485- int err = VM_SYCALL_CPI_UPDATE_CALLEE_ACC_FUNC ( vm , caller_account , (uchar )index_in_caller );
486- if ( FD_UNLIKELY ( err ) ) {
487- /* errors are propagated in the function itself. */
488- return err ;
483+ /* Update the callee account to reflect any changes the caller has made.
484+ This code is split out under stricter_abi_and_runtime_constraints
485+ https://github.com/anza-xyz/agave/blob/v3.1.0-beta.0/program-runtime/src/cpi.rs#L1092-L1106 */
486+ if ( !vm -> stricter_abi_and_runtime_constraints ) {
487+ int err = VM_SYCALL_CPI_UPDATE_CALLEE_ACC_FUNC ( vm , caller_account , (uchar )index_in_caller );
488+ if ( FD_UNLIKELY ( err ) ) {
489+ return err ;
490+ }
489491 }
490492 }
491493
@@ -864,6 +866,20 @@ VM_SYSCALL_CPI_ENTRYPOINT( void * _vm,
864866 /* errors are propagated in the function itself. */
865867 if ( FD_UNLIKELY ( err ) ) return err ;
866868
869+ /* Before stricter_abi_and_runtime_constraints, this happens in
870+ VM_SYSCALL_CPI_TRANSLATE_AND_UPDATE_ACCOUNTS_FUNC.
871+ https://github.com/anza-xyz/agave/blob/v3.1.0-beta.0/program-runtime/src/cpi.rs#L856-L876 */
872+ if ( vm -> stricter_abi_and_runtime_constraints ) {
873+ for ( ulong i = 0UL ; i < caller_accounts_to_update_len ; i ++ ) {
874+ /* Update the callee account to reflect any changes the caller has made
875+ https://github.com/anza-xyz/agave/blob/v3.1.0-beta.0/program-runtime/src/cpi.rs#L866-L872 */
876+ err = VM_SYCALL_CPI_UPDATE_CALLEE_ACC_FUNC ( vm , caller_accounts + i , (uchar )callee_account_keys [i ] );
877+ if ( FD_UNLIKELY ( err ) ) {
878+ return err ;
879+ }
880+ }
881+ }
882+
867883 /* Set the transaction compute meter to be the same as the VM's compute meter,
868884 so that the callee cannot use compute units that the caller has already used. */
869885 vm -> instr_ctx -> txn_ctx -> details .compute_budget .compute_meter = vm -> cu ;
0 commit comments