-
Notifications
You must be signed in to change notification settings - Fork 157
Ports command line argument handling for proxy and handler to Rust #48232
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PR looks good! Minus one debugging statement left in I think this is ready to test on a node for correctness.
8319e99
to
ce7de89
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Everything here looks good to me, going to tag in Justin though for a more thorough review of the c++ pieces.
…te struct issue in bindgen for handler and proxy
9f4e249
to
f32d28f
Compare
This change is a part of the transition from C++ to Rust.
Argument handling has been collapsed into core/[handler/proxy]argsdata.cpp and core/[handler/proxy]cliargs.rs for C++ and Rust respectively. Old argument parsing logic was removed from the C++ modules. Runner was updated with the new command line values to standardize tags. ArgsData in Runner was updated to RunnerArgsData for differentiation.
In the Rust modules, handler and proxy use clap to parse arguments into CliArgs, convert to its FFI struct equivalent [Handler/Proxy]CliArgsFfi, and then call handler_main and proxy_main respectively with the [Handler/Proxy]CliArgsFfi variable being passed in as the argument. cbindgen creates a binding for [Handler/Proxy]CliArgsFfi within "rust/bindings.h" for use by C++ at compilation time. Then in the C++ modules, the [Handler/Proxy]CliArgsFfi gets loaded into an ArgsData struct for use with QT types and loaded into the Settings struct.
cbindgen was used to pass the data through because the linker had trouble with cxx due to QT (that wasn't able to be resolved with cxx-qt), but it'll be good to use cxx in the future for security and stability to create safe bindings (vs the unsafe bindings from cbindgen).
I've created unit testing for both the Rust modules that send the arguments within cliargs.rs and the C++ modules that receive the modules within [handler/proxy]argstest.cpp. Both test with the same values and the same two use cases— all arguments are set and no arguments are set.
Tested on a canary node (lck) on 08/08/2025.