Skip to content

Commit e4d5f1d

Browse files
authored
program/rust: Instruction docs: Add the permissions account (#426)
* program/rust: Consistent instruction account doc style Indentation of the account description was inconsistent in a few cases. Plus all instructions use `account[i]` prefix for the account description, except for `DelProduct` and `UpdPermissions`. That also seems inconsistent. * program/rust: Mention permissions account in instructions Many instructions require the permissions account, but do not document that it needs to be present in the instruction documentation.
1 parent 25dd347 commit e4d5f1d

File tree

11 files changed

+42
-29
lines changed

11 files changed

+42
-29
lines changed

program/rust/src/instruction.rs

Lines changed: 26 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -23,34 +23,36 @@ pub enum OracleCommand {
2323
/// Initialize first mapping list account
2424
// account[0] funding account [signer writable]
2525
// account[1] mapping account [signer writable]
26+
// account[2] permissions account []
2627
InitMapping = 0,
27-
/// Initialize and add new mapping account
28-
// account[0] funding account [signer writable]
29-
// account[1] tail mapping account [signer writable]
30-
// account[2] new mapping account [signer writable]
28+
/// deprecated
3129
AddMapping = 1,
3230
/// Initialize and add new product reference data account
3331
// account[0] funding account [signer writable]
3432
// account[1] mapping account [signer writable]
3533
// account[2] new product account [signer writable]
34+
// account[3] permissions account []
3635
AddProduct = 2,
3736
/// Update product account
3837
// account[0] funding account [signer writable]
3938
// account[1] product account [signer writable]
39+
// account[2] permissions account []
4040
UpdProduct = 3,
4141
/// Add new price account to a product account
42-
// account[0] funding account [signer writable]
43-
// account[1] product account [writable]
44-
// account[2] new price account [writable]
45-
// account[3] permissions account [writable]
42+
// account[0] funding account [signer writable]
43+
// account[1] product account [writable]
44+
// account[2] new price account [writable]
45+
// account[3] permissions account [writable]
4646
AddPrice = 4,
4747
/// Add publisher to symbol account
4848
// account[0] funding account [signer writable]
4949
// account[1] price account [signer writable]
50+
// account[2] permissions account []
5051
AddPublisher = 5,
5152
/// Delete publisher from symbol account
5253
// account[0] funding account [signer writable]
5354
// account[1] price account [signer writable]
55+
// account[2] permissions account []
5456
DelPublisher = 6,
5557
/// Publish component price
5658
// account[0] funding account [signer writable]
@@ -65,6 +67,7 @@ pub enum OracleCommand {
6567
/// (Re)initialize price account
6668
// account[0] funding account [signer writable]
6769
// account[1] new price account [signer writable]
70+
// account[2] permissions account []
6871
InitPrice = 9,
6972
/// deprecated
7073
InitTest = 10,
@@ -73,41 +76,42 @@ pub enum OracleCommand {
7376
/// Set min publishers
7477
// account[0] funding account [signer writable]
7578
// account[1] price account [signer writable]
79+
// account[2] permissions account []
7680
SetMinPub = 12,
7781
/// Publish component price, never returning an error even if the update failed
7882
// account[0] funding account [signer writable]
7983
// account[1] price account [writable]
8084
// account[2] sysvar_clock account []
8185
UpdPriceNoFailOnError = 13,
82-
/// Resizes a price account so that it fits the Time Machine
83-
// account[0] funding account [signer writable]
84-
// account[1] price account [signer writable]
85-
// account[2] system program []
86+
/// deprecated
8687
ResizePriceAccount = 14,
8788
/// Deletes a price account
8889
// account[0] funding account [signer writable]
8990
// account[1] product account [signer writable]
9091
// account[2] price account [signer writable]
92+
// account[3] permissions account []
9193
DelPrice = 15,
9294
/// Deletes a product account
93-
// key[0] funding account [signer writable]
94-
// key[1] mapping account [signer writable]
95-
// key[2] product account [signer writable]
95+
// account[0] funding account [signer writable]
96+
// account[1] mapping account [signer writable]
97+
// account[2] product account [signer writable]
98+
// account[3] permissions account []
9699
DelProduct = 16,
97100
/// Update authorities
98-
// key[0] upgrade authority [signer writable]
99-
// key[1] programdata account []
100-
// key[2] permissions account [writable]
101-
// key[3] system program []
101+
// account[0] upgrade authority [signer writable]
102+
// account[1] programdata account []
103+
// account[2] permissions account [writable]
104+
// account[3] system program []
102105
UpdPermissions = 17,
103106
/// Set max latency
104107
// account[0] funding account [signer writable]
105108
// account[1] price account [signer writable]
109+
// account[2] permissions account []
106110
SetMaxLatency = 18,
107111
/// Init price feed index
108-
// account[0] funding account [signer writable]
109-
// account[1] price account [writable]
110-
// account[2] permissions account [writable]
112+
// account[0] funding account [signer writable]
113+
// account[1] price account [writable]
114+
// account[2] permissions account [writable]
111115
InitPriceFeedIndex = 19,
112116
// account[0] mapping account [writable]
113117
ResizeMapping = 20,

program/rust/src/processor/add_product.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ use {
3636
// account[0] funding account [signer writable]
3737
// account[1] mapping account [signer writable]
3838
// account[2] new product account [signer writable]
39+
// account[3] permissions account []
3940
pub fn add_product(
4041
program_id: &Pubkey,
4142
accounts: &[AccountInfo],

program/rust/src/processor/add_publisher.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ pub const DISABLE_ACCUMULATOR_V2: [u8; 32] = [
4444
/// Add publisher to symbol account
4545
// account[0] funding account [signer writable]
4646
// account[1] price account [signer writable]
47+
// account[2] permissions account []
4748
pub fn add_publisher(
4849
program_id: &Pubkey,
4950
accounts: &[AccountInfo],

program/rust/src/processor/del_price.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ use {
3030
// account[0] funding account [signer writable]
3131
// account[1] product account [signer writable]
3232
// account[2] price account [signer writable]
33+
// account[3] permissions account []
3334
/// Warning: This function is dangerous and will break any programs that depend on the deleted
3435
/// price account!
3536
pub fn del_price(

program/rust/src/processor/del_product.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,10 @@ use {
3636
/// little weird, as it allows you to construct a list of multiple mapping accounts where non-tail
3737
/// accounts have empty space. This is fine however; users should simply add new products to the
3838
/// first available spot.
39-
// key[0] funding account [signer writable]
40-
// key[1] mapping account [signer writable]
41-
// key[2] product account [signer writable]
39+
// account[0] funding account [signer writable]
40+
// account[1] mapping account [signer writable]
41+
// account[2] product account [signer writable]
42+
// account[3] permissions account []
4243
pub fn del_product(
4344
program_id: &Pubkey,
4445
accounts: &[AccountInfo],

program/rust/src/processor/del_publisher.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ use {
3232
/// Delete publisher from symbol account
3333
// account[0] funding account [signer writable]
3434
// account[1] price account [signer writable]
35+
// account[2] permissions account []
3536
pub fn del_publisher(
3637
program_id: &Pubkey,
3738
accounts: &[AccountInfo],

program/rust/src/processor/init_price.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ use {
3232
/// (Re)initialize price account
3333
// account[0] funding account [signer writable]
3434
// account[1] new price account [signer writable]
35+
// account[2] permissions account []
3536
pub fn init_price(
3637
program_id: &Pubkey,
3738
accounts: &[AccountInfo],

program/rust/src/processor/set_max_latency.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ use {
2525
/// Set max latency
2626
// account[0] funding account [signer writable]
2727
// account[1] price account [signer writable]
28+
// account[2] permissions account []
2829
pub fn set_max_latency(
2930
program_id: &Pubkey,
3031
accounts: &[AccountInfo],

program/rust/src/processor/set_min_pub.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ use {
2525
/// Set min publishers
2626
// account[0] funding account [signer writable]
2727
// account[1] price account [signer writable]
28+
// account[2] permissions account []
2829
pub fn set_min_pub(
2930
program_id: &Pubkey,
3031
accounts: &[AccountInfo],

program/rust/src/processor/upd_permissions.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,10 @@ use {
2929
/// Updates permissions for the pyth oracle program
3030
/// This function can create and update the permissions accounts, which stores
3131
/// several public keys that can execute administrative instructions in the pyth program
32-
// key[0] upgrade authority [signer writable]
33-
// key[1] programdata account []
34-
// key[2] permissions account [writable]
35-
// key[3] system program []
32+
// account[0] upgrade authority [signer writable]
33+
// account[1] programdata account []
34+
// account[2] permissions account [writable]
35+
// account[3] system program []
3636
pub fn upd_permissions(
3737
program_id: &Pubkey,
3838
accounts: &[AccountInfo],

0 commit comments

Comments
 (0)