Skip to content

Commit

Permalink
sync
Browse files Browse the repository at this point in the history
  • Loading branch information
abenso committed Nov 8, 2024
1 parent a9e804a commit 702f7c1
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 13 deletions.
3 changes: 3 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,8 @@ file(GLOB_RECURSE LIB_SRC
${CMAKE_CURRENT_SOURCE_DIR}/app/src/nanopb_tiny/pb_common.c
${CMAKE_CURRENT_SOURCE_DIR}/app/src/nanopb_tiny/pb_decode.c
${CMAKE_CURRENT_SOURCE_DIR}/app/src/parser_interface.c
${CMAKE_CURRENT_SOURCE_DIR}/app/src/spend_plan.c
${CMAKE_CURRENT_SOURCE_DIR}/app/src/parser_pb_utils.c
)

add_library(app_lib STATIC ${LIB_SRC})
Expand Down Expand Up @@ -233,6 +235,7 @@ target_include_directories(unittests PRIVATE
${CONAN_INCLUDE_DIRS_JSONCPP}
${CMAKE_CURRENT_SOURCE_DIR}/app/src
${CMAKE_CURRENT_SOURCE_DIR}/app/src/lib
${CMAKE_CURRENT_SOURCE_DIR}/app/rust/include
)

target_link_libraries(unittests PRIVATE
Expand Down
9 changes: 9 additions & 0 deletions app/rust/.cargo/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,12 @@ rustflags = [
"-C",
"inline-threshold=0",
]


[target.'cfg(target_os = "linux")']
rustflags = [
"-C",
"link-arg=-Wl,--gc-sections",
"-C",
"link-arg=-Wl,--as-needed",
]
8 changes: 8 additions & 0 deletions app/rust/include/rslib.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@

#include "coin.h"

#ifdef __cplusplus
extern "C" {
#endif

void get_sr25519_sk(uint8_t *sk_ed25519_expanded);

void sign_sr25519_phase1(const uint8_t *sk_ed25519_expanded, const uint8_t *pk, const uint8_t *context_ptr,
Expand All @@ -27,3 +31,7 @@ parser_error_t rs_compute_transaction_plan(transaction_plan_t *plan, uint8_t *ou

int32_t rs_bech32_encode(const uint8_t *hrp_ptr, size_t hrp_len, const uint8_t *data_ptr, size_t data_len,
uint8_t *output_ptr, size_t output_len);

#ifdef __cplusplus
}
#endif
16 changes: 8 additions & 8 deletions app/rust/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
********************************************************************************/
#![no_std]
// #![no_std]
#![no_builtins]
#![allow(dead_code)]
#![deny(unused_crate_dependencies)]
Expand Down Expand Up @@ -43,14 +43,14 @@ pub(crate) use utils::prf::{expand_fq, expand_fr};

fn debug(_msg: &str) {}

#[cfg(all(not(test), not(feature = "clippy"), not(feature = "fuzzing")))]
use core::panic::PanicInfo;
// #[cfg(all(not(test), not(feature = "clippy"), not(feature = "fuzzing")))]
// use core::panic::PanicInfo;

#[cfg(all(not(test), not(feature = "clippy"), not(feature = "fuzzing")))]
#[panic_handler]
fn panic(_info: &PanicInfo) -> ! {
loop {}
}
// #[cfg(all(not(test), not(feature = "clippy"), not(feature = "fuzzing")))]
// #[panic_handler]
// fn panic(_info: &PanicInfo) -> ! {
// loop {}
// }

extern "C" {
fn check_app_canary();
Expand Down
9 changes: 4 additions & 5 deletions app/src/spend_plan.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,6 @@
********************************************************************************/
#pragma once

#ifdef __cplusplus
extern "C" {
#endif

#include <stddef.h>
#include <stdint.h>

Expand All @@ -31,7 +27,10 @@ extern "C" {

#include "pb_common.h"
#include "pb_decode.h"
#include "protobuf/penumbra/core/transaction/v1/transaction.pb.h"

#ifdef __cplusplus
extern "C" {
#endif

parser_error_t decode_spend_plan(const Bytes_t *input, spend_plan_t *spend_plan);

Expand Down

0 comments on commit 702f7c1

Please sign in to comment.