Skip to content

Conversation

@satoshiotomakan
Copy link
Collaborator

This pull request refactors memory handling in the Rust FFI layer to simplify error handling and improve API consistency. The main change is that methods like CByteArrayRef::to_vec() and CByteArrayRef::as_slice() now always return a value (empty if pointer is NULL), instead of an Option. Additionally, a new test is added for Ethereum Barz authorization with an empty-array representation of zero nonce.

Memory API refactoring

FFI function simplification

  • rust/tw_keypair/src/ffi/privkey.rs, rust/tw_keypair/src/ffi/pubkey.rs, rust/tw_keypair/src/ffi/asn.rs: Removed error-handling macros (try_or_else!, try_or_false!) from FFI functions, relying on the new memory API to return empty values on invalid input instead. [1] [2] [3] [4] [5] [6]

Testing improvements

@github-actions
Copy link

Binary size comparison

➡️ aarch64-apple-ios: 14.11 MB

➡️ aarch64-apple-ios-sim:

- 14.11 MB
+ 14.11 MB 	 -1 KB

➡️ aarch64-linux-android:

- 18.57 MB
+ 18.57 MB 	 -1 KB

➡️ armv7-linux-androideabi: 15.53 MB

➡️ wasm32-unknown-emscripten:

- 13.23 MB
+ 13.23 MB 	 -1 KB

@satoshiotomakan satoshiotomakan merged commit 6d1a0ed into master Sep 29, 2025
15 checks passed
@satoshiotomakan satoshiotomakan deleted the fix/barz-zero-uint256 branch September 29, 2025 16:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants