Skip to content

Commit 5b2003b

Browse files
committed
merging formatting issues
1 parent 6b9ff4b commit 5b2003b

File tree

3 files changed

+9
-13
lines changed

3 files changed

+9
-13
lines changed

program/rust/build.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
mod build_utils;
22
use bindgen::Builder;
33

4-
54
fn main() {
65
println!("cargo:rustc-link-search=../c/target");
76

@@ -14,7 +13,6 @@ fn main() {
1413
parser.register_traits("pc_price_info", borsh_derives.to_vec());
1514
parser.register_traits("cmd_upd_price", borsh_derives.to_vec());
1615

17-
1816
//generate and write bindings
1917
let bindings = Builder::default()
2018
.header("./src/bindings.h")

program/rust/src/lib.rs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
11
pub mod c_oracle_header;
2-
mod rust_oracle;
3-
mod time_machine_types;
42
mod error;
53
mod log;
4+
mod rust_oracle;
5+
mod time_machine_types;
66

77
use crate::log::{post_log, pre_log};
8-
use solana_program::entrypoint::deserialize;
98
use borsh::{BorshDeserialize, BorshSerialize};
109
use solana_program::entrypoint::deserialize;
11-
10+
use solana_program::entrypoint::deserialize;
1211

1312
//Below is a high lever description of the rust/c setup.
1413

@@ -44,7 +43,7 @@ pub extern "C" fn c_entrypoint(input: *mut u8) -> u64 {
4443
pub extern "C" fn entrypoint(input: *mut u8) -> u64 {
4544
let (_program_id, accounts, instruction_data) = unsafe { deserialize(input) };
4645

47-
match pre_log(&accounts,instruction_data) {
46+
match pre_log(&accounts, instruction_data) {
4847
Err(error) => return error.into(),
4948
_ => {}
5049
}
@@ -74,7 +73,7 @@ pub extern "C" fn entrypoint(input: *mut u8) -> u64 {
7473
rust_oracle::update_version(program_id, accounts, instruction_data)
7574
}
7675
_ => unsafe { return c_entrypoint(input) },
77-
}
76+
};
7877

7978
match post_log(c_ret_val, &accounts) {
8079
Err(error) => return error.into(),

program/rust/src/log.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use solana_program::entrypoint::ProgramResult;
66
use solana_program::msg;
77
use std::mem::size_of;
88

9-
pub fn pre_log(accounts : &[AccountInfo], instruction_data: &[u8]) -> ProgramResult {
9+
pub fn pre_log(accounts: &[AccountInfo], instruction_data: &[u8]) -> ProgramResult {
1010
msg!("Pyth oracle contract");
1111

1212
let instruction_header: cmd_hdr = cmd_hdr::try_from_slice(&instruction_data[..8])?;
@@ -15,7 +15,7 @@ pub fn pre_log(accounts : &[AccountInfo], instruction_data: &[u8]) -> ProgramRes
1515
.try_into()
1616
.map_err(|_| OracleError::Generic)?;
1717
match instruction_id {
18-
command_t_e_cmd_upd_price | command_t_e_cmd_agg_price=> {
18+
command_t_e_cmd_upd_price | command_t_e_cmd_agg_price => {
1919
let instruction: cmd_upd_price = cmd_upd_price::try_from_slice(instruction_data)?;
2020
msg!(
2121
"UpdatePrice: publisher={:}, price_account={:}, price={:}, conf={:}, status={:}, slot={:}",
@@ -29,7 +29,7 @@ pub fn pre_log(accounts : &[AccountInfo], instruction_data: &[u8]) -> ProgramRes
2929
instruction.pub_slot_
3030
);
3131
}
32-
command_t_e_cmd_upd_price_no_fail_on_error=> {
32+
command_t_e_cmd_upd_price_no_fail_on_error => {
3333
let instruction: cmd_upd_price = cmd_upd_price::try_from_slice(instruction_data)?;
3434
msg!(
3535
"UpdatePriceNoFailOnError: publisher={:}, price_account={:}, price={:}, conf={:}, status={:}, slot={:}",
@@ -93,8 +93,7 @@ pub fn post_log(c_ret_val: u64, accounts: &[AccountInfo]) -> ProgramResult {
9393
)?;
9494
msg!(
9595
"UpdateAggregate : price_account={:}, price={:}, conf={:}, status={:}, slot={:}",
96-
accounts.get(1)
97-
.ok_or(OracleError::Generic)?.key,
96+
accounts.get(1).ok_or(OracleError::Generic)?.key,
9897
aggregate_price_info.price_,
9998
aggregate_price_info.conf_,
10099
aggregate_price_info.status_,

0 commit comments

Comments
 (0)