File tree Expand file tree Collapse file tree 3 files changed +12
-13
lines changed Expand file tree Collapse file tree 3 files changed +12
-13
lines changed Original file line number Diff line number Diff line change 11fn main ( ) {
22 println ! ( "cargo:rustc-link-search=../c/target" ) ;
3- }
3+ }
Original file line number Diff line number Diff line change 33mod c_oracle_header;
44mod time_machine_types;
55
6- //do not link with C during unit tests (which are built in native architecture, unlike libpyth.o)
6+ //do not link with C during unit tests (which are built in native architecture, unlike libpyth.o)
77#[ cfg( target_arch = "bpf" ) ]
88#[ link( name = "cpyth" ) ]
99extern "C" {
@@ -12,18 +12,17 @@ extern "C" {
1212
1313//make the C entrypoint a no-op when running cargo test
1414#[ cfg( not( target_arch = "bpf" ) ) ]
15- pub extern "C" fn c_entrypoint ( input : * mut u8 ) -> u64 {
16- 0 //SUCCESS value
15+ pub extern "C" fn c_entrypoint ( input : * mut u8 ) -> u64 {
16+ 0 //SUCCESS value
1717}
1818
19-
2019#[ no_mangle]
2120pub extern "C" fn entrypoint ( input : * mut u8 ) -> u64 {
22- let c_ret_val = unsafe { c_entrypoint ( input) } ;
23- if c_ret_val == c_oracle_header:: SUCCESSFULLY_UPDATED_AGGREGATE {
21+ let c_ret_val = unsafe { c_entrypoint ( input) } ;
22+ if c_ret_val == c_oracle_header:: SUCCESSFULLY_UPDATED_AGGREGATE {
2423 //0 is the SUCCESS value for solana
2524 return 0 ;
2625 } else {
2726 return c_ret_val;
2827 }
29- }
28+ }
Original file line number Diff line number Diff line change 11use super :: c_oracle_header;
22#[ derive( Debug , Clone ) ]
33#[ repr( C ) ]
4- /// this wraps multiple SMA and tick trackers, and includes all the state
5- /// used by the time machine
6- pub struct TimeMachineWrapper {
4+ /// this wraps multiple SMA and tick trackers, and includes all the state
5+ /// used by the time machine
6+ pub struct TimeMachineWrapper {
77 //Place holder with the size of the fields I am planning to add
8- place_holder : [ u8 ; 1864 ] ,
8+ place_holder : [ u8 ; 1864 ] ,
99}
1010
1111#[ test]
@@ -17,4 +17,4 @@ fn c_time_machine_size_is_correct() {
1717 c_oracle_header:: TIME_MACHINE_STRUCT_SIZE . try_into( ) . unwrap( ) ,
1818 "expected TIME_MACHINE_STRUCT_SIZE in oracle.h to the same as the size of TimeMachineWrapper"
1919 ) ;
20- }
20+ }
You can’t perform that action at this time.
0 commit comments