From 0f238d06504aa751839c70dc3ba847de6aae1b6e Mon Sep 17 00:00:00 2001 From: majabbour <59592028+majabbour@users.noreply.github.com> Date: Tue, 19 Jul 2022 13:04:23 -0500 Subject: [PATCH 01/27] changed c return value of update price to indicate aggregation (#190) * changed c return value of update price to indicate aggregation * forgot to add bindings * removed the need for casting * fixed update_no_fail * removed unnecessary docker packages --- program/c/src/oracle/oracle.h | 1 + 1 file changed, 1 insertion(+) diff --git a/program/c/src/oracle/oracle.h b/program/c/src/oracle/oracle.h index 6ca196855..ed2c177ac 100644 --- a/program/c/src/oracle/oracle.h +++ b/program/c/src/oracle/oracle.h @@ -6,6 +6,7 @@ extern "C" { #endif + //A return value indicating that the aggregate price was updated //this triggers SMA trackers to update //values 0-14 are defined in solana_sdk.h (v1.10.31 ) From 3a2140b814b8ca017dc904e091bcc26c280aec43 Mon Sep 17 00:00:00 2001 From: Mark Jabbour Date: Wed, 20 Jul 2022 14:19:01 +0000 Subject: [PATCH 02/27] timeless coments --- program/c/src/oracle/oracle.h | 1 - 1 file changed, 1 deletion(-) diff --git a/program/c/src/oracle/oracle.h b/program/c/src/oracle/oracle.h index ed2c177ac..6ca196855 100644 --- a/program/c/src/oracle/oracle.h +++ b/program/c/src/oracle/oracle.h @@ -6,7 +6,6 @@ extern "C" { #endif - //A return value indicating that the aggregate price was updated //this triggers SMA trackers to update //values 0-14 are defined in solana_sdk.h (v1.10.31 ) From 13377c8d668082832b9e5fbc4e2ffdd7585ee64c Mon Sep 17 00:00:00 2001 From: Mark Jabbour Date: Wed, 20 Jul 2022 14:24:55 +0000 Subject: [PATCH 03/27] added comment clarifying that 0 is success --- program/rust/src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/program/rust/src/lib.rs b/program/rust/src/lib.rs index 27c2ba0f5..a297a092c 100644 --- a/program/rust/src/lib.rs +++ b/program/rust/src/lib.rs @@ -25,4 +25,4 @@ pub extern "C" fn entrypoint(input: *mut u8) -> u64 { } else { return c_ret_val; } -} +} \ No newline at end of file From a0556d7a2c414fcfb9b75a7287841b1ffbb9428b Mon Sep 17 00:00:00 2001 From: Mark Jabbour Date: Wed, 20 Jul 2022 20:26:40 +0000 Subject: [PATCH 04/27] a convinient way to derive traits --- program/rust/Cargo.toml | 5 +++++ program/rust/build.rs | 18 ++++++++++++++++++ program/rust/build_utils.rs | 25 +++++++++++++++++++++++++ program/rust/src/c_oracle_header.rs | 8 ++++++++ program/rust/src/lib.rs | 2 -- scripts/build-bpf.sh | 4 ++-- 6 files changed, 58 insertions(+), 4 deletions(-) create mode 100644 program/rust/build_utils.rs create mode 100644 program/rust/src/c_oracle_header.rs diff --git a/program/rust/Cargo.toml b/program/rust/Cargo.toml index 91b35559f..782b40b6f 100644 --- a/program/rust/Cargo.toml +++ b/program/rust/Cargo.toml @@ -7,8 +7,13 @@ edition = "2021" license = "Apache 2.0" publish = false +[build-dependencies] +bindgen = "0.60.1" + [dependencies] solana-program = "=1.10.29" +borsh = "0.9" + [lib] crate-type = ["cdylib", "lib"] diff --git a/program/rust/build.rs b/program/rust/build.rs index 60da04a8d..82a4ac671 100644 --- a/program/rust/build.rs +++ b/program/rust/build.rs @@ -1,3 +1,21 @@ +mod build_utils; +use bindgen; +use std::collections::HashMap; +use std::vec::Vec; + + fn main() { println!("cargo:rustc-link-search=../c/target"); + + let borsh_derives: Vec = vec!["BorshSerialize".to_string(), "BorshDeserialize".to_string()]; + + let parser = build_utils::DeriveAdderParserCallback{types_to_traits: HashMap::from([ + ("cmd_hdr", borsh_derives) + //map more struct names to traits here, be sure that the definitions of your traites + //are included in c_oracle_header.rs + ])}; + + //generate and write bindings + let bindings = bindgen::Builder::default().header("./src/bindings.h").parse_callbacks(Box::new(parser)).generate().expect("Unable to generate bindings"); + bindings.write_to_file("./bindings.rs").expect("Couldn't write bindings!"); } diff --git a/program/rust/build_utils.rs b/program/rust/build_utils.rs new file mode 100644 index 000000000..7d5a97b36 --- /dev/null +++ b/program/rust/build_utils.rs @@ -0,0 +1,25 @@ +use bindgen; +use std::panic::UnwindSafe; +use std::collections::HashMap; +///This type stores a hashmap from structnames +///to vectors of trait names, and ensures +///that the traits of each struct are added to its +///definition when an instance of this struct +///is provided as a ParseCallback for bindgen +#[derive(Debug)] +pub struct DeriveAdderParserCallback<'a>{ + pub types_to_traits: HashMap<&'a str, Vec> , +} + +//this is required to implement the callback trait +impl UnwindSafe for DeriveAdderParserCallback<'_> {} + +impl bindgen::callbacks::ParseCallbacks for DeriveAdderParserCallback<'_>{ + fn add_derives(&self, _name: &str) -> Vec{ + let traits = self.types_to_traits.get(_name); + match traits{ + Some(trait_names)=>trait_names.to_vec(), + None => vec![], + } + } +} \ No newline at end of file diff --git a/program/rust/src/c_oracle_header.rs b/program/rust/src/c_oracle_header.rs new file mode 100644 index 000000000..839858e11 --- /dev/null +++ b/program/rust/src/c_oracle_header.rs @@ -0,0 +1,8 @@ +#![allow(non_upper_case_globals)] +#![allow(non_camel_case_types)] +#![allow(non_snake_case)] +//All the custom trait imports should go here +use borsh::{BorshSerialize, BorshDeserialize}; +//bindings.rs is generated by build.rs to include +//things defined in bindings.h +include!("../bindings.rs"); \ No newline at end of file diff --git a/program/rust/src/lib.rs b/program/rust/src/lib.rs index a297a092c..375ba3503 100644 --- a/program/rust/src/lib.rs +++ b/program/rust/src/lib.rs @@ -1,5 +1,3 @@ -//c_oracle_header is auto generated by build_bpf.sh -//to reflect the current status of oracle.h mod c_oracle_header; mod time_machine_types; diff --git a/scripts/build-bpf.sh b/scripts/build-bpf.sh index 95818a2ad..08d1a72e1 100755 --- a/scripts/build-bpf.sh +++ b/scripts/build-bpf.sh @@ -40,8 +40,8 @@ rm ./target/*-keypair.json #build Rust and link it with C cd "${RUST_DIR}" -cargo install bindgen -bindgen ./src/bindings.h -o ./src/c_oracle_header.rs +#cargo install bindgen +#bindgen ./src/bindings.h -o ./src/c_oracle_header.rs cargo clean cargo test cargo clean From 2abb63be1b7c847b7ec1fa1f600474ee130042af Mon Sep 17 00:00:00 2001 From: Mark Jabbour Date: Thu, 21 Jul 2022 15:31:18 +0000 Subject: [PATCH 05/27] silenced unused bindings warnings --- program/rust/src/c_oracle_header.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/program/rust/src/c_oracle_header.rs b/program/rust/src/c_oracle_header.rs index 839858e11..8073e46a4 100644 --- a/program/rust/src/c_oracle_header.rs +++ b/program/rust/src/c_oracle_header.rs @@ -1,6 +1,9 @@ #![allow(non_upper_case_globals)] #![allow(non_camel_case_types)] #![allow(non_snake_case)] +//we do not use all the variables in oracle.h, so this helps with the warnings +#![allow(unused_variables)] +#![allow(dead_code)] //All the custom trait imports should go here use borsh::{BorshSerialize, BorshDeserialize}; //bindings.rs is generated by build.rs to include From cb1a3b80f65078b685425df2668b98eef1c28803 Mon Sep 17 00:00:00 2001 From: Mark Jabbour Date: Thu, 21 Jul 2022 15:36:27 +0000 Subject: [PATCH 06/27] removed dead code --- scripts/build-bpf.sh | 2 -- 1 file changed, 2 deletions(-) diff --git a/scripts/build-bpf.sh b/scripts/build-bpf.sh index 08d1a72e1..8880ce140 100755 --- a/scripts/build-bpf.sh +++ b/scripts/build-bpf.sh @@ -40,8 +40,6 @@ rm ./target/*-keypair.json #build Rust and link it with C cd "${RUST_DIR}" -#cargo install bindgen -#bindgen ./src/bindings.h -o ./src/c_oracle_header.rs cargo clean cargo test cargo clean From 80ac6a07d75df9d463478c3872f293927f1c1d3a Mon Sep 17 00:00:00 2001 From: Mark Jabbour Date: Thu, 21 Jul 2022 17:20:11 +0000 Subject: [PATCH 07/27] added a comment explaining the structure --- program/rust/src/lib.rs | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/program/rust/src/lib.rs b/program/rust/src/lib.rs index 375ba3503..46884dc60 100644 --- a/program/rust/src/lib.rs +++ b/program/rust/src/lib.rs @@ -1,7 +1,26 @@ mod c_oracle_header; mod time_machine_types; -//do not link with C during unit tests (which are built in native architecture, unlike libpyth.o) + +//Below is a high lever description of the rust/c setup. + +//As we migrate from C to Rust, our Rust code needs to be able to interract with C +//build-bpf.sh is set up to compile the C code into a bpf archive file, that build.rs +//is set up to link the rust targets to. This enables to interact with the c_entrypoint +//as well as similarly declare other C functions in Rust and call them + +//We also generate bindings for the types and constants in oracle.h (as well as other things +//included in bindings.h), these bindings can be accessed through c_oracle_header.rs +//Bindings allow us to access type definitions, function definitions and constants. In order to +//add traits to the bindings, we use the parser in build.rs. The traits must be defined/included +//at the the top of c_oracle_headers.rs. One of the most important traits we deal are the Borsh +//serialization traits. + +//the only limitation of our set up is that we can not unit test in rust, anything that calls +//a c function. Though we can test functions that use constants/types defined in oracle.h + + +//do not link with C during unit tests (which are built in native architecture, unlike libpyth.o) #[cfg(target_arch = "bpf")] #[link(name = "cpyth")] extern "C" { From abd8e2e495a326c8f2c67fe954c2e00cb23a81db Mon Sep 17 00:00:00 2001 From: Mark Jabbour Date: Thu, 21 Jul 2022 17:41:58 +0000 Subject: [PATCH 08/27] changed importing style --- program/rust/build.rs | 4 ++-- program/rust/build_utils.rs | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/program/rust/build.rs b/program/rust/build.rs index 82a4ac671..a069e7370 100644 --- a/program/rust/build.rs +++ b/program/rust/build.rs @@ -1,5 +1,5 @@ mod build_utils; -use bindgen; +use bindgen::Builder; use std::collections::HashMap; use std::vec::Vec; @@ -16,6 +16,6 @@ fn main() { ])}; //generate and write bindings - let bindings = bindgen::Builder::default().header("./src/bindings.h").parse_callbacks(Box::new(parser)).generate().expect("Unable to generate bindings"); + let bindings = Builder::default().header("./src/bindings.h").parse_callbacks(Box::new(parser)).generate().expect("Unable to generate bindings"); bindings.write_to_file("./bindings.rs").expect("Couldn't write bindings!"); } diff --git a/program/rust/build_utils.rs b/program/rust/build_utils.rs index 7d5a97b36..83635de80 100644 --- a/program/rust/build_utils.rs +++ b/program/rust/build_utils.rs @@ -1,4 +1,4 @@ -use bindgen; +use bindgen::callbacks::ParseCallbacks; use std::panic::UnwindSafe; use std::collections::HashMap; ///This type stores a hashmap from structnames @@ -14,7 +14,7 @@ pub struct DeriveAdderParserCallback<'a>{ //this is required to implement the callback trait impl UnwindSafe for DeriveAdderParserCallback<'_> {} -impl bindgen::callbacks::ParseCallbacks for DeriveAdderParserCallback<'_>{ +impl ParseCallbacks for DeriveAdderParserCallback<'_>{ fn add_derives(&self, _name: &str) -> Vec{ let traits = self.types_to_traits.get(_name); match traits{ From fba7985ba882b3ecd01792fa169f6502dcc5685d Mon Sep 17 00:00:00 2001 From: Mark Jabbour Date: Thu, 21 Jul 2022 18:04:55 +0000 Subject: [PATCH 09/27] called fmt on bindings output --- program/rust/build.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/program/rust/build.rs b/program/rust/build.rs index a069e7370..750ec1a40 100644 --- a/program/rust/build.rs +++ b/program/rust/build.rs @@ -16,6 +16,6 @@ fn main() { ])}; //generate and write bindings - let bindings = Builder::default().header("./src/bindings.h").parse_callbacks(Box::new(parser)).generate().expect("Unable to generate bindings"); + let bindings = Builder::default().header("./src/bindings.h").parse_callbacks(Box::new(parser)).rustfmt_bindings(true).generate().expect("Unable to generate bindings"); bindings.write_to_file("./bindings.rs").expect("Couldn't write bindings!"); } From c6fa336e34fa7cc40300f1bc4c2d807eb1bca288 Mon Sep 17 00:00:00 2001 From: Mark Jabbour Date: Thu, 21 Jul 2022 19:12:34 +0000 Subject: [PATCH 10/27] added register_traits method --- program/rust/build.rs | 9 +++------ program/rust/build_utils.rs | 14 +++++++++++++- 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/program/rust/build.rs b/program/rust/build.rs index 750ec1a40..0d7706c68 100644 --- a/program/rust/build.rs +++ b/program/rust/build.rs @@ -1,6 +1,5 @@ mod build_utils; use bindgen::Builder; -use std::collections::HashMap; use std::vec::Vec; @@ -9,11 +8,9 @@ fn main() { let borsh_derives: Vec = vec!["BorshSerialize".to_string(), "BorshDeserialize".to_string()]; - let parser = build_utils::DeriveAdderParserCallback{types_to_traits: HashMap::from([ - ("cmd_hdr", borsh_derives) - //map more struct names to traits here, be sure that the definitions of your traites - //are included in c_oracle_header.rs - ])}; + //make a parser and to it type, traits pairs + let mut parser = build_utils::DeriveAdderParserCallback::new(); + parser.register_traits("cmd_hdr", borsh_derives); //generate and write bindings let bindings = Builder::default().header("./src/bindings.h").parse_callbacks(Box::new(parser)).rustfmt_bindings(true).generate().expect("Unable to generate bindings"); diff --git a/program/rust/build_utils.rs b/program/rust/build_utils.rs index 83635de80..25bb4c28c 100644 --- a/program/rust/build_utils.rs +++ b/program/rust/build_utils.rs @@ -6,11 +6,23 @@ use std::collections::HashMap; ///that the traits of each struct are added to its ///definition when an instance of this struct ///is provided as a ParseCallback for bindgen -#[derive(Debug)] +#[derive(Debug, Default)] pub struct DeriveAdderParserCallback<'a>{ pub types_to_traits: HashMap<&'a str, Vec> , } +impl <'a> DeriveAdderParserCallback<'a>{ + ///create a parser that does not add any traits + pub fn new() -> Self { + Default::default() + } + //add pairs of types and their desired traits + pub fn register_traits(&mut self, type_name: &'a str ,traits: Vec){ + self.types_to_traits.insert(&type_name, traits); + } + +} + //this is required to implement the callback trait impl UnwindSafe for DeriveAdderParserCallback<'_> {} From 371d45362db98c286e484f59c58d77cd2a90edb6 Mon Sep 17 00:00:00 2001 From: Mark Jabbour Date: Thu, 21 Jul 2022 19:28:47 +0000 Subject: [PATCH 11/27] removed unnecessary match --- program/rust/build_utils.rs | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/program/rust/build_utils.rs b/program/rust/build_utils.rs index 25bb4c28c..9c552481a 100644 --- a/program/rust/build_utils.rs +++ b/program/rust/build_utils.rs @@ -28,10 +28,6 @@ impl UnwindSafe for DeriveAdderParserCallback<'_> {} impl ParseCallbacks for DeriveAdderParserCallback<'_>{ fn add_derives(&self, _name: &str) -> Vec{ - let traits = self.types_to_traits.get(_name); - match traits{ - Some(trait_names)=>trait_names.to_vec(), - None => vec![], - } + self.types_to_traits.get(_name).unwrap_or(&Vec::::new()).to_vec() } } \ No newline at end of file From 5871ab8ba02296896389225fc17c4fd484f344e9 Mon Sep 17 00:00:00 2001 From: Mark Jabbour Date: Thu, 21 Jul 2022 21:48:16 +0000 Subject: [PATCH 12/27] fixed formatting --- program/rust/build.rs | 17 ++++++++++++----- program/rust/build_utils.rs | 22 ++++++++++++---------- program/rust/src/c_oracle_header.rs | 4 ++-- program/rust/src/lib.rs | 6 ++---- 4 files changed, 28 insertions(+), 21 deletions(-) diff --git a/program/rust/build.rs b/program/rust/build.rs index 0d7706c68..e7ab7dd65 100644 --- a/program/rust/build.rs +++ b/program/rust/build.rs @@ -2,17 +2,24 @@ mod build_utils; use bindgen::Builder; use std::vec::Vec; - fn main() { println!("cargo:rustc-link-search=../c/target"); - - let borsh_derives: Vec = vec!["BorshSerialize".to_string(), "BorshDeserialize".to_string()]; + + let borsh_derives: Vec = + vec!["BorshSerialize".to_string(), "BorshDeserialize".to_string()]; //make a parser and to it type, traits pairs let mut parser = build_utils::DeriveAdderParserCallback::new(); parser.register_traits("cmd_hdr", borsh_derives); //generate and write bindings - let bindings = Builder::default().header("./src/bindings.h").parse_callbacks(Box::new(parser)).rustfmt_bindings(true).generate().expect("Unable to generate bindings"); - bindings.write_to_file("./bindings.rs").expect("Couldn't write bindings!"); + let bindings = Builder::default() + .header("./src/bindings.h") + .parse_callbacks(Box::new(parser)) + .rustfmt_bindings(true) + .generate() + .expect("Unable to generate bindings"); + bindings + .write_to_file("./bindings.rs") + .expect("Couldn't write bindings!"); } diff --git a/program/rust/build_utils.rs b/program/rust/build_utils.rs index 9c552481a..7848d73a3 100644 --- a/program/rust/build_utils.rs +++ b/program/rust/build_utils.rs @@ -1,33 +1,35 @@ use bindgen::callbacks::ParseCallbacks; -use std::panic::UnwindSafe; use std::collections::HashMap; +use std::panic::UnwindSafe; ///This type stores a hashmap from structnames ///to vectors of trait names, and ensures ///that the traits of each struct are added to its ///definition when an instance of this struct ///is provided as a ParseCallback for bindgen #[derive(Debug, Default)] -pub struct DeriveAdderParserCallback<'a>{ - pub types_to_traits: HashMap<&'a str, Vec> , +pub struct DeriveAdderParserCallback<'a> { + pub types_to_traits: HashMap<&'a str, Vec>, } -impl <'a> DeriveAdderParserCallback<'a>{ +impl<'a> DeriveAdderParserCallback<'a> { ///create a parser that does not add any traits pub fn new() -> Self { Default::default() } //add pairs of types and their desired traits - pub fn register_traits(&mut self, type_name: &'a str ,traits: Vec){ + pub fn register_traits(&mut self, type_name: &'a str, traits: Vec) { self.types_to_traits.insert(&type_name, traits); } - } //this is required to implement the callback trait impl UnwindSafe for DeriveAdderParserCallback<'_> {} -impl ParseCallbacks for DeriveAdderParserCallback<'_>{ - fn add_derives(&self, _name: &str) -> Vec{ - self.types_to_traits.get(_name).unwrap_or(&Vec::::new()).to_vec() +impl ParseCallbacks for DeriveAdderParserCallback<'_> { + fn add_derives(&self, _name: &str) -> Vec { + self.types_to_traits + .get(_name) + .unwrap_or(&Vec::::new()) + .to_vec() } -} \ No newline at end of file +} diff --git a/program/rust/src/c_oracle_header.rs b/program/rust/src/c_oracle_header.rs index 8073e46a4..5432e3e7b 100644 --- a/program/rust/src/c_oracle_header.rs +++ b/program/rust/src/c_oracle_header.rs @@ -5,7 +5,7 @@ #![allow(unused_variables)] #![allow(dead_code)] //All the custom trait imports should go here -use borsh::{BorshSerialize, BorshDeserialize}; +use borsh::{BorshDeserialize, BorshSerialize}; //bindings.rs is generated by build.rs to include //things defined in bindings.h -include!("../bindings.rs"); \ No newline at end of file +include!("../bindings.rs"); diff --git a/program/rust/src/lib.rs b/program/rust/src/lib.rs index 46884dc60..c4ebbc1c8 100644 --- a/program/rust/src/lib.rs +++ b/program/rust/src/lib.rs @@ -1,7 +1,6 @@ mod c_oracle_header; mod time_machine_types; - //Below is a high lever description of the rust/c setup. //As we migrate from C to Rust, our Rust code needs to be able to interract with C @@ -19,8 +18,7 @@ mod time_machine_types; //the only limitation of our set up is that we can not unit test in rust, anything that calls //a c function. Though we can test functions that use constants/types defined in oracle.h - -//do not link with C during unit tests (which are built in native architecture, unlike libpyth.o) +//do not link with C during unit tests (which are built in native architecture, unlike libpyth.o) #[cfg(target_arch = "bpf")] #[link(name = "cpyth")] extern "C" { @@ -42,4 +40,4 @@ pub extern "C" fn entrypoint(input: *mut u8) -> u64 { } else { return c_ret_val; } -} \ No newline at end of file +} From ec94b785a1a03d81e331fba88c6ffbb9067f03a6 Mon Sep 17 00:00:00 2001 From: Mark Jabbour Date: Fri, 22 Jul 2022 00:31:46 +0000 Subject: [PATCH 13/27] made it easier to add borsch to more types by not using vectors --- program/rust/build.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/program/rust/build.rs b/program/rust/build.rs index e7ab7dd65..e12cf262e 100644 --- a/program/rust/build.rs +++ b/program/rust/build.rs @@ -5,12 +5,13 @@ use std::vec::Vec; fn main() { println!("cargo:rustc-link-search=../c/target"); - let borsh_derives: Vec = - vec!["BorshSerialize".to_string(), "BorshDeserialize".to_string()]; + let borsh_derives = ["BorshSerialize".to_string(), "BorshDeserialize".to_string()]; //make a parser and to it type, traits pairs let mut parser = build_utils::DeriveAdderParserCallback::new(); - parser.register_traits("cmd_hdr", borsh_derives); + parser.register_traits("cmd_hdr", borsh_derives.to_vec()); + parser.register_traits("pc_acc", borsh_derives.to_vec()); + //generate and write bindings let bindings = Builder::default() From 93717a9404c034b3bd2b7ce270a3954d38a2eebe Mon Sep 17 00:00:00 2001 From: majabbour <59592028+majabbour@users.noreply.github.com> Date: Tue, 19 Jul 2022 13:04:23 -0500 Subject: [PATCH 14/27] changed c return value of update price to indicate aggregation (#190) * changed c return value of update price to indicate aggregation * forgot to add bindings * removed the need for casting * fixed update_no_fail * removed unnecessary docker packages --- program/c/src/oracle/oracle.h | 1 + program/rust/bindings.rs | 2218 +++++++++++++++++++++++++++++++++ program/rust/src/offset.h | 2 + 3 files changed, 2221 insertions(+) create mode 100644 program/rust/bindings.rs create mode 100644 program/rust/src/offset.h diff --git a/program/c/src/oracle/oracle.h b/program/c/src/oracle/oracle.h index 6ca196855..ed2c177ac 100644 --- a/program/c/src/oracle/oracle.h +++ b/program/c/src/oracle/oracle.h @@ -6,6 +6,7 @@ extern "C" { #endif + //A return value indicating that the aggregate price was updated //this triggers SMA trackers to update //values 0-14 are defined in solana_sdk.h (v1.10.31 ) diff --git a/program/rust/bindings.rs b/program/rust/bindings.rs new file mode 100644 index 000000000..aa10b0746 --- /dev/null +++ b/program/rust/bindings.rs @@ -0,0 +1,2218 @@ +/* automatically generated by rust-bindgen 0.60.1 */ + +#[repr(C)] +#[derive(Default)] +pub struct __IncompleteArrayField(::std::marker::PhantomData, [T; 0]); +impl __IncompleteArrayField { + #[inline] + pub const fn new() -> Self { + __IncompleteArrayField(::std::marker::PhantomData, []) + } + #[inline] + pub fn as_ptr(&self) -> *const T { + self as *const _ as *const T + } + #[inline] + pub fn as_mut_ptr(&mut self) -> *mut T { + self as *mut _ as *mut T + } + #[inline] + pub unsafe fn as_slice(&self, len: usize) -> &[T] { + ::std::slice::from_raw_parts(self.as_ptr(), len) + } + #[inline] + pub unsafe fn as_mut_slice(&mut self, len: usize) -> &mut [T] { + ::std::slice::from_raw_parts_mut(self.as_mut_ptr(), len) + } +} +impl ::std::fmt::Debug for __IncompleteArrayField { + fn fmt(&self, fmt: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + fmt.write_str("__IncompleteArrayField") + } +} +pub const true_: u32 = 1; +pub const false_: u32 = 0; +pub const __bool_true_false_are_defined: u32 = 1; +pub const PC_MAGIC: u32 = 2712847316; +pub const PC_VERSION: u32 = 2; +pub const PC_MAX_SEND_LATENCY: u32 = 25; +pub const PC_PUBKEY_SIZE: u32 = 32; +pub const PC_MAP_TABLE_SIZE: u32 = 640; +pub const PC_COMP_SIZE: u32 = 32; +pub const PC_MAX_NUM_DECIMALS: u32 = 8; +pub const PC_PROD_ACC_SIZE: u32 = 512; +pub const PC_EXP_DECAY: i32 = -9; +pub const PC_MAX_CI_DIVISOR: u32 = 20; +pub const PC_HEAP_START: u64 = 12884901888; +pub const PC_PTYPE_UNKNOWN: u32 = 0; +pub const PC_PTYPE_PRICE: u32 = 1; +pub const PC_STATUS_UNKNOWN: u32 = 0; +pub const PC_STATUS_TRADING: u32 = 1; +pub const PC_STATUS_HALTED: u32 = 2; +pub const PC_STATUS_AUCTION: u32 = 3; +pub const PC_ACCTYPE_MAPPING: u32 = 1; +pub const PC_ACCTYPE_PRODUCT: u32 = 2; +pub const PC_ACCTYPE_PRICE: u32 = 3; +pub const PC_ACCTYPE_TEST: u32 = 4; +pub const SUCCESSFULLY_UPDATED_AGGREGATE: u64 = 1000; +pub const TIME_MACHINE_STRUCT_SIZE: u64 = 1864; +extern "C" { + pub static sysvar_clock: [u64; 4usize]; +} +#[repr(C)] +#[derive(Copy, Clone)] +pub union pc_pub_key { + pub k1_: [u8; 32usize], + pub k8_: [u64; 4usize], +} +#[test] +fn bindgen_test_layout_pc_pub_key() { + assert_eq!( + ::std::mem::size_of::(), + 32usize, + concat!("Size of: ", stringify!(pc_pub_key)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(pc_pub_key)) + ); + fn test_field_k1_() { + assert_eq!( + unsafe { + let uninit = ::std::mem::MaybeUninit::::uninit(); + let ptr = uninit.as_ptr(); + ::std::ptr::addr_of!((*ptr).k1_) as usize - ptr as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(pc_pub_key), + "::", + stringify!(k1_) + ) + ); + } + test_field_k1_(); + fn test_field_k8_() { + assert_eq!( + unsafe { + let uninit = ::std::mem::MaybeUninit::::uninit(); + let ptr = uninit.as_ptr(); + ::std::ptr::addr_of!((*ptr).k8_) as usize - ptr as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(pc_pub_key), + "::", + stringify!(k8_) + ) + ); + } + test_field_k8_(); +} +pub type pc_pub_key_t = pc_pub_key; +#[repr(C)] +#[derive(Debug, Copy, Clone, BorshSerialize, BorshDeserialize)] +pub struct pc_acc { + pub magic_: u32, + pub ver_: u32, + pub type_: u32, + pub size_: u32, +} +#[test] +fn bindgen_test_layout_pc_acc() { + assert_eq!( + ::std::mem::size_of::(), + 16usize, + concat!("Size of: ", stringify!(pc_acc)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(pc_acc)) + ); + fn test_field_magic_() { + assert_eq!( + unsafe { + let uninit = ::std::mem::MaybeUninit::::uninit(); + let ptr = uninit.as_ptr(); + ::std::ptr::addr_of!((*ptr).magic_) as usize - ptr as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(pc_acc), + "::", + stringify!(magic_) + ) + ); + } + test_field_magic_(); + fn test_field_ver_() { + assert_eq!( + unsafe { + let uninit = ::std::mem::MaybeUninit::::uninit(); + let ptr = uninit.as_ptr(); + ::std::ptr::addr_of!((*ptr).ver_) as usize - ptr as usize + }, + 4usize, + concat!( + "Offset of field: ", + stringify!(pc_acc), + "::", + stringify!(ver_) + ) + ); + } + test_field_ver_(); + fn test_field_type_() { + assert_eq!( + unsafe { + let uninit = ::std::mem::MaybeUninit::::uninit(); + let ptr = uninit.as_ptr(); + ::std::ptr::addr_of!((*ptr).type_) as usize - ptr as usize + }, + 8usize, + concat!( + "Offset of field: ", + stringify!(pc_acc), + "::", + stringify!(type_) + ) + ); + } + test_field_type_(); + fn test_field_size_() { + assert_eq!( + unsafe { + let uninit = ::std::mem::MaybeUninit::::uninit(); + let ptr = uninit.as_ptr(); + ::std::ptr::addr_of!((*ptr).size_) as usize - ptr as usize + }, + 12usize, + concat!( + "Offset of field: ", + stringify!(pc_acc), + "::", + stringify!(size_) + ) + ); + } + test_field_size_(); +} +pub type pc_acc_t = pc_acc; +#[repr(C)] +#[derive(Copy, Clone)] +pub struct pc_map_table { + pub magic_: u32, + pub ver_: u32, + pub type_: u32, + pub size_: u32, + pub num_: u32, + pub unused_: u32, + pub next_: pc_pub_key_t, + pub prod_: [pc_pub_key_t; 640usize], +} +#[test] +fn bindgen_test_layout_pc_map_table() { + assert_eq!( + ::std::mem::size_of::(), + 20536usize, + concat!("Size of: ", stringify!(pc_map_table)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(pc_map_table)) + ); + fn test_field_magic_() { + assert_eq!( + unsafe { + let uninit = ::std::mem::MaybeUninit::::uninit(); + let ptr = uninit.as_ptr(); + ::std::ptr::addr_of!((*ptr).magic_) as usize - ptr as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(pc_map_table), + "::", + stringify!(magic_) + ) + ); + } + test_field_magic_(); + fn test_field_ver_() { + assert_eq!( + unsafe { + let uninit = ::std::mem::MaybeUninit::::uninit(); + let ptr = uninit.as_ptr(); + ::std::ptr::addr_of!((*ptr).ver_) as usize - ptr as usize + }, + 4usize, + concat!( + "Offset of field: ", + stringify!(pc_map_table), + "::", + stringify!(ver_) + ) + ); + } + test_field_ver_(); + fn test_field_type_() { + assert_eq!( + unsafe { + let uninit = ::std::mem::MaybeUninit::::uninit(); + let ptr = uninit.as_ptr(); + ::std::ptr::addr_of!((*ptr).type_) as usize - ptr as usize + }, + 8usize, + concat!( + "Offset of field: ", + stringify!(pc_map_table), + "::", + stringify!(type_) + ) + ); + } + test_field_type_(); + fn test_field_size_() { + assert_eq!( + unsafe { + let uninit = ::std::mem::MaybeUninit::::uninit(); + let ptr = uninit.as_ptr(); + ::std::ptr::addr_of!((*ptr).size_) as usize - ptr as usize + }, + 12usize, + concat!( + "Offset of field: ", + stringify!(pc_map_table), + "::", + stringify!(size_) + ) + ); + } + test_field_size_(); + fn test_field_num_() { + assert_eq!( + unsafe { + let uninit = ::std::mem::MaybeUninit::::uninit(); + let ptr = uninit.as_ptr(); + ::std::ptr::addr_of!((*ptr).num_) as usize - ptr as usize + }, + 16usize, + concat!( + "Offset of field: ", + stringify!(pc_map_table), + "::", + stringify!(num_) + ) + ); + } + test_field_num_(); + fn test_field_unused_() { + assert_eq!( + unsafe { + let uninit = ::std::mem::MaybeUninit::::uninit(); + let ptr = uninit.as_ptr(); + ::std::ptr::addr_of!((*ptr).unused_) as usize - ptr as usize + }, + 20usize, + concat!( + "Offset of field: ", + stringify!(pc_map_table), + "::", + stringify!(unused_) + ) + ); + } + test_field_unused_(); + fn test_field_next_() { + assert_eq!( + unsafe { + let uninit = ::std::mem::MaybeUninit::::uninit(); + let ptr = uninit.as_ptr(); + ::std::ptr::addr_of!((*ptr).next_) as usize - ptr as usize + }, + 24usize, + concat!( + "Offset of field: ", + stringify!(pc_map_table), + "::", + stringify!(next_) + ) + ); + } + test_field_next_(); + fn test_field_prod_() { + assert_eq!( + unsafe { + let uninit = ::std::mem::MaybeUninit::::uninit(); + let ptr = uninit.as_ptr(); + ::std::ptr::addr_of!((*ptr).prod_) as usize - ptr as usize + }, + 56usize, + concat!( + "Offset of field: ", + stringify!(pc_map_table), + "::", + stringify!(prod_) + ) + ); + } + test_field_prod_(); +} +pub type pc_map_table_t = pc_map_table; +#[repr(C)] +#[derive(Debug)] +pub struct pc_str { + pub len_: u8, + pub data_: __IncompleteArrayField<::std::os::raw::c_char>, +} +#[test] +fn bindgen_test_layout_pc_str() { + assert_eq!( + ::std::mem::size_of::(), + 1usize, + concat!("Size of: ", stringify!(pc_str)) + ); + assert_eq!( + ::std::mem::align_of::(), + 1usize, + concat!("Alignment of ", stringify!(pc_str)) + ); + fn test_field_len_() { + assert_eq!( + unsafe { + let uninit = ::std::mem::MaybeUninit::::uninit(); + let ptr = uninit.as_ptr(); + ::std::ptr::addr_of!((*ptr).len_) as usize - ptr as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(pc_str), + "::", + stringify!(len_) + ) + ); + } + test_field_len_(); + fn test_field_data_() { + assert_eq!( + unsafe { + let uninit = ::std::mem::MaybeUninit::::uninit(); + let ptr = uninit.as_ptr(); + ::std::ptr::addr_of!((*ptr).data_) as usize - ptr as usize + }, + 1usize, + concat!( + "Offset of field: ", + stringify!(pc_str), + "::", + stringify!(data_) + ) + ); + } + test_field_data_(); +} +pub type pc_str_t = pc_str; +#[repr(C)] +#[derive(Copy, Clone)] +pub struct pc_prod { + pub magic_: u32, + pub ver_: u32, + pub type_: u32, + pub size_: u32, + pub px_acc_: pc_pub_key_t, +} +#[test] +fn bindgen_test_layout_pc_prod() { + assert_eq!( + ::std::mem::size_of::(), + 48usize, + concat!("Size of: ", stringify!(pc_prod)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(pc_prod)) + ); + fn test_field_magic_() { + assert_eq!( + unsafe { + let uninit = ::std::mem::MaybeUninit::::uninit(); + let ptr = uninit.as_ptr(); + ::std::ptr::addr_of!((*ptr).magic_) as usize - ptr as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(pc_prod), + "::", + stringify!(magic_) + ) + ); + } + test_field_magic_(); + fn test_field_ver_() { + assert_eq!( + unsafe { + let uninit = ::std::mem::MaybeUninit::::uninit(); + let ptr = uninit.as_ptr(); + ::std::ptr::addr_of!((*ptr).ver_) as usize - ptr as usize + }, + 4usize, + concat!( + "Offset of field: ", + stringify!(pc_prod), + "::", + stringify!(ver_) + ) + ); + } + test_field_ver_(); + fn test_field_type_() { + assert_eq!( + unsafe { + let uninit = ::std::mem::MaybeUninit::::uninit(); + let ptr = uninit.as_ptr(); + ::std::ptr::addr_of!((*ptr).type_) as usize - ptr as usize + }, + 8usize, + concat!( + "Offset of field: ", + stringify!(pc_prod), + "::", + stringify!(type_) + ) + ); + } + test_field_type_(); + fn test_field_size_() { + assert_eq!( + unsafe { + let uninit = ::std::mem::MaybeUninit::::uninit(); + let ptr = uninit.as_ptr(); + ::std::ptr::addr_of!((*ptr).size_) as usize - ptr as usize + }, + 12usize, + concat!( + "Offset of field: ", + stringify!(pc_prod), + "::", + stringify!(size_) + ) + ); + } + test_field_size_(); + fn test_field_px_acc_() { + assert_eq!( + unsafe { + let uninit = ::std::mem::MaybeUninit::::uninit(); + let ptr = uninit.as_ptr(); + ::std::ptr::addr_of!((*ptr).px_acc_) as usize - ptr as usize + }, + 16usize, + concat!( + "Offset of field: ", + stringify!(pc_prod), + "::", + stringify!(px_acc_) + ) + ); + } + test_field_px_acc_(); +} +pub type pc_prod_t = pc_prod; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct pc_price_info { + pub price_: i64, + pub conf_: u64, + pub status_: u32, + pub corp_act_status_: u32, + pub pub_slot_: u64, +} +#[test] +fn bindgen_test_layout_pc_price_info() { + assert_eq!( + ::std::mem::size_of::(), + 32usize, + concat!("Size of: ", stringify!(pc_price_info)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(pc_price_info)) + ); + fn test_field_price_() { + assert_eq!( + unsafe { + let uninit = ::std::mem::MaybeUninit::::uninit(); + let ptr = uninit.as_ptr(); + ::std::ptr::addr_of!((*ptr).price_) as usize - ptr as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(pc_price_info), + "::", + stringify!(price_) + ) + ); + } + test_field_price_(); + fn test_field_conf_() { + assert_eq!( + unsafe { + let uninit = ::std::mem::MaybeUninit::::uninit(); + let ptr = uninit.as_ptr(); + ::std::ptr::addr_of!((*ptr).conf_) as usize - ptr as usize + }, + 8usize, + concat!( + "Offset of field: ", + stringify!(pc_price_info), + "::", + stringify!(conf_) + ) + ); + } + test_field_conf_(); + fn test_field_status_() { + assert_eq!( + unsafe { + let uninit = ::std::mem::MaybeUninit::::uninit(); + let ptr = uninit.as_ptr(); + ::std::ptr::addr_of!((*ptr).status_) as usize - ptr as usize + }, + 16usize, + concat!( + "Offset of field: ", + stringify!(pc_price_info), + "::", + stringify!(status_) + ) + ); + } + test_field_status_(); + fn test_field_corp_act_status_() { + assert_eq!( + unsafe { + let uninit = ::std::mem::MaybeUninit::::uninit(); + let ptr = uninit.as_ptr(); + ::std::ptr::addr_of!((*ptr).corp_act_status_) as usize - ptr as usize + }, + 20usize, + concat!( + "Offset of field: ", + stringify!(pc_price_info), + "::", + stringify!(corp_act_status_) + ) + ); + } + test_field_corp_act_status_(); + fn test_field_pub_slot_() { + assert_eq!( + unsafe { + let uninit = ::std::mem::MaybeUninit::::uninit(); + let ptr = uninit.as_ptr(); + ::std::ptr::addr_of!((*ptr).pub_slot_) as usize - ptr as usize + }, + 24usize, + concat!( + "Offset of field: ", + stringify!(pc_price_info), + "::", + stringify!(pub_slot_) + ) + ); + } + test_field_pub_slot_(); +} +pub type pc_price_info_t = pc_price_info; +#[repr(C)] +#[derive(Copy, Clone)] +pub struct pc_price_comp { + pub pub_: pc_pub_key_t, + pub agg_: pc_price_info_t, + pub latest_: pc_price_info_t, +} +#[test] +fn bindgen_test_layout_pc_price_comp() { + assert_eq!( + ::std::mem::size_of::(), + 96usize, + concat!("Size of: ", stringify!(pc_price_comp)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(pc_price_comp)) + ); + fn test_field_pub_() { + assert_eq!( + unsafe { + let uninit = ::std::mem::MaybeUninit::::uninit(); + let ptr = uninit.as_ptr(); + ::std::ptr::addr_of!((*ptr).pub_) as usize - ptr as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(pc_price_comp), + "::", + stringify!(pub_) + ) + ); + } + test_field_pub_(); + fn test_field_agg_() { + assert_eq!( + unsafe { + let uninit = ::std::mem::MaybeUninit::::uninit(); + let ptr = uninit.as_ptr(); + ::std::ptr::addr_of!((*ptr).agg_) as usize - ptr as usize + }, + 32usize, + concat!( + "Offset of field: ", + stringify!(pc_price_comp), + "::", + stringify!(agg_) + ) + ); + } + test_field_agg_(); + fn test_field_latest_() { + assert_eq!( + unsafe { + let uninit = ::std::mem::MaybeUninit::::uninit(); + let ptr = uninit.as_ptr(); + ::std::ptr::addr_of!((*ptr).latest_) as usize - ptr as usize + }, + 64usize, + concat!( + "Offset of field: ", + stringify!(pc_price_comp), + "::", + stringify!(latest_) + ) + ); + } + test_field_latest_(); +} +pub type pc_price_comp_t = pc_price_comp; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct pc_ema { + pub val_: i64, + pub numer_: i64, + pub denom_: i64, +} +#[test] +fn bindgen_test_layout_pc_ema() { + assert_eq!( + ::std::mem::size_of::(), + 24usize, + concat!("Size of: ", stringify!(pc_ema)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(pc_ema)) + ); + fn test_field_val_() { + assert_eq!( + unsafe { + let uninit = ::std::mem::MaybeUninit::::uninit(); + let ptr = uninit.as_ptr(); + ::std::ptr::addr_of!((*ptr).val_) as usize - ptr as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(pc_ema), + "::", + stringify!(val_) + ) + ); + } + test_field_val_(); + fn test_field_numer_() { + assert_eq!( + unsafe { + let uninit = ::std::mem::MaybeUninit::::uninit(); + let ptr = uninit.as_ptr(); + ::std::ptr::addr_of!((*ptr).numer_) as usize - ptr as usize + }, + 8usize, + concat!( + "Offset of field: ", + stringify!(pc_ema), + "::", + stringify!(numer_) + ) + ); + } + test_field_numer_(); + fn test_field_denom_() { + assert_eq!( + unsafe { + let uninit = ::std::mem::MaybeUninit::::uninit(); + let ptr = uninit.as_ptr(); + ::std::ptr::addr_of!((*ptr).denom_) as usize - ptr as usize + }, + 16usize, + concat!( + "Offset of field: ", + stringify!(pc_ema), + "::", + stringify!(denom_) + ) + ); + } + test_field_denom_(); +} +pub type pc_ema_t = pc_ema; +#[repr(C)] +#[derive(Copy, Clone)] +pub struct pc_price { + pub magic_: u32, + pub ver_: u32, + pub type_: u32, + pub size_: u32, + pub ptype_: u32, + pub expo_: i32, + pub num_: u32, + pub num_qt_: u32, + pub last_slot_: u64, + pub valid_slot_: u64, + pub twap_: pc_ema_t, + pub twac_: pc_ema_t, + pub timestamp_: i64, + pub min_pub_: u8, + pub drv2_: i8, + pub drv3_: i16, + pub drv4_: i32, + pub prod_: pc_pub_key_t, + pub next_: pc_pub_key_t, + pub prev_slot_: u64, + pub prev_price_: i64, + pub prev_conf_: u64, + pub prev_timestamp_: i64, + pub agg_: pc_price_info_t, + pub comp_: [pc_price_comp_t; 32usize], +} +#[test] +fn bindgen_test_layout_pc_price() { + assert_eq!( + ::std::mem::size_of::(), + 3312usize, + concat!("Size of: ", stringify!(pc_price)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(pc_price)) + ); + fn test_field_magic_() { + assert_eq!( + unsafe { + let uninit = ::std::mem::MaybeUninit::::uninit(); + let ptr = uninit.as_ptr(); + ::std::ptr::addr_of!((*ptr).magic_) as usize - ptr as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(pc_price), + "::", + stringify!(magic_) + ) + ); + } + test_field_magic_(); + fn test_field_ver_() { + assert_eq!( + unsafe { + let uninit = ::std::mem::MaybeUninit::::uninit(); + let ptr = uninit.as_ptr(); + ::std::ptr::addr_of!((*ptr).ver_) as usize - ptr as usize + }, + 4usize, + concat!( + "Offset of field: ", + stringify!(pc_price), + "::", + stringify!(ver_) + ) + ); + } + test_field_ver_(); + fn test_field_type_() { + assert_eq!( + unsafe { + let uninit = ::std::mem::MaybeUninit::::uninit(); + let ptr = uninit.as_ptr(); + ::std::ptr::addr_of!((*ptr).type_) as usize - ptr as usize + }, + 8usize, + concat!( + "Offset of field: ", + stringify!(pc_price), + "::", + stringify!(type_) + ) + ); + } + test_field_type_(); + fn test_field_size_() { + assert_eq!( + unsafe { + let uninit = ::std::mem::MaybeUninit::::uninit(); + let ptr = uninit.as_ptr(); + ::std::ptr::addr_of!((*ptr).size_) as usize - ptr as usize + }, + 12usize, + concat!( + "Offset of field: ", + stringify!(pc_price), + "::", + stringify!(size_) + ) + ); + } + test_field_size_(); + fn test_field_ptype_() { + assert_eq!( + unsafe { + let uninit = ::std::mem::MaybeUninit::::uninit(); + let ptr = uninit.as_ptr(); + ::std::ptr::addr_of!((*ptr).ptype_) as usize - ptr as usize + }, + 16usize, + concat!( + "Offset of field: ", + stringify!(pc_price), + "::", + stringify!(ptype_) + ) + ); + } + test_field_ptype_(); + fn test_field_expo_() { + assert_eq!( + unsafe { + let uninit = ::std::mem::MaybeUninit::::uninit(); + let ptr = uninit.as_ptr(); + ::std::ptr::addr_of!((*ptr).expo_) as usize - ptr as usize + }, + 20usize, + concat!( + "Offset of field: ", + stringify!(pc_price), + "::", + stringify!(expo_) + ) + ); + } + test_field_expo_(); + fn test_field_num_() { + assert_eq!( + unsafe { + let uninit = ::std::mem::MaybeUninit::::uninit(); + let ptr = uninit.as_ptr(); + ::std::ptr::addr_of!((*ptr).num_) as usize - ptr as usize + }, + 24usize, + concat!( + "Offset of field: ", + stringify!(pc_price), + "::", + stringify!(num_) + ) + ); + } + test_field_num_(); + fn test_field_num_qt_() { + assert_eq!( + unsafe { + let uninit = ::std::mem::MaybeUninit::::uninit(); + let ptr = uninit.as_ptr(); + ::std::ptr::addr_of!((*ptr).num_qt_) as usize - ptr as usize + }, + 28usize, + concat!( + "Offset of field: ", + stringify!(pc_price), + "::", + stringify!(num_qt_) + ) + ); + } + test_field_num_qt_(); + fn test_field_last_slot_() { + assert_eq!( + unsafe { + let uninit = ::std::mem::MaybeUninit::::uninit(); + let ptr = uninit.as_ptr(); + ::std::ptr::addr_of!((*ptr).last_slot_) as usize - ptr as usize + }, + 32usize, + concat!( + "Offset of field: ", + stringify!(pc_price), + "::", + stringify!(last_slot_) + ) + ); + } + test_field_last_slot_(); + fn test_field_valid_slot_() { + assert_eq!( + unsafe { + let uninit = ::std::mem::MaybeUninit::::uninit(); + let ptr = uninit.as_ptr(); + ::std::ptr::addr_of!((*ptr).valid_slot_) as usize - ptr as usize + }, + 40usize, + concat!( + "Offset of field: ", + stringify!(pc_price), + "::", + stringify!(valid_slot_) + ) + ); + } + test_field_valid_slot_(); + fn test_field_twap_() { + assert_eq!( + unsafe { + let uninit = ::std::mem::MaybeUninit::::uninit(); + let ptr = uninit.as_ptr(); + ::std::ptr::addr_of!((*ptr).twap_) as usize - ptr as usize + }, + 48usize, + concat!( + "Offset of field: ", + stringify!(pc_price), + "::", + stringify!(twap_) + ) + ); + } + test_field_twap_(); + fn test_field_twac_() { + assert_eq!( + unsafe { + let uninit = ::std::mem::MaybeUninit::::uninit(); + let ptr = uninit.as_ptr(); + ::std::ptr::addr_of!((*ptr).twac_) as usize - ptr as usize + }, + 72usize, + concat!( + "Offset of field: ", + stringify!(pc_price), + "::", + stringify!(twac_) + ) + ); + } + test_field_twac_(); + fn test_field_timestamp_() { + assert_eq!( + unsafe { + let uninit = ::std::mem::MaybeUninit::::uninit(); + let ptr = uninit.as_ptr(); + ::std::ptr::addr_of!((*ptr).timestamp_) as usize - ptr as usize + }, + 96usize, + concat!( + "Offset of field: ", + stringify!(pc_price), + "::", + stringify!(timestamp_) + ) + ); + } + test_field_timestamp_(); + fn test_field_min_pub_() { + assert_eq!( + unsafe { + let uninit = ::std::mem::MaybeUninit::::uninit(); + let ptr = uninit.as_ptr(); + ::std::ptr::addr_of!((*ptr).min_pub_) as usize - ptr as usize + }, + 104usize, + concat!( + "Offset of field: ", + stringify!(pc_price), + "::", + stringify!(min_pub_) + ) + ); + } + test_field_min_pub_(); + fn test_field_drv2_() { + assert_eq!( + unsafe { + let uninit = ::std::mem::MaybeUninit::::uninit(); + let ptr = uninit.as_ptr(); + ::std::ptr::addr_of!((*ptr).drv2_) as usize - ptr as usize + }, + 105usize, + concat!( + "Offset of field: ", + stringify!(pc_price), + "::", + stringify!(drv2_) + ) + ); + } + test_field_drv2_(); + fn test_field_drv3_() { + assert_eq!( + unsafe { + let uninit = ::std::mem::MaybeUninit::::uninit(); + let ptr = uninit.as_ptr(); + ::std::ptr::addr_of!((*ptr).drv3_) as usize - ptr as usize + }, + 106usize, + concat!( + "Offset of field: ", + stringify!(pc_price), + "::", + stringify!(drv3_) + ) + ); + } + test_field_drv3_(); + fn test_field_drv4_() { + assert_eq!( + unsafe { + let uninit = ::std::mem::MaybeUninit::::uninit(); + let ptr = uninit.as_ptr(); + ::std::ptr::addr_of!((*ptr).drv4_) as usize - ptr as usize + }, + 108usize, + concat!( + "Offset of field: ", + stringify!(pc_price), + "::", + stringify!(drv4_) + ) + ); + } + test_field_drv4_(); + fn test_field_prod_() { + assert_eq!( + unsafe { + let uninit = ::std::mem::MaybeUninit::::uninit(); + let ptr = uninit.as_ptr(); + ::std::ptr::addr_of!((*ptr).prod_) as usize - ptr as usize + }, + 112usize, + concat!( + "Offset of field: ", + stringify!(pc_price), + "::", + stringify!(prod_) + ) + ); + } + test_field_prod_(); + fn test_field_next_() { + assert_eq!( + unsafe { + let uninit = ::std::mem::MaybeUninit::::uninit(); + let ptr = uninit.as_ptr(); + ::std::ptr::addr_of!((*ptr).next_) as usize - ptr as usize + }, + 144usize, + concat!( + "Offset of field: ", + stringify!(pc_price), + "::", + stringify!(next_) + ) + ); + } + test_field_next_(); + fn test_field_prev_slot_() { + assert_eq!( + unsafe { + let uninit = ::std::mem::MaybeUninit::::uninit(); + let ptr = uninit.as_ptr(); + ::std::ptr::addr_of!((*ptr).prev_slot_) as usize - ptr as usize + }, + 176usize, + concat!( + "Offset of field: ", + stringify!(pc_price), + "::", + stringify!(prev_slot_) + ) + ); + } + test_field_prev_slot_(); + fn test_field_prev_price_() { + assert_eq!( + unsafe { + let uninit = ::std::mem::MaybeUninit::::uninit(); + let ptr = uninit.as_ptr(); + ::std::ptr::addr_of!((*ptr).prev_price_) as usize - ptr as usize + }, + 184usize, + concat!( + "Offset of field: ", + stringify!(pc_price), + "::", + stringify!(prev_price_) + ) + ); + } + test_field_prev_price_(); + fn test_field_prev_conf_() { + assert_eq!( + unsafe { + let uninit = ::std::mem::MaybeUninit::::uninit(); + let ptr = uninit.as_ptr(); + ::std::ptr::addr_of!((*ptr).prev_conf_) as usize - ptr as usize + }, + 192usize, + concat!( + "Offset of field: ", + stringify!(pc_price), + "::", + stringify!(prev_conf_) + ) + ); + } + test_field_prev_conf_(); + fn test_field_prev_timestamp_() { + assert_eq!( + unsafe { + let uninit = ::std::mem::MaybeUninit::::uninit(); + let ptr = uninit.as_ptr(); + ::std::ptr::addr_of!((*ptr).prev_timestamp_) as usize - ptr as usize + }, + 200usize, + concat!( + "Offset of field: ", + stringify!(pc_price), + "::", + stringify!(prev_timestamp_) + ) + ); + } + test_field_prev_timestamp_(); + fn test_field_agg_() { + assert_eq!( + unsafe { + let uninit = ::std::mem::MaybeUninit::::uninit(); + let ptr = uninit.as_ptr(); + ::std::ptr::addr_of!((*ptr).agg_) as usize - ptr as usize + }, + 208usize, + concat!( + "Offset of field: ", + stringify!(pc_price), + "::", + stringify!(agg_) + ) + ); + } + test_field_agg_(); + fn test_field_comp_() { + assert_eq!( + unsafe { + let uninit = ::std::mem::MaybeUninit::::uninit(); + let ptr = uninit.as_ptr(); + ::std::ptr::addr_of!((*ptr).comp_) as usize - ptr as usize + }, + 240usize, + concat!( + "Offset of field: ", + stringify!(pc_price), + "::", + stringify!(comp_) + ) + ); + } + test_field_comp_(); +} +pub type pc_price_t = pc_price; +pub const command_t_e_cmd_init_mapping: command_t = 0; +pub const command_t_e_cmd_add_mapping: command_t = 1; +pub const command_t_e_cmd_add_product: command_t = 2; +pub const command_t_e_cmd_upd_product: command_t = 3; +pub const command_t_e_cmd_add_price: command_t = 4; +pub const command_t_e_cmd_add_publisher: command_t = 5; +pub const command_t_e_cmd_del_publisher: command_t = 6; +pub const command_t_e_cmd_upd_price: command_t = 7; +pub const command_t_e_cmd_agg_price: command_t = 8; +pub const command_t_e_cmd_init_price: command_t = 9; +pub const command_t_e_cmd_init_test: command_t = 10; +pub const command_t_e_cmd_upd_test: command_t = 11; +pub const command_t_e_cmd_set_min_pub: command_t = 12; +pub const command_t_e_cmd_upd_price_no_fail_on_error: command_t = 13; +pub type command_t = ::std::os::raw::c_uint; +#[repr(C)] +#[derive(Debug, Copy, Clone, BorshSerialize, BorshDeserialize)] +pub struct cmd_hdr { + pub ver_: u32, + pub cmd_: i32, +} +#[test] +fn bindgen_test_layout_cmd_hdr() { + assert_eq!( + ::std::mem::size_of::(), + 8usize, + concat!("Size of: ", stringify!(cmd_hdr)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(cmd_hdr)) + ); + fn test_field_ver_() { + assert_eq!( + unsafe { + let uninit = ::std::mem::MaybeUninit::::uninit(); + let ptr = uninit.as_ptr(); + ::std::ptr::addr_of!((*ptr).ver_) as usize - ptr as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(cmd_hdr), + "::", + stringify!(ver_) + ) + ); + } + test_field_ver_(); + fn test_field_cmd_() { + assert_eq!( + unsafe { + let uninit = ::std::mem::MaybeUninit::::uninit(); + let ptr = uninit.as_ptr(); + ::std::ptr::addr_of!((*ptr).cmd_) as usize - ptr as usize + }, + 4usize, + concat!( + "Offset of field: ", + stringify!(cmd_hdr), + "::", + stringify!(cmd_) + ) + ); + } + test_field_cmd_(); +} +pub type cmd_hdr_t = cmd_hdr; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct cmd_add_product { + pub ver_: u32, + pub cmd_: i32, +} +#[test] +fn bindgen_test_layout_cmd_add_product() { + assert_eq!( + ::std::mem::size_of::(), + 8usize, + concat!("Size of: ", stringify!(cmd_add_product)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(cmd_add_product)) + ); + fn test_field_ver_() { + assert_eq!( + unsafe { + let uninit = ::std::mem::MaybeUninit::::uninit(); + let ptr = uninit.as_ptr(); + ::std::ptr::addr_of!((*ptr).ver_) as usize - ptr as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(cmd_add_product), + "::", + stringify!(ver_) + ) + ); + } + test_field_ver_(); + fn test_field_cmd_() { + assert_eq!( + unsafe { + let uninit = ::std::mem::MaybeUninit::::uninit(); + let ptr = uninit.as_ptr(); + ::std::ptr::addr_of!((*ptr).cmd_) as usize - ptr as usize + }, + 4usize, + concat!( + "Offset of field: ", + stringify!(cmd_add_product), + "::", + stringify!(cmd_) + ) + ); + } + test_field_cmd_(); +} +pub type cmd_add_product_t = cmd_add_product; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct cmd_upd_product { + pub ver_: u32, + pub cmd_: i32, +} +#[test] +fn bindgen_test_layout_cmd_upd_product() { + assert_eq!( + ::std::mem::size_of::(), + 8usize, + concat!("Size of: ", stringify!(cmd_upd_product)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(cmd_upd_product)) + ); + fn test_field_ver_() { + assert_eq!( + unsafe { + let uninit = ::std::mem::MaybeUninit::::uninit(); + let ptr = uninit.as_ptr(); + ::std::ptr::addr_of!((*ptr).ver_) as usize - ptr as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(cmd_upd_product), + "::", + stringify!(ver_) + ) + ); + } + test_field_ver_(); + fn test_field_cmd_() { + assert_eq!( + unsafe { + let uninit = ::std::mem::MaybeUninit::::uninit(); + let ptr = uninit.as_ptr(); + ::std::ptr::addr_of!((*ptr).cmd_) as usize - ptr as usize + }, + 4usize, + concat!( + "Offset of field: ", + stringify!(cmd_upd_product), + "::", + stringify!(cmd_) + ) + ); + } + test_field_cmd_(); +} +pub type cmd_upd_product_t = cmd_upd_product; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct cmd_add_price { + pub ver_: u32, + pub cmd_: i32, + pub expo_: i32, + pub ptype_: u32, +} +#[test] +fn bindgen_test_layout_cmd_add_price() { + assert_eq!( + ::std::mem::size_of::(), + 16usize, + concat!("Size of: ", stringify!(cmd_add_price)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(cmd_add_price)) + ); + fn test_field_ver_() { + assert_eq!( + unsafe { + let uninit = ::std::mem::MaybeUninit::::uninit(); + let ptr = uninit.as_ptr(); + ::std::ptr::addr_of!((*ptr).ver_) as usize - ptr as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(cmd_add_price), + "::", + stringify!(ver_) + ) + ); + } + test_field_ver_(); + fn test_field_cmd_() { + assert_eq!( + unsafe { + let uninit = ::std::mem::MaybeUninit::::uninit(); + let ptr = uninit.as_ptr(); + ::std::ptr::addr_of!((*ptr).cmd_) as usize - ptr as usize + }, + 4usize, + concat!( + "Offset of field: ", + stringify!(cmd_add_price), + "::", + stringify!(cmd_) + ) + ); + } + test_field_cmd_(); + fn test_field_expo_() { + assert_eq!( + unsafe { + let uninit = ::std::mem::MaybeUninit::::uninit(); + let ptr = uninit.as_ptr(); + ::std::ptr::addr_of!((*ptr).expo_) as usize - ptr as usize + }, + 8usize, + concat!( + "Offset of field: ", + stringify!(cmd_add_price), + "::", + stringify!(expo_) + ) + ); + } + test_field_expo_(); + fn test_field_ptype_() { + assert_eq!( + unsafe { + let uninit = ::std::mem::MaybeUninit::::uninit(); + let ptr = uninit.as_ptr(); + ::std::ptr::addr_of!((*ptr).ptype_) as usize - ptr as usize + }, + 12usize, + concat!( + "Offset of field: ", + stringify!(cmd_add_price), + "::", + stringify!(ptype_) + ) + ); + } + test_field_ptype_(); +} +pub type cmd_add_price_t = cmd_add_price; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct cmd_init_price { + pub ver_: u32, + pub cmd_: i32, + pub expo_: i32, + pub ptype_: u32, +} +#[test] +fn bindgen_test_layout_cmd_init_price() { + assert_eq!( + ::std::mem::size_of::(), + 16usize, + concat!("Size of: ", stringify!(cmd_init_price)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(cmd_init_price)) + ); + fn test_field_ver_() { + assert_eq!( + unsafe { + let uninit = ::std::mem::MaybeUninit::::uninit(); + let ptr = uninit.as_ptr(); + ::std::ptr::addr_of!((*ptr).ver_) as usize - ptr as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(cmd_init_price), + "::", + stringify!(ver_) + ) + ); + } + test_field_ver_(); + fn test_field_cmd_() { + assert_eq!( + unsafe { + let uninit = ::std::mem::MaybeUninit::::uninit(); + let ptr = uninit.as_ptr(); + ::std::ptr::addr_of!((*ptr).cmd_) as usize - ptr as usize + }, + 4usize, + concat!( + "Offset of field: ", + stringify!(cmd_init_price), + "::", + stringify!(cmd_) + ) + ); + } + test_field_cmd_(); + fn test_field_expo_() { + assert_eq!( + unsafe { + let uninit = ::std::mem::MaybeUninit::::uninit(); + let ptr = uninit.as_ptr(); + ::std::ptr::addr_of!((*ptr).expo_) as usize - ptr as usize + }, + 8usize, + concat!( + "Offset of field: ", + stringify!(cmd_init_price), + "::", + stringify!(expo_) + ) + ); + } + test_field_expo_(); + fn test_field_ptype_() { + assert_eq!( + unsafe { + let uninit = ::std::mem::MaybeUninit::::uninit(); + let ptr = uninit.as_ptr(); + ::std::ptr::addr_of!((*ptr).ptype_) as usize - ptr as usize + }, + 12usize, + concat!( + "Offset of field: ", + stringify!(cmd_init_price), + "::", + stringify!(ptype_) + ) + ); + } + test_field_ptype_(); +} +pub type cmd_init_price_t = cmd_init_price; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct cmd_set_min_pub { + pub ver_: u32, + pub cmd_: i32, + pub min_pub_: u8, +} +#[test] +fn bindgen_test_layout_cmd_set_min_pub() { + assert_eq!( + ::std::mem::size_of::(), + 12usize, + concat!("Size of: ", stringify!(cmd_set_min_pub)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(cmd_set_min_pub)) + ); + fn test_field_ver_() { + assert_eq!( + unsafe { + let uninit = ::std::mem::MaybeUninit::::uninit(); + let ptr = uninit.as_ptr(); + ::std::ptr::addr_of!((*ptr).ver_) as usize - ptr as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(cmd_set_min_pub), + "::", + stringify!(ver_) + ) + ); + } + test_field_ver_(); + fn test_field_cmd_() { + assert_eq!( + unsafe { + let uninit = ::std::mem::MaybeUninit::::uninit(); + let ptr = uninit.as_ptr(); + ::std::ptr::addr_of!((*ptr).cmd_) as usize - ptr as usize + }, + 4usize, + concat!( + "Offset of field: ", + stringify!(cmd_set_min_pub), + "::", + stringify!(cmd_) + ) + ); + } + test_field_cmd_(); + fn test_field_min_pub_() { + assert_eq!( + unsafe { + let uninit = ::std::mem::MaybeUninit::::uninit(); + let ptr = uninit.as_ptr(); + ::std::ptr::addr_of!((*ptr).min_pub_) as usize - ptr as usize + }, + 8usize, + concat!( + "Offset of field: ", + stringify!(cmd_set_min_pub), + "::", + stringify!(min_pub_) + ) + ); + } + test_field_min_pub_(); +} +pub type cmd_set_min_pub_t = cmd_set_min_pub; +#[repr(C)] +#[derive(Copy, Clone)] +pub struct cmd_add_publisher { + pub ver_: u32, + pub cmd_: i32, + pub pub_: pc_pub_key_t, +} +#[test] +fn bindgen_test_layout_cmd_add_publisher() { + assert_eq!( + ::std::mem::size_of::(), + 40usize, + concat!("Size of: ", stringify!(cmd_add_publisher)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(cmd_add_publisher)) + ); + fn test_field_ver_() { + assert_eq!( + unsafe { + let uninit = ::std::mem::MaybeUninit::::uninit(); + let ptr = uninit.as_ptr(); + ::std::ptr::addr_of!((*ptr).ver_) as usize - ptr as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(cmd_add_publisher), + "::", + stringify!(ver_) + ) + ); + } + test_field_ver_(); + fn test_field_cmd_() { + assert_eq!( + unsafe { + let uninit = ::std::mem::MaybeUninit::::uninit(); + let ptr = uninit.as_ptr(); + ::std::ptr::addr_of!((*ptr).cmd_) as usize - ptr as usize + }, + 4usize, + concat!( + "Offset of field: ", + stringify!(cmd_add_publisher), + "::", + stringify!(cmd_) + ) + ); + } + test_field_cmd_(); + fn test_field_pub_() { + assert_eq!( + unsafe { + let uninit = ::std::mem::MaybeUninit::::uninit(); + let ptr = uninit.as_ptr(); + ::std::ptr::addr_of!((*ptr).pub_) as usize - ptr as usize + }, + 8usize, + concat!( + "Offset of field: ", + stringify!(cmd_add_publisher), + "::", + stringify!(pub_) + ) + ); + } + test_field_pub_(); +} +pub type cmd_add_publisher_t = cmd_add_publisher; +#[repr(C)] +#[derive(Copy, Clone)] +pub struct cmd_del_publisher { + pub ver_: u32, + pub cmd_: i32, + pub pub_: pc_pub_key_t, +} +#[test] +fn bindgen_test_layout_cmd_del_publisher() { + assert_eq!( + ::std::mem::size_of::(), + 40usize, + concat!("Size of: ", stringify!(cmd_del_publisher)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(cmd_del_publisher)) + ); + fn test_field_ver_() { + assert_eq!( + unsafe { + let uninit = ::std::mem::MaybeUninit::::uninit(); + let ptr = uninit.as_ptr(); + ::std::ptr::addr_of!((*ptr).ver_) as usize - ptr as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(cmd_del_publisher), + "::", + stringify!(ver_) + ) + ); + } + test_field_ver_(); + fn test_field_cmd_() { + assert_eq!( + unsafe { + let uninit = ::std::mem::MaybeUninit::::uninit(); + let ptr = uninit.as_ptr(); + ::std::ptr::addr_of!((*ptr).cmd_) as usize - ptr as usize + }, + 4usize, + concat!( + "Offset of field: ", + stringify!(cmd_del_publisher), + "::", + stringify!(cmd_) + ) + ); + } + test_field_cmd_(); + fn test_field_pub_() { + assert_eq!( + unsafe { + let uninit = ::std::mem::MaybeUninit::::uninit(); + let ptr = uninit.as_ptr(); + ::std::ptr::addr_of!((*ptr).pub_) as usize - ptr as usize + }, + 8usize, + concat!( + "Offset of field: ", + stringify!(cmd_del_publisher), + "::", + stringify!(pub_) + ) + ); + } + test_field_pub_(); +} +pub type cmd_del_publisher_t = cmd_del_publisher; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct cmd_upd_price { + pub ver_: u32, + pub cmd_: i32, + pub status_: u32, + pub unused_: u32, + pub price_: i64, + pub conf_: u64, + pub pub_slot_: u64, +} +#[test] +fn bindgen_test_layout_cmd_upd_price() { + assert_eq!( + ::std::mem::size_of::(), + 40usize, + concat!("Size of: ", stringify!(cmd_upd_price)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(cmd_upd_price)) + ); + fn test_field_ver_() { + assert_eq!( + unsafe { + let uninit = ::std::mem::MaybeUninit::::uninit(); + let ptr = uninit.as_ptr(); + ::std::ptr::addr_of!((*ptr).ver_) as usize - ptr as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(cmd_upd_price), + "::", + stringify!(ver_) + ) + ); + } + test_field_ver_(); + fn test_field_cmd_() { + assert_eq!( + unsafe { + let uninit = ::std::mem::MaybeUninit::::uninit(); + let ptr = uninit.as_ptr(); + ::std::ptr::addr_of!((*ptr).cmd_) as usize - ptr as usize + }, + 4usize, + concat!( + "Offset of field: ", + stringify!(cmd_upd_price), + "::", + stringify!(cmd_) + ) + ); + } + test_field_cmd_(); + fn test_field_status_() { + assert_eq!( + unsafe { + let uninit = ::std::mem::MaybeUninit::::uninit(); + let ptr = uninit.as_ptr(); + ::std::ptr::addr_of!((*ptr).status_) as usize - ptr as usize + }, + 8usize, + concat!( + "Offset of field: ", + stringify!(cmd_upd_price), + "::", + stringify!(status_) + ) + ); + } + test_field_status_(); + fn test_field_unused_() { + assert_eq!( + unsafe { + let uninit = ::std::mem::MaybeUninit::::uninit(); + let ptr = uninit.as_ptr(); + ::std::ptr::addr_of!((*ptr).unused_) as usize - ptr as usize + }, + 12usize, + concat!( + "Offset of field: ", + stringify!(cmd_upd_price), + "::", + stringify!(unused_) + ) + ); + } + test_field_unused_(); + fn test_field_price_() { + assert_eq!( + unsafe { + let uninit = ::std::mem::MaybeUninit::::uninit(); + let ptr = uninit.as_ptr(); + ::std::ptr::addr_of!((*ptr).price_) as usize - ptr as usize + }, + 16usize, + concat!( + "Offset of field: ", + stringify!(cmd_upd_price), + "::", + stringify!(price_) + ) + ); + } + test_field_price_(); + fn test_field_conf_() { + assert_eq!( + unsafe { + let uninit = ::std::mem::MaybeUninit::::uninit(); + let ptr = uninit.as_ptr(); + ::std::ptr::addr_of!((*ptr).conf_) as usize - ptr as usize + }, + 24usize, + concat!( + "Offset of field: ", + stringify!(cmd_upd_price), + "::", + stringify!(conf_) + ) + ); + } + test_field_conf_(); + fn test_field_pub_slot_() { + assert_eq!( + unsafe { + let uninit = ::std::mem::MaybeUninit::::uninit(); + let ptr = uninit.as_ptr(); + ::std::ptr::addr_of!((*ptr).pub_slot_) as usize - ptr as usize + }, + 32usize, + concat!( + "Offset of field: ", + stringify!(cmd_upd_price), + "::", + stringify!(pub_slot_) + ) + ); + } + test_field_pub_slot_(); +} +pub type cmd_upd_price_t = cmd_upd_price; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct cmd_upd_test { + pub ver_: u32, + pub cmd_: i32, + pub num_: u32, + pub expo_: i32, + pub slot_diff_: [i8; 32usize], + pub price_: [i64; 32usize], + pub conf_: [u64; 32usize], +} +#[test] +fn bindgen_test_layout_cmd_upd_test() { + assert_eq!( + ::std::mem::size_of::(), + 560usize, + concat!("Size of: ", stringify!(cmd_upd_test)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(cmd_upd_test)) + ); + fn test_field_ver_() { + assert_eq!( + unsafe { + let uninit = ::std::mem::MaybeUninit::::uninit(); + let ptr = uninit.as_ptr(); + ::std::ptr::addr_of!((*ptr).ver_) as usize - ptr as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(cmd_upd_test), + "::", + stringify!(ver_) + ) + ); + } + test_field_ver_(); + fn test_field_cmd_() { + assert_eq!( + unsafe { + let uninit = ::std::mem::MaybeUninit::::uninit(); + let ptr = uninit.as_ptr(); + ::std::ptr::addr_of!((*ptr).cmd_) as usize - ptr as usize + }, + 4usize, + concat!( + "Offset of field: ", + stringify!(cmd_upd_test), + "::", + stringify!(cmd_) + ) + ); + } + test_field_cmd_(); + fn test_field_num_() { + assert_eq!( + unsafe { + let uninit = ::std::mem::MaybeUninit::::uninit(); + let ptr = uninit.as_ptr(); + ::std::ptr::addr_of!((*ptr).num_) as usize - ptr as usize + }, + 8usize, + concat!( + "Offset of field: ", + stringify!(cmd_upd_test), + "::", + stringify!(num_) + ) + ); + } + test_field_num_(); + fn test_field_expo_() { + assert_eq!( + unsafe { + let uninit = ::std::mem::MaybeUninit::::uninit(); + let ptr = uninit.as_ptr(); + ::std::ptr::addr_of!((*ptr).expo_) as usize - ptr as usize + }, + 12usize, + concat!( + "Offset of field: ", + stringify!(cmd_upd_test), + "::", + stringify!(expo_) + ) + ); + } + test_field_expo_(); + fn test_field_slot_diff_() { + assert_eq!( + unsafe { + let uninit = ::std::mem::MaybeUninit::::uninit(); + let ptr = uninit.as_ptr(); + ::std::ptr::addr_of!((*ptr).slot_diff_) as usize - ptr as usize + }, + 16usize, + concat!( + "Offset of field: ", + stringify!(cmd_upd_test), + "::", + stringify!(slot_diff_) + ) + ); + } + test_field_slot_diff_(); + fn test_field_price_() { + assert_eq!( + unsafe { + let uninit = ::std::mem::MaybeUninit::::uninit(); + let ptr = uninit.as_ptr(); + ::std::ptr::addr_of!((*ptr).price_) as usize - ptr as usize + }, + 48usize, + concat!( + "Offset of field: ", + stringify!(cmd_upd_test), + "::", + stringify!(price_) + ) + ); + } + test_field_price_(); + fn test_field_conf_() { + assert_eq!( + unsafe { + let uninit = ::std::mem::MaybeUninit::::uninit(); + let ptr = uninit.as_ptr(); + ::std::ptr::addr_of!((*ptr).conf_) as usize - ptr as usize + }, + 304usize, + concat!( + "Offset of field: ", + stringify!(cmd_upd_test), + "::", + stringify!(conf_) + ) + ); + } + test_field_conf_(); +} +pub type cmd_upd_test_t = cmd_upd_test; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct sysvar_clock { + pub slot_: u64, + pub epoch_start_timestamp_: i64, + pub epoch_: u64, + pub leader_schedule_epoch_: u64, + pub unix_timestamp_: i64, +} +#[test] +fn bindgen_test_layout_sysvar_clock() { + assert_eq!( + ::std::mem::size_of::(), + 40usize, + concat!("Size of: ", stringify!(sysvar_clock)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(sysvar_clock)) + ); + fn test_field_slot_() { + assert_eq!( + unsafe { + let uninit = ::std::mem::MaybeUninit::::uninit(); + let ptr = uninit.as_ptr(); + ::std::ptr::addr_of!((*ptr).slot_) as usize - ptr as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(sysvar_clock), + "::", + stringify!(slot_) + ) + ); + } + test_field_slot_(); + fn test_field_epoch_start_timestamp_() { + assert_eq!( + unsafe { + let uninit = ::std::mem::MaybeUninit::::uninit(); + let ptr = uninit.as_ptr(); + ::std::ptr::addr_of!((*ptr).epoch_start_timestamp_) as usize - ptr as usize + }, + 8usize, + concat!( + "Offset of field: ", + stringify!(sysvar_clock), + "::", + stringify!(epoch_start_timestamp_) + ) + ); + } + test_field_epoch_start_timestamp_(); + fn test_field_epoch_() { + assert_eq!( + unsafe { + let uninit = ::std::mem::MaybeUninit::::uninit(); + let ptr = uninit.as_ptr(); + ::std::ptr::addr_of!((*ptr).epoch_) as usize - ptr as usize + }, + 16usize, + concat!( + "Offset of field: ", + stringify!(sysvar_clock), + "::", + stringify!(epoch_) + ) + ); + } + test_field_epoch_(); + fn test_field_leader_schedule_epoch_() { + assert_eq!( + unsafe { + let uninit = ::std::mem::MaybeUninit::::uninit(); + let ptr = uninit.as_ptr(); + ::std::ptr::addr_of!((*ptr).leader_schedule_epoch_) as usize - ptr as usize + }, + 24usize, + concat!( + "Offset of field: ", + stringify!(sysvar_clock), + "::", + stringify!(leader_schedule_epoch_) + ) + ); + } + test_field_leader_schedule_epoch_(); + fn test_field_unix_timestamp_() { + assert_eq!( + unsafe { + let uninit = ::std::mem::MaybeUninit::::uninit(); + let ptr = uninit.as_ptr(); + ::std::ptr::addr_of!((*ptr).unix_timestamp_) as usize - ptr as usize + }, + 32usize, + concat!( + "Offset of field: ", + stringify!(sysvar_clock), + "::", + stringify!(unix_timestamp_) + ) + ); + } + test_field_unix_timestamp_(); +} +pub type sysvar_clock_t = sysvar_clock; diff --git a/program/rust/src/offset.h b/program/rust/src/offset.h new file mode 100644 index 000000000..a50754c4c --- /dev/null +++ b/program/rust/src/offset.h @@ -0,0 +1,2 @@ +#include +const size_t PRICE_T_CONF_OFFSET = offsetof(struct pc_price, agg_); \ No newline at end of file From 3911d151a70646ed5bbf0f6cace093b6ebc955ed Mon Sep 17 00:00:00 2001 From: Guillermo Bescos Date: Thu, 21 Jul 2022 18:47:50 +0000 Subject: [PATCH 15/27] Switch from vector to slice to allow adding traits to multiple structs --- program/rust/build.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/program/rust/build.rs b/program/rust/build.rs index e12cf262e..4114e4af4 100644 --- a/program/rust/build.rs +++ b/program/rust/build.rs @@ -1,6 +1,6 @@ mod build_utils; use bindgen::Builder; -use std::vec::Vec; +use std::collections::HashMap; fn main() { println!("cargo:rustc-link-search=../c/target"); From 637990c08a97a0f974fb1ff5670b415443dd6ab7 Mon Sep 17 00:00:00 2001 From: Guillermo Bescos Date: Thu, 21 Jul 2022 19:14:25 +0000 Subject: [PATCH 16/27] Logging 2 --- program/rust/Cargo.toml | 1 + program/rust/src/error.rs | 21 +++++++++ program/rust/src/lib.rs | 17 +++++++- program/rust/src/log.rs | 91 +++++++++++++++++++++++++++++++++++++++ 4 files changed, 128 insertions(+), 2 deletions(-) create mode 100644 program/rust/src/error.rs create mode 100644 program/rust/src/log.rs diff --git a/program/rust/Cargo.toml b/program/rust/Cargo.toml index 782b40b6f..c3e881ac5 100644 --- a/program/rust/Cargo.toml +++ b/program/rust/Cargo.toml @@ -13,6 +13,7 @@ bindgen = "0.60.1" [dependencies] solana-program = "=1.10.29" borsh = "0.9" +thiserror = "1.0" [lib] diff --git a/program/rust/src/error.rs b/program/rust/src/error.rs new file mode 100644 index 000000000..cfe11defd --- /dev/null +++ b/program/rust/src/error.rs @@ -0,0 +1,21 @@ +//! Error types + +use solana_program::{ + program_error::{ProgramError}, +}; +use thiserror::Error; + + +/// Errors that may be returned by the oracle program +#[derive(Clone, Debug, Eq, Error, PartialEq)] +pub enum OracleError { + /// Generic catch all error + #[error("Generic")] + Generic = 600, +} + +impl From for ProgramError { + fn from(e: OracleError) -> Self { + ProgramError::Custom(e as u32) + } +} \ No newline at end of file diff --git a/program/rust/src/lib.rs b/program/rust/src/lib.rs index c4ebbc1c8..df31e2049 100644 --- a/program/rust/src/lib.rs +++ b/program/rust/src/lib.rs @@ -1,5 +1,10 @@ mod c_oracle_header; mod time_machine_types; +mod error; +mod log; + +use crate::log::pre_log; +use solana_program::entrypoint::{deserialize}; //Below is a high lever description of the rust/c setup. @@ -33,8 +38,16 @@ pub extern "C" fn c_entrypoint(input: *mut u8) -> u64 { #[no_mangle] pub extern "C" fn entrypoint(input: *mut u8) -> u64 { - let c_ret_val = unsafe { c_entrypoint(input) }; - if c_ret_val == c_oracle_header::SUCCESSFULLY_UPDATED_AGGREGATE { + + let (_program_id, _accounts, instruction_data) = unsafe { deserialize(input) }; + + match pre_log(_program_id, &_accounts, instruction_data) { + Err(error) => return error.into(), + _ => {} + } + + let c_ret_val = unsafe{c_entrypoint(input)}; + if c_ret_val == c_oracle_header::SUCCESSFULLY_UPDATED_AGGREGATE{ //0 is the SUCCESS value for solana return 0; } else { diff --git a/program/rust/src/log.rs b/program/rust/src/log.rs new file mode 100644 index 000000000..701d4e08c --- /dev/null +++ b/program/rust/src/log.rs @@ -0,0 +1,91 @@ +use solana_program::{account_info::AccountInfo, pubkey::Pubkey}; +use solana_program::msg; +use solana_program::entrypoint::{ ProgramResult}; +use borsh::{BorshDeserialize}; +use crate::error::OracleError; +use crate::c_oracle_header::{ + cmd_hdr, cmd_upd_price, command_t_e_cmd_add_mapping, command_t_e_cmd_add_price, + command_t_e_cmd_add_product, command_t_e_cmd_add_publisher, command_t_e_cmd_del_publisher, + command_t_e_cmd_init_mapping, command_t_e_cmd_init_price, command_t_e_cmd_set_min_pub, + command_t_e_cmd_upd_price, command_t_e_cmd_upd_price_no_fail_on_error, command_t_e_cmd_agg_price, + command_t_e_cmd_upd_product +}; + +pub fn pre_log( + program_id: &Pubkey, + accounts: &[AccountInfo], + instruction_data: &[u8], +) -> ProgramResult { + msg!("Pyth oracle contract"); + + let instruction_header: cmd_hdr = cmd_hdr::try_from_slice(&instruction_data[..8])?; + let instruction_id: u32 = instruction_header + .cmd_ + .try_into() + .map_err(|_| OracleError::Generic)?; + match instruction_id { + command_t_e_cmd_upd_price_no_fail_on_error => { + let instruction: cmd_upd_price = + cmd_upd_price::try_from_slice(&instruction_data).unwrap(); + msg!( + "Update price no fail on error: price={:}, conf={:}, status={:}", + instruction.price_, + instruction.conf_, + instruction.status_ + ); + } + command_t_e_cmd_upd_price => { + let instruction: cmd_upd_price = + cmd_upd_price::try_from_slice(&instruction_data).unwrap(); + msg!( + "Update price: price={:}, conf={:}, status={:}", + instruction.price_, + instruction.conf_, + instruction.status_ + ); + } + command_t_e_cmd_agg_price => { + let instruction: cmd_upd_price = + cmd_upd_price::try_from_slice(&instruction_data).unwrap(); + msg!( + "Update price: price={:}, conf={:}, status={:}", + instruction.price_, + instruction.conf_, + instruction.status_ + ); + } + command_t_e_cmd_add_mapping => { + msg!("Add mapping"); + } + command_t_e_cmd_add_price => { + msg!("Add price"); + } + command_t_e_cmd_add_product => { + msg!("Add product") + } + command_t_e_cmd_add_publisher => { + msg!("Add publisher") + } + command_t_e_cmd_del_publisher => { + msg!("Delete publisher") + } + command_t_e_cmd_init_price => { + msg!("Initialize price") + } + command_t_e_cmd_init_mapping => { + msg!("Initialize mapping account"); + } + + command_t_e_cmd_set_min_pub =>{ + msg!("Set minimum number of publishers"); + } + command_t_e_cmd_upd_product =>{ + msg!("Update product"); + } + _ => { + msg!("Unrecognized instruction"); + return Err(OracleError::Generic.into()); + } + } + Ok(()) +} \ No newline at end of file From 5f04d3bcf3d0478fc12fac2802a8c06d1297f20d Mon Sep 17 00:00:00 2001 From: Guillermo Bescos Date: Fri, 22 Jul 2022 00:23:51 +0000 Subject: [PATCH 17/27] Prelog and postlog instructions --- program/rust/bindings.rs | 60 +++++++++++++++++++++++++++- program/rust/build.rs | 2 + program/rust/src/bindings.h | 5 ++- program/rust/src/c_oracle_header.rs | 1 + program/rust/src/error.rs | 7 +--- program/rust/src/lib.rs | 20 +++++++--- program/rust/src/log.rs | 62 ++++++++++++++++++----------- 7 files changed, 121 insertions(+), 36 deletions(-) diff --git a/program/rust/bindings.rs b/program/rust/bindings.rs index aa10b0746..358f92bf0 100644 --- a/program/rust/bindings.rs +++ b/program/rust/bindings.rs @@ -54,6 +54,63 @@ pub const PC_ACCTYPE_MAPPING: u32 = 1; pub const PC_ACCTYPE_PRODUCT: u32 = 2; pub const PC_ACCTYPE_PRICE: u32 = 3; pub const PC_ACCTYPE_TEST: u32 = 4; +pub type size_t = ::std::os::raw::c_ulong; +pub type wchar_t = ::std::os::raw::c_int; +#[repr(C)] +#[repr(align(16))] +#[derive(Debug, Copy, Clone)] +pub struct max_align_t { + pub __clang_max_align_nonce1: ::std::os::raw::c_longlong, + pub __bindgen_padding_0: u64, + pub __clang_max_align_nonce2: u128, +} +#[test] +fn bindgen_test_layout_max_align_t() { + assert_eq!( + ::std::mem::size_of::(), + 32usize, + concat!("Size of: ", stringify!(max_align_t)) + ); + assert_eq!( + ::std::mem::align_of::(), + 16usize, + concat!("Alignment of ", stringify!(max_align_t)) + ); + fn test_field___clang_max_align_nonce1() { + assert_eq!( + unsafe { + let uninit = ::std::mem::MaybeUninit::::uninit(); + let ptr = uninit.as_ptr(); + ::std::ptr::addr_of!((*ptr).__clang_max_align_nonce1) as usize - ptr as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(max_align_t), + "::", + stringify!(__clang_max_align_nonce1) + ) + ); + } + test_field___clang_max_align_nonce1(); + fn test_field___clang_max_align_nonce2() { + assert_eq!( + unsafe { + let uninit = ::std::mem::MaybeUninit::::uninit(); + let ptr = uninit.as_ptr(); + ::std::ptr::addr_of!((*ptr).__clang_max_align_nonce2) as usize - ptr as usize + }, + 16usize, + concat!( + "Offset of field: ", + stringify!(max_align_t), + "::", + stringify!(__clang_max_align_nonce2) + ) + ); + } + test_field___clang_max_align_nonce2(); +} pub const SUCCESSFULLY_UPDATED_AGGREGATE: u64 = 1000; pub const TIME_MACHINE_STRUCT_SIZE: u64 = 1864; extern "C" { @@ -528,7 +585,7 @@ fn bindgen_test_layout_pc_prod() { } pub type pc_prod_t = pc_prod; #[repr(C)] -#[derive(Debug, Copy, Clone)] +#[derive(Debug, Copy, Clone, BorshSerialize, BorshDeserialize)] pub struct pc_price_info { pub price_: i64, pub conf_: u64, @@ -2216,3 +2273,4 @@ fn bindgen_test_layout_sysvar_clock() { test_field_unix_timestamp_(); } pub type sysvar_clock_t = sysvar_clock; +pub const PRICE_T_CONF_OFFSET: size_t = 208; diff --git a/program/rust/build.rs b/program/rust/build.rs index 4114e4af4..1989623dc 100644 --- a/program/rust/build.rs +++ b/program/rust/build.rs @@ -11,6 +11,8 @@ fn main() { let mut parser = build_utils::DeriveAdderParserCallback::new(); parser.register_traits("cmd_hdr", borsh_derives.to_vec()); parser.register_traits("pc_acc", borsh_derives.to_vec()); + parser.register_traits("pc_price_info", borsh_derives.to_vec()); + //generate and write bindings diff --git a/program/rust/src/bindings.h b/program/rust/src/bindings.h index 91431edf5..30c0997f5 100644 --- a/program/rust/src/bindings.h +++ b/program/rust/src/bindings.h @@ -11,4 +11,7 @@ typedef unsigned int uint32_t; typedef signed long int int64_t; typedef unsigned long int uint64_t; -#include "../../c/src/oracle/oracle.h" \ No newline at end of file +#include +#include "../../c/src/oracle/oracle.h" + +const size_t PRICE_T_CONF_OFFSET = offsetof(struct pc_price, agg_); \ No newline at end of file diff --git a/program/rust/src/c_oracle_header.rs b/program/rust/src/c_oracle_header.rs index 5432e3e7b..46db9daa0 100644 --- a/program/rust/src/c_oracle_header.rs +++ b/program/rust/src/c_oracle_header.rs @@ -4,6 +4,7 @@ //we do not use all the variables in oracle.h, so this helps with the warnings #![allow(unused_variables)] #![allow(dead_code)] + //All the custom trait imports should go here use borsh::{BorshDeserialize, BorshSerialize}; //bindings.rs is generated by build.rs to include diff --git a/program/rust/src/error.rs b/program/rust/src/error.rs index cfe11defd..8ea7c7fb8 100644 --- a/program/rust/src/error.rs +++ b/program/rust/src/error.rs @@ -1,11 +1,8 @@ //! Error types -use solana_program::{ - program_error::{ProgramError}, -}; +use solana_program::program_error::ProgramError; use thiserror::Error; - /// Errors that may be returned by the oracle program #[derive(Clone, Debug, Eq, Error, PartialEq)] pub enum OracleError { @@ -18,4 +15,4 @@ impl From for ProgramError { fn from(e: OracleError) -> Self { ProgramError::Custom(e as u32) } -} \ No newline at end of file +} diff --git a/program/rust/src/lib.rs b/program/rust/src/lib.rs index df31e2049..79e8d9558 100644 --- a/program/rust/src/lib.rs +++ b/program/rust/src/lib.rs @@ -3,8 +3,8 @@ mod time_machine_types; mod error; mod log; -use crate::log::pre_log; -use solana_program::entrypoint::{deserialize}; +use crate::log::{post_log, pre_log}; +use solana_program::entrypoint::deserialize; //Below is a high lever description of the rust/c setup. @@ -38,19 +38,27 @@ pub extern "C" fn c_entrypoint(input: *mut u8) -> u64 { #[no_mangle] pub extern "C" fn entrypoint(input: *mut u8) -> u64 { + let (_program_id, accounts, instruction_data) = unsafe { deserialize(input) }; - let (_program_id, _accounts, instruction_data) = unsafe { deserialize(input) }; + match pre_log(instruction_data) { + Err(error) => return error.into(), + _ => {} + } - match pre_log(_program_id, &_accounts, instruction_data) { + let c_ret_val = unsafe { c_entrypoint(input) }; + + match post_log(c_ret_val, &accounts) { Err(error) => return error.into(), _ => {} } - let c_ret_val = unsafe{c_entrypoint(input)}; - if c_ret_val == c_oracle_header::SUCCESSFULLY_UPDATED_AGGREGATE{ + if c_ret_val == c_oracle_header::SUCCESSFULLY_UPDATED_AGGREGATE { //0 is the SUCCESS value for solana return 0; } else { return c_ret_val; } } + +solana_program::custom_heap_default!(); +solana_program::custom_panic_default!(); diff --git a/program/rust/src/log.rs b/program/rust/src/log.rs index 701d4e08c..4b0d1e3a0 100644 --- a/program/rust/src/log.rs +++ b/program/rust/src/log.rs @@ -1,21 +1,19 @@ -use solana_program::{account_info::AccountInfo, pubkey::Pubkey}; -use solana_program::msg; -use solana_program::entrypoint::{ ProgramResult}; -use borsh::{BorshDeserialize}; -use crate::error::OracleError; use crate::c_oracle_header::{ cmd_hdr, cmd_upd_price, command_t_e_cmd_add_mapping, command_t_e_cmd_add_price, - command_t_e_cmd_add_product, command_t_e_cmd_add_publisher, command_t_e_cmd_del_publisher, - command_t_e_cmd_init_mapping, command_t_e_cmd_init_price, command_t_e_cmd_set_min_pub, - command_t_e_cmd_upd_price, command_t_e_cmd_upd_price_no_fail_on_error, command_t_e_cmd_agg_price, - command_t_e_cmd_upd_product + command_t_e_cmd_add_product, command_t_e_cmd_add_publisher, command_t_e_cmd_agg_price, + command_t_e_cmd_del_publisher, command_t_e_cmd_init_mapping, command_t_e_cmd_init_price, + command_t_e_cmd_set_min_pub, command_t_e_cmd_upd_price, + command_t_e_cmd_upd_price_no_fail_on_error, command_t_e_cmd_upd_product, pc_price_info, + PRICE_T_CONF_OFFSET, SUCCESSFULLY_UPDATED_AGGREGATE, }; +use crate::error::OracleError; +use borsh::BorshDeserialize; +use solana_program::entrypoint::ProgramResult; +use solana_program::msg; +use solana_program::{account_info::AccountInfo, pubkey::Pubkey}; +use std::mem::size_of; -pub fn pre_log( - program_id: &Pubkey, - accounts: &[AccountInfo], - instruction_data: &[u8], -) -> ProgramResult { +pub fn pre_log(instruction_data: &[u8]) -> ProgramResult { msg!("Pyth oracle contract"); let instruction_header: cmd_hdr = cmd_hdr::try_from_slice(&instruction_data[..8])?; @@ -25,8 +23,7 @@ pub fn pre_log( .map_err(|_| OracleError::Generic)?; match instruction_id { command_t_e_cmd_upd_price_no_fail_on_error => { - let instruction: cmd_upd_price = - cmd_upd_price::try_from_slice(&instruction_data).unwrap(); + let instruction: cmd_upd_price = cmd_upd_price::try_from_slice(&instruction_data)?; msg!( "Update price no fail on error: price={:}, conf={:}, status={:}", instruction.price_, @@ -35,8 +32,7 @@ pub fn pre_log( ); } command_t_e_cmd_upd_price => { - let instruction: cmd_upd_price = - cmd_upd_price::try_from_slice(&instruction_data).unwrap(); + let instruction: cmd_upd_price = cmd_upd_price::try_from_slice(&instruction_data)?; msg!( "Update price: price={:}, conf={:}, status={:}", instruction.price_, @@ -45,8 +41,7 @@ pub fn pre_log( ); } command_t_e_cmd_agg_price => { - let instruction: cmd_upd_price = - cmd_upd_price::try_from_slice(&instruction_data).unwrap(); + let instruction: cmd_upd_price = cmd_upd_price::try_from_slice(&instruction_data)?; msg!( "Update price: price={:}, conf={:}, status={:}", instruction.price_, @@ -76,10 +71,10 @@ pub fn pre_log( msg!("Initialize mapping account"); } - command_t_e_cmd_set_min_pub =>{ + command_t_e_cmd_set_min_pub => { msg!("Set minimum number of publishers"); } - command_t_e_cmd_upd_product =>{ + command_t_e_cmd_upd_product => { msg!("Update product"); } _ => { @@ -88,4 +83,25 @@ pub fn pre_log( } } Ok(()) -} \ No newline at end of file +} + +pub fn post_log(c_ret_val: u64, accounts: &[AccountInfo]) -> ProgramResult { + if c_ret_val == SUCCESSFULLY_UPDATED_AGGREGATE { + let start: usize = PRICE_T_CONF_OFFSET + .try_into() + .map_err(|_| OracleError::Generic)?; + let price_struct: pc_price_info = pc_price_info::try_from_slice( + &accounts + .get(1) + .ok_or(OracleError::Generic)? + .try_borrow_data()?[start..(start + size_of::())], + )?; + msg!( + "Aggregate updated : price={:}, conf={:}, status={:}", + price_struct.price_, + price_struct.conf_, + price_struct.status_ + ); + } + Ok(()) +} From 940af7911806891411a42f76b28d3f908b06a0a5 Mon Sep 17 00:00:00 2001 From: Guillermo Bescos Date: Fri, 22 Jul 2022 17:35:17 +0000 Subject: [PATCH 18/27] Fix CI --- program/rust/bindings.rs | 2276 -------------------------------------- program/rust/build.rs | 1 + 2 files changed, 1 insertion(+), 2276 deletions(-) delete mode 100644 program/rust/bindings.rs diff --git a/program/rust/bindings.rs b/program/rust/bindings.rs deleted file mode 100644 index 358f92bf0..000000000 --- a/program/rust/bindings.rs +++ /dev/null @@ -1,2276 +0,0 @@ -/* automatically generated by rust-bindgen 0.60.1 */ - -#[repr(C)] -#[derive(Default)] -pub struct __IncompleteArrayField(::std::marker::PhantomData, [T; 0]); -impl __IncompleteArrayField { - #[inline] - pub const fn new() -> Self { - __IncompleteArrayField(::std::marker::PhantomData, []) - } - #[inline] - pub fn as_ptr(&self) -> *const T { - self as *const _ as *const T - } - #[inline] - pub fn as_mut_ptr(&mut self) -> *mut T { - self as *mut _ as *mut T - } - #[inline] - pub unsafe fn as_slice(&self, len: usize) -> &[T] { - ::std::slice::from_raw_parts(self.as_ptr(), len) - } - #[inline] - pub unsafe fn as_mut_slice(&mut self, len: usize) -> &mut [T] { - ::std::slice::from_raw_parts_mut(self.as_mut_ptr(), len) - } -} -impl ::std::fmt::Debug for __IncompleteArrayField { - fn fmt(&self, fmt: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - fmt.write_str("__IncompleteArrayField") - } -} -pub const true_: u32 = 1; -pub const false_: u32 = 0; -pub const __bool_true_false_are_defined: u32 = 1; -pub const PC_MAGIC: u32 = 2712847316; -pub const PC_VERSION: u32 = 2; -pub const PC_MAX_SEND_LATENCY: u32 = 25; -pub const PC_PUBKEY_SIZE: u32 = 32; -pub const PC_MAP_TABLE_SIZE: u32 = 640; -pub const PC_COMP_SIZE: u32 = 32; -pub const PC_MAX_NUM_DECIMALS: u32 = 8; -pub const PC_PROD_ACC_SIZE: u32 = 512; -pub const PC_EXP_DECAY: i32 = -9; -pub const PC_MAX_CI_DIVISOR: u32 = 20; -pub const PC_HEAP_START: u64 = 12884901888; -pub const PC_PTYPE_UNKNOWN: u32 = 0; -pub const PC_PTYPE_PRICE: u32 = 1; -pub const PC_STATUS_UNKNOWN: u32 = 0; -pub const PC_STATUS_TRADING: u32 = 1; -pub const PC_STATUS_HALTED: u32 = 2; -pub const PC_STATUS_AUCTION: u32 = 3; -pub const PC_ACCTYPE_MAPPING: u32 = 1; -pub const PC_ACCTYPE_PRODUCT: u32 = 2; -pub const PC_ACCTYPE_PRICE: u32 = 3; -pub const PC_ACCTYPE_TEST: u32 = 4; -pub type size_t = ::std::os::raw::c_ulong; -pub type wchar_t = ::std::os::raw::c_int; -#[repr(C)] -#[repr(align(16))] -#[derive(Debug, Copy, Clone)] -pub struct max_align_t { - pub __clang_max_align_nonce1: ::std::os::raw::c_longlong, - pub __bindgen_padding_0: u64, - pub __clang_max_align_nonce2: u128, -} -#[test] -fn bindgen_test_layout_max_align_t() { - assert_eq!( - ::std::mem::size_of::(), - 32usize, - concat!("Size of: ", stringify!(max_align_t)) - ); - assert_eq!( - ::std::mem::align_of::(), - 16usize, - concat!("Alignment of ", stringify!(max_align_t)) - ); - fn test_field___clang_max_align_nonce1() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).__clang_max_align_nonce1) as usize - ptr as usize - }, - 0usize, - concat!( - "Offset of field: ", - stringify!(max_align_t), - "::", - stringify!(__clang_max_align_nonce1) - ) - ); - } - test_field___clang_max_align_nonce1(); - fn test_field___clang_max_align_nonce2() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).__clang_max_align_nonce2) as usize - ptr as usize - }, - 16usize, - concat!( - "Offset of field: ", - stringify!(max_align_t), - "::", - stringify!(__clang_max_align_nonce2) - ) - ); - } - test_field___clang_max_align_nonce2(); -} -pub const SUCCESSFULLY_UPDATED_AGGREGATE: u64 = 1000; -pub const TIME_MACHINE_STRUCT_SIZE: u64 = 1864; -extern "C" { - pub static sysvar_clock: [u64; 4usize]; -} -#[repr(C)] -#[derive(Copy, Clone)] -pub union pc_pub_key { - pub k1_: [u8; 32usize], - pub k8_: [u64; 4usize], -} -#[test] -fn bindgen_test_layout_pc_pub_key() { - assert_eq!( - ::std::mem::size_of::(), - 32usize, - concat!("Size of: ", stringify!(pc_pub_key)) - ); - assert_eq!( - ::std::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(pc_pub_key)) - ); - fn test_field_k1_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).k1_) as usize - ptr as usize - }, - 0usize, - concat!( - "Offset of field: ", - stringify!(pc_pub_key), - "::", - stringify!(k1_) - ) - ); - } - test_field_k1_(); - fn test_field_k8_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).k8_) as usize - ptr as usize - }, - 0usize, - concat!( - "Offset of field: ", - stringify!(pc_pub_key), - "::", - stringify!(k8_) - ) - ); - } - test_field_k8_(); -} -pub type pc_pub_key_t = pc_pub_key; -#[repr(C)] -#[derive(Debug, Copy, Clone, BorshSerialize, BorshDeserialize)] -pub struct pc_acc { - pub magic_: u32, - pub ver_: u32, - pub type_: u32, - pub size_: u32, -} -#[test] -fn bindgen_test_layout_pc_acc() { - assert_eq!( - ::std::mem::size_of::(), - 16usize, - concat!("Size of: ", stringify!(pc_acc)) - ); - assert_eq!( - ::std::mem::align_of::(), - 4usize, - concat!("Alignment of ", stringify!(pc_acc)) - ); - fn test_field_magic_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).magic_) as usize - ptr as usize - }, - 0usize, - concat!( - "Offset of field: ", - stringify!(pc_acc), - "::", - stringify!(magic_) - ) - ); - } - test_field_magic_(); - fn test_field_ver_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).ver_) as usize - ptr as usize - }, - 4usize, - concat!( - "Offset of field: ", - stringify!(pc_acc), - "::", - stringify!(ver_) - ) - ); - } - test_field_ver_(); - fn test_field_type_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).type_) as usize - ptr as usize - }, - 8usize, - concat!( - "Offset of field: ", - stringify!(pc_acc), - "::", - stringify!(type_) - ) - ); - } - test_field_type_(); - fn test_field_size_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).size_) as usize - ptr as usize - }, - 12usize, - concat!( - "Offset of field: ", - stringify!(pc_acc), - "::", - stringify!(size_) - ) - ); - } - test_field_size_(); -} -pub type pc_acc_t = pc_acc; -#[repr(C)] -#[derive(Copy, Clone)] -pub struct pc_map_table { - pub magic_: u32, - pub ver_: u32, - pub type_: u32, - pub size_: u32, - pub num_: u32, - pub unused_: u32, - pub next_: pc_pub_key_t, - pub prod_: [pc_pub_key_t; 640usize], -} -#[test] -fn bindgen_test_layout_pc_map_table() { - assert_eq!( - ::std::mem::size_of::(), - 20536usize, - concat!("Size of: ", stringify!(pc_map_table)) - ); - assert_eq!( - ::std::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(pc_map_table)) - ); - fn test_field_magic_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).magic_) as usize - ptr as usize - }, - 0usize, - concat!( - "Offset of field: ", - stringify!(pc_map_table), - "::", - stringify!(magic_) - ) - ); - } - test_field_magic_(); - fn test_field_ver_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).ver_) as usize - ptr as usize - }, - 4usize, - concat!( - "Offset of field: ", - stringify!(pc_map_table), - "::", - stringify!(ver_) - ) - ); - } - test_field_ver_(); - fn test_field_type_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).type_) as usize - ptr as usize - }, - 8usize, - concat!( - "Offset of field: ", - stringify!(pc_map_table), - "::", - stringify!(type_) - ) - ); - } - test_field_type_(); - fn test_field_size_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).size_) as usize - ptr as usize - }, - 12usize, - concat!( - "Offset of field: ", - stringify!(pc_map_table), - "::", - stringify!(size_) - ) - ); - } - test_field_size_(); - fn test_field_num_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).num_) as usize - ptr as usize - }, - 16usize, - concat!( - "Offset of field: ", - stringify!(pc_map_table), - "::", - stringify!(num_) - ) - ); - } - test_field_num_(); - fn test_field_unused_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).unused_) as usize - ptr as usize - }, - 20usize, - concat!( - "Offset of field: ", - stringify!(pc_map_table), - "::", - stringify!(unused_) - ) - ); - } - test_field_unused_(); - fn test_field_next_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).next_) as usize - ptr as usize - }, - 24usize, - concat!( - "Offset of field: ", - stringify!(pc_map_table), - "::", - stringify!(next_) - ) - ); - } - test_field_next_(); - fn test_field_prod_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).prod_) as usize - ptr as usize - }, - 56usize, - concat!( - "Offset of field: ", - stringify!(pc_map_table), - "::", - stringify!(prod_) - ) - ); - } - test_field_prod_(); -} -pub type pc_map_table_t = pc_map_table; -#[repr(C)] -#[derive(Debug)] -pub struct pc_str { - pub len_: u8, - pub data_: __IncompleteArrayField<::std::os::raw::c_char>, -} -#[test] -fn bindgen_test_layout_pc_str() { - assert_eq!( - ::std::mem::size_of::(), - 1usize, - concat!("Size of: ", stringify!(pc_str)) - ); - assert_eq!( - ::std::mem::align_of::(), - 1usize, - concat!("Alignment of ", stringify!(pc_str)) - ); - fn test_field_len_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).len_) as usize - ptr as usize - }, - 0usize, - concat!( - "Offset of field: ", - stringify!(pc_str), - "::", - stringify!(len_) - ) - ); - } - test_field_len_(); - fn test_field_data_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).data_) as usize - ptr as usize - }, - 1usize, - concat!( - "Offset of field: ", - stringify!(pc_str), - "::", - stringify!(data_) - ) - ); - } - test_field_data_(); -} -pub type pc_str_t = pc_str; -#[repr(C)] -#[derive(Copy, Clone)] -pub struct pc_prod { - pub magic_: u32, - pub ver_: u32, - pub type_: u32, - pub size_: u32, - pub px_acc_: pc_pub_key_t, -} -#[test] -fn bindgen_test_layout_pc_prod() { - assert_eq!( - ::std::mem::size_of::(), - 48usize, - concat!("Size of: ", stringify!(pc_prod)) - ); - assert_eq!( - ::std::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(pc_prod)) - ); - fn test_field_magic_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).magic_) as usize - ptr as usize - }, - 0usize, - concat!( - "Offset of field: ", - stringify!(pc_prod), - "::", - stringify!(magic_) - ) - ); - } - test_field_magic_(); - fn test_field_ver_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).ver_) as usize - ptr as usize - }, - 4usize, - concat!( - "Offset of field: ", - stringify!(pc_prod), - "::", - stringify!(ver_) - ) - ); - } - test_field_ver_(); - fn test_field_type_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).type_) as usize - ptr as usize - }, - 8usize, - concat!( - "Offset of field: ", - stringify!(pc_prod), - "::", - stringify!(type_) - ) - ); - } - test_field_type_(); - fn test_field_size_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).size_) as usize - ptr as usize - }, - 12usize, - concat!( - "Offset of field: ", - stringify!(pc_prod), - "::", - stringify!(size_) - ) - ); - } - test_field_size_(); - fn test_field_px_acc_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).px_acc_) as usize - ptr as usize - }, - 16usize, - concat!( - "Offset of field: ", - stringify!(pc_prod), - "::", - stringify!(px_acc_) - ) - ); - } - test_field_px_acc_(); -} -pub type pc_prod_t = pc_prod; -#[repr(C)] -#[derive(Debug, Copy, Clone, BorshSerialize, BorshDeserialize)] -pub struct pc_price_info { - pub price_: i64, - pub conf_: u64, - pub status_: u32, - pub corp_act_status_: u32, - pub pub_slot_: u64, -} -#[test] -fn bindgen_test_layout_pc_price_info() { - assert_eq!( - ::std::mem::size_of::(), - 32usize, - concat!("Size of: ", stringify!(pc_price_info)) - ); - assert_eq!( - ::std::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(pc_price_info)) - ); - fn test_field_price_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).price_) as usize - ptr as usize - }, - 0usize, - concat!( - "Offset of field: ", - stringify!(pc_price_info), - "::", - stringify!(price_) - ) - ); - } - test_field_price_(); - fn test_field_conf_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).conf_) as usize - ptr as usize - }, - 8usize, - concat!( - "Offset of field: ", - stringify!(pc_price_info), - "::", - stringify!(conf_) - ) - ); - } - test_field_conf_(); - fn test_field_status_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).status_) as usize - ptr as usize - }, - 16usize, - concat!( - "Offset of field: ", - stringify!(pc_price_info), - "::", - stringify!(status_) - ) - ); - } - test_field_status_(); - fn test_field_corp_act_status_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).corp_act_status_) as usize - ptr as usize - }, - 20usize, - concat!( - "Offset of field: ", - stringify!(pc_price_info), - "::", - stringify!(corp_act_status_) - ) - ); - } - test_field_corp_act_status_(); - fn test_field_pub_slot_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).pub_slot_) as usize - ptr as usize - }, - 24usize, - concat!( - "Offset of field: ", - stringify!(pc_price_info), - "::", - stringify!(pub_slot_) - ) - ); - } - test_field_pub_slot_(); -} -pub type pc_price_info_t = pc_price_info; -#[repr(C)] -#[derive(Copy, Clone)] -pub struct pc_price_comp { - pub pub_: pc_pub_key_t, - pub agg_: pc_price_info_t, - pub latest_: pc_price_info_t, -} -#[test] -fn bindgen_test_layout_pc_price_comp() { - assert_eq!( - ::std::mem::size_of::(), - 96usize, - concat!("Size of: ", stringify!(pc_price_comp)) - ); - assert_eq!( - ::std::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(pc_price_comp)) - ); - fn test_field_pub_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).pub_) as usize - ptr as usize - }, - 0usize, - concat!( - "Offset of field: ", - stringify!(pc_price_comp), - "::", - stringify!(pub_) - ) - ); - } - test_field_pub_(); - fn test_field_agg_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).agg_) as usize - ptr as usize - }, - 32usize, - concat!( - "Offset of field: ", - stringify!(pc_price_comp), - "::", - stringify!(agg_) - ) - ); - } - test_field_agg_(); - fn test_field_latest_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).latest_) as usize - ptr as usize - }, - 64usize, - concat!( - "Offset of field: ", - stringify!(pc_price_comp), - "::", - stringify!(latest_) - ) - ); - } - test_field_latest_(); -} -pub type pc_price_comp_t = pc_price_comp; -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct pc_ema { - pub val_: i64, - pub numer_: i64, - pub denom_: i64, -} -#[test] -fn bindgen_test_layout_pc_ema() { - assert_eq!( - ::std::mem::size_of::(), - 24usize, - concat!("Size of: ", stringify!(pc_ema)) - ); - assert_eq!( - ::std::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(pc_ema)) - ); - fn test_field_val_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).val_) as usize - ptr as usize - }, - 0usize, - concat!( - "Offset of field: ", - stringify!(pc_ema), - "::", - stringify!(val_) - ) - ); - } - test_field_val_(); - fn test_field_numer_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).numer_) as usize - ptr as usize - }, - 8usize, - concat!( - "Offset of field: ", - stringify!(pc_ema), - "::", - stringify!(numer_) - ) - ); - } - test_field_numer_(); - fn test_field_denom_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).denom_) as usize - ptr as usize - }, - 16usize, - concat!( - "Offset of field: ", - stringify!(pc_ema), - "::", - stringify!(denom_) - ) - ); - } - test_field_denom_(); -} -pub type pc_ema_t = pc_ema; -#[repr(C)] -#[derive(Copy, Clone)] -pub struct pc_price { - pub magic_: u32, - pub ver_: u32, - pub type_: u32, - pub size_: u32, - pub ptype_: u32, - pub expo_: i32, - pub num_: u32, - pub num_qt_: u32, - pub last_slot_: u64, - pub valid_slot_: u64, - pub twap_: pc_ema_t, - pub twac_: pc_ema_t, - pub timestamp_: i64, - pub min_pub_: u8, - pub drv2_: i8, - pub drv3_: i16, - pub drv4_: i32, - pub prod_: pc_pub_key_t, - pub next_: pc_pub_key_t, - pub prev_slot_: u64, - pub prev_price_: i64, - pub prev_conf_: u64, - pub prev_timestamp_: i64, - pub agg_: pc_price_info_t, - pub comp_: [pc_price_comp_t; 32usize], -} -#[test] -fn bindgen_test_layout_pc_price() { - assert_eq!( - ::std::mem::size_of::(), - 3312usize, - concat!("Size of: ", stringify!(pc_price)) - ); - assert_eq!( - ::std::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(pc_price)) - ); - fn test_field_magic_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).magic_) as usize - ptr as usize - }, - 0usize, - concat!( - "Offset of field: ", - stringify!(pc_price), - "::", - stringify!(magic_) - ) - ); - } - test_field_magic_(); - fn test_field_ver_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).ver_) as usize - ptr as usize - }, - 4usize, - concat!( - "Offset of field: ", - stringify!(pc_price), - "::", - stringify!(ver_) - ) - ); - } - test_field_ver_(); - fn test_field_type_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).type_) as usize - ptr as usize - }, - 8usize, - concat!( - "Offset of field: ", - stringify!(pc_price), - "::", - stringify!(type_) - ) - ); - } - test_field_type_(); - fn test_field_size_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).size_) as usize - ptr as usize - }, - 12usize, - concat!( - "Offset of field: ", - stringify!(pc_price), - "::", - stringify!(size_) - ) - ); - } - test_field_size_(); - fn test_field_ptype_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).ptype_) as usize - ptr as usize - }, - 16usize, - concat!( - "Offset of field: ", - stringify!(pc_price), - "::", - stringify!(ptype_) - ) - ); - } - test_field_ptype_(); - fn test_field_expo_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).expo_) as usize - ptr as usize - }, - 20usize, - concat!( - "Offset of field: ", - stringify!(pc_price), - "::", - stringify!(expo_) - ) - ); - } - test_field_expo_(); - fn test_field_num_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).num_) as usize - ptr as usize - }, - 24usize, - concat!( - "Offset of field: ", - stringify!(pc_price), - "::", - stringify!(num_) - ) - ); - } - test_field_num_(); - fn test_field_num_qt_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).num_qt_) as usize - ptr as usize - }, - 28usize, - concat!( - "Offset of field: ", - stringify!(pc_price), - "::", - stringify!(num_qt_) - ) - ); - } - test_field_num_qt_(); - fn test_field_last_slot_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).last_slot_) as usize - ptr as usize - }, - 32usize, - concat!( - "Offset of field: ", - stringify!(pc_price), - "::", - stringify!(last_slot_) - ) - ); - } - test_field_last_slot_(); - fn test_field_valid_slot_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).valid_slot_) as usize - ptr as usize - }, - 40usize, - concat!( - "Offset of field: ", - stringify!(pc_price), - "::", - stringify!(valid_slot_) - ) - ); - } - test_field_valid_slot_(); - fn test_field_twap_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).twap_) as usize - ptr as usize - }, - 48usize, - concat!( - "Offset of field: ", - stringify!(pc_price), - "::", - stringify!(twap_) - ) - ); - } - test_field_twap_(); - fn test_field_twac_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).twac_) as usize - ptr as usize - }, - 72usize, - concat!( - "Offset of field: ", - stringify!(pc_price), - "::", - stringify!(twac_) - ) - ); - } - test_field_twac_(); - fn test_field_timestamp_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).timestamp_) as usize - ptr as usize - }, - 96usize, - concat!( - "Offset of field: ", - stringify!(pc_price), - "::", - stringify!(timestamp_) - ) - ); - } - test_field_timestamp_(); - fn test_field_min_pub_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).min_pub_) as usize - ptr as usize - }, - 104usize, - concat!( - "Offset of field: ", - stringify!(pc_price), - "::", - stringify!(min_pub_) - ) - ); - } - test_field_min_pub_(); - fn test_field_drv2_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).drv2_) as usize - ptr as usize - }, - 105usize, - concat!( - "Offset of field: ", - stringify!(pc_price), - "::", - stringify!(drv2_) - ) - ); - } - test_field_drv2_(); - fn test_field_drv3_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).drv3_) as usize - ptr as usize - }, - 106usize, - concat!( - "Offset of field: ", - stringify!(pc_price), - "::", - stringify!(drv3_) - ) - ); - } - test_field_drv3_(); - fn test_field_drv4_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).drv4_) as usize - ptr as usize - }, - 108usize, - concat!( - "Offset of field: ", - stringify!(pc_price), - "::", - stringify!(drv4_) - ) - ); - } - test_field_drv4_(); - fn test_field_prod_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).prod_) as usize - ptr as usize - }, - 112usize, - concat!( - "Offset of field: ", - stringify!(pc_price), - "::", - stringify!(prod_) - ) - ); - } - test_field_prod_(); - fn test_field_next_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).next_) as usize - ptr as usize - }, - 144usize, - concat!( - "Offset of field: ", - stringify!(pc_price), - "::", - stringify!(next_) - ) - ); - } - test_field_next_(); - fn test_field_prev_slot_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).prev_slot_) as usize - ptr as usize - }, - 176usize, - concat!( - "Offset of field: ", - stringify!(pc_price), - "::", - stringify!(prev_slot_) - ) - ); - } - test_field_prev_slot_(); - fn test_field_prev_price_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).prev_price_) as usize - ptr as usize - }, - 184usize, - concat!( - "Offset of field: ", - stringify!(pc_price), - "::", - stringify!(prev_price_) - ) - ); - } - test_field_prev_price_(); - fn test_field_prev_conf_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).prev_conf_) as usize - ptr as usize - }, - 192usize, - concat!( - "Offset of field: ", - stringify!(pc_price), - "::", - stringify!(prev_conf_) - ) - ); - } - test_field_prev_conf_(); - fn test_field_prev_timestamp_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).prev_timestamp_) as usize - ptr as usize - }, - 200usize, - concat!( - "Offset of field: ", - stringify!(pc_price), - "::", - stringify!(prev_timestamp_) - ) - ); - } - test_field_prev_timestamp_(); - fn test_field_agg_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).agg_) as usize - ptr as usize - }, - 208usize, - concat!( - "Offset of field: ", - stringify!(pc_price), - "::", - stringify!(agg_) - ) - ); - } - test_field_agg_(); - fn test_field_comp_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).comp_) as usize - ptr as usize - }, - 240usize, - concat!( - "Offset of field: ", - stringify!(pc_price), - "::", - stringify!(comp_) - ) - ); - } - test_field_comp_(); -} -pub type pc_price_t = pc_price; -pub const command_t_e_cmd_init_mapping: command_t = 0; -pub const command_t_e_cmd_add_mapping: command_t = 1; -pub const command_t_e_cmd_add_product: command_t = 2; -pub const command_t_e_cmd_upd_product: command_t = 3; -pub const command_t_e_cmd_add_price: command_t = 4; -pub const command_t_e_cmd_add_publisher: command_t = 5; -pub const command_t_e_cmd_del_publisher: command_t = 6; -pub const command_t_e_cmd_upd_price: command_t = 7; -pub const command_t_e_cmd_agg_price: command_t = 8; -pub const command_t_e_cmd_init_price: command_t = 9; -pub const command_t_e_cmd_init_test: command_t = 10; -pub const command_t_e_cmd_upd_test: command_t = 11; -pub const command_t_e_cmd_set_min_pub: command_t = 12; -pub const command_t_e_cmd_upd_price_no_fail_on_error: command_t = 13; -pub type command_t = ::std::os::raw::c_uint; -#[repr(C)] -#[derive(Debug, Copy, Clone, BorshSerialize, BorshDeserialize)] -pub struct cmd_hdr { - pub ver_: u32, - pub cmd_: i32, -} -#[test] -fn bindgen_test_layout_cmd_hdr() { - assert_eq!( - ::std::mem::size_of::(), - 8usize, - concat!("Size of: ", stringify!(cmd_hdr)) - ); - assert_eq!( - ::std::mem::align_of::(), - 4usize, - concat!("Alignment of ", stringify!(cmd_hdr)) - ); - fn test_field_ver_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).ver_) as usize - ptr as usize - }, - 0usize, - concat!( - "Offset of field: ", - stringify!(cmd_hdr), - "::", - stringify!(ver_) - ) - ); - } - test_field_ver_(); - fn test_field_cmd_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).cmd_) as usize - ptr as usize - }, - 4usize, - concat!( - "Offset of field: ", - stringify!(cmd_hdr), - "::", - stringify!(cmd_) - ) - ); - } - test_field_cmd_(); -} -pub type cmd_hdr_t = cmd_hdr; -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct cmd_add_product { - pub ver_: u32, - pub cmd_: i32, -} -#[test] -fn bindgen_test_layout_cmd_add_product() { - assert_eq!( - ::std::mem::size_of::(), - 8usize, - concat!("Size of: ", stringify!(cmd_add_product)) - ); - assert_eq!( - ::std::mem::align_of::(), - 4usize, - concat!("Alignment of ", stringify!(cmd_add_product)) - ); - fn test_field_ver_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).ver_) as usize - ptr as usize - }, - 0usize, - concat!( - "Offset of field: ", - stringify!(cmd_add_product), - "::", - stringify!(ver_) - ) - ); - } - test_field_ver_(); - fn test_field_cmd_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).cmd_) as usize - ptr as usize - }, - 4usize, - concat!( - "Offset of field: ", - stringify!(cmd_add_product), - "::", - stringify!(cmd_) - ) - ); - } - test_field_cmd_(); -} -pub type cmd_add_product_t = cmd_add_product; -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct cmd_upd_product { - pub ver_: u32, - pub cmd_: i32, -} -#[test] -fn bindgen_test_layout_cmd_upd_product() { - assert_eq!( - ::std::mem::size_of::(), - 8usize, - concat!("Size of: ", stringify!(cmd_upd_product)) - ); - assert_eq!( - ::std::mem::align_of::(), - 4usize, - concat!("Alignment of ", stringify!(cmd_upd_product)) - ); - fn test_field_ver_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).ver_) as usize - ptr as usize - }, - 0usize, - concat!( - "Offset of field: ", - stringify!(cmd_upd_product), - "::", - stringify!(ver_) - ) - ); - } - test_field_ver_(); - fn test_field_cmd_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).cmd_) as usize - ptr as usize - }, - 4usize, - concat!( - "Offset of field: ", - stringify!(cmd_upd_product), - "::", - stringify!(cmd_) - ) - ); - } - test_field_cmd_(); -} -pub type cmd_upd_product_t = cmd_upd_product; -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct cmd_add_price { - pub ver_: u32, - pub cmd_: i32, - pub expo_: i32, - pub ptype_: u32, -} -#[test] -fn bindgen_test_layout_cmd_add_price() { - assert_eq!( - ::std::mem::size_of::(), - 16usize, - concat!("Size of: ", stringify!(cmd_add_price)) - ); - assert_eq!( - ::std::mem::align_of::(), - 4usize, - concat!("Alignment of ", stringify!(cmd_add_price)) - ); - fn test_field_ver_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).ver_) as usize - ptr as usize - }, - 0usize, - concat!( - "Offset of field: ", - stringify!(cmd_add_price), - "::", - stringify!(ver_) - ) - ); - } - test_field_ver_(); - fn test_field_cmd_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).cmd_) as usize - ptr as usize - }, - 4usize, - concat!( - "Offset of field: ", - stringify!(cmd_add_price), - "::", - stringify!(cmd_) - ) - ); - } - test_field_cmd_(); - fn test_field_expo_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).expo_) as usize - ptr as usize - }, - 8usize, - concat!( - "Offset of field: ", - stringify!(cmd_add_price), - "::", - stringify!(expo_) - ) - ); - } - test_field_expo_(); - fn test_field_ptype_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).ptype_) as usize - ptr as usize - }, - 12usize, - concat!( - "Offset of field: ", - stringify!(cmd_add_price), - "::", - stringify!(ptype_) - ) - ); - } - test_field_ptype_(); -} -pub type cmd_add_price_t = cmd_add_price; -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct cmd_init_price { - pub ver_: u32, - pub cmd_: i32, - pub expo_: i32, - pub ptype_: u32, -} -#[test] -fn bindgen_test_layout_cmd_init_price() { - assert_eq!( - ::std::mem::size_of::(), - 16usize, - concat!("Size of: ", stringify!(cmd_init_price)) - ); - assert_eq!( - ::std::mem::align_of::(), - 4usize, - concat!("Alignment of ", stringify!(cmd_init_price)) - ); - fn test_field_ver_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).ver_) as usize - ptr as usize - }, - 0usize, - concat!( - "Offset of field: ", - stringify!(cmd_init_price), - "::", - stringify!(ver_) - ) - ); - } - test_field_ver_(); - fn test_field_cmd_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).cmd_) as usize - ptr as usize - }, - 4usize, - concat!( - "Offset of field: ", - stringify!(cmd_init_price), - "::", - stringify!(cmd_) - ) - ); - } - test_field_cmd_(); - fn test_field_expo_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).expo_) as usize - ptr as usize - }, - 8usize, - concat!( - "Offset of field: ", - stringify!(cmd_init_price), - "::", - stringify!(expo_) - ) - ); - } - test_field_expo_(); - fn test_field_ptype_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).ptype_) as usize - ptr as usize - }, - 12usize, - concat!( - "Offset of field: ", - stringify!(cmd_init_price), - "::", - stringify!(ptype_) - ) - ); - } - test_field_ptype_(); -} -pub type cmd_init_price_t = cmd_init_price; -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct cmd_set_min_pub { - pub ver_: u32, - pub cmd_: i32, - pub min_pub_: u8, -} -#[test] -fn bindgen_test_layout_cmd_set_min_pub() { - assert_eq!( - ::std::mem::size_of::(), - 12usize, - concat!("Size of: ", stringify!(cmd_set_min_pub)) - ); - assert_eq!( - ::std::mem::align_of::(), - 4usize, - concat!("Alignment of ", stringify!(cmd_set_min_pub)) - ); - fn test_field_ver_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).ver_) as usize - ptr as usize - }, - 0usize, - concat!( - "Offset of field: ", - stringify!(cmd_set_min_pub), - "::", - stringify!(ver_) - ) - ); - } - test_field_ver_(); - fn test_field_cmd_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).cmd_) as usize - ptr as usize - }, - 4usize, - concat!( - "Offset of field: ", - stringify!(cmd_set_min_pub), - "::", - stringify!(cmd_) - ) - ); - } - test_field_cmd_(); - fn test_field_min_pub_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).min_pub_) as usize - ptr as usize - }, - 8usize, - concat!( - "Offset of field: ", - stringify!(cmd_set_min_pub), - "::", - stringify!(min_pub_) - ) - ); - } - test_field_min_pub_(); -} -pub type cmd_set_min_pub_t = cmd_set_min_pub; -#[repr(C)] -#[derive(Copy, Clone)] -pub struct cmd_add_publisher { - pub ver_: u32, - pub cmd_: i32, - pub pub_: pc_pub_key_t, -} -#[test] -fn bindgen_test_layout_cmd_add_publisher() { - assert_eq!( - ::std::mem::size_of::(), - 40usize, - concat!("Size of: ", stringify!(cmd_add_publisher)) - ); - assert_eq!( - ::std::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(cmd_add_publisher)) - ); - fn test_field_ver_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).ver_) as usize - ptr as usize - }, - 0usize, - concat!( - "Offset of field: ", - stringify!(cmd_add_publisher), - "::", - stringify!(ver_) - ) - ); - } - test_field_ver_(); - fn test_field_cmd_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).cmd_) as usize - ptr as usize - }, - 4usize, - concat!( - "Offset of field: ", - stringify!(cmd_add_publisher), - "::", - stringify!(cmd_) - ) - ); - } - test_field_cmd_(); - fn test_field_pub_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).pub_) as usize - ptr as usize - }, - 8usize, - concat!( - "Offset of field: ", - stringify!(cmd_add_publisher), - "::", - stringify!(pub_) - ) - ); - } - test_field_pub_(); -} -pub type cmd_add_publisher_t = cmd_add_publisher; -#[repr(C)] -#[derive(Copy, Clone)] -pub struct cmd_del_publisher { - pub ver_: u32, - pub cmd_: i32, - pub pub_: pc_pub_key_t, -} -#[test] -fn bindgen_test_layout_cmd_del_publisher() { - assert_eq!( - ::std::mem::size_of::(), - 40usize, - concat!("Size of: ", stringify!(cmd_del_publisher)) - ); - assert_eq!( - ::std::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(cmd_del_publisher)) - ); - fn test_field_ver_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).ver_) as usize - ptr as usize - }, - 0usize, - concat!( - "Offset of field: ", - stringify!(cmd_del_publisher), - "::", - stringify!(ver_) - ) - ); - } - test_field_ver_(); - fn test_field_cmd_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).cmd_) as usize - ptr as usize - }, - 4usize, - concat!( - "Offset of field: ", - stringify!(cmd_del_publisher), - "::", - stringify!(cmd_) - ) - ); - } - test_field_cmd_(); - fn test_field_pub_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).pub_) as usize - ptr as usize - }, - 8usize, - concat!( - "Offset of field: ", - stringify!(cmd_del_publisher), - "::", - stringify!(pub_) - ) - ); - } - test_field_pub_(); -} -pub type cmd_del_publisher_t = cmd_del_publisher; -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct cmd_upd_price { - pub ver_: u32, - pub cmd_: i32, - pub status_: u32, - pub unused_: u32, - pub price_: i64, - pub conf_: u64, - pub pub_slot_: u64, -} -#[test] -fn bindgen_test_layout_cmd_upd_price() { - assert_eq!( - ::std::mem::size_of::(), - 40usize, - concat!("Size of: ", stringify!(cmd_upd_price)) - ); - assert_eq!( - ::std::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(cmd_upd_price)) - ); - fn test_field_ver_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).ver_) as usize - ptr as usize - }, - 0usize, - concat!( - "Offset of field: ", - stringify!(cmd_upd_price), - "::", - stringify!(ver_) - ) - ); - } - test_field_ver_(); - fn test_field_cmd_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).cmd_) as usize - ptr as usize - }, - 4usize, - concat!( - "Offset of field: ", - stringify!(cmd_upd_price), - "::", - stringify!(cmd_) - ) - ); - } - test_field_cmd_(); - fn test_field_status_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).status_) as usize - ptr as usize - }, - 8usize, - concat!( - "Offset of field: ", - stringify!(cmd_upd_price), - "::", - stringify!(status_) - ) - ); - } - test_field_status_(); - fn test_field_unused_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).unused_) as usize - ptr as usize - }, - 12usize, - concat!( - "Offset of field: ", - stringify!(cmd_upd_price), - "::", - stringify!(unused_) - ) - ); - } - test_field_unused_(); - fn test_field_price_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).price_) as usize - ptr as usize - }, - 16usize, - concat!( - "Offset of field: ", - stringify!(cmd_upd_price), - "::", - stringify!(price_) - ) - ); - } - test_field_price_(); - fn test_field_conf_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).conf_) as usize - ptr as usize - }, - 24usize, - concat!( - "Offset of field: ", - stringify!(cmd_upd_price), - "::", - stringify!(conf_) - ) - ); - } - test_field_conf_(); - fn test_field_pub_slot_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).pub_slot_) as usize - ptr as usize - }, - 32usize, - concat!( - "Offset of field: ", - stringify!(cmd_upd_price), - "::", - stringify!(pub_slot_) - ) - ); - } - test_field_pub_slot_(); -} -pub type cmd_upd_price_t = cmd_upd_price; -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct cmd_upd_test { - pub ver_: u32, - pub cmd_: i32, - pub num_: u32, - pub expo_: i32, - pub slot_diff_: [i8; 32usize], - pub price_: [i64; 32usize], - pub conf_: [u64; 32usize], -} -#[test] -fn bindgen_test_layout_cmd_upd_test() { - assert_eq!( - ::std::mem::size_of::(), - 560usize, - concat!("Size of: ", stringify!(cmd_upd_test)) - ); - assert_eq!( - ::std::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(cmd_upd_test)) - ); - fn test_field_ver_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).ver_) as usize - ptr as usize - }, - 0usize, - concat!( - "Offset of field: ", - stringify!(cmd_upd_test), - "::", - stringify!(ver_) - ) - ); - } - test_field_ver_(); - fn test_field_cmd_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).cmd_) as usize - ptr as usize - }, - 4usize, - concat!( - "Offset of field: ", - stringify!(cmd_upd_test), - "::", - stringify!(cmd_) - ) - ); - } - test_field_cmd_(); - fn test_field_num_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).num_) as usize - ptr as usize - }, - 8usize, - concat!( - "Offset of field: ", - stringify!(cmd_upd_test), - "::", - stringify!(num_) - ) - ); - } - test_field_num_(); - fn test_field_expo_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).expo_) as usize - ptr as usize - }, - 12usize, - concat!( - "Offset of field: ", - stringify!(cmd_upd_test), - "::", - stringify!(expo_) - ) - ); - } - test_field_expo_(); - fn test_field_slot_diff_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).slot_diff_) as usize - ptr as usize - }, - 16usize, - concat!( - "Offset of field: ", - stringify!(cmd_upd_test), - "::", - stringify!(slot_diff_) - ) - ); - } - test_field_slot_diff_(); - fn test_field_price_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).price_) as usize - ptr as usize - }, - 48usize, - concat!( - "Offset of field: ", - stringify!(cmd_upd_test), - "::", - stringify!(price_) - ) - ); - } - test_field_price_(); - fn test_field_conf_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).conf_) as usize - ptr as usize - }, - 304usize, - concat!( - "Offset of field: ", - stringify!(cmd_upd_test), - "::", - stringify!(conf_) - ) - ); - } - test_field_conf_(); -} -pub type cmd_upd_test_t = cmd_upd_test; -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct sysvar_clock { - pub slot_: u64, - pub epoch_start_timestamp_: i64, - pub epoch_: u64, - pub leader_schedule_epoch_: u64, - pub unix_timestamp_: i64, -} -#[test] -fn bindgen_test_layout_sysvar_clock() { - assert_eq!( - ::std::mem::size_of::(), - 40usize, - concat!("Size of: ", stringify!(sysvar_clock)) - ); - assert_eq!( - ::std::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(sysvar_clock)) - ); - fn test_field_slot_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).slot_) as usize - ptr as usize - }, - 0usize, - concat!( - "Offset of field: ", - stringify!(sysvar_clock), - "::", - stringify!(slot_) - ) - ); - } - test_field_slot_(); - fn test_field_epoch_start_timestamp_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).epoch_start_timestamp_) as usize - ptr as usize - }, - 8usize, - concat!( - "Offset of field: ", - stringify!(sysvar_clock), - "::", - stringify!(epoch_start_timestamp_) - ) - ); - } - test_field_epoch_start_timestamp_(); - fn test_field_epoch_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).epoch_) as usize - ptr as usize - }, - 16usize, - concat!( - "Offset of field: ", - stringify!(sysvar_clock), - "::", - stringify!(epoch_) - ) - ); - } - test_field_epoch_(); - fn test_field_leader_schedule_epoch_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).leader_schedule_epoch_) as usize - ptr as usize - }, - 24usize, - concat!( - "Offset of field: ", - stringify!(sysvar_clock), - "::", - stringify!(leader_schedule_epoch_) - ) - ); - } - test_field_leader_schedule_epoch_(); - fn test_field_unix_timestamp_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).unix_timestamp_) as usize - ptr as usize - }, - 32usize, - concat!( - "Offset of field: ", - stringify!(sysvar_clock), - "::", - stringify!(unix_timestamp_) - ) - ); - } - test_field_unix_timestamp_(); -} -pub type sysvar_clock_t = sysvar_clock; -pub const PRICE_T_CONF_OFFSET: size_t = 208; diff --git a/program/rust/build.rs b/program/rust/build.rs index 1989623dc..3f4f9566b 100644 --- a/program/rust/build.rs +++ b/program/rust/build.rs @@ -12,6 +12,7 @@ fn main() { parser.register_traits("cmd_hdr", borsh_derives.to_vec()); parser.register_traits("pc_acc", borsh_derives.to_vec()); parser.register_traits("pc_price_info", borsh_derives.to_vec()); + parser.register_traits("cmd_upd_price", borsh_derives.to_vec()); From 0cbafb86d27f894ed616d9c293ada8fef38fdf18 Mon Sep 17 00:00:00 2001 From: Guillermo Bescos Date: Fri, 22 Jul 2022 18:55:46 +0000 Subject: [PATCH 19/27] Remove accidental commits --- program/c/.vscode/c_cpp_properties.json | 17 - program/rust/bindings.rs | 2276 ----------------------- 2 files changed, 2293 deletions(-) delete mode 100644 program/c/.vscode/c_cpp_properties.json delete mode 100644 program/rust/bindings.rs diff --git a/program/c/.vscode/c_cpp_properties.json b/program/c/.vscode/c_cpp_properties.json deleted file mode 100644 index df967d03a..000000000 --- a/program/c/.vscode/c_cpp_properties.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "configurations": [ - { - "name": "Linux", - "includePath": [ - "${workspaceFolder}/**", - "/home/pyth/solana/**" - ], - "defines": [], - "compilerPath": "/usr/bin/gcc", - "cStandard": "gnu17", - "cppStandard": "gnu++14", - "intelliSenseMode": "linux-gcc-x64" - } - ], - "version": 4 -} \ No newline at end of file diff --git a/program/rust/bindings.rs b/program/rust/bindings.rs deleted file mode 100644 index f52117b14..000000000 --- a/program/rust/bindings.rs +++ /dev/null @@ -1,2276 +0,0 @@ -/* automatically generated by rust-bindgen 0.60.1 */ - -#[repr(C)] -#[derive(Default)] -pub struct __IncompleteArrayField(::std::marker::PhantomData, [T; 0]); -impl __IncompleteArrayField { - #[inline] - pub const fn new() -> Self { - __IncompleteArrayField(::std::marker::PhantomData, []) - } - #[inline] - pub fn as_ptr(&self) -> *const T { - self as *const _ as *const T - } - #[inline] - pub fn as_mut_ptr(&mut self) -> *mut T { - self as *mut _ as *mut T - } - #[inline] - pub unsafe fn as_slice(&self, len: usize) -> &[T] { - ::std::slice::from_raw_parts(self.as_ptr(), len) - } - #[inline] - pub unsafe fn as_mut_slice(&mut self, len: usize) -> &mut [T] { - ::std::slice::from_raw_parts_mut(self.as_mut_ptr(), len) - } -} -impl ::std::fmt::Debug for __IncompleteArrayField { - fn fmt(&self, fmt: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - fmt.write_str("__IncompleteArrayField") - } -} -pub const true_: u32 = 1; -pub const false_: u32 = 0; -pub const __bool_true_false_are_defined: u32 = 1; -pub const PC_MAGIC: u32 = 2712847316; -pub const PC_VERSION: u32 = 2; -pub const PC_MAX_SEND_LATENCY: u32 = 25; -pub const PC_PUBKEY_SIZE: u32 = 32; -pub const PC_MAP_TABLE_SIZE: u32 = 640; -pub const PC_COMP_SIZE: u32 = 32; -pub const PC_MAX_NUM_DECIMALS: u32 = 8; -pub const PC_PROD_ACC_SIZE: u32 = 512; -pub const PC_EXP_DECAY: i32 = -9; -pub const PC_MAX_CI_DIVISOR: u32 = 20; -pub const PC_HEAP_START: u64 = 12884901888; -pub const PC_PTYPE_UNKNOWN: u32 = 0; -pub const PC_PTYPE_PRICE: u32 = 1; -pub const PC_STATUS_UNKNOWN: u32 = 0; -pub const PC_STATUS_TRADING: u32 = 1; -pub const PC_STATUS_HALTED: u32 = 2; -pub const PC_STATUS_AUCTION: u32 = 3; -pub const PC_ACCTYPE_MAPPING: u32 = 1; -pub const PC_ACCTYPE_PRODUCT: u32 = 2; -pub const PC_ACCTYPE_PRICE: u32 = 3; -pub const PC_ACCTYPE_TEST: u32 = 4; -pub type size_t = ::std::os::raw::c_ulong; -pub type wchar_t = ::std::os::raw::c_int; -#[repr(C)] -#[repr(align(16))] -#[derive(Debug, Copy, Clone)] -pub struct max_align_t { - pub __clang_max_align_nonce1: ::std::os::raw::c_longlong, - pub __bindgen_padding_0: u64, - pub __clang_max_align_nonce2: u128, -} -#[test] -fn bindgen_test_layout_max_align_t() { - assert_eq!( - ::std::mem::size_of::(), - 32usize, - concat!("Size of: ", stringify!(max_align_t)) - ); - assert_eq!( - ::std::mem::align_of::(), - 16usize, - concat!("Alignment of ", stringify!(max_align_t)) - ); - fn test_field___clang_max_align_nonce1() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).__clang_max_align_nonce1) as usize - ptr as usize - }, - 0usize, - concat!( - "Offset of field: ", - stringify!(max_align_t), - "::", - stringify!(__clang_max_align_nonce1) - ) - ); - } - test_field___clang_max_align_nonce1(); - fn test_field___clang_max_align_nonce2() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).__clang_max_align_nonce2) as usize - ptr as usize - }, - 16usize, - concat!( - "Offset of field: ", - stringify!(max_align_t), - "::", - stringify!(__clang_max_align_nonce2) - ) - ); - } - test_field___clang_max_align_nonce2(); -} -pub const SUCCESSFULLY_UPDATED_AGGREGATE: u64 = 1000; -pub const TIME_MACHINE_STRUCT_SIZE: u64 = 1864; -extern "C" { - pub static sysvar_clock: [u64; 4usize]; -} -#[repr(C)] -#[derive(Copy, Clone)] -pub union pc_pub_key { - pub k1_: [u8; 32usize], - pub k8_: [u64; 4usize], -} -#[test] -fn bindgen_test_layout_pc_pub_key() { - assert_eq!( - ::std::mem::size_of::(), - 32usize, - concat!("Size of: ", stringify!(pc_pub_key)) - ); - assert_eq!( - ::std::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(pc_pub_key)) - ); - fn test_field_k1_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).k1_) as usize - ptr as usize - }, - 0usize, - concat!( - "Offset of field: ", - stringify!(pc_pub_key), - "::", - stringify!(k1_) - ) - ); - } - test_field_k1_(); - fn test_field_k8_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).k8_) as usize - ptr as usize - }, - 0usize, - concat!( - "Offset of field: ", - stringify!(pc_pub_key), - "::", - stringify!(k8_) - ) - ); - } - test_field_k8_(); -} -pub type pc_pub_key_t = pc_pub_key; -#[repr(C)] -#[derive(Debug, Copy, Clone, BorshSerialize, BorshDeserialize)] -pub struct pc_acc { - pub magic_: u32, - pub ver_: u32, - pub type_: u32, - pub size_: u32, -} -#[test] -fn bindgen_test_layout_pc_acc() { - assert_eq!( - ::std::mem::size_of::(), - 16usize, - concat!("Size of: ", stringify!(pc_acc)) - ); - assert_eq!( - ::std::mem::align_of::(), - 4usize, - concat!("Alignment of ", stringify!(pc_acc)) - ); - fn test_field_magic_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).magic_) as usize - ptr as usize - }, - 0usize, - concat!( - "Offset of field: ", - stringify!(pc_acc), - "::", - stringify!(magic_) - ) - ); - } - test_field_magic_(); - fn test_field_ver_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).ver_) as usize - ptr as usize - }, - 4usize, - concat!( - "Offset of field: ", - stringify!(pc_acc), - "::", - stringify!(ver_) - ) - ); - } - test_field_ver_(); - fn test_field_type_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).type_) as usize - ptr as usize - }, - 8usize, - concat!( - "Offset of field: ", - stringify!(pc_acc), - "::", - stringify!(type_) - ) - ); - } - test_field_type_(); - fn test_field_size_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).size_) as usize - ptr as usize - }, - 12usize, - concat!( - "Offset of field: ", - stringify!(pc_acc), - "::", - stringify!(size_) - ) - ); - } - test_field_size_(); -} -pub type pc_acc_t = pc_acc; -#[repr(C)] -#[derive(Copy, Clone)] -pub struct pc_map_table { - pub magic_: u32, - pub ver_: u32, - pub type_: u32, - pub size_: u32, - pub num_: u32, - pub unused_: u32, - pub next_: pc_pub_key_t, - pub prod_: [pc_pub_key_t; 640usize], -} -#[test] -fn bindgen_test_layout_pc_map_table() { - assert_eq!( - ::std::mem::size_of::(), - 20536usize, - concat!("Size of: ", stringify!(pc_map_table)) - ); - assert_eq!( - ::std::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(pc_map_table)) - ); - fn test_field_magic_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).magic_) as usize - ptr as usize - }, - 0usize, - concat!( - "Offset of field: ", - stringify!(pc_map_table), - "::", - stringify!(magic_) - ) - ); - } - test_field_magic_(); - fn test_field_ver_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).ver_) as usize - ptr as usize - }, - 4usize, - concat!( - "Offset of field: ", - stringify!(pc_map_table), - "::", - stringify!(ver_) - ) - ); - } - test_field_ver_(); - fn test_field_type_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).type_) as usize - ptr as usize - }, - 8usize, - concat!( - "Offset of field: ", - stringify!(pc_map_table), - "::", - stringify!(type_) - ) - ); - } - test_field_type_(); - fn test_field_size_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).size_) as usize - ptr as usize - }, - 12usize, - concat!( - "Offset of field: ", - stringify!(pc_map_table), - "::", - stringify!(size_) - ) - ); - } - test_field_size_(); - fn test_field_num_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).num_) as usize - ptr as usize - }, - 16usize, - concat!( - "Offset of field: ", - stringify!(pc_map_table), - "::", - stringify!(num_) - ) - ); - } - test_field_num_(); - fn test_field_unused_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).unused_) as usize - ptr as usize - }, - 20usize, - concat!( - "Offset of field: ", - stringify!(pc_map_table), - "::", - stringify!(unused_) - ) - ); - } - test_field_unused_(); - fn test_field_next_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).next_) as usize - ptr as usize - }, - 24usize, - concat!( - "Offset of field: ", - stringify!(pc_map_table), - "::", - stringify!(next_) - ) - ); - } - test_field_next_(); - fn test_field_prod_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).prod_) as usize - ptr as usize - }, - 56usize, - concat!( - "Offset of field: ", - stringify!(pc_map_table), - "::", - stringify!(prod_) - ) - ); - } - test_field_prod_(); -} -pub type pc_map_table_t = pc_map_table; -#[repr(C)] -#[derive(Debug)] -pub struct pc_str { - pub len_: u8, - pub data_: __IncompleteArrayField<::std::os::raw::c_char>, -} -#[test] -fn bindgen_test_layout_pc_str() { - assert_eq!( - ::std::mem::size_of::(), - 1usize, - concat!("Size of: ", stringify!(pc_str)) - ); - assert_eq!( - ::std::mem::align_of::(), - 1usize, - concat!("Alignment of ", stringify!(pc_str)) - ); - fn test_field_len_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).len_) as usize - ptr as usize - }, - 0usize, - concat!( - "Offset of field: ", - stringify!(pc_str), - "::", - stringify!(len_) - ) - ); - } - test_field_len_(); - fn test_field_data_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).data_) as usize - ptr as usize - }, - 1usize, - concat!( - "Offset of field: ", - stringify!(pc_str), - "::", - stringify!(data_) - ) - ); - } - test_field_data_(); -} -pub type pc_str_t = pc_str; -#[repr(C)] -#[derive(Copy, Clone)] -pub struct pc_prod { - pub magic_: u32, - pub ver_: u32, - pub type_: u32, - pub size_: u32, - pub px_acc_: pc_pub_key_t, -} -#[test] -fn bindgen_test_layout_pc_prod() { - assert_eq!( - ::std::mem::size_of::(), - 48usize, - concat!("Size of: ", stringify!(pc_prod)) - ); - assert_eq!( - ::std::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(pc_prod)) - ); - fn test_field_magic_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).magic_) as usize - ptr as usize - }, - 0usize, - concat!( - "Offset of field: ", - stringify!(pc_prod), - "::", - stringify!(magic_) - ) - ); - } - test_field_magic_(); - fn test_field_ver_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).ver_) as usize - ptr as usize - }, - 4usize, - concat!( - "Offset of field: ", - stringify!(pc_prod), - "::", - stringify!(ver_) - ) - ); - } - test_field_ver_(); - fn test_field_type_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).type_) as usize - ptr as usize - }, - 8usize, - concat!( - "Offset of field: ", - stringify!(pc_prod), - "::", - stringify!(type_) - ) - ); - } - test_field_type_(); - fn test_field_size_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).size_) as usize - ptr as usize - }, - 12usize, - concat!( - "Offset of field: ", - stringify!(pc_prod), - "::", - stringify!(size_) - ) - ); - } - test_field_size_(); - fn test_field_px_acc_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).px_acc_) as usize - ptr as usize - }, - 16usize, - concat!( - "Offset of field: ", - stringify!(pc_prod), - "::", - stringify!(px_acc_) - ) - ); - } - test_field_px_acc_(); -} -pub type pc_prod_t = pc_prod; -#[repr(C)] -#[derive(Debug, Copy, Clone, BorshSerialize, BorshDeserialize)] -pub struct pc_price_info { - pub price_: i64, - pub conf_: u64, - pub status_: u32, - pub corp_act_status_: u32, - pub pub_slot_: u64, -} -#[test] -fn bindgen_test_layout_pc_price_info() { - assert_eq!( - ::std::mem::size_of::(), - 32usize, - concat!("Size of: ", stringify!(pc_price_info)) - ); - assert_eq!( - ::std::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(pc_price_info)) - ); - fn test_field_price_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).price_) as usize - ptr as usize - }, - 0usize, - concat!( - "Offset of field: ", - stringify!(pc_price_info), - "::", - stringify!(price_) - ) - ); - } - test_field_price_(); - fn test_field_conf_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).conf_) as usize - ptr as usize - }, - 8usize, - concat!( - "Offset of field: ", - stringify!(pc_price_info), - "::", - stringify!(conf_) - ) - ); - } - test_field_conf_(); - fn test_field_status_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).status_) as usize - ptr as usize - }, - 16usize, - concat!( - "Offset of field: ", - stringify!(pc_price_info), - "::", - stringify!(status_) - ) - ); - } - test_field_status_(); - fn test_field_corp_act_status_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).corp_act_status_) as usize - ptr as usize - }, - 20usize, - concat!( - "Offset of field: ", - stringify!(pc_price_info), - "::", - stringify!(corp_act_status_) - ) - ); - } - test_field_corp_act_status_(); - fn test_field_pub_slot_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).pub_slot_) as usize - ptr as usize - }, - 24usize, - concat!( - "Offset of field: ", - stringify!(pc_price_info), - "::", - stringify!(pub_slot_) - ) - ); - } - test_field_pub_slot_(); -} -pub type pc_price_info_t = pc_price_info; -#[repr(C)] -#[derive(Copy, Clone)] -pub struct pc_price_comp { - pub pub_: pc_pub_key_t, - pub agg_: pc_price_info_t, - pub latest_: pc_price_info_t, -} -#[test] -fn bindgen_test_layout_pc_price_comp() { - assert_eq!( - ::std::mem::size_of::(), - 96usize, - concat!("Size of: ", stringify!(pc_price_comp)) - ); - assert_eq!( - ::std::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(pc_price_comp)) - ); - fn test_field_pub_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).pub_) as usize - ptr as usize - }, - 0usize, - concat!( - "Offset of field: ", - stringify!(pc_price_comp), - "::", - stringify!(pub_) - ) - ); - } - test_field_pub_(); - fn test_field_agg_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).agg_) as usize - ptr as usize - }, - 32usize, - concat!( - "Offset of field: ", - stringify!(pc_price_comp), - "::", - stringify!(agg_) - ) - ); - } - test_field_agg_(); - fn test_field_latest_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).latest_) as usize - ptr as usize - }, - 64usize, - concat!( - "Offset of field: ", - stringify!(pc_price_comp), - "::", - stringify!(latest_) - ) - ); - } - test_field_latest_(); -} -pub type pc_price_comp_t = pc_price_comp; -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct pc_ema { - pub val_: i64, - pub numer_: i64, - pub denom_: i64, -} -#[test] -fn bindgen_test_layout_pc_ema() { - assert_eq!( - ::std::mem::size_of::(), - 24usize, - concat!("Size of: ", stringify!(pc_ema)) - ); - assert_eq!( - ::std::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(pc_ema)) - ); - fn test_field_val_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).val_) as usize - ptr as usize - }, - 0usize, - concat!( - "Offset of field: ", - stringify!(pc_ema), - "::", - stringify!(val_) - ) - ); - } - test_field_val_(); - fn test_field_numer_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).numer_) as usize - ptr as usize - }, - 8usize, - concat!( - "Offset of field: ", - stringify!(pc_ema), - "::", - stringify!(numer_) - ) - ); - } - test_field_numer_(); - fn test_field_denom_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).denom_) as usize - ptr as usize - }, - 16usize, - concat!( - "Offset of field: ", - stringify!(pc_ema), - "::", - stringify!(denom_) - ) - ); - } - test_field_denom_(); -} -pub type pc_ema_t = pc_ema; -#[repr(C)] -#[derive(Copy, Clone)] -pub struct pc_price { - pub magic_: u32, - pub ver_: u32, - pub type_: u32, - pub size_: u32, - pub ptype_: u32, - pub expo_: i32, - pub num_: u32, - pub num_qt_: u32, - pub last_slot_: u64, - pub valid_slot_: u64, - pub twap_: pc_ema_t, - pub twac_: pc_ema_t, - pub timestamp_: i64, - pub min_pub_: u8, - pub drv2_: i8, - pub drv3_: i16, - pub drv4_: i32, - pub prod_: pc_pub_key_t, - pub next_: pc_pub_key_t, - pub prev_slot_: u64, - pub prev_price_: i64, - pub prev_conf_: u64, - pub prev_timestamp_: i64, - pub agg_: pc_price_info_t, - pub comp_: [pc_price_comp_t; 32usize], -} -#[test] -fn bindgen_test_layout_pc_price() { - assert_eq!( - ::std::mem::size_of::(), - 3312usize, - concat!("Size of: ", stringify!(pc_price)) - ); - assert_eq!( - ::std::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(pc_price)) - ); - fn test_field_magic_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).magic_) as usize - ptr as usize - }, - 0usize, - concat!( - "Offset of field: ", - stringify!(pc_price), - "::", - stringify!(magic_) - ) - ); - } - test_field_magic_(); - fn test_field_ver_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).ver_) as usize - ptr as usize - }, - 4usize, - concat!( - "Offset of field: ", - stringify!(pc_price), - "::", - stringify!(ver_) - ) - ); - } - test_field_ver_(); - fn test_field_type_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).type_) as usize - ptr as usize - }, - 8usize, - concat!( - "Offset of field: ", - stringify!(pc_price), - "::", - stringify!(type_) - ) - ); - } - test_field_type_(); - fn test_field_size_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).size_) as usize - ptr as usize - }, - 12usize, - concat!( - "Offset of field: ", - stringify!(pc_price), - "::", - stringify!(size_) - ) - ); - } - test_field_size_(); - fn test_field_ptype_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).ptype_) as usize - ptr as usize - }, - 16usize, - concat!( - "Offset of field: ", - stringify!(pc_price), - "::", - stringify!(ptype_) - ) - ); - } - test_field_ptype_(); - fn test_field_expo_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).expo_) as usize - ptr as usize - }, - 20usize, - concat!( - "Offset of field: ", - stringify!(pc_price), - "::", - stringify!(expo_) - ) - ); - } - test_field_expo_(); - fn test_field_num_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).num_) as usize - ptr as usize - }, - 24usize, - concat!( - "Offset of field: ", - stringify!(pc_price), - "::", - stringify!(num_) - ) - ); - } - test_field_num_(); - fn test_field_num_qt_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).num_qt_) as usize - ptr as usize - }, - 28usize, - concat!( - "Offset of field: ", - stringify!(pc_price), - "::", - stringify!(num_qt_) - ) - ); - } - test_field_num_qt_(); - fn test_field_last_slot_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).last_slot_) as usize - ptr as usize - }, - 32usize, - concat!( - "Offset of field: ", - stringify!(pc_price), - "::", - stringify!(last_slot_) - ) - ); - } - test_field_last_slot_(); - fn test_field_valid_slot_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).valid_slot_) as usize - ptr as usize - }, - 40usize, - concat!( - "Offset of field: ", - stringify!(pc_price), - "::", - stringify!(valid_slot_) - ) - ); - } - test_field_valid_slot_(); - fn test_field_twap_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).twap_) as usize - ptr as usize - }, - 48usize, - concat!( - "Offset of field: ", - stringify!(pc_price), - "::", - stringify!(twap_) - ) - ); - } - test_field_twap_(); - fn test_field_twac_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).twac_) as usize - ptr as usize - }, - 72usize, - concat!( - "Offset of field: ", - stringify!(pc_price), - "::", - stringify!(twac_) - ) - ); - } - test_field_twac_(); - fn test_field_timestamp_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).timestamp_) as usize - ptr as usize - }, - 96usize, - concat!( - "Offset of field: ", - stringify!(pc_price), - "::", - stringify!(timestamp_) - ) - ); - } - test_field_timestamp_(); - fn test_field_min_pub_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).min_pub_) as usize - ptr as usize - }, - 104usize, - concat!( - "Offset of field: ", - stringify!(pc_price), - "::", - stringify!(min_pub_) - ) - ); - } - test_field_min_pub_(); - fn test_field_drv2_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).drv2_) as usize - ptr as usize - }, - 105usize, - concat!( - "Offset of field: ", - stringify!(pc_price), - "::", - stringify!(drv2_) - ) - ); - } - test_field_drv2_(); - fn test_field_drv3_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).drv3_) as usize - ptr as usize - }, - 106usize, - concat!( - "Offset of field: ", - stringify!(pc_price), - "::", - stringify!(drv3_) - ) - ); - } - test_field_drv3_(); - fn test_field_drv4_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).drv4_) as usize - ptr as usize - }, - 108usize, - concat!( - "Offset of field: ", - stringify!(pc_price), - "::", - stringify!(drv4_) - ) - ); - } - test_field_drv4_(); - fn test_field_prod_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).prod_) as usize - ptr as usize - }, - 112usize, - concat!( - "Offset of field: ", - stringify!(pc_price), - "::", - stringify!(prod_) - ) - ); - } - test_field_prod_(); - fn test_field_next_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).next_) as usize - ptr as usize - }, - 144usize, - concat!( - "Offset of field: ", - stringify!(pc_price), - "::", - stringify!(next_) - ) - ); - } - test_field_next_(); - fn test_field_prev_slot_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).prev_slot_) as usize - ptr as usize - }, - 176usize, - concat!( - "Offset of field: ", - stringify!(pc_price), - "::", - stringify!(prev_slot_) - ) - ); - } - test_field_prev_slot_(); - fn test_field_prev_price_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).prev_price_) as usize - ptr as usize - }, - 184usize, - concat!( - "Offset of field: ", - stringify!(pc_price), - "::", - stringify!(prev_price_) - ) - ); - } - test_field_prev_price_(); - fn test_field_prev_conf_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).prev_conf_) as usize - ptr as usize - }, - 192usize, - concat!( - "Offset of field: ", - stringify!(pc_price), - "::", - stringify!(prev_conf_) - ) - ); - } - test_field_prev_conf_(); - fn test_field_prev_timestamp_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).prev_timestamp_) as usize - ptr as usize - }, - 200usize, - concat!( - "Offset of field: ", - stringify!(pc_price), - "::", - stringify!(prev_timestamp_) - ) - ); - } - test_field_prev_timestamp_(); - fn test_field_agg_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).agg_) as usize - ptr as usize - }, - 208usize, - concat!( - "Offset of field: ", - stringify!(pc_price), - "::", - stringify!(agg_) - ) - ); - } - test_field_agg_(); - fn test_field_comp_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).comp_) as usize - ptr as usize - }, - 240usize, - concat!( - "Offset of field: ", - stringify!(pc_price), - "::", - stringify!(comp_) - ) - ); - } - test_field_comp_(); -} -pub type pc_price_t = pc_price; -pub const command_t_e_cmd_init_mapping: command_t = 0; -pub const command_t_e_cmd_add_mapping: command_t = 1; -pub const command_t_e_cmd_add_product: command_t = 2; -pub const command_t_e_cmd_upd_product: command_t = 3; -pub const command_t_e_cmd_add_price: command_t = 4; -pub const command_t_e_cmd_add_publisher: command_t = 5; -pub const command_t_e_cmd_del_publisher: command_t = 6; -pub const command_t_e_cmd_upd_price: command_t = 7; -pub const command_t_e_cmd_agg_price: command_t = 8; -pub const command_t_e_cmd_init_price: command_t = 9; -pub const command_t_e_cmd_init_test: command_t = 10; -pub const command_t_e_cmd_upd_test: command_t = 11; -pub const command_t_e_cmd_set_min_pub: command_t = 12; -pub const command_t_e_cmd_upd_price_no_fail_on_error: command_t = 13; -pub type command_t = ::std::os::raw::c_uint; -#[repr(C)] -#[derive(Debug, Copy, Clone, BorshSerialize, BorshDeserialize)] -pub struct cmd_hdr { - pub ver_: u32, - pub cmd_: i32, -} -#[test] -fn bindgen_test_layout_cmd_hdr() { - assert_eq!( - ::std::mem::size_of::(), - 8usize, - concat!("Size of: ", stringify!(cmd_hdr)) - ); - assert_eq!( - ::std::mem::align_of::(), - 4usize, - concat!("Alignment of ", stringify!(cmd_hdr)) - ); - fn test_field_ver_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).ver_) as usize - ptr as usize - }, - 0usize, - concat!( - "Offset of field: ", - stringify!(cmd_hdr), - "::", - stringify!(ver_) - ) - ); - } - test_field_ver_(); - fn test_field_cmd_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).cmd_) as usize - ptr as usize - }, - 4usize, - concat!( - "Offset of field: ", - stringify!(cmd_hdr), - "::", - stringify!(cmd_) - ) - ); - } - test_field_cmd_(); -} -pub type cmd_hdr_t = cmd_hdr; -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct cmd_add_product { - pub ver_: u32, - pub cmd_: i32, -} -#[test] -fn bindgen_test_layout_cmd_add_product() { - assert_eq!( - ::std::mem::size_of::(), - 8usize, - concat!("Size of: ", stringify!(cmd_add_product)) - ); - assert_eq!( - ::std::mem::align_of::(), - 4usize, - concat!("Alignment of ", stringify!(cmd_add_product)) - ); - fn test_field_ver_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).ver_) as usize - ptr as usize - }, - 0usize, - concat!( - "Offset of field: ", - stringify!(cmd_add_product), - "::", - stringify!(ver_) - ) - ); - } - test_field_ver_(); - fn test_field_cmd_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).cmd_) as usize - ptr as usize - }, - 4usize, - concat!( - "Offset of field: ", - stringify!(cmd_add_product), - "::", - stringify!(cmd_) - ) - ); - } - test_field_cmd_(); -} -pub type cmd_add_product_t = cmd_add_product; -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct cmd_upd_product { - pub ver_: u32, - pub cmd_: i32, -} -#[test] -fn bindgen_test_layout_cmd_upd_product() { - assert_eq!( - ::std::mem::size_of::(), - 8usize, - concat!("Size of: ", stringify!(cmd_upd_product)) - ); - assert_eq!( - ::std::mem::align_of::(), - 4usize, - concat!("Alignment of ", stringify!(cmd_upd_product)) - ); - fn test_field_ver_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).ver_) as usize - ptr as usize - }, - 0usize, - concat!( - "Offset of field: ", - stringify!(cmd_upd_product), - "::", - stringify!(ver_) - ) - ); - } - test_field_ver_(); - fn test_field_cmd_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).cmd_) as usize - ptr as usize - }, - 4usize, - concat!( - "Offset of field: ", - stringify!(cmd_upd_product), - "::", - stringify!(cmd_) - ) - ); - } - test_field_cmd_(); -} -pub type cmd_upd_product_t = cmd_upd_product; -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct cmd_add_price { - pub ver_: u32, - pub cmd_: i32, - pub expo_: i32, - pub ptype_: u32, -} -#[test] -fn bindgen_test_layout_cmd_add_price() { - assert_eq!( - ::std::mem::size_of::(), - 16usize, - concat!("Size of: ", stringify!(cmd_add_price)) - ); - assert_eq!( - ::std::mem::align_of::(), - 4usize, - concat!("Alignment of ", stringify!(cmd_add_price)) - ); - fn test_field_ver_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).ver_) as usize - ptr as usize - }, - 0usize, - concat!( - "Offset of field: ", - stringify!(cmd_add_price), - "::", - stringify!(ver_) - ) - ); - } - test_field_ver_(); - fn test_field_cmd_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).cmd_) as usize - ptr as usize - }, - 4usize, - concat!( - "Offset of field: ", - stringify!(cmd_add_price), - "::", - stringify!(cmd_) - ) - ); - } - test_field_cmd_(); - fn test_field_expo_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).expo_) as usize - ptr as usize - }, - 8usize, - concat!( - "Offset of field: ", - stringify!(cmd_add_price), - "::", - stringify!(expo_) - ) - ); - } - test_field_expo_(); - fn test_field_ptype_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).ptype_) as usize - ptr as usize - }, - 12usize, - concat!( - "Offset of field: ", - stringify!(cmd_add_price), - "::", - stringify!(ptype_) - ) - ); - } - test_field_ptype_(); -} -pub type cmd_add_price_t = cmd_add_price; -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct cmd_init_price { - pub ver_: u32, - pub cmd_: i32, - pub expo_: i32, - pub ptype_: u32, -} -#[test] -fn bindgen_test_layout_cmd_init_price() { - assert_eq!( - ::std::mem::size_of::(), - 16usize, - concat!("Size of: ", stringify!(cmd_init_price)) - ); - assert_eq!( - ::std::mem::align_of::(), - 4usize, - concat!("Alignment of ", stringify!(cmd_init_price)) - ); - fn test_field_ver_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).ver_) as usize - ptr as usize - }, - 0usize, - concat!( - "Offset of field: ", - stringify!(cmd_init_price), - "::", - stringify!(ver_) - ) - ); - } - test_field_ver_(); - fn test_field_cmd_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).cmd_) as usize - ptr as usize - }, - 4usize, - concat!( - "Offset of field: ", - stringify!(cmd_init_price), - "::", - stringify!(cmd_) - ) - ); - } - test_field_cmd_(); - fn test_field_expo_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).expo_) as usize - ptr as usize - }, - 8usize, - concat!( - "Offset of field: ", - stringify!(cmd_init_price), - "::", - stringify!(expo_) - ) - ); - } - test_field_expo_(); - fn test_field_ptype_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).ptype_) as usize - ptr as usize - }, - 12usize, - concat!( - "Offset of field: ", - stringify!(cmd_init_price), - "::", - stringify!(ptype_) - ) - ); - } - test_field_ptype_(); -} -pub type cmd_init_price_t = cmd_init_price; -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct cmd_set_min_pub { - pub ver_: u32, - pub cmd_: i32, - pub min_pub_: u8, -} -#[test] -fn bindgen_test_layout_cmd_set_min_pub() { - assert_eq!( - ::std::mem::size_of::(), - 12usize, - concat!("Size of: ", stringify!(cmd_set_min_pub)) - ); - assert_eq!( - ::std::mem::align_of::(), - 4usize, - concat!("Alignment of ", stringify!(cmd_set_min_pub)) - ); - fn test_field_ver_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).ver_) as usize - ptr as usize - }, - 0usize, - concat!( - "Offset of field: ", - stringify!(cmd_set_min_pub), - "::", - stringify!(ver_) - ) - ); - } - test_field_ver_(); - fn test_field_cmd_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).cmd_) as usize - ptr as usize - }, - 4usize, - concat!( - "Offset of field: ", - stringify!(cmd_set_min_pub), - "::", - stringify!(cmd_) - ) - ); - } - test_field_cmd_(); - fn test_field_min_pub_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).min_pub_) as usize - ptr as usize - }, - 8usize, - concat!( - "Offset of field: ", - stringify!(cmd_set_min_pub), - "::", - stringify!(min_pub_) - ) - ); - } - test_field_min_pub_(); -} -pub type cmd_set_min_pub_t = cmd_set_min_pub; -#[repr(C)] -#[derive(Copy, Clone)] -pub struct cmd_add_publisher { - pub ver_: u32, - pub cmd_: i32, - pub pub_: pc_pub_key_t, -} -#[test] -fn bindgen_test_layout_cmd_add_publisher() { - assert_eq!( - ::std::mem::size_of::(), - 40usize, - concat!("Size of: ", stringify!(cmd_add_publisher)) - ); - assert_eq!( - ::std::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(cmd_add_publisher)) - ); - fn test_field_ver_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).ver_) as usize - ptr as usize - }, - 0usize, - concat!( - "Offset of field: ", - stringify!(cmd_add_publisher), - "::", - stringify!(ver_) - ) - ); - } - test_field_ver_(); - fn test_field_cmd_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).cmd_) as usize - ptr as usize - }, - 4usize, - concat!( - "Offset of field: ", - stringify!(cmd_add_publisher), - "::", - stringify!(cmd_) - ) - ); - } - test_field_cmd_(); - fn test_field_pub_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).pub_) as usize - ptr as usize - }, - 8usize, - concat!( - "Offset of field: ", - stringify!(cmd_add_publisher), - "::", - stringify!(pub_) - ) - ); - } - test_field_pub_(); -} -pub type cmd_add_publisher_t = cmd_add_publisher; -#[repr(C)] -#[derive(Copy, Clone)] -pub struct cmd_del_publisher { - pub ver_: u32, - pub cmd_: i32, - pub pub_: pc_pub_key_t, -} -#[test] -fn bindgen_test_layout_cmd_del_publisher() { - assert_eq!( - ::std::mem::size_of::(), - 40usize, - concat!("Size of: ", stringify!(cmd_del_publisher)) - ); - assert_eq!( - ::std::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(cmd_del_publisher)) - ); - fn test_field_ver_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).ver_) as usize - ptr as usize - }, - 0usize, - concat!( - "Offset of field: ", - stringify!(cmd_del_publisher), - "::", - stringify!(ver_) - ) - ); - } - test_field_ver_(); - fn test_field_cmd_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).cmd_) as usize - ptr as usize - }, - 4usize, - concat!( - "Offset of field: ", - stringify!(cmd_del_publisher), - "::", - stringify!(cmd_) - ) - ); - } - test_field_cmd_(); - fn test_field_pub_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).pub_) as usize - ptr as usize - }, - 8usize, - concat!( - "Offset of field: ", - stringify!(cmd_del_publisher), - "::", - stringify!(pub_) - ) - ); - } - test_field_pub_(); -} -pub type cmd_del_publisher_t = cmd_del_publisher; -#[repr(C)] -#[derive(Debug, Copy, Clone, BorshSerialize, BorshDeserialize)] -pub struct cmd_upd_price { - pub ver_: u32, - pub cmd_: i32, - pub status_: u32, - pub unused_: u32, - pub price_: i64, - pub conf_: u64, - pub pub_slot_: u64, -} -#[test] -fn bindgen_test_layout_cmd_upd_price() { - assert_eq!( - ::std::mem::size_of::(), - 40usize, - concat!("Size of: ", stringify!(cmd_upd_price)) - ); - assert_eq!( - ::std::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(cmd_upd_price)) - ); - fn test_field_ver_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).ver_) as usize - ptr as usize - }, - 0usize, - concat!( - "Offset of field: ", - stringify!(cmd_upd_price), - "::", - stringify!(ver_) - ) - ); - } - test_field_ver_(); - fn test_field_cmd_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).cmd_) as usize - ptr as usize - }, - 4usize, - concat!( - "Offset of field: ", - stringify!(cmd_upd_price), - "::", - stringify!(cmd_) - ) - ); - } - test_field_cmd_(); - fn test_field_status_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).status_) as usize - ptr as usize - }, - 8usize, - concat!( - "Offset of field: ", - stringify!(cmd_upd_price), - "::", - stringify!(status_) - ) - ); - } - test_field_status_(); - fn test_field_unused_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).unused_) as usize - ptr as usize - }, - 12usize, - concat!( - "Offset of field: ", - stringify!(cmd_upd_price), - "::", - stringify!(unused_) - ) - ); - } - test_field_unused_(); - fn test_field_price_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).price_) as usize - ptr as usize - }, - 16usize, - concat!( - "Offset of field: ", - stringify!(cmd_upd_price), - "::", - stringify!(price_) - ) - ); - } - test_field_price_(); - fn test_field_conf_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).conf_) as usize - ptr as usize - }, - 24usize, - concat!( - "Offset of field: ", - stringify!(cmd_upd_price), - "::", - stringify!(conf_) - ) - ); - } - test_field_conf_(); - fn test_field_pub_slot_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).pub_slot_) as usize - ptr as usize - }, - 32usize, - concat!( - "Offset of field: ", - stringify!(cmd_upd_price), - "::", - stringify!(pub_slot_) - ) - ); - } - test_field_pub_slot_(); -} -pub type cmd_upd_price_t = cmd_upd_price; -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct cmd_upd_test { - pub ver_: u32, - pub cmd_: i32, - pub num_: u32, - pub expo_: i32, - pub slot_diff_: [i8; 32usize], - pub price_: [i64; 32usize], - pub conf_: [u64; 32usize], -} -#[test] -fn bindgen_test_layout_cmd_upd_test() { - assert_eq!( - ::std::mem::size_of::(), - 560usize, - concat!("Size of: ", stringify!(cmd_upd_test)) - ); - assert_eq!( - ::std::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(cmd_upd_test)) - ); - fn test_field_ver_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).ver_) as usize - ptr as usize - }, - 0usize, - concat!( - "Offset of field: ", - stringify!(cmd_upd_test), - "::", - stringify!(ver_) - ) - ); - } - test_field_ver_(); - fn test_field_cmd_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).cmd_) as usize - ptr as usize - }, - 4usize, - concat!( - "Offset of field: ", - stringify!(cmd_upd_test), - "::", - stringify!(cmd_) - ) - ); - } - test_field_cmd_(); - fn test_field_num_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).num_) as usize - ptr as usize - }, - 8usize, - concat!( - "Offset of field: ", - stringify!(cmd_upd_test), - "::", - stringify!(num_) - ) - ); - } - test_field_num_(); - fn test_field_expo_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).expo_) as usize - ptr as usize - }, - 12usize, - concat!( - "Offset of field: ", - stringify!(cmd_upd_test), - "::", - stringify!(expo_) - ) - ); - } - test_field_expo_(); - fn test_field_slot_diff_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).slot_diff_) as usize - ptr as usize - }, - 16usize, - concat!( - "Offset of field: ", - stringify!(cmd_upd_test), - "::", - stringify!(slot_diff_) - ) - ); - } - test_field_slot_diff_(); - fn test_field_price_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).price_) as usize - ptr as usize - }, - 48usize, - concat!( - "Offset of field: ", - stringify!(cmd_upd_test), - "::", - stringify!(price_) - ) - ); - } - test_field_price_(); - fn test_field_conf_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).conf_) as usize - ptr as usize - }, - 304usize, - concat!( - "Offset of field: ", - stringify!(cmd_upd_test), - "::", - stringify!(conf_) - ) - ); - } - test_field_conf_(); -} -pub type cmd_upd_test_t = cmd_upd_test; -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct sysvar_clock { - pub slot_: u64, - pub epoch_start_timestamp_: i64, - pub epoch_: u64, - pub leader_schedule_epoch_: u64, - pub unix_timestamp_: i64, -} -#[test] -fn bindgen_test_layout_sysvar_clock() { - assert_eq!( - ::std::mem::size_of::(), - 40usize, - concat!("Size of: ", stringify!(sysvar_clock)) - ); - assert_eq!( - ::std::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(sysvar_clock)) - ); - fn test_field_slot_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).slot_) as usize - ptr as usize - }, - 0usize, - concat!( - "Offset of field: ", - stringify!(sysvar_clock), - "::", - stringify!(slot_) - ) - ); - } - test_field_slot_(); - fn test_field_epoch_start_timestamp_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).epoch_start_timestamp_) as usize - ptr as usize - }, - 8usize, - concat!( - "Offset of field: ", - stringify!(sysvar_clock), - "::", - stringify!(epoch_start_timestamp_) - ) - ); - } - test_field_epoch_start_timestamp_(); - fn test_field_epoch_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).epoch_) as usize - ptr as usize - }, - 16usize, - concat!( - "Offset of field: ", - stringify!(sysvar_clock), - "::", - stringify!(epoch_) - ) - ); - } - test_field_epoch_(); - fn test_field_leader_schedule_epoch_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).leader_schedule_epoch_) as usize - ptr as usize - }, - 24usize, - concat!( - "Offset of field: ", - stringify!(sysvar_clock), - "::", - stringify!(leader_schedule_epoch_) - ) - ); - } - test_field_leader_schedule_epoch_(); - fn test_field_unix_timestamp_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).unix_timestamp_) as usize - ptr as usize - }, - 32usize, - concat!( - "Offset of field: ", - stringify!(sysvar_clock), - "::", - stringify!(unix_timestamp_) - ) - ); - } - test_field_unix_timestamp_(); -} -pub type sysvar_clock_t = sysvar_clock; -pub const PRICE_T_CONF_OFFSET: size_t = 208; From 3f5dfb935969e1fc6830ff61dcfccb5e353fdba8 Mon Sep 17 00:00:00 2001 From: Guillermo Bescos Date: Fri, 22 Jul 2022 19:08:04 +0000 Subject: [PATCH 20/27] Remove line --- program/c/src/oracle/oracle.h | 1 - 1 file changed, 1 deletion(-) diff --git a/program/c/src/oracle/oracle.h b/program/c/src/oracle/oracle.h index ed2c177ac..6ca196855 100644 --- a/program/c/src/oracle/oracle.h +++ b/program/c/src/oracle/oracle.h @@ -6,7 +6,6 @@ extern "C" { #endif - //A return value indicating that the aggregate price was updated //this triggers SMA trackers to update //values 0-14 are defined in solana_sdk.h (v1.10.31 ) From f579d789362ae8baf3571d54e92e5ae44c1770fc Mon Sep 17 00:00:00 2001 From: Guillermo Bescos Date: Fri, 22 Jul 2022 19:11:21 +0000 Subject: [PATCH 21/27] Clippy --- program/rust/src/log.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/program/rust/src/log.rs b/program/rust/src/log.rs index f81bb3db3..d3cf0792b 100644 --- a/program/rust/src/log.rs +++ b/program/rust/src/log.rs @@ -10,7 +10,7 @@ use crate::error::OracleError; use borsh::BorshDeserialize; use solana_program::entrypoint::ProgramResult; use solana_program::msg; -use solana_program::{account_info::AccountInfo, pubkey::Pubkey}; +use solana_program::{account_info::AccountInfo}; use std::mem::size_of; pub fn pre_log(instruction_data: &[u8]) -> ProgramResult { @@ -23,7 +23,7 @@ pub fn pre_log(instruction_data: &[u8]) -> ProgramResult { .map_err(|_| OracleError::Generic)?; match instruction_id { command_t_e_cmd_upd_price_no_fail_on_error => { - let instruction: cmd_upd_price = cmd_upd_price::try_from_slice(&instruction_data)?; + let instruction: cmd_upd_price = cmd_upd_price::try_from_slice(instruction_data)?; msg!( "Update price no fail on error: price={:}, conf={:}, status={:}", instruction.price_, @@ -32,7 +32,7 @@ pub fn pre_log(instruction_data: &[u8]) -> ProgramResult { ); } command_t_e_cmd_upd_price => { - let instruction: cmd_upd_price = cmd_upd_price::try_from_slice(&instruction_data)?; + let instruction: cmd_upd_price = cmd_upd_price::try_from_slice(instruction_data)?; msg!( "Update price: price={:}, conf={:}, status={:}", instruction.price_, @@ -41,7 +41,7 @@ pub fn pre_log(instruction_data: &[u8]) -> ProgramResult { ); } command_t_e_cmd_agg_price => { - let instruction: cmd_upd_price = cmd_upd_price::try_from_slice(&instruction_data)?; + let instruction: cmd_upd_price = cmd_upd_price::try_from_slice(instruction_data)?; msg!( "Update price: price={:}, conf={:}, status={:}", instruction.price_, From b426d38857c14b18a03c528697829c038d710804 Mon Sep 17 00:00:00 2001 From: Guillermo Bescos Date: Fri, 22 Jul 2022 19:14:05 +0000 Subject: [PATCH 22/27] Format and reorder --- program/rust/src/log.rs | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) diff --git a/program/rust/src/log.rs b/program/rust/src/log.rs index d3cf0792b..47256b4b1 100644 --- a/program/rust/src/log.rs +++ b/program/rust/src/log.rs @@ -1,16 +1,9 @@ -use crate::c_oracle_header::{ - cmd_hdr, cmd_upd_price, command_t_e_cmd_add_mapping, command_t_e_cmd_add_price, - command_t_e_cmd_add_product, command_t_e_cmd_add_publisher, command_t_e_cmd_agg_price, - command_t_e_cmd_del_publisher, command_t_e_cmd_init_mapping, command_t_e_cmd_init_price, - command_t_e_cmd_set_min_pub, command_t_e_cmd_upd_price, - command_t_e_cmd_upd_price_no_fail_on_error, command_t_e_cmd_upd_product, pc_price_info, - PRICE_T_AGGREGATE_OFFSET, SUCCESSFULLY_UPDATED_AGGREGATE, -}; +use crate::c_oracle_header::*; use crate::error::OracleError; use borsh::BorshDeserialize; +use solana_program::account_info::AccountInfo; use solana_program::entrypoint::ProgramResult; use solana_program::msg; -use solana_program::{account_info::AccountInfo}; use std::mem::size_of; pub fn pre_log(instruction_data: &[u8]) -> ProgramResult { @@ -22,16 +15,16 @@ pub fn pre_log(instruction_data: &[u8]) -> ProgramResult { .try_into() .map_err(|_| OracleError::Generic)?; match instruction_id { - command_t_e_cmd_upd_price_no_fail_on_error => { + command_t_e_cmd_upd_price => { let instruction: cmd_upd_price = cmd_upd_price::try_from_slice(instruction_data)?; msg!( - "Update price no fail on error: price={:}, conf={:}, status={:}", + "Update price: price={:}, conf={:}, status={:}", instruction.price_, instruction.conf_, instruction.status_ ); } - command_t_e_cmd_upd_price => { + command_t_e_cmd_agg_price => { let instruction: cmd_upd_price = cmd_upd_price::try_from_slice(instruction_data)?; msg!( "Update price: price={:}, conf={:}, status={:}", @@ -40,15 +33,16 @@ pub fn pre_log(instruction_data: &[u8]) -> ProgramResult { instruction.status_ ); } - command_t_e_cmd_agg_price => { + command_t_e_cmd_upd_price_no_fail_on_error => { let instruction: cmd_upd_price = cmd_upd_price::try_from_slice(instruction_data)?; msg!( - "Update price: price={:}, conf={:}, status={:}", + "Update price no fail on error: price={:}, conf={:}, status={:}", instruction.price_, instruction.conf_, instruction.status_ ); } + command_t_e_cmd_add_mapping => { msg!("Add mapping"); } From 5bf547fef2ead60a816f440da88395dd41241a6e Mon Sep 17 00:00:00 2001 From: Guillermo Bescos Date: Fri, 22 Jul 2022 19:18:24 +0000 Subject: [PATCH 23/27] Add comment about accessing account 1 --- program/rust/src/log.rs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/program/rust/src/log.rs b/program/rust/src/log.rs index 47256b4b1..71495af3f 100644 --- a/program/rust/src/log.rs +++ b/program/rust/src/log.rs @@ -84,7 +84,8 @@ pub fn post_log(c_ret_val: u64, accounts: &[AccountInfo]) -> ProgramResult { let start: usize = PRICE_T_AGGREGATE_OFFSET .try_into() .map_err(|_| OracleError::Generic)?; - let price_struct: pc_price_info = pc_price_info::try_from_slice( + // We trust that the C oracle has properly checked this account + let aggregate_price_info: pc_price_info = pc_price_info::try_from_slice( &accounts .get(1) .ok_or(OracleError::Generic)? @@ -92,9 +93,9 @@ pub fn post_log(c_ret_val: u64, accounts: &[AccountInfo]) -> ProgramResult { )?; msg!( "Aggregate updated : price={:}, conf={:}, status={:}", - price_struct.price_, - price_struct.conf_, - price_struct.status_ + aggregate_price_info.price_, + aggregate_price_info.conf_, + aggregate_price_info.status_ ); } Ok(()) From 93121b01188b015497720af3d574a541e8077549 Mon Sep 17 00:00:00 2001 From: Guillermo Bescos Date: Fri, 22 Jul 2022 19:19:18 +0000 Subject: [PATCH 24/27] Remove old offset file --- program/rust/src/offset.h | 2 -- 1 file changed, 2 deletions(-) delete mode 100644 program/rust/src/offset.h diff --git a/program/rust/src/offset.h b/program/rust/src/offset.h deleted file mode 100644 index a50754c4c..000000000 --- a/program/rust/src/offset.h +++ /dev/null @@ -1,2 +0,0 @@ -#include -const size_t PRICE_T_CONF_OFFSET = offsetof(struct pc_price, agg_); \ No newline at end of file From 928360c913c3ce1e88c6f2ffa9b86bea822afef7 Mon Sep 17 00:00:00 2001 From: Guillermo Bescos Date: Fri, 22 Jul 2022 19:20:52 +0000 Subject: [PATCH 25/27] Remove duplicate comment --- program/rust/src/lib.rs | 17 ----------------- 1 file changed, 17 deletions(-) diff --git a/program/rust/src/lib.rs b/program/rust/src/lib.rs index 8bb79dca9..79e8d9558 100644 --- a/program/rust/src/lib.rs +++ b/program/rust/src/lib.rs @@ -23,23 +23,6 @@ use solana_program::entrypoint::deserialize; //the only limitation of our set up is that we can not unit test in rust, anything that calls //a c function. Though we can test functions that use constants/types defined in oracle.h -//Below is a high lever description of the rust/c setup. - -//As we migrate from C to Rust, our Rust code needs to be able to interract with C -//build-bpf.sh is set up to compile the C code into a bpf archive file, that build.rs -//is set up to link the rust targets to. This enables to interact with the c_entrypoint -//as well as similarly declare other C functions in Rust and call them - -//We also generate bindings for the types and constants in oracle.h (as well as other things -//included in bindings.h), these bindings can be accessed through c_oracle_header.rs -//Bindings allow us to access type definitions, function definitions and constants. In order to -//add traits to the bindings, we use the parser in build.rs. The traits must be defined/included -//at the the top of c_oracle_headers.rs. One of the most important traits we deal are the Borsh -//serialization traits. - -//the only limitation of our set up is that we can not unit test in rust, anything that calls -//a c function. Though we can test functions that use constants/types defined in oracle.h - //do not link with C during unit tests (which are built in native architecture, unlike libpyth.o) #[cfg(target_arch = "bpf")] #[link(name = "cpyth")] From 9574cfddc00c65cb4b13ea34a0a2f3a7965158a6 Mon Sep 17 00:00:00 2001 From: Guillermo Bescos Date: Mon, 25 Jul 2022 16:04:13 +0000 Subject: [PATCH 26/27] More info --- program/rust/src/lib.rs | 2 +- program/rust/src/log.rs | 61 +++++++++++++++++++++-------------------- 2 files changed, 33 insertions(+), 30 deletions(-) diff --git a/program/rust/src/lib.rs b/program/rust/src/lib.rs index 79e8d9558..2ddf766b0 100644 --- a/program/rust/src/lib.rs +++ b/program/rust/src/lib.rs @@ -40,7 +40,7 @@ pub extern "C" fn c_entrypoint(input: *mut u8) -> u64 { pub extern "C" fn entrypoint(input: *mut u8) -> u64 { let (_program_id, accounts, instruction_data) = unsafe { deserialize(input) }; - match pre_log(instruction_data) { + match pre_log(&accounts,instruction_data) { Err(error) => return error.into(), _ => {} } diff --git a/program/rust/src/log.rs b/program/rust/src/log.rs index 71495af3f..9176e3722 100644 --- a/program/rust/src/log.rs +++ b/program/rust/src/log.rs @@ -6,7 +6,7 @@ use solana_program::entrypoint::ProgramResult; use solana_program::msg; use std::mem::size_of; -pub fn pre_log(instruction_data: &[u8]) -> ProgramResult { +pub fn pre_log(accounts : &[AccountInfo], instruction_data: &[u8]) -> ProgramResult { msg!("Pyth oracle contract"); let instruction_header: cmd_hdr = cmd_hdr::try_from_slice(&instruction_data[..8])?; @@ -15,64 +15,64 @@ pub fn pre_log(instruction_data: &[u8]) -> ProgramResult { .try_into() .map_err(|_| OracleError::Generic)?; match instruction_id { - command_t_e_cmd_upd_price => { + command_t_e_cmd_upd_price | command_t_e_cmd_agg_price=> { let instruction: cmd_upd_price = cmd_upd_price::try_from_slice(instruction_data)?; msg!( - "Update price: price={:}, conf={:}, status={:}", + "UpdatePrice: publisher={:}, price_account={:}, price={:}, conf={:}, status={:}, slot={:}", + accounts.get(0) + .ok_or(OracleError::Generic)?.key, + accounts.get(1) + .ok_or(OracleError::Generic)?.key, instruction.price_, instruction.conf_, - instruction.status_ + instruction.status_, + instruction.pub_slot_ ); } - command_t_e_cmd_agg_price => { + command_t_e_cmd_upd_price_no_fail_on_error=> { let instruction: cmd_upd_price = cmd_upd_price::try_from_slice(instruction_data)?; msg!( - "Update price: price={:}, conf={:}, status={:}", + "UpdatePriceNoFailOnError: publisher={:}, price_account={:}, price={:}, conf={:}, status={:}, slot={:}", + accounts.get(0) + .ok_or(OracleError::Generic)?.key, + accounts.get(1) + .ok_or(OracleError::Generic)?.key, instruction.price_, instruction.conf_, - instruction.status_ + instruction.status_, + instruction.pub_slot_ ); } - command_t_e_cmd_upd_price_no_fail_on_error => { - let instruction: cmd_upd_price = cmd_upd_price::try_from_slice(instruction_data)?; - msg!( - "Update price no fail on error: price={:}, conf={:}, status={:}", - instruction.price_, - instruction.conf_, - instruction.status_ - ); - } - command_t_e_cmd_add_mapping => { - msg!("Add mapping"); + msg!("AddMapping"); } command_t_e_cmd_add_price => { - msg!("Add price"); + msg!("AddPrice"); } command_t_e_cmd_add_product => { - msg!("Add product") + msg!("AddProduct") } command_t_e_cmd_add_publisher => { - msg!("Add publisher") + msg!("AddPublisher") } command_t_e_cmd_del_publisher => { - msg!("Delete publisher") + msg!("DeletePublisher") } command_t_e_cmd_init_price => { - msg!("Initialize price") + msg!("InitializePrice") } command_t_e_cmd_init_mapping => { - msg!("Initialize mapping account"); + msg!("InitializeMapping"); } command_t_e_cmd_set_min_pub => { - msg!("Set minimum number of publishers"); + msg!("SetMinimumPublishers"); } command_t_e_cmd_upd_product => { - msg!("Update product"); + msg!("UpdateProduct"); } _ => { - msg!("Unrecognized instruction"); + msg!("UnrecognizedInstruction"); return Err(OracleError::Generic.into()); } } @@ -92,10 +92,13 @@ pub fn post_log(c_ret_val: u64, accounts: &[AccountInfo]) -> ProgramResult { .try_borrow_data()?[start..(start + size_of::())], )?; msg!( - "Aggregate updated : price={:}, conf={:}, status={:}", + "UpdateAggregate : price_account={:}, price={:}, conf={:}, status={:}, slot={:}", + accounts.get(1) + .ok_or(OracleError::Generic)?.key, aggregate_price_info.price_, aggregate_price_info.conf_, - aggregate_price_info.status_ + aggregate_price_info.status_, + aggregate_price_info.pub_slot_ ); } Ok(()) From 87ceaa89813a6163adb92d159a76e608264fd29d Mon Sep 17 00:00:00 2001 From: Guillermo Bescos Date: Mon, 25 Jul 2022 16:09:35 +0000 Subject: [PATCH 27/27] Don't commit bindings --- program/rust/bindings.rs | 2284 -------------------------------------- 1 file changed, 2284 deletions(-) delete mode 100644 program/rust/bindings.rs diff --git a/program/rust/bindings.rs b/program/rust/bindings.rs deleted file mode 100644 index 95bd5edb0..000000000 --- a/program/rust/bindings.rs +++ /dev/null @@ -1,2284 +0,0 @@ -/* automatically generated by rust-bindgen 0.60.1 */ - -#[repr(C)] -#[derive(Default)] -pub struct __IncompleteArrayField(::std::marker::PhantomData, [T; 0]); -impl __IncompleteArrayField { - #[inline] - pub const fn new() -> Self { - __IncompleteArrayField(::std::marker::PhantomData, []) - } - #[inline] - pub fn as_ptr(&self) -> *const T { - self as *const _ as *const T - } - #[inline] - pub fn as_mut_ptr(&mut self) -> *mut T { - self as *mut _ as *mut T - } - #[inline] - pub unsafe fn as_slice(&self, len: usize) -> &[T] { - ::std::slice::from_raw_parts(self.as_ptr(), len) - } - #[inline] - pub unsafe fn as_mut_slice(&mut self, len: usize) -> &mut [T] { - ::std::slice::from_raw_parts_mut(self.as_mut_ptr(), len) - } -} -impl ::std::fmt::Debug for __IncompleteArrayField { - fn fmt(&self, fmt: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - fmt.write_str("__IncompleteArrayField") - } -} -pub const true_: u32 = 1; -pub const false_: u32 = 0; -pub const __bool_true_false_are_defined: u32 = 1; -pub const PC_MAGIC: u32 = 2712847316; -pub const PC_VERSION: u32 = 2; -pub const PC_MAX_SEND_LATENCY: u32 = 25; -pub const PC_PUBKEY_SIZE: u32 = 32; -pub const PC_MAP_TABLE_SIZE: u32 = 640; -pub const PC_COMP_SIZE: u32 = 32; -pub const PC_MAX_NUM_DECIMALS: u32 = 8; -pub const PC_PROD_ACC_SIZE: u32 = 512; -pub const PC_EXP_DECAY: i32 = -9; -pub const PC_MAX_CI_DIVISOR: u32 = 20; -pub const PC_HEAP_START: u64 = 12884901888; -pub const PC_PTYPE_UNKNOWN: u32 = 0; -pub const PC_PTYPE_PRICE: u32 = 1; -pub const PC_STATUS_UNKNOWN: u32 = 0; -pub const PC_STATUS_TRADING: u32 = 1; -pub const PC_STATUS_HALTED: u32 = 2; -pub const PC_STATUS_AUCTION: u32 = 3; -pub const PC_ACCTYPE_MAPPING: u32 = 1; -pub const PC_ACCTYPE_PRODUCT: u32 = 2; -pub const PC_ACCTYPE_PRICE: u32 = 3; -pub const PC_ACCTYPE_TEST: u32 = 4; -pub const SUCCESSFULLY_UPDATED_AGGREGATE: u64 = 1000; -pub const TIME_MACHINE_STRUCT_SIZE: u64 = 1864; -extern "C" { - pub static sysvar_clock: [u64; 4usize]; -} -#[repr(C)] -#[derive(Copy, Clone)] -pub union pc_pub_key { - pub k1_: [u8; 32usize], - pub k8_: [u64; 4usize], -} -#[test] -fn bindgen_test_layout_pc_pub_key() { - assert_eq!( - ::std::mem::size_of::(), - 32usize, - concat!("Size of: ", stringify!(pc_pub_key)) - ); - assert_eq!( - ::std::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(pc_pub_key)) - ); - fn test_field_k1_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).k1_) as usize - ptr as usize - }, - 0usize, - concat!( - "Offset of field: ", - stringify!(pc_pub_key), - "::", - stringify!(k1_) - ) - ); - } - test_field_k1_(); - fn test_field_k8_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).k8_) as usize - ptr as usize - }, - 0usize, - concat!( - "Offset of field: ", - stringify!(pc_pub_key), - "::", - stringify!(k8_) - ) - ); - } - test_field_k8_(); -} -pub type pc_pub_key_t = pc_pub_key; -#[repr(C)] -#[derive(Debug, Copy, Clone, BorshSerialize, BorshDeserialize)] -pub struct pc_acc { - pub magic_: u32, - pub ver_: u32, - pub type_: u32, - pub size_: u32, -} -#[test] -fn bindgen_test_layout_pc_acc() { - assert_eq!( - ::std::mem::size_of::(), - 16usize, - concat!("Size of: ", stringify!(pc_acc)) - ); - assert_eq!( - ::std::mem::align_of::(), - 4usize, - concat!("Alignment of ", stringify!(pc_acc)) - ); - fn test_field_magic_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).magic_) as usize - ptr as usize - }, - 0usize, - concat!( - "Offset of field: ", - stringify!(pc_acc), - "::", - stringify!(magic_) - ) - ); - } - test_field_magic_(); - fn test_field_ver_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).ver_) as usize - ptr as usize - }, - 4usize, - concat!( - "Offset of field: ", - stringify!(pc_acc), - "::", - stringify!(ver_) - ) - ); - } - test_field_ver_(); - fn test_field_type_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).type_) as usize - ptr as usize - }, - 8usize, - concat!( - "Offset of field: ", - stringify!(pc_acc), - "::", - stringify!(type_) - ) - ); - } - test_field_type_(); - fn test_field_size_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).size_) as usize - ptr as usize - }, - 12usize, - concat!( - "Offset of field: ", - stringify!(pc_acc), - "::", - stringify!(size_) - ) - ); - } - test_field_size_(); -} -pub type pc_acc_t = pc_acc; -#[repr(C)] -#[derive(Copy, Clone)] -pub struct pc_map_table { - pub magic_: u32, - pub ver_: u32, - pub type_: u32, - pub size_: u32, - pub num_: u32, - pub unused_: u32, - pub next_: pc_pub_key_t, - pub prod_: [pc_pub_key_t; 640usize], -} -#[test] -fn bindgen_test_layout_pc_map_table() { - assert_eq!( - ::std::mem::size_of::(), - 20536usize, - concat!("Size of: ", stringify!(pc_map_table)) - ); - assert_eq!( - ::std::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(pc_map_table)) - ); - fn test_field_magic_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).magic_) as usize - ptr as usize - }, - 0usize, - concat!( - "Offset of field: ", - stringify!(pc_map_table), - "::", - stringify!(magic_) - ) - ); - } - test_field_magic_(); - fn test_field_ver_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).ver_) as usize - ptr as usize - }, - 4usize, - concat!( - "Offset of field: ", - stringify!(pc_map_table), - "::", - stringify!(ver_) - ) - ); - } - test_field_ver_(); - fn test_field_type_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).type_) as usize - ptr as usize - }, - 8usize, - concat!( - "Offset of field: ", - stringify!(pc_map_table), - "::", - stringify!(type_) - ) - ); - } - test_field_type_(); - fn test_field_size_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).size_) as usize - ptr as usize - }, - 12usize, - concat!( - "Offset of field: ", - stringify!(pc_map_table), - "::", - stringify!(size_) - ) - ); - } - test_field_size_(); - fn test_field_num_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).num_) as usize - ptr as usize - }, - 16usize, - concat!( - "Offset of field: ", - stringify!(pc_map_table), - "::", - stringify!(num_) - ) - ); - } - test_field_num_(); - fn test_field_unused_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).unused_) as usize - ptr as usize - }, - 20usize, - concat!( - "Offset of field: ", - stringify!(pc_map_table), - "::", - stringify!(unused_) - ) - ); - } - test_field_unused_(); - fn test_field_next_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).next_) as usize - ptr as usize - }, - 24usize, - concat!( - "Offset of field: ", - stringify!(pc_map_table), - "::", - stringify!(next_) - ) - ); - } - test_field_next_(); - fn test_field_prod_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).prod_) as usize - ptr as usize - }, - 56usize, - concat!( - "Offset of field: ", - stringify!(pc_map_table), - "::", - stringify!(prod_) - ) - ); - } - test_field_prod_(); -} -pub type pc_map_table_t = pc_map_table; -#[repr(C)] -#[derive(Debug)] -pub struct pc_str { - pub len_: u8, - pub data_: __IncompleteArrayField<::std::os::raw::c_char>, -} -#[test] -fn bindgen_test_layout_pc_str() { - assert_eq!( - ::std::mem::size_of::(), - 1usize, - concat!("Size of: ", stringify!(pc_str)) - ); - assert_eq!( - ::std::mem::align_of::(), - 1usize, - concat!("Alignment of ", stringify!(pc_str)) - ); - fn test_field_len_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).len_) as usize - ptr as usize - }, - 0usize, - concat!( - "Offset of field: ", - stringify!(pc_str), - "::", - stringify!(len_) - ) - ); - } - test_field_len_(); - fn test_field_data_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).data_) as usize - ptr as usize - }, - 1usize, - concat!( - "Offset of field: ", - stringify!(pc_str), - "::", - stringify!(data_) - ) - ); - } - test_field_data_(); -} -pub type pc_str_t = pc_str; -#[repr(C)] -#[derive(Copy, Clone)] -pub struct pc_prod { - pub magic_: u32, - pub ver_: u32, - pub type_: u32, - pub size_: u32, - pub px_acc_: pc_pub_key_t, -} -#[test] -fn bindgen_test_layout_pc_prod() { - assert_eq!( - ::std::mem::size_of::(), - 48usize, - concat!("Size of: ", stringify!(pc_prod)) - ); - assert_eq!( - ::std::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(pc_prod)) - ); - fn test_field_magic_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).magic_) as usize - ptr as usize - }, - 0usize, - concat!( - "Offset of field: ", - stringify!(pc_prod), - "::", - stringify!(magic_) - ) - ); - } - test_field_magic_(); - fn test_field_ver_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).ver_) as usize - ptr as usize - }, - 4usize, - concat!( - "Offset of field: ", - stringify!(pc_prod), - "::", - stringify!(ver_) - ) - ); - } - test_field_ver_(); - fn test_field_type_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).type_) as usize - ptr as usize - }, - 8usize, - concat!( - "Offset of field: ", - stringify!(pc_prod), - "::", - stringify!(type_) - ) - ); - } - test_field_type_(); - fn test_field_size_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).size_) as usize - ptr as usize - }, - 12usize, - concat!( - "Offset of field: ", - stringify!(pc_prod), - "::", - stringify!(size_) - ) - ); - } - test_field_size_(); - fn test_field_px_acc_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).px_acc_) as usize - ptr as usize - }, - 16usize, - concat!( - "Offset of field: ", - stringify!(pc_prod), - "::", - stringify!(px_acc_) - ) - ); - } - test_field_px_acc_(); -} -pub type pc_prod_t = pc_prod; -#[repr(C)] -#[derive(Debug, Copy, Clone, BorshSerialize, BorshDeserialize)] -pub struct pc_price_info { - pub price_: i64, - pub conf_: u64, - pub status_: u32, - pub corp_act_status_: u32, - pub pub_slot_: u64, -} -#[test] -fn bindgen_test_layout_pc_price_info() { - assert_eq!( - ::std::mem::size_of::(), - 32usize, - concat!("Size of: ", stringify!(pc_price_info)) - ); - assert_eq!( - ::std::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(pc_price_info)) - ); - fn test_field_price_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).price_) as usize - ptr as usize - }, - 0usize, - concat!( - "Offset of field: ", - stringify!(pc_price_info), - "::", - stringify!(price_) - ) - ); - } - test_field_price_(); - fn test_field_conf_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).conf_) as usize - ptr as usize - }, - 8usize, - concat!( - "Offset of field: ", - stringify!(pc_price_info), - "::", - stringify!(conf_) - ) - ); - } - test_field_conf_(); - fn test_field_status_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).status_) as usize - ptr as usize - }, - 16usize, - concat!( - "Offset of field: ", - stringify!(pc_price_info), - "::", - stringify!(status_) - ) - ); - } - test_field_status_(); - fn test_field_corp_act_status_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).corp_act_status_) as usize - ptr as usize - }, - 20usize, - concat!( - "Offset of field: ", - stringify!(pc_price_info), - "::", - stringify!(corp_act_status_) - ) - ); - } - test_field_corp_act_status_(); - fn test_field_pub_slot_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).pub_slot_) as usize - ptr as usize - }, - 24usize, - concat!( - "Offset of field: ", - stringify!(pc_price_info), - "::", - stringify!(pub_slot_) - ) - ); - } - test_field_pub_slot_(); -} -pub type pc_price_info_t = pc_price_info; -#[repr(C)] -#[derive(Copy, Clone)] -pub struct pc_price_comp { - pub pub_: pc_pub_key_t, - pub agg_: pc_price_info_t, - pub latest_: pc_price_info_t, -} -#[test] -fn bindgen_test_layout_pc_price_comp() { - assert_eq!( - ::std::mem::size_of::(), - 96usize, - concat!("Size of: ", stringify!(pc_price_comp)) - ); - assert_eq!( - ::std::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(pc_price_comp)) - ); - fn test_field_pub_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).pub_) as usize - ptr as usize - }, - 0usize, - concat!( - "Offset of field: ", - stringify!(pc_price_comp), - "::", - stringify!(pub_) - ) - ); - } - test_field_pub_(); - fn test_field_agg_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).agg_) as usize - ptr as usize - }, - 32usize, - concat!( - "Offset of field: ", - stringify!(pc_price_comp), - "::", - stringify!(agg_) - ) - ); - } - test_field_agg_(); - fn test_field_latest_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).latest_) as usize - ptr as usize - }, - 64usize, - concat!( - "Offset of field: ", - stringify!(pc_price_comp), - "::", - stringify!(latest_) - ) - ); - } - test_field_latest_(); -} -pub type pc_price_comp_t = pc_price_comp; -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct pc_ema { - pub val_: i64, - pub numer_: i64, - pub denom_: i64, -} -#[test] -fn bindgen_test_layout_pc_ema() { - assert_eq!( - ::std::mem::size_of::(), - 24usize, - concat!("Size of: ", stringify!(pc_ema)) - ); - assert_eq!( - ::std::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(pc_ema)) - ); - fn test_field_val_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).val_) as usize - ptr as usize - }, - 0usize, - concat!( - "Offset of field: ", - stringify!(pc_ema), - "::", - stringify!(val_) - ) - ); - } - test_field_val_(); - fn test_field_numer_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).numer_) as usize - ptr as usize - }, - 8usize, - concat!( - "Offset of field: ", - stringify!(pc_ema), - "::", - stringify!(numer_) - ) - ); - } - test_field_numer_(); - fn test_field_denom_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).denom_) as usize - ptr as usize - }, - 16usize, - concat!( - "Offset of field: ", - stringify!(pc_ema), - "::", - stringify!(denom_) - ) - ); - } - test_field_denom_(); -} -pub type pc_ema_t = pc_ema; -#[repr(C)] -#[derive(Copy, Clone)] -pub struct pc_price { - pub magic_: u32, - pub ver_: u32, - pub type_: u32, - pub size_: u32, - pub ptype_: u32, - pub expo_: i32, - pub num_: u32, - pub num_qt_: u32, - pub last_slot_: u64, - pub valid_slot_: u64, - pub twap_: pc_ema_t, - pub twac_: pc_ema_t, - pub timestamp_: i64, - pub min_pub_: u8, - pub drv2_: i8, - pub drv3_: i16, - pub drv4_: i32, - pub prod_: pc_pub_key_t, - pub next_: pc_pub_key_t, - pub prev_slot_: u64, - pub prev_price_: i64, - pub prev_conf_: u64, - pub prev_timestamp_: i64, - pub agg_: pc_price_info_t, - pub comp_: [pc_price_comp_t; 32usize], -} -#[test] -fn bindgen_test_layout_pc_price() { - assert_eq!( - ::std::mem::size_of::(), - 3312usize, - concat!("Size of: ", stringify!(pc_price)) - ); - assert_eq!( - ::std::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(pc_price)) - ); - fn test_field_magic_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).magic_) as usize - ptr as usize - }, - 0usize, - concat!( - "Offset of field: ", - stringify!(pc_price), - "::", - stringify!(magic_) - ) - ); - } - test_field_magic_(); - fn test_field_ver_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).ver_) as usize - ptr as usize - }, - 4usize, - concat!( - "Offset of field: ", - stringify!(pc_price), - "::", - stringify!(ver_) - ) - ); - } - test_field_ver_(); - fn test_field_type_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).type_) as usize - ptr as usize - }, - 8usize, - concat!( - "Offset of field: ", - stringify!(pc_price), - "::", - stringify!(type_) - ) - ); - } - test_field_type_(); - fn test_field_size_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).size_) as usize - ptr as usize - }, - 12usize, - concat!( - "Offset of field: ", - stringify!(pc_price), - "::", - stringify!(size_) - ) - ); - } - test_field_size_(); - fn test_field_ptype_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).ptype_) as usize - ptr as usize - }, - 16usize, - concat!( - "Offset of field: ", - stringify!(pc_price), - "::", - stringify!(ptype_) - ) - ); - } - test_field_ptype_(); - fn test_field_expo_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).expo_) as usize - ptr as usize - }, - 20usize, - concat!( - "Offset of field: ", - stringify!(pc_price), - "::", - stringify!(expo_) - ) - ); - } - test_field_expo_(); - fn test_field_num_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).num_) as usize - ptr as usize - }, - 24usize, - concat!( - "Offset of field: ", - stringify!(pc_price), - "::", - stringify!(num_) - ) - ); - } - test_field_num_(); - fn test_field_num_qt_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).num_qt_) as usize - ptr as usize - }, - 28usize, - concat!( - "Offset of field: ", - stringify!(pc_price), - "::", - stringify!(num_qt_) - ) - ); - } - test_field_num_qt_(); - fn test_field_last_slot_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).last_slot_) as usize - ptr as usize - }, - 32usize, - concat!( - "Offset of field: ", - stringify!(pc_price), - "::", - stringify!(last_slot_) - ) - ); - } - test_field_last_slot_(); - fn test_field_valid_slot_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).valid_slot_) as usize - ptr as usize - }, - 40usize, - concat!( - "Offset of field: ", - stringify!(pc_price), - "::", - stringify!(valid_slot_) - ) - ); - } - test_field_valid_slot_(); - fn test_field_twap_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).twap_) as usize - ptr as usize - }, - 48usize, - concat!( - "Offset of field: ", - stringify!(pc_price), - "::", - stringify!(twap_) - ) - ); - } - test_field_twap_(); - fn test_field_twac_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).twac_) as usize - ptr as usize - }, - 72usize, - concat!( - "Offset of field: ", - stringify!(pc_price), - "::", - stringify!(twac_) - ) - ); - } - test_field_twac_(); - fn test_field_timestamp_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).timestamp_) as usize - ptr as usize - }, - 96usize, - concat!( - "Offset of field: ", - stringify!(pc_price), - "::", - stringify!(timestamp_) - ) - ); - } - test_field_timestamp_(); - fn test_field_min_pub_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).min_pub_) as usize - ptr as usize - }, - 104usize, - concat!( - "Offset of field: ", - stringify!(pc_price), - "::", - stringify!(min_pub_) - ) - ); - } - test_field_min_pub_(); - fn test_field_drv2_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).drv2_) as usize - ptr as usize - }, - 105usize, - concat!( - "Offset of field: ", - stringify!(pc_price), - "::", - stringify!(drv2_) - ) - ); - } - test_field_drv2_(); - fn test_field_drv3_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).drv3_) as usize - ptr as usize - }, - 106usize, - concat!( - "Offset of field: ", - stringify!(pc_price), - "::", - stringify!(drv3_) - ) - ); - } - test_field_drv3_(); - fn test_field_drv4_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).drv4_) as usize - ptr as usize - }, - 108usize, - concat!( - "Offset of field: ", - stringify!(pc_price), - "::", - stringify!(drv4_) - ) - ); - } - test_field_drv4_(); - fn test_field_prod_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).prod_) as usize - ptr as usize - }, - 112usize, - concat!( - "Offset of field: ", - stringify!(pc_price), - "::", - stringify!(prod_) - ) - ); - } - test_field_prod_(); - fn test_field_next_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).next_) as usize - ptr as usize - }, - 144usize, - concat!( - "Offset of field: ", - stringify!(pc_price), - "::", - stringify!(next_) - ) - ); - } - test_field_next_(); - fn test_field_prev_slot_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).prev_slot_) as usize - ptr as usize - }, - 176usize, - concat!( - "Offset of field: ", - stringify!(pc_price), - "::", - stringify!(prev_slot_) - ) - ); - } - test_field_prev_slot_(); - fn test_field_prev_price_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).prev_price_) as usize - ptr as usize - }, - 184usize, - concat!( - "Offset of field: ", - stringify!(pc_price), - "::", - stringify!(prev_price_) - ) - ); - } - test_field_prev_price_(); - fn test_field_prev_conf_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).prev_conf_) as usize - ptr as usize - }, - 192usize, - concat!( - "Offset of field: ", - stringify!(pc_price), - "::", - stringify!(prev_conf_) - ) - ); - } - test_field_prev_conf_(); - fn test_field_prev_timestamp_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).prev_timestamp_) as usize - ptr as usize - }, - 200usize, - concat!( - "Offset of field: ", - stringify!(pc_price), - "::", - stringify!(prev_timestamp_) - ) - ); - } - test_field_prev_timestamp_(); - fn test_field_agg_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).agg_) as usize - ptr as usize - }, - 208usize, - concat!( - "Offset of field: ", - stringify!(pc_price), - "::", - stringify!(agg_) - ) - ); - } - test_field_agg_(); - fn test_field_comp_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).comp_) as usize - ptr as usize - }, - 240usize, - concat!( - "Offset of field: ", - stringify!(pc_price), - "::", - stringify!(comp_) - ) - ); - } - test_field_comp_(); -} -pub type pc_price_t = pc_price; -pub const command_t_e_cmd_init_mapping: command_t = 0; -pub const command_t_e_cmd_add_mapping: command_t = 1; -pub const command_t_e_cmd_add_product: command_t = 2; -pub const command_t_e_cmd_upd_product: command_t = 3; -pub const command_t_e_cmd_add_price: command_t = 4; -pub const command_t_e_cmd_add_publisher: command_t = 5; -pub const command_t_e_cmd_del_publisher: command_t = 6; -pub const command_t_e_cmd_upd_price: command_t = 7; -pub const command_t_e_cmd_agg_price: command_t = 8; -pub const command_t_e_cmd_init_price: command_t = 9; -pub const command_t_e_cmd_init_test: command_t = 10; -pub const command_t_e_cmd_upd_test: command_t = 11; -pub const command_t_e_cmd_set_min_pub: command_t = 12; -pub const command_t_e_cmd_upd_price_no_fail_on_error: command_t = 13; -pub type command_t = ::std::os::raw::c_uint; -#[repr(C)] -#[derive(Debug, Copy, Clone, BorshSerialize, BorshDeserialize)] -pub struct cmd_hdr { - pub ver_: u32, - pub cmd_: i32, -} -#[test] -fn bindgen_test_layout_cmd_hdr() { - assert_eq!( - ::std::mem::size_of::(), - 8usize, - concat!("Size of: ", stringify!(cmd_hdr)) - ); - assert_eq!( - ::std::mem::align_of::(), - 4usize, - concat!("Alignment of ", stringify!(cmd_hdr)) - ); - fn test_field_ver_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).ver_) as usize - ptr as usize - }, - 0usize, - concat!( - "Offset of field: ", - stringify!(cmd_hdr), - "::", - stringify!(ver_) - ) - ); - } - test_field_ver_(); - fn test_field_cmd_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).cmd_) as usize - ptr as usize - }, - 4usize, - concat!( - "Offset of field: ", - stringify!(cmd_hdr), - "::", - stringify!(cmd_) - ) - ); - } - test_field_cmd_(); -} -pub type cmd_hdr_t = cmd_hdr; -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct cmd_add_product { - pub ver_: u32, - pub cmd_: i32, -} -#[test] -fn bindgen_test_layout_cmd_add_product() { - assert_eq!( - ::std::mem::size_of::(), - 8usize, - concat!("Size of: ", stringify!(cmd_add_product)) - ); - assert_eq!( - ::std::mem::align_of::(), - 4usize, - concat!("Alignment of ", stringify!(cmd_add_product)) - ); - fn test_field_ver_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).ver_) as usize - ptr as usize - }, - 0usize, - concat!( - "Offset of field: ", - stringify!(cmd_add_product), - "::", - stringify!(ver_) - ) - ); - } - test_field_ver_(); - fn test_field_cmd_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).cmd_) as usize - ptr as usize - }, - 4usize, - concat!( - "Offset of field: ", - stringify!(cmd_add_product), - "::", - stringify!(cmd_) - ) - ); - } - test_field_cmd_(); -} -pub type cmd_add_product_t = cmd_add_product; -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct cmd_upd_product { - pub ver_: u32, - pub cmd_: i32, -} -#[test] -fn bindgen_test_layout_cmd_upd_product() { - assert_eq!( - ::std::mem::size_of::(), - 8usize, - concat!("Size of: ", stringify!(cmd_upd_product)) - ); - assert_eq!( - ::std::mem::align_of::(), - 4usize, - concat!("Alignment of ", stringify!(cmd_upd_product)) - ); - fn test_field_ver_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).ver_) as usize - ptr as usize - }, - 0usize, - concat!( - "Offset of field: ", - stringify!(cmd_upd_product), - "::", - stringify!(ver_) - ) - ); - } - test_field_ver_(); - fn test_field_cmd_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).cmd_) as usize - ptr as usize - }, - 4usize, - concat!( - "Offset of field: ", - stringify!(cmd_upd_product), - "::", - stringify!(cmd_) - ) - ); - } - test_field_cmd_(); -} -pub type cmd_upd_product_t = cmd_upd_product; -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct cmd_add_price { - pub ver_: u32, - pub cmd_: i32, - pub expo_: i32, - pub ptype_: u32, -} -#[test] -fn bindgen_test_layout_cmd_add_price() { - assert_eq!( - ::std::mem::size_of::(), - 16usize, - concat!("Size of: ", stringify!(cmd_add_price)) - ); - assert_eq!( - ::std::mem::align_of::(), - 4usize, - concat!("Alignment of ", stringify!(cmd_add_price)) - ); - fn test_field_ver_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).ver_) as usize - ptr as usize - }, - 0usize, - concat!( - "Offset of field: ", - stringify!(cmd_add_price), - "::", - stringify!(ver_) - ) - ); - } - test_field_ver_(); - fn test_field_cmd_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).cmd_) as usize - ptr as usize - }, - 4usize, - concat!( - "Offset of field: ", - stringify!(cmd_add_price), - "::", - stringify!(cmd_) - ) - ); - } - test_field_cmd_(); - fn test_field_expo_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).expo_) as usize - ptr as usize - }, - 8usize, - concat!( - "Offset of field: ", - stringify!(cmd_add_price), - "::", - stringify!(expo_) - ) - ); - } - test_field_expo_(); - fn test_field_ptype_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).ptype_) as usize - ptr as usize - }, - 12usize, - concat!( - "Offset of field: ", - stringify!(cmd_add_price), - "::", - stringify!(ptype_) - ) - ); - } - test_field_ptype_(); -} -pub type cmd_add_price_t = cmd_add_price; -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct cmd_init_price { - pub ver_: u32, - pub cmd_: i32, - pub expo_: i32, - pub ptype_: u32, -} -#[test] -fn bindgen_test_layout_cmd_init_price() { - assert_eq!( - ::std::mem::size_of::(), - 16usize, - concat!("Size of: ", stringify!(cmd_init_price)) - ); - assert_eq!( - ::std::mem::align_of::(), - 4usize, - concat!("Alignment of ", stringify!(cmd_init_price)) - ); - fn test_field_ver_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).ver_) as usize - ptr as usize - }, - 0usize, - concat!( - "Offset of field: ", - stringify!(cmd_init_price), - "::", - stringify!(ver_) - ) - ); - } - test_field_ver_(); - fn test_field_cmd_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).cmd_) as usize - ptr as usize - }, - 4usize, - concat!( - "Offset of field: ", - stringify!(cmd_init_price), - "::", - stringify!(cmd_) - ) - ); - } - test_field_cmd_(); - fn test_field_expo_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).expo_) as usize - ptr as usize - }, - 8usize, - concat!( - "Offset of field: ", - stringify!(cmd_init_price), - "::", - stringify!(expo_) - ) - ); - } - test_field_expo_(); - fn test_field_ptype_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).ptype_) as usize - ptr as usize - }, - 12usize, - concat!( - "Offset of field: ", - stringify!(cmd_init_price), - "::", - stringify!(ptype_) - ) - ); - } - test_field_ptype_(); -} -pub type cmd_init_price_t = cmd_init_price; -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct cmd_set_min_pub { - pub ver_: u32, - pub cmd_: i32, - pub min_pub_: u8, -} -#[test] -fn bindgen_test_layout_cmd_set_min_pub() { - assert_eq!( - ::std::mem::size_of::(), - 12usize, - concat!("Size of: ", stringify!(cmd_set_min_pub)) - ); - assert_eq!( - ::std::mem::align_of::(), - 4usize, - concat!("Alignment of ", stringify!(cmd_set_min_pub)) - ); - fn test_field_ver_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).ver_) as usize - ptr as usize - }, - 0usize, - concat!( - "Offset of field: ", - stringify!(cmd_set_min_pub), - "::", - stringify!(ver_) - ) - ); - } - test_field_ver_(); - fn test_field_cmd_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).cmd_) as usize - ptr as usize - }, - 4usize, - concat!( - "Offset of field: ", - stringify!(cmd_set_min_pub), - "::", - stringify!(cmd_) - ) - ); - } - test_field_cmd_(); - fn test_field_min_pub_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).min_pub_) as usize - ptr as usize - }, - 8usize, - concat!( - "Offset of field: ", - stringify!(cmd_set_min_pub), - "::", - stringify!(min_pub_) - ) - ); - } - test_field_min_pub_(); -} -pub type cmd_set_min_pub_t = cmd_set_min_pub; -#[repr(C)] -#[derive(Copy, Clone)] -pub struct cmd_add_publisher { - pub ver_: u32, - pub cmd_: i32, - pub pub_: pc_pub_key_t, -} -#[test] -fn bindgen_test_layout_cmd_add_publisher() { - assert_eq!( - ::std::mem::size_of::(), - 40usize, - concat!("Size of: ", stringify!(cmd_add_publisher)) - ); - assert_eq!( - ::std::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(cmd_add_publisher)) - ); - fn test_field_ver_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).ver_) as usize - ptr as usize - }, - 0usize, - concat!( - "Offset of field: ", - stringify!(cmd_add_publisher), - "::", - stringify!(ver_) - ) - ); - } - test_field_ver_(); - fn test_field_cmd_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).cmd_) as usize - ptr as usize - }, - 4usize, - concat!( - "Offset of field: ", - stringify!(cmd_add_publisher), - "::", - stringify!(cmd_) - ) - ); - } - test_field_cmd_(); - fn test_field_pub_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).pub_) as usize - ptr as usize - }, - 8usize, - concat!( - "Offset of field: ", - stringify!(cmd_add_publisher), - "::", - stringify!(pub_) - ) - ); - } - test_field_pub_(); -} -pub type cmd_add_publisher_t = cmd_add_publisher; -#[repr(C)] -#[derive(Copy, Clone)] -pub struct cmd_del_publisher { - pub ver_: u32, - pub cmd_: i32, - pub pub_: pc_pub_key_t, -} -#[test] -fn bindgen_test_layout_cmd_del_publisher() { - assert_eq!( - ::std::mem::size_of::(), - 40usize, - concat!("Size of: ", stringify!(cmd_del_publisher)) - ); - assert_eq!( - ::std::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(cmd_del_publisher)) - ); - fn test_field_ver_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).ver_) as usize - ptr as usize - }, - 0usize, - concat!( - "Offset of field: ", - stringify!(cmd_del_publisher), - "::", - stringify!(ver_) - ) - ); - } - test_field_ver_(); - fn test_field_cmd_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).cmd_) as usize - ptr as usize - }, - 4usize, - concat!( - "Offset of field: ", - stringify!(cmd_del_publisher), - "::", - stringify!(cmd_) - ) - ); - } - test_field_cmd_(); - fn test_field_pub_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).pub_) as usize - ptr as usize - }, - 8usize, - concat!( - "Offset of field: ", - stringify!(cmd_del_publisher), - "::", - stringify!(pub_) - ) - ); - } - test_field_pub_(); -} -pub type cmd_del_publisher_t = cmd_del_publisher; -#[repr(C)] -#[derive(Debug, Copy, Clone, BorshSerialize, BorshDeserialize)] -pub struct cmd_upd_price { - pub ver_: u32, - pub cmd_: i32, - pub status_: u32, - pub unused_: u32, - pub price_: i64, - pub conf_: u64, - pub pub_slot_: u64, -} -#[test] -fn bindgen_test_layout_cmd_upd_price() { - assert_eq!( - ::std::mem::size_of::(), - 40usize, - concat!("Size of: ", stringify!(cmd_upd_price)) - ); - assert_eq!( - ::std::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(cmd_upd_price)) - ); - fn test_field_ver_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).ver_) as usize - ptr as usize - }, - 0usize, - concat!( - "Offset of field: ", - stringify!(cmd_upd_price), - "::", - stringify!(ver_) - ) - ); - } - test_field_ver_(); - fn test_field_cmd_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).cmd_) as usize - ptr as usize - }, - 4usize, - concat!( - "Offset of field: ", - stringify!(cmd_upd_price), - "::", - stringify!(cmd_) - ) - ); - } - test_field_cmd_(); - fn test_field_status_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).status_) as usize - ptr as usize - }, - 8usize, - concat!( - "Offset of field: ", - stringify!(cmd_upd_price), - "::", - stringify!(status_) - ) - ); - } - test_field_status_(); - fn test_field_unused_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).unused_) as usize - ptr as usize - }, - 12usize, - concat!( - "Offset of field: ", - stringify!(cmd_upd_price), - "::", - stringify!(unused_) - ) - ); - } - test_field_unused_(); - fn test_field_price_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).price_) as usize - ptr as usize - }, - 16usize, - concat!( - "Offset of field: ", - stringify!(cmd_upd_price), - "::", - stringify!(price_) - ) - ); - } - test_field_price_(); - fn test_field_conf_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).conf_) as usize - ptr as usize - }, - 24usize, - concat!( - "Offset of field: ", - stringify!(cmd_upd_price), - "::", - stringify!(conf_) - ) - ); - } - test_field_conf_(); - fn test_field_pub_slot_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).pub_slot_) as usize - ptr as usize - }, - 32usize, - concat!( - "Offset of field: ", - stringify!(cmd_upd_price), - "::", - stringify!(pub_slot_) - ) - ); - } - test_field_pub_slot_(); -} -pub type cmd_upd_price_t = cmd_upd_price; -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct cmd_upd_test { - pub ver_: u32, - pub cmd_: i32, - pub num_: u32, - pub expo_: i32, - pub slot_diff_: [i8; 32usize], - pub price_: [i64; 32usize], - pub conf_: [u64; 32usize], -} -#[test] -fn bindgen_test_layout_cmd_upd_test() { - assert_eq!( - ::std::mem::size_of::(), - 560usize, - concat!("Size of: ", stringify!(cmd_upd_test)) - ); - assert_eq!( - ::std::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(cmd_upd_test)) - ); - fn test_field_ver_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).ver_) as usize - ptr as usize - }, - 0usize, - concat!( - "Offset of field: ", - stringify!(cmd_upd_test), - "::", - stringify!(ver_) - ) - ); - } - test_field_ver_(); - fn test_field_cmd_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).cmd_) as usize - ptr as usize - }, - 4usize, - concat!( - "Offset of field: ", - stringify!(cmd_upd_test), - "::", - stringify!(cmd_) - ) - ); - } - test_field_cmd_(); - fn test_field_num_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).num_) as usize - ptr as usize - }, - 8usize, - concat!( - "Offset of field: ", - stringify!(cmd_upd_test), - "::", - stringify!(num_) - ) - ); - } - test_field_num_(); - fn test_field_expo_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).expo_) as usize - ptr as usize - }, - 12usize, - concat!( - "Offset of field: ", - stringify!(cmd_upd_test), - "::", - stringify!(expo_) - ) - ); - } - test_field_expo_(); - fn test_field_slot_diff_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).slot_diff_) as usize - ptr as usize - }, - 16usize, - concat!( - "Offset of field: ", - stringify!(cmd_upd_test), - "::", - stringify!(slot_diff_) - ) - ); - } - test_field_slot_diff_(); - fn test_field_price_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).price_) as usize - ptr as usize - }, - 48usize, - concat!( - "Offset of field: ", - stringify!(cmd_upd_test), - "::", - stringify!(price_) - ) - ); - } - test_field_price_(); - fn test_field_conf_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).conf_) as usize - ptr as usize - }, - 304usize, - concat!( - "Offset of field: ", - stringify!(cmd_upd_test), - "::", - stringify!(conf_) - ) - ); - } - test_field_conf_(); -} -pub type cmd_upd_test_t = cmd_upd_test; -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct sysvar_clock { - pub slot_: u64, - pub epoch_start_timestamp_: i64, - pub epoch_: u64, - pub leader_schedule_epoch_: u64, - pub unix_timestamp_: i64, -} -#[test] -fn bindgen_test_layout_sysvar_clock() { - assert_eq!( - ::std::mem::size_of::(), - 40usize, - concat!("Size of: ", stringify!(sysvar_clock)) - ); - assert_eq!( - ::std::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(sysvar_clock)) - ); - fn test_field_slot_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).slot_) as usize - ptr as usize - }, - 0usize, - concat!( - "Offset of field: ", - stringify!(sysvar_clock), - "::", - stringify!(slot_) - ) - ); - } - test_field_slot_(); - fn test_field_epoch_start_timestamp_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).epoch_start_timestamp_) as usize - ptr as usize - }, - 8usize, - concat!( - "Offset of field: ", - stringify!(sysvar_clock), - "::", - stringify!(epoch_start_timestamp_) - ) - ); - } - test_field_epoch_start_timestamp_(); - fn test_field_epoch_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).epoch_) as usize - ptr as usize - }, - 16usize, - concat!( - "Offset of field: ", - stringify!(sysvar_clock), - "::", - stringify!(epoch_) - ) - ); - } - test_field_epoch_(); - fn test_field_leader_schedule_epoch_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).leader_schedule_epoch_) as usize - ptr as usize - }, - 24usize, - concat!( - "Offset of field: ", - stringify!(sysvar_clock), - "::", - stringify!(leader_schedule_epoch_) - ) - ); - } - test_field_leader_schedule_epoch_(); - fn test_field_unix_timestamp_() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).unix_timestamp_) as usize - ptr as usize - }, - 32usize, - concat!( - "Offset of field: ", - stringify!(sysvar_clock), - "::", - stringify!(unix_timestamp_) - ) - ); - } - test_field_unix_timestamp_(); -} -pub type sysvar_clock_t = sysvar_clock; -pub type size_t = ::std::os::raw::c_ulong; -pub type wchar_t = ::std::os::raw::c_int; -#[repr(C)] -#[repr(align(16))] -#[derive(Debug, Copy, Clone)] -pub struct max_align_t { - pub __clang_max_align_nonce1: ::std::os::raw::c_longlong, - pub __bindgen_padding_0: u64, - pub __clang_max_align_nonce2: u128, -} -#[test] -fn bindgen_test_layout_max_align_t() { - assert_eq!( - ::std::mem::size_of::(), - 32usize, - concat!("Size of: ", stringify!(max_align_t)) - ); - assert_eq!( - ::std::mem::align_of::(), - 16usize, - concat!("Alignment of ", stringify!(max_align_t)) - ); - fn test_field___clang_max_align_nonce1() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).__clang_max_align_nonce1) as usize - ptr as usize - }, - 0usize, - concat!( - "Offset of field: ", - stringify!(max_align_t), - "::", - stringify!(__clang_max_align_nonce1) - ) - ); - } - test_field___clang_max_align_nonce1(); - fn test_field___clang_max_align_nonce2() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).__clang_max_align_nonce2) as usize - ptr as usize - }, - 16usize, - concat!( - "Offset of field: ", - stringify!(max_align_t), - "::", - stringify!(__clang_max_align_nonce2) - ) - ); - } - test_field___clang_max_align_nonce2(); -} -pub const PRICE_T_EXPO_OFFSET: size_t = 20; -pub const PRICE_T_TIMESTAMP_OFFSET: size_t = 96; -pub const PRICE_T_AGGREGATE_OFFSET: size_t = 208; -pub const PRICE_T_AGGREGATE_CONF_OFFSET: size_t = 216; -pub const PRICE_T_AGGREGATE_PRICE_OFFSET: size_t = 208; -pub const PRICE_T_AGGREGATE_STATUS_OFFSET: size_t = 224; -pub const PRICE_T_PREV_TIMESTAMP_OFFSET: size_t = 200; -pub const PRICE_T_PREV_CONF_OFFSET: size_t = 192; -pub const PRICE_T_PREV_AGGREGATE_OFFSET: size_t = 184;