Skip to content

Commit 372edb0

Browse files
committed
Move sysvar_clock account before price accounts in oracle batch_upd_price instruction
1 parent 43bcac2 commit 372edb0

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

program/src/oracle/oracle.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -554,7 +554,7 @@ static uint64_t batch_upd_price( SolParameters *prm, SolAccountInfo *ka ) {
554554
return ERROR_INVALID_ARGUMENT;
555555
}
556556
SolAccountInfo *publish_account = &ka[0];
557-
SolAccountInfo *clock_account = &ka[hptr->count_ + 1];
557+
SolAccountInfo *clock_account = &ka[1];
558558

559559
// Check that the publish accounts and the clock accounts are valid
560560
if ( !valid_funding_account( publish_account ) ||
@@ -567,7 +567,7 @@ static uint64_t batch_upd_price( SolParameters *prm, SolAccountInfo *ka ) {
567567
for ( uint64_t i = 0; i < hptr->count_; i++ ) {
568568

569569
cmd_upd_price_t *uptr = &cptr->upds_[i];
570-
SolAccountInfo *price_account = &ka[1 + i];
570+
SolAccountInfo *price_account = &ka[2 + i];
571571

572572
// Check that the price account is signed, writable with the correct ownership and is of the correct size
573573
if ( !valid_writable_account( prm, price_account, sizeof( pc_price_t ) ) ) {

program/src/oracle/oracle.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -223,8 +223,9 @@ typedef enum {
223223

224224
// publish a batch of component prices
225225
// key[0] funding account [signer writable]
226-
// key[1..n] price accounts [writable]
227-
// key[n] sysvar_clock account [readable]
226+
// key[1] sysvar_clock account [readable]
227+
// key[2...n] price accounts [writable]
228+
228229
e_cmd_batch_upd_price,
229230

230231
// compute aggregate price

0 commit comments

Comments
 (0)