@@ -2547,8 +2547,15 @@ fn match_orders_ix(
25472547 seller_order : & Pubkey ,
25482548) -> Instruction {
25492549 match_orders_ix_with_oracle (
2550- crank, crank_signer, market, orderbook, base_vault, quote_vault,
2551- buyer_order, seller_order, None ,
2550+ crank,
2551+ crank_signer,
2552+ market,
2553+ orderbook,
2554+ base_vault,
2555+ quote_vault,
2556+ buyer_order,
2557+ seller_order,
2558+ None ,
25522559 )
25532560}
25542561
@@ -4210,10 +4217,8 @@ fn two_traders_delegate_undelegate_match_settle() {
42104217
42114218/// Pyth oracle program ID on mainnet (just for owner field in test).
42124219const PYTH_ORACLE_ID : Pubkey = Pubkey :: new_from_array ( [
4213- 0x6d , 0xe2 , 0x39 , 0xa5 , 0xa2 , 0xb4 , 0xc7 , 0x43 ,
4214- 0x62 , 0x09 , 0xf5 , 0xa5 , 0x0c , 0x35 , 0x2b , 0x98 ,
4215- 0x51 , 0xdb , 0xe0 , 0x4e , 0xae , 0x13 , 0x8a , 0xd3 ,
4216- 0x11 , 0xf8 , 0x9e , 0x28 , 0x85 , 0xaf , 0x11 , 0x00 ,
4220+ 0x6d , 0xe2 , 0x39 , 0xa5 , 0xa2 , 0xb4 , 0xc7 , 0x43 , 0x62 , 0x09 , 0xf5 , 0xa5 , 0x0c , 0x35 , 0x2b , 0x98 ,
4221+ 0x51 , 0xdb , 0xe0 , 0x4e , 0xae , 0x13 , 0x8a , 0xd3 , 0x11 , 0xf8 , 0x9e , 0x28 , 0x85 , 0xaf , 0x11 , 0x00 ,
42174222] ) ;
42184223
42194224/// Create a mock Pyth V2 price account and set it into the SVM.
@@ -4226,16 +4231,18 @@ fn setup_pyth_oracle(
42264231 exponent : i32 ,
42274232 num_publishers : u32 ,
42284233) {
4229- use flux_dex:: oracle:: { COMP_SIZE , HEADER_SIZE , PRICE_INFO_SIZE , PYTH_ACCOUNT_TYPE_PRICE , PYTH_MAGIC } ;
4234+ use flux_dex:: oracle:: {
4235+ COMP_SIZE , HEADER_SIZE , PRICE_INFO_SIZE , PYTH_ACCOUNT_TYPE_PRICE , PYTH_MAGIC ,
4236+ } ;
42304237
42314238 let comp_array_size = num_publishers as usize * COMP_SIZE ;
42324239 let total_size = HEADER_SIZE + comp_array_size + PRICE_INFO_SIZE ;
42334240 let mut data = vec ! [ 0u8 ; total_size] ;
42344241
42354242 // Header
42364243 data[ 0 ..4 ] . copy_from_slice ( & PYTH_MAGIC . to_le_bytes ( ) ) ;
4237- data[ 4 ..8 ] . copy_from_slice ( & 2u32 . to_le_bytes ( ) ) ; // version
4238- data[ 8 ] = PYTH_ACCOUNT_TYPE_PRICE ; // type
4244+ data[ 4 ..8 ] . copy_from_slice ( & 2u32 . to_le_bytes ( ) ) ; // version
4245+ data[ 8 ] = PYTH_ACCOUNT_TYPE_PRICE ; // type
42394246 data[ 12 ..16 ] . copy_from_slice ( & ( total_size as u32 ) . to_le_bytes ( ) ) ;
42404247 data[ 16 ..20 ] . copy_from_slice ( & exponent. to_le_bytes ( ) ) ;
42414248 data[ 20 ..24 ] . copy_from_slice ( & num_publishers. to_le_bytes ( ) ) ;
@@ -4251,10 +4258,13 @@ fn setup_pyth_oracle(
42514258 // Insert into SVM
42524259 svm. airdrop ( oracle_addr, 1_000_000_000 )
42534260 . expect ( "airdrop for oracle account" ) ;
4254- let mut account = svm. get_account ( oracle_addr) . expect ( "oracle account after airdrop" ) ;
4261+ let mut account = svm
4262+ . get_account ( oracle_addr)
4263+ . expect ( "oracle account after airdrop" ) ;
42554264 account. data = data;
42564265 account. owner = PYTH_ORACLE_ID ;
4257- svm. set_account ( * oracle_addr, account) . expect ( "set pyth oracle account" ) ;
4266+ svm. set_account ( * oracle_addr, account)
4267+ . expect ( "set pyth oracle account" ) ;
42584268}
42594269
42604270/// match_orders with a valid Pyth oracle price account.
@@ -4296,7 +4306,10 @@ fn match_orders_with_pyth_oracle() {
42964306 Some ( & px) ,
42974307 ) ;
42984308 let cu = send_tx ( & mut fix. svm , & [ ix] , & fix. payer . pubkey ( ) , & [ & fix. payer ] ) ;
4299- assert ! ( cu < 40_000 , "match_orders with oracle CU {cu} exceeded 40k limit" ) ;
4309+ assert ! (
4310+ cu < 40_000 ,
4311+ "match_orders with oracle CU {cu} exceeded 40k limit"
4312+ ) ;
43004313
43014314 // Verify both orders filled.
43024315 let b_acc = fix. svm . get_account ( & b_order) . expect ( "buyer order account" ) ;
@@ -4311,7 +4324,11 @@ fn match_orders_with_pyth_oracle() {
43114324 // The raw Pyth price (100_000_000) is stored; frontend normalizes via exponent.
43124325 let mkt_acc = fix. svm . get_account ( & fix. market ) . expect ( "market account" ) ;
43134326 let mkt = Market :: from_account ( & mkt_acc. data ) . expect ( "decode market" ) ;
4314- assert_eq ! ( mkt. oracle_price( ) , 100_000_000 , "oracle price raw (exp -6 => 100 human)" ) ;
4327+ assert_eq ! (
4328+ mkt. oracle_price( ) ,
4329+ 100_000_000 ,
4330+ "oracle price raw (exp -6 => 100 human)"
4331+ ) ;
43154332 assert_eq ! ( mkt. oracle_timestamp( ) , now, "oracle timestamp cached" ) ;
43164333}
43174334
@@ -4357,7 +4374,11 @@ fn match_orders_with_stale_oracle_still_succeeds() {
43574374 // Verify orders filled.
43584375 let b_acc = fix. svm . get_account ( & b_order) . expect ( "buyer order account" ) ;
43594376 let b = Order :: from_account ( & b_acc. data ) . expect ( "decode buyer order" ) ;
4360- assert_eq ! ( b. status( ) . unwrap( ) , OrderStatus :: Filled , "buyer filled despite stale oracle" ) ;
4377+ assert_eq ! (
4378+ b. status( ) . unwrap( ) ,
4379+ OrderStatus :: Filled ,
4380+ "buyer filled despite stale oracle"
4381+ ) ;
43614382}
43624383
43634384/// match_orders without oracle (back-compat): 7-account layout still works.
@@ -4383,11 +4404,18 @@ fn match_orders_without_oracle_back_compat() {
43834404 & s_order,
43844405 ) ;
43854406 let cu = send_tx ( & mut fix. svm , & [ ix] , & fix. payer . pubkey ( ) , & [ & fix. payer ] ) ;
4386- assert ! ( cu < 30_000 , "match_orders w/o oracle CU {cu} exceeded 30k limit" ) ;
4407+ assert ! (
4408+ cu < 30_000 ,
4409+ "match_orders w/o oracle CU {cu} exceeded 30k limit"
4410+ ) ;
43874411
43884412 let b_acc = fix. svm . get_account ( & b_order) . expect ( "buyer order account" ) ;
43894413 let b = Order :: from_account ( & b_acc. data ) . expect ( "decode buyer order" ) ;
4390- assert_eq ! ( b. status( ) . unwrap( ) , OrderStatus :: Filled , "buyer filled without oracle" ) ;
4414+ assert_eq ! (
4415+ b. status( ) . unwrap( ) ,
4416+ OrderStatus :: Filled ,
4417+ "buyer filled without oracle"
4418+ ) ;
43914419}
43924420
43934421// ============================================================================
0 commit comments