Skip to content

Commit 955e7b2

Browse files
committed
Improve docs
1 parent f730b6e commit 955e7b2

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

sdk/pinocchio/src/program.rs

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,13 +48,25 @@ impl<'a> From<&Instruction<'a, '_, '_, '_>> for CInstruction<'a> {
4848
}
4949
}
5050

51+
/// Invoke a cross-program instruction.
52+
///
53+
/// # Important
54+
///
55+
/// The accounts on the `account_infos` slice must be in the same order as the
56+
/// `accounts` field of the `instruction`.
5157
pub fn invoke<const ACCOUNTS: usize>(
5258
instruction: &Instruction,
5359
account_infos: &[&AccountInfo; ACCOUNTS],
5460
) -> ProgramResult {
5561
invoke_signed(instruction, account_infos, &[])
5662
}
5763

64+
/// Invoke a cross-program instruction with signatures.
65+
///
66+
/// # Important
67+
///
68+
/// The accounts on the `account_infos` slice must be in the same order as the
69+
/// `accounts` field of the `instruction`.
5870
pub fn invoke_signed<const ACCOUNTS: usize>(
5971
instruction: &Instruction,
6072
account_infos: &[&AccountInfo; ACCOUNTS],
@@ -109,6 +121,11 @@ pub fn invoke_signed<const ACCOUNTS: usize>(
109121
/// borrowed within the calling program, and that data is written to by the
110122
/// callee, then Rust's aliasing rules will be violated and cause undefined
111123
/// behavior.
124+
///
125+
/// # Important
126+
///
127+
/// The accounts on the `account_infos` slice must be in the same order as the
128+
/// `accounts` field of the `instruction`.
112129
pub unsafe fn invoke_unchecked(instruction: &Instruction, accounts: &[Account]) {
113130
invoke_signed_unchecked(instruction, accounts, &[])
114131
}
@@ -126,6 +143,11 @@ pub unsafe fn invoke_unchecked(instruction: &Instruction, accounts: &[Account])
126143
/// borrowed within the calling program, and that data is written to by the
127144
/// callee, then Rust's aliasing rules will be violated and cause undefined
128145
/// behavior.
146+
///
147+
/// # Important
148+
///
149+
/// The accounts on the `account_infos` slice must be in the same order as the
150+
/// `accounts` field of the `instruction`.
129151
pub unsafe fn invoke_signed_unchecked(
130152
instruction: &Instruction,
131153
accounts: &[Account],

0 commit comments

Comments
 (0)