Refactor CPI, add tests and sprinkle some comments (#28544)

* bpf_loader: cpi: split account update code to update_caller_account and add tests

* bpf_loader: cpi: set CallerAccount::original_data_len earlier

* cpi: add CallerAccount::from_account_info and CallerAccount::from_sol_account_info

* cpi: refactor common account info translation code in translate_account_infos

* update_caller docs

* cpi: rename translate_accounts to translate_and_update_accounts

* cpi: refactor pre-cpi account update code into update_callee_account

* cpi: add tests for CallerAccount::from_account_info

* cpi: add test for SyscallInvokeSignedRust::translate_accounts

* cpi: fix lints

* cpi: add test for translate_instruction()

* cpi: add test for translate_signers

* cpi: fix lint

* cpi: review fixups round 1

* cpi: more review fixups

Replace ugly MockInvokeContext with a macro

* cpi: more review fixes

replace get_callee with macro

* cpi: more review fixes

Add MockAccountInfo::new

* Fix rebase mistake
This commit is contained in:
Alessandro Decina 2022-11-23 23:22:50 +11:00 committed by GitHub
parent 1f40cb3d37
commit bee24a81b8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1173 additions and 300 deletions

File diff suppressed because it is too large Load Diff