diff --git a/program/rust/src/c_oracle_header.rs b/program/rust/src/c_oracle_header.rs index e45f04a84..3cbf21e5e 100644 --- a/program/rust/src/c_oracle_header.rs +++ b/program/rust/src/c_oracle_header.rs @@ -21,8 +21,7 @@ pub const PERMISSIONS_SEED: &str = "permissions"; /// If ci > price / PC_MAX_CI_DIVISOR, set publisher status to unknown. /// (e.g., 20 means ci must be < 5% of price) -pub const MAX_CI_DIVISOR: i64 = 20; - +pub const MAX_CI_DIVISOR: i64 = 3; /// Bound on the range of the exponent in price accounts. This number is set such that the /// PD-based EMA computation does not lose too much precision. pub const MAX_NUM_DECIMALS: i32 = 8; diff --git a/program/rust/src/tests/test_upd_price.rs b/program/rust/src/tests/test_upd_price.rs index 59c69a4b5..3eb0d4f5b 100644 --- a/program/rust/src/tests/test_upd_price.rs +++ b/program/rust/src/tests/test_upd_price.rs @@ -214,7 +214,7 @@ fn test_upd_price() { assert_eq!(price_data.agg_.status_, PC_STATUS_TRADING); } - populate_instruction(&mut instruction_data, 50, 6, 5); + populate_instruction(&mut instruction_data, 50, 20, 5); update_clock_slot(&mut clock_account, 6); // Publishing a wide CI results in a status of unknown. @@ -239,7 +239,7 @@ fn test_upd_price() { { let price_data = load_checked::(&price_account, PC_VERSION).unwrap(); assert_eq!(price_data.comp_[0].latest_.price_, 50); - assert_eq!(price_data.comp_[0].latest_.conf_, 6); + assert_eq!(price_data.comp_[0].latest_.conf_, 20); assert_eq!(price_data.comp_[0].latest_.pub_slot_, 5); assert_eq!(price_data.comp_[0].latest_.status_, PC_STATUS_UNKNOWN); assert_eq!(price_data.valid_slot_, 5); @@ -249,7 +249,7 @@ fn test_upd_price() { } // Crank one more time and aggregate should be unknown - populate_instruction(&mut instruction_data, 50, 6, 6); + populate_instruction(&mut instruction_data, 50, 20, 6); update_clock_slot(&mut clock_account, 7); assert!(process_instruction( @@ -266,7 +266,7 @@ fn test_upd_price() { { let price_data = load_checked::(&price_account, PC_VERSION).unwrap(); assert_eq!(price_data.comp_[0].latest_.price_, 50); - assert_eq!(price_data.comp_[0].latest_.conf_, 6); + assert_eq!(price_data.comp_[0].latest_.conf_, 20); assert_eq!(price_data.comp_[0].latest_.pub_slot_, 6); assert_eq!(price_data.comp_[0].latest_.status_, PC_STATUS_UNKNOWN); assert_eq!(price_data.valid_slot_, 6); diff --git a/program/rust/src/tests/test_upd_price_no_fail_on_error.rs b/program/rust/src/tests/test_upd_price_no_fail_on_error.rs index 27e730e0f..ef779e2b9 100644 --- a/program/rust/src/tests/test_upd_price_no_fail_on_error.rs +++ b/program/rust/src/tests/test_upd_price_no_fail_on_error.rs @@ -116,7 +116,7 @@ fn test_upd_price_no_fail_on_error_no_fail_on_error() { assert_eq!(price_data.comp_[0].latest_.price_, 42); assert_eq!(price_data.comp_[0].latest_.conf_, 9); assert_eq!(price_data.comp_[0].latest_.pub_slot_, 1); - assert_eq!(price_data.comp_[0].latest_.status_, PC_STATUS_UNKNOWN); + assert_eq!(price_data.comp_[0].latest_.status_, PC_STATUS_TRADING); assert_eq!(price_data.valid_slot_, 0); assert_eq!(price_data.agg_.pub_slot_, 1); assert_eq!(price_data.agg_.price_, 0); @@ -158,7 +158,7 @@ fn test_upd_price_no_fail_on_error_no_fail_on_error() { assert_eq!(price_data.comp_[0].latest_.price_, 42); assert_eq!(price_data.comp_[0].latest_.conf_, 9); assert_eq!(price_data.comp_[0].latest_.pub_slot_, 1); - assert_eq!(price_data.comp_[0].latest_.status_, PC_STATUS_UNKNOWN); + assert_eq!(price_data.comp_[0].latest_.status_, PC_STATUS_TRADING); assert_eq!(price_data.valid_slot_, 0); assert_eq!(price_data.agg_.pub_slot_, 1); assert_eq!(price_data.agg_.price_, 0); diff --git a/program/rust/src/tests/test_upd_sma.rs b/program/rust/src/tests/test_upd_sma.rs index 1d757d819..9cd499d41 100644 --- a/program/rust/src/tests/test_upd_sma.rs +++ b/program/rust/src/tests/test_upd_sma.rs @@ -277,7 +277,7 @@ fn test_upd_sma() { assert_eq!(price_data.time_machine.current_epoch_denominator, 3 + 1 + 1); } - populate_instruction(&mut instruction_data, 50, 6, 5); + populate_instruction(&mut instruction_data, 50, 20, 5); update_clock_slot(&mut clock_account, 6); // Publishing a wide CI results in a status of unknown. @@ -305,7 +305,7 @@ fn test_upd_sma() { { let price_data = load_checked::(&price_account, PC_VERSION).unwrap(); assert_eq!(price_data.price_data.comp_[0].latest_.price_, 50); - assert_eq!(price_data.price_data.comp_[0].latest_.conf_, 6); + assert_eq!(price_data.price_data.comp_[0].latest_.conf_, 20); assert_eq!(price_data.price_data.comp_[0].latest_.pub_slot_, 5); assert_eq!( price_data.price_data.comp_[0].latest_.status_, @@ -328,7 +328,7 @@ fn test_upd_sma() { } // Crank one more time and aggregate should be unknown - populate_instruction(&mut instruction_data, 50, 6, 6); + populate_instruction(&mut instruction_data, 50, 20, 6); update_clock_slot(&mut clock_account, 7); assert!(process_instruction( @@ -345,7 +345,7 @@ fn test_upd_sma() { { let price_data = load_checked::(&price_account, PC_VERSION).unwrap(); assert_eq!(price_data.price_data.comp_[0].latest_.price_, 50); - assert_eq!(price_data.price_data.comp_[0].latest_.conf_, 6); + assert_eq!(price_data.price_data.comp_[0].latest_.conf_, 20); assert_eq!(price_data.price_data.comp_[0].latest_.pub_slot_, 6); assert_eq!( price_data.price_data.comp_[0].latest_.status_, diff --git a/pyth/tests/test_update_price.py b/pyth/tests/test_update_price.py index bc2dbe8f8..44971ebe2 100644 --- a/pyth/tests/test_update_price.py +++ b/pyth/tests/test_update_price.py @@ -116,6 +116,6 @@ def get_publisher_acc(product_acc): assert publisher_acc['price'] == new_values[product]['price'] assert publisher_acc['conf'] == new_values[product]['conf'] - conf_threshold = new_values[product]['price'] / 20 + conf_threshold = new_values[product]['price'] // 3 expected_status = 'unknown' if new_values[product]['conf'] > conf_threshold else 'trading' assert publisher_acc['status'] == expected_status