sign_tx: rename signing cbor getters to match the other params() calls
What changed, and why it matters
This commit is a simple code cleanup: it renames several internal helper functions from names starting with 'rpc_get_' to names starting with 'params_' so they match the naming style used elsewhere in the project. It also makes two helpers 'static' (private to their file) and fixes a typo in a comment. There is no change to behavior, no bug fix, and no security impact.
No action required; this is a non-functional refactor.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The diff renames rpc_get_signing_tx() to params_txn(), rpc_get_signing_outputs() to params_signing_outputs(), rpc_get_additional_info() to params_additional_info(), and rpc_get_trusted_commitments() to params_trusted_commitments(). The first two are additionally marked static. A parameter name is changed from ‘value’ to ‘params’ and a comment typo ‘additional_data’ is corrected to ‘additional_info’. No logic, parsing, memory handling, or control flow changes are present.
Changed components
main/process/sign_tx.cmain/process/sign_utils.cmain/process/sign_utils.hInspect captured patch +17 / −19
diff --git a/main/process/sign_tx.c b/main/process/sign_tx.c
index 294d67d..f097cf6 100644
--- a/main/process/sign_tx.c
+++ b/main/process/sign_tx.c
@@ -23,7 +23,7 @@
#include "sign_utils.h"
-struct wally_tx* rpc_get_signing_tx(
+static struct wally_tx* params_txn(
jade_process_t* process, const CborValue* params, const network_t network_id, const bool for_liquid)
{
struct wally_tx* tx = NULL;
@@ -97,7 +97,7 @@ fail:
}
// Can optionally be passed paths for change outputs, which we verify internally
-bool rpc_get_signing_outputs(jade_process_t* process, const CborValue* params, const network_t network_id,
+static bool params_signing_outputs(jade_process_t* process, const CborValue* params, const network_t network_id,
const bool for_liquid, const struct wally_tx* tx, output_info_t** output_info)
{
JADE_ASSERT(process);
@@ -502,7 +502,7 @@ static void sign_tx_impl(jade_process_t* process, const bool for_liquid)
CHECK_NETWORK_CONSISTENT(process);
const jade_msg_source_t source = process->ctx.source;
- struct wally_tx* tx = rpc_get_signing_tx(process, ¶ms, network_id, for_liquid);
+ struct wally_tx* tx = params_txn(process, ¶ms, network_id, for_liquid);
if (!tx) {
goto cleanup;
}
@@ -514,13 +514,13 @@ static void sign_tx_impl(jade_process_t* process, const bool for_liquid)
commitment_t* commitments = NULL;
// Liquid: Copy trusted commitment data so we can free the message
- if (for_liquid && !rpc_get_trusted_commitments(process, ¶ms, tx, &commitments)) {
+ if (for_liquid && !params_trusted_commitments(process, ¶ms, tx, &commitments)) {
goto cleanup;
}
// Optional info for wallet outputs
output_info_t* output_info = NULL;
- if (!rpc_get_signing_outputs(process, ¶ms, network_id, for_liquid, tx, &output_info)) {
+ if (!params_signing_outputs(process, ¶ms, network_id, for_liquid, tx, &output_info)) {
goto cleanup;
}
@@ -545,7 +545,7 @@ static void sign_tx_impl(jade_process_t* process, const bool for_liquid)
TxType_t txtype = TXTYPE_SEND_PAYMENT;
// Liquid: Get any data from the optional 'additional_info' section
if (for_liquid
- && !rpc_get_additional_info(
+ && !params_additional_info(
process, ¶ms, tx, &txtype, &is_partial, &in_sums, &num_in_sums, &out_sums, &num_out_sums)) {
goto cleanup;
}
diff --git a/main/process/sign_utils.c b/main/process/sign_utils.c
index 5f2ac4d..86de814 100644
--- a/main/process/sign_utils.c
+++ b/main/process/sign_utils.c
@@ -131,9 +131,8 @@ done:
return true;
}
-TxType_t rpc_get_additional_info(jade_process_t* process, CborValue* params, const struct wally_tx* tx,
- TxType_t* txtype, bool* is_partial, asset_summary_t** in_sums, size_t* num_in_sums, asset_summary_t** out_sums,
- size_t* num_out_sums)
+TxType_t params_additional_info(jade_process_t* process, CborValue* params, const struct wally_tx* tx, TxType_t* txtype,
+ bool* is_partial, asset_summary_t** in_sums, size_t* num_in_sums, asset_summary_t** out_sums, size_t* num_out_sums)
{
JADE_ASSERT(params);
JADE_ASSERT(tx);
@@ -147,7 +146,7 @@ TxType_t rpc_get_additional_info(jade_process_t* process, CborValue* params, con
*is_partial = false;
*txtype = TXTYPE_SEND_PAYMENT;
- // If no 'additional_data' passed, assume this is a a simple send-payment 'classic' tx
+ // If no 'additional_info' passed, assume this is a a simple send-payment 'classic' tx
CborValue additional_info;
if (!rpc_get_map("additional_info", params, &additional_info)) {
return true;
@@ -280,18 +279,18 @@ bool get_commitment_data(CborValue* item, commitment_t* commitment)
return true;
}
-bool rpc_get_trusted_commitments(
- jade_process_t* process, const CborValue* value, const struct wally_tx* tx, commitment_t** data)
+bool params_trusted_commitments(
+ jade_process_t* process, const CborValue* params, const struct wally_tx* tx, commitment_t** data)
{
JADE_ASSERT(process);
- JADE_ASSERT(value);
+ JADE_ASSERT(params);
JADE_ASSERT(tx);
JADE_INIT_OUT_PPTR(data);
const char* errmsg = NULL;
CborValue result;
- if (!rpc_get_array("trusted_commitments", value, &result)) {
+ if (!rpc_get_array("trusted_commitments", params, &result)) {
errmsg = "Failed to extract trusted commitments from parameters";
goto cleanup;
}
diff --git a/main/process/sign_utils.h b/main/process/sign_utils.h
index 01f026e..d3162f5 100644
--- a/main/process/sign_utils.h
+++ b/main/process/sign_utils.h
@@ -19,12 +19,11 @@ typedef struct _asset_summary {
uint64_t validated_value;
} asset_summary_t;
-bool rpc_get_trusted_commitments(
- jade_process_t* process, const CborValue* value, const struct wally_tx* tx, commitment_t** data);
+bool params_trusted_commitments(
+ jade_process_t* process, const CborValue* params, const struct wally_tx* tx, commitment_t** data);
-TxType_t rpc_get_additional_info(jade_process_t* process, CborValue* params, const struct wally_tx* tx,
- TxType_t* txtype, bool* is_partial, asset_summary_t** in_sums, size_t* num_in_sums, asset_summary_t** out_sums,
- size_t* num_out_sums);
+TxType_t params_additional_info(jade_process_t* process, CborValue* params, const struct wally_tx* tx, TxType_t* txtype,
+ bool* is_partial, asset_summary_t** in_sums, size_t* num_in_sums, asset_summary_t** out_sums, size_t* num_out_sums);
bool get_commitment_data(CborValue* item, commitment_t* commitment);
bool verify_commitment_consistent(const commitment_t* commitments, const char** errmsg);
Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.