Skip to content

Commit 83cc606

Browse files
jayantkJayant Krishnamurthy
and
Jayant Krishnamurthy
authored
Add new status flag for data providers kicked out of aggregate (#329)
Co-authored-by: Jayant Krishnamurthy <[email protected]>
1 parent c263c61 commit 83cc606

File tree

4 files changed

+12
-7
lines changed

4 files changed

+12
-7
lines changed

program/c/src/oracle/oracle.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ const uint64_t EXTRA_PUBLISHER_SPACE = 3072ULL;
4545
#define PC_STATUS_TRADING 1
4646
#define PC_STATUS_HALTED 2
4747
#define PC_STATUS_AUCTION 3
48+
#define PC_STATUS_IGNORED 4
4849

4950
// account types
5051
#define PC_ACCTYPE_MAPPING 1

program/rust/src/processor/upd_price.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use {
66
},
77
c_oracle_header::{
88
MAX_CI_DIVISOR,
9-
PC_STATUS_UNKNOWN,
9+
PC_STATUS_IGNORED,
1010
},
1111
deserialize::{
1212
load,
@@ -151,7 +151,7 @@ pub fn upd_price(
151151
}
152152

153153
if cmd_args.confidence > try_convert::<_, u64>(threshold_conf)? {
154-
status = PC_STATUS_UNKNOWN
154+
status = PC_STATUS_IGNORED
155155
}
156156

157157
{

program/rust/src/tests/test_upd_price.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ use {
55
PythAccount,
66
},
77
c_oracle_header::{
8+
PC_STATUS_IGNORED,
89
PC_STATUS_TRADING,
910
PC_STATUS_UNKNOWN,
1011
PC_VERSION,
@@ -243,7 +244,7 @@ fn test_upd_price() {
243244
assert_eq!(price_data.comp_[0].latest_.price_, 50);
244245
assert_eq!(price_data.comp_[0].latest_.conf_, 20);
245246
assert_eq!(price_data.comp_[0].latest_.pub_slot_, 5);
246-
assert_eq!(price_data.comp_[0].latest_.status_, PC_STATUS_UNKNOWN);
247+
assert_eq!(price_data.comp_[0].latest_.status_, PC_STATUS_IGNORED);
247248
assert_eq!(price_data.valid_slot_, 5);
248249
assert_eq!(price_data.agg_.pub_slot_, 6);
249250
assert_eq!(price_data.agg_.price_, 81);
@@ -270,7 +271,7 @@ fn test_upd_price() {
270271
assert_eq!(price_data.comp_[0].latest_.price_, 50);
271272
assert_eq!(price_data.comp_[0].latest_.conf_, 20);
272273
assert_eq!(price_data.comp_[0].latest_.pub_slot_, 6);
273-
assert_eq!(price_data.comp_[0].latest_.status_, PC_STATUS_UNKNOWN);
274+
assert_eq!(price_data.comp_[0].latest_.status_, PC_STATUS_IGNORED);
274275
assert_eq!(price_data.valid_slot_, 6);
275276
assert_eq!(price_data.agg_.pub_slot_, 7);
276277
assert_eq!(price_data.agg_.price_, 81);

program/rust/src/tests/test_upd_sma.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
use crate::accounts::PythAccount;
1+
use crate::{
2+
accounts::PythAccount,
3+
c_oracle_header::PC_STATUS_IGNORED,
4+
};
25
// use crate::processor::process_instruction;
36
use {
47
crate::{
@@ -309,7 +312,7 @@ fn test_upd_sma() {
309312
assert_eq!(price_data.price_data.comp_[0].latest_.pub_slot_, 5);
310313
assert_eq!(
311314
price_data.price_data.comp_[0].latest_.status_,
312-
PC_STATUS_UNKNOWN
315+
PC_STATUS_IGNORED
313316
);
314317
assert_eq!(price_data.price_data.valid_slot_, 5);
315318
assert_eq!(price_data.price_data.agg_.pub_slot_, 6);
@@ -349,7 +352,7 @@ fn test_upd_sma() {
349352
assert_eq!(price_data.price_data.comp_[0].latest_.pub_slot_, 6);
350353
assert_eq!(
351354
price_data.price_data.comp_[0].latest_.status_,
352-
PC_STATUS_UNKNOWN
355+
PC_STATUS_IGNORED
353356
);
354357
assert_eq!(price_data.price_data.valid_slot_, 6);
355358
assert_eq!(price_data.price_data.agg_.pub_slot_, 7);

0 commit comments

Comments
 (0)