Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion dash/src/bip152.rs
Original file line number Diff line number Diff line change
Expand Up @@ -504,7 +504,7 @@ mod test {
fn test_getblocktx_panic_when_encoding_u64_max() {
serialize(&BlockTransactionsRequest {
block_hash: Hash::all_zeros(),
indexes: vec![core::u64::MAX],
indexes: vec![u64::MAX],
});
}
}
1 change: 0 additions & 1 deletion dash/src/blockdata/fee_rate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,6 @@ crate::parse::impl_parse_str_from_int_infallible!(FeeRate, u64, from_sat_per_kwu

#[cfg(test)]
mod tests {
use std::u64;

use super::*;

Expand Down
4 changes: 2 additions & 2 deletions dash/src/blockdata/transaction/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -468,7 +468,7 @@ impl Transaction {
S: FnMut(&OutPoint) -> Option<TxOut>,
F: Into<u32>,
{
let tx = encode::serialize(&*self);
let tx = encode::serialize(self);
let flags: u32 = flags.into();
for (idx, input) in self.input.iter().enumerate() {
if let Some(output) = spent(&input.previous_output) {
Expand All @@ -479,7 +479,7 @@ impl Transaction {
flags,
)?;
} else {
return Err(script::Error::UnknownSpentOutput(input.previous_output.clone()));
return Err(script::Error::UnknownSpentOutput(input.previous_output));
}
}
Ok(())
Expand Down
6 changes: 3 additions & 3 deletions dash/src/consensus/encode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1438,7 +1438,7 @@ mod tests {
.is_err()
);

let rand_io_err = Error::Io(io::Error::new(io::ErrorKind::Other, ""));
let rand_io_err = Error::Io(io::Error::other(""));

// Check serialization that `if len > MAX_VEC_SIZE {return err}` isn't inclusive,
// by making sure it fails with IO Error and not an `OversizedVectorAllocation` Error.
Expand Down Expand Up @@ -1466,7 +1466,7 @@ mod tests {
Vec<T>: Decodable,
T: fmt::Debug,
{
let rand_io_err = Error::Io(io::Error::new(io::ErrorKind::Other, ""));
let rand_io_err = Error::Io(io::Error::other(""));
let varint = VarInt((super::MAX_VEC_SIZE / mem::size_of::<T>()) as u64);
let err = deserialize::<Vec<T>>(&serialize(&varint)).unwrap_err();
assert_eq!(discriminant(&err), discriminant(&rand_io_err));
Expand Down Expand Up @@ -1617,7 +1617,7 @@ mod tests {
// Expect the write to succeed
let bytes_written = result.expect("Failed to write");
// Calculate expected bytes written
let expected_bytes = (size + 7) / 8;
let expected_bytes = size.div_ceil(8);
assert_eq!(
bytes_written, expected_bytes,
"Incorrect number of bytes written for bitset with size {}",
Expand Down
8 changes: 0 additions & 8 deletions dash/src/crypto/sighash.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1563,7 +1563,6 @@ mod tests {

#[derive(serde::Deserialize)]
#[serde(rename_all = "camelCase")]

struct KpsGiven {
#[serde(with = "con_serde::With::<con_serde::Hex>")]
raw_unsigned_tx: Transaction,
Expand All @@ -1572,7 +1571,6 @@ mod tests {

#[derive(serde::Deserialize)]
#[serde(rename_all = "camelCase")]

struct KpsIntermediary {
hash_prevouts: sha256::Hash,
hash_outputs: sha256::Hash,
Expand All @@ -1583,7 +1581,6 @@ mod tests {

#[derive(serde::Deserialize)]
#[serde(rename_all = "camelCase")]

struct KpsInputSpendingGiven {
txin_index: usize,
internal_privkey: SecretKey,
Expand All @@ -1594,7 +1591,6 @@ mod tests {

#[derive(serde::Deserialize)]
#[serde(rename_all = "camelCase")]

struct KpsInputSpendingIntermediary {
internal_pubkey: XOnlyPublicKey,
tweak: TapTweakHash,
Expand All @@ -1606,14 +1602,12 @@ mod tests {

#[derive(serde::Deserialize)]
#[serde(rename_all = "camelCase")]

struct KpsInputSpendingExpected {
witness: Vec<String>,
}

#[derive(serde::Deserialize)]
#[serde(rename_all = "camelCase")]

struct KpsInputSpending {
given: KpsInputSpendingGiven,
intermediary: KpsInputSpendingIntermediary,
Expand All @@ -1623,7 +1617,6 @@ mod tests {

#[derive(serde::Deserialize)]
#[serde(rename_all = "camelCase")]

struct KeyPathSpending {
given: KpsGiven,
intermediary: KpsIntermediary,
Expand All @@ -1632,7 +1625,6 @@ mod tests {

#[derive(serde::Deserialize)]
#[serde(rename_all = "camelCase")]

struct TestData {
version: u64,
key_path_spending: Vec<KeyPathSpending>,
Expand Down
4 changes: 2 additions & 2 deletions dash/src/merkle_tree/block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -601,7 +601,7 @@ mod tests {
let mut height = 1;
let mut ntx = tx_count;
while ntx > 1 {
ntx = (ntx + 1) / 2;
ntx = ntx.div_ceil(2);
height += 1;
}

Expand Down Expand Up @@ -629,7 +629,7 @@ mod tests {

// Verify PartialMerkleTree's size guarantees
let n = min(tx_count, 1 + match_txid1.len() * height);
assert!(serialized.len() <= 10 + (258 * n + 7) / 8);
assert!(serialized.len() <= 10 + (258 * n).div_ceil(8));

// Deserialize into a tester copy
let pmt2: PartialMerkleTree =
Expand Down
4 changes: 2 additions & 2 deletions dash/src/network/message.rs
Original file line number Diff line number Diff line change
Expand Up @@ -994,7 +994,7 @@ mod test {
// Verify
match decoded.payload {
NetworkMessage::SendDsq(wants_dsq) => {
assert_eq!(wants_dsq, true);
assert!(wants_dsq);
}
_ => panic!("Expected SendDsq message"),
}
Expand All @@ -1015,7 +1015,7 @@ mod test {
// Verify
match decoded.payload {
NetworkMessage::SendDsq(wants_dsq) => {
assert_eq!(wants_dsq, false);
assert!(!wants_dsq);
}
_ => panic!("Expected SendDsq message"),
}
Expand Down
2 changes: 1 addition & 1 deletion dash/src/pow.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1490,7 +1490,7 @@ mod tests {

let config = bincode::config::standard();

let bin_encoded = bincode::encode_to_vec(&uint, config).unwrap();
let bin_encoded = bincode::encode_to_vec(uint, config).unwrap();
let bin_decoded: U256 = bincode::decode_from_slice(&bin_encoded, config).unwrap().0;
assert_eq!(bin_decoded, uint);
};
Expand Down
13 changes: 6 additions & 7 deletions dash/src/sml/masternode_list_engine/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1278,19 +1278,19 @@ mod tests {
let block_container_bytes: &[u8] =
include_bytes!("../../../tests/data/test_DML_diffs/block_container_2240504.dat");
let block_container: MasternodeListEngineBlockContainer =
bincode::decode_from_slice(&block_container_bytes, bincode::config::standard())
bincode::decode_from_slice(block_container_bytes, bincode::config::standard())
.expect("expected to decode")
.0;
let mn_list_diffs_bytes: &[u8] =
include_bytes!("../../../tests/data/test_DML_diffs/mnlistdiffs_2240504.dat");
let mn_list_diffs: BTreeMap<(CoreBlockHeight, CoreBlockHeight), MnListDiff> =
bincode::decode_from_slice(&mn_list_diffs_bytes, bincode::config::standard())
bincode::decode_from_slice(mn_list_diffs_bytes, bincode::config::standard())
.expect("expected to decode")
.0;
let qr_info_bytes: &[u8] =
include_bytes!("../../../tests/data/test_DML_diffs/qrinfo_2240504.dat");
let qr_info: QRInfo =
bincode::decode_from_slice(&qr_info_bytes, bincode::config::standard())
bincode::decode_from_slice(qr_info_bytes, bincode::config::standard())
.expect("expected to decode")
.0;

Expand Down Expand Up @@ -1403,10 +1403,9 @@ mod tests {

for (cycle_hash, quorums) in mn_list_engine.rotated_quorums_per_cycle.iter() {
for (i, quorum) in quorums.iter().enumerate() {
mn_list_engine.validate_quorum(quorum).expect(
format!("expected to validate quorum {} in cycle hash {}", i, cycle_hash)
.as_str(),
);
mn_list_engine.validate_quorum(quorum).unwrap_or_else(|_| {
panic!("expected to validate quorum {} in cycle hash {}", i, cycle_hash)
});
}
}
}
Expand Down
8 changes: 4 additions & 4 deletions dash/src/sml/quorum_entry/validation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ mod tests {
#[test]
fn test_real_operator_key_compatibility() {
// Real operator public keys from mainnet quorum at height 2300832
let real_keys = vec![
let real_keys = [
hex!(
"86e7ea34cc084da3ed0e90649ad444df0ca25d638164a596b4fbec9567bbcf3e635a8d8457107e7fe76326f3816e34d9"
),
Expand Down Expand Up @@ -294,7 +294,7 @@ mod tests {
println!("Verification with modern sig format: {:?}", result);

// Try with reversed block hash (endianness)
let mut reversed_hash = block_hash.clone();
let mut reversed_hash = block_hash;
reversed_hash.reverse();
let result_reversed = sig.verify(&pk, &reversed_hash);
println!("Verification with reversed block hash: {:?}", result_reversed);
Expand Down Expand Up @@ -399,7 +399,7 @@ mod tests {
for _ in 0..10 {
let _ = verify_secure_basic_with_mode::<Bls12381G2Impl, _>(
&operator_keys,
inner_sig.clone(),
inner_sig,
msg,
SerializationFormat::Modern,
);
Expand All @@ -412,7 +412,7 @@ mod tests {
for _ in 0..iterations {
let _ = verify_secure_basic_with_mode::<Bls12381G2Impl, _>(
&operator_keys,
inner_sig.clone(),
inner_sig,
msg,
SerializationFormat::Modern,
);
Expand Down
7 changes: 2 additions & 5 deletions hashes/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ exclude = ["tests", "contrib"]
default = ["std"]
std = ["alloc", "internals/std"]
alloc = ["internals/alloc"]
schemars = ["actual-schemars", "dyn-clone"]
schemars = ["actual-schemars"]

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Feature should gate on std to reflect the comment and avoid accidental no_std builds.

Tie the schemars feature to this crate’s std feature.

-schemars = ["actual-schemars"]
+schemars = ["std", "actual-schemars"]
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
schemars = ["actual-schemars"]
schemars = ["std", "actual-schemars"]
🤖 Prompt for AI Agents
In hashes/Cargo.toml around line 19, the "schemars" feature currently enables
only "actual-schemars" but must be gated on this crate's "std" feature; update
the features section so the "schemars" feature depends on "std" as well (i.e.,
include "std" in the feature's activation list) and ensure a "std" feature
exists and enables the standard-library-dependent dependencies.

serde-std = ["serde/std"]
x11 = ["rs-x11-hash"]

Expand All @@ -31,10 +31,7 @@ core2 = { version = "0.4.0", default-features = false, optional = true }
# Only enable this if you explicitly do not want to use "std", otherwise enable "serde-std".
serde = { version = "1.0.219", default-features = false, optional = true }
# Do NOT use this as a feature! Use the `schemars` feature instead. Can only be used with "std" enabled.
actual-schemars = { package = "schemars", version = "<=0.8.3", optional = true }
# Do NOT enable this dependency, this is just to pin dyn-clone (transitive dep from schemars)
# because 1.0.8 does not build with Rust 1.41.1 (because of useage of `Arc::as_ptr`).
dyn-clone = { version = "<=1.0.7", default-features = false, optional = true }
actual-schemars = { package = "schemars", version = "1.0", optional = true }

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Verification agent

🧩 Analysis chain

Crate alias changed to actual-schemars; ensure code imports use the alias or re-export it.

Code under hashes/src/util.rs imports schemars::…, which will not resolve unless you re-export the alias as schemars somewhere (e.g., in src/lib.rs) or switch imports to actual_schemars::…. Recommend aligning imports or adding a re-export (see util.rs comment for a concrete diff).

Run to verify any remaining schemars:: imports and a crate-level re-export:


🏁 Script executed:

#!/bin/bash
set -euo pipefail
echo "Cargo alias:"
rg -nP '^\s*actual-schemars\s*=' -n --glob 'hashes/Cargo.toml' -N

echo -e "\nRust imports using schemars:: :"
rg -nP --type=rust -C2 '\buse\s+schemars::' | sed -n '1,120p'

echo -e "\nRe-export present?"
rg -nP --type=rust -C2 'pub\s+use\s+actual_schemars\s+as\s+schemars;'

Length of output: 788


Align schemars imports with the new crate alias
hashes/src/util.rs lines 586–587 import schemars::…, but hashes/Cargo.toml aliases the package as actual-schemars (crate name actual_schemars) and there’s no pub use actual_schemars as schemars; present—these imports will fail. Change imports to use actual_schemars::… or add a crate-level re-export (pub use actual_schemars as schemars;, e.g. in lib.rs).

🤖 Prompt for AI Agents
In hashes/Cargo.toml around line 34 and in hashes/src/util.rs around lines
586–587, the Cargo.toml aliases the schemars crate as actual-schemars (crate
name actual_schemars) but the code imports use schemars::... — update imports to
use actual_schemars::... or add a crate-level re-export so schemars resolves:
add pub use actual_schemars as schemars; in the crate root (e.g., lib.rs).
Ensure the chosen fix is applied consistently (either change the two imports to
actual_schemars or add the re-export) and run cargo build to verify imports
succeed.

secp256k1 = { default-features = false, features = ["hashes"], version= "0.30.0" }

rs-x11-hash = { version = "0.1.8", optional = true }
Expand Down
22 changes: 11 additions & 11 deletions hashes/src/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -583,19 +583,19 @@ macro_rules! hash_newtype_known_attrs {

#[cfg(feature = "schemars")]
pub mod json_hex_string {
use schemars::JsonSchema;
use schemars::r#gen::SchemaGenerator;
use schemars::schema::{Schema, SchemaObject};
use schemars::SchemaGenerator;
use schemars::{Schema, json_schema};

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Imports should target the aliased crate name (actual-schemars) or rely on a re-export.

Given Cargo uses actual-schemars = { package = "schemars", ... }, direct use schemars::… will fail unless re-exported. Either import from actual_schemars here, or add pub use actual_schemars as schemars; behind the feature in the crate root.

-    use schemars::SchemaGenerator;
-    use schemars::{Schema, json_schema};
+    use actual_schemars::SchemaGenerator;
+    use actual_schemars::{Schema, json_schema};

Alternatively, add in hashes/src/lib.rs (or the crate root) so existing schemars:: paths continue to work:

#[cfg(feature = "schemars")]
pub use actual_schemars as schemars;
🤖 Prompt for AI Agents
In hashes/src/util.rs around lines 586-588 the file imports schemars directly
(use schemars::SchemaGenerator; use schemars::{Schema, json_schema};) but Cargo
aliases the dependency as actual-schemars, so update the imports to use the
aliased crate (use actual_schemars::SchemaGenerator; use
actual_schemars::{Schema, json_schema};) OR add a re-export in the crate root
(hashes/src/lib.rs) such as #[cfg(feature = "schemars")] pub use actual_schemars
as schemars; so existing schemars:: paths keep working; pick one approach and
apply it consistently.

macro_rules! define_custom_hex {
($name:ident, $len:expr) => {
pub fn $name(generator: &mut SchemaGenerator) -> Schema {
let mut schema: SchemaObject = <String>::json_schema(generator).into();
schema.string = Some(Box::new(schemars::schema::StringValidation {
max_length: Some($len * 2),
min_length: Some($len * 2),
pattern: Some("[0-9a-fA-F]+".to_owned()),
}));
schema.into()
pub fn $name(_generator: &mut SchemaGenerator) -> Schema {
// In schemars 1.0, we can use the json_schema! macro to create schemas
json_schema!({
"type": "string",
"minLength": $len * 2,
"maxLength": $len * 2,
"pattern": "^[0-9a-fA-F]+$"
})
}
};
}
Expand Down
16 changes: 15 additions & 1 deletion key-wallet-ffi/include/key_wallet_ffi.h
Original file line number Diff line number Diff line change
Expand Up @@ -3789,16 +3789,30 @@ void wallet_manager_free_addresses(char **addresses,

/*
Encrypt a private key with BIP38

# Safety

This function is unsafe because it dereferences raw pointers:
- `private_key` must be a valid, null-terminated C string
- `passphrase` must be a valid, null-terminated C string
- `error` must be a valid pointer to an FFIError or null
*/

char *bip38_encrypt_private_key(const char *private_key,
const char *passphrase,
FFINetwork network,
FFINetwork _network,
FFIError *error)
;
Comment on lines +3792 to 3805

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

BIP38 encrypt docs: document allocation/free and current unimplemented behavior

The header doesn’t say how to free the returned string and that this currently always returns NULL with WALLET_ERROR (feature disabled or not implemented). Please document both; also note _network is reserved/ignored.

Apply this header doc tweak (mirror in Rust doc comments so cbindgen regenerates it):

-/*
- Encrypt a private key with BIP38
-
- # Safety
- 
- This function is unsafe because it dereferences raw pointers:
- - `private_key` must be a valid, null-terminated C string
- - `passphrase` must be a valid, null-terminated C string
- - `error` must be a valid pointer to an FFIError or null
- */
+/*
+ Encrypt a private key with BIP38
+ 
+ Returns: newly allocated C string on success; NULL on error.
+ - Free the returned string with `string_free`.
+ - Currently unimplemented: returns NULL and sets error->code = WALLET_ERROR (or when the `bip38` feature is disabled).
+ - Note: `_network` is reserved/ignored at present.
+ 
+ # Safety
+ This function is unsafe because it dereferences raw pointers:
+ - `private_key` must be a valid, null-terminated C string
+ - `passphrase` must be a valid, null-terminated C string
+ - `error` must be a valid pointer to an FFIError or null
+ */
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
# Safety
This function is unsafe because it dereferences raw pointers:
- `private_key` must be a valid, null-terminated C string
- `passphrase` must be a valid, null-terminated C string
- `error` must be a valid pointer to an FFIError or null
*/
char *bip38_encrypt_private_key(const char *private_key,
const char *passphrase,
FFINetwork network,
FFINetwork _network,
FFIError *error)
;
/*
Encrypt a private key with BIP38
Returns: newly allocated C string on success; NULL on error.
- Free the returned string with `string_free`.
- Currently unimplemented: returns NULL and sets error->code = WALLET_ERROR (or when the `bip38` feature is disabled).
- Note: `_network` is reserved/ignored at present.
# Safety
This function is unsafe because it dereferences raw pointers:
- `private_key` must be a valid, null-terminated C string
- `passphrase` must be a valid, null-terminated C string
- `error` must be a valid pointer to an FFIError or null
*/
char *bip38_encrypt_private_key(const char *private_key,
const char *passphrase,
FFINetwork _network,
FFIError *error)
;
🤖 Prompt for AI Agents
In key-wallet-ffi/include/key_wallet_ffi.h around lines 3792 to 3805, the BIP38
encrypt function header lacks docs about ownership and current unimplemented
behavior: update the comment to state that the returned char* is heap-allocated
and must be freed by the caller (e.g. free()), or NULL on error; explicitly
document that this implementation currently always returns NULL and sets
error->code = WALLET_ERROR when the feature is disabled/not implemented; also
note that the _network parameter is reserved/ignored. Make the same text change
in the corresponding Rust doc comments so cbindgen regenerates the header with
these notes.


/*
Decrypt a BIP38 encrypted private key

# Safety

This function is unsafe because it dereferences raw pointers:
- `encrypted_key` must be a valid, null-terminated C string
- `passphrase` must be a valid, null-terminated C string
- `error` must be a valid pointer to an FFIError or null
*/
Comment on lines 3808 to 3816

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

FFI contract: document allocation/ownership for BIP38 decrypt

State who frees the returned string and typical error path.

-/*
- Decrypt a BIP38 encrypted private key
-
- # Safety
+/*
+ Decrypt a BIP38 encrypted private key
+ 
+ Returns: newly allocated C string (WIF) on success; NULL on error.
+ - Free the returned string with `string_free`.
+ 
+ # Safety
  This function is unsafe because it dereferences raw pointers:
  - `encrypted_key` must be a valid, null-terminated C string
  - `passphrase` must be a valid, null-terminated C string
  - `error` must be a valid pointer to an FFIError or null
 */
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
Decrypt a BIP38 encrypted private key
# Safety
This function is unsafe because it dereferences raw pointers:
- `encrypted_key` must be a valid, null-terminated C string
- `passphrase` must be a valid, null-terminated C string
- `error` must be a valid pointer to an FFIError or null
*/
/*
Decrypt a BIP38 encrypted private key
Returns: newly allocated C string (WIF) on success; NULL on error.
- Free the returned string with `string_free`.
# Safety
This function is unsafe because it dereferences raw pointers:
- `encrypted_key` must be a valid, null-terminated C string
- `passphrase` must be a valid, null-terminated C string
- `error` must be a valid pointer to an FFIError or null
*/
🤖 Prompt for AI Agents
In key-wallet-ffi/include/key_wallet_ffi.h around lines 3800 to 3808, the BIP38
decrypt FFI comment lacks allocation/ownership and error-path details; update
the docblock to state precisely who owns and must free returned memory (e.g.,
the function returns a heap-allocated NUL-terminated C string which the caller
must free with the FFI's free function/standard free), and describe the error
path (on failure return NULL and, if an error pointer is provided, populate
error->message with a heap-allocated NUL-terminated C string that the caller
must also free; clarify that the error object itself is written by callee into
the provided pointer and not allocated). Ensure the wording names the allocator
used (malloc/ffi_free) and that both success and error message lifetimes are the
caller's responsibility.


char *bip38_decrypt_private_key(const char *encrypted_key,
Expand Down
24 changes: 12 additions & 12 deletions key-wallet-ffi/src/account_collection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1151,7 +1151,7 @@ mod tests {
options.option_type = crate::types::FFIAccountCreationOptionType::AllAccounts;

// Add provider operator keys account type
let special_types = vec![crate::types::FFIAccountType::ProviderOperatorKeys];
let special_types = [crate::types::FFIAccountType::ProviderOperatorKeys];
options.special_account_types = special_types.as_ptr();
options.special_account_types_count = special_types.len();

Expand Down Expand Up @@ -1199,7 +1199,7 @@ mod tests {
options.option_type = crate::types::FFIAccountCreationOptionType::AllAccounts;

// Add provider platform keys account type
let special_types = vec![crate::types::FFIAccountType::ProviderPlatformKeys];
let special_types = [crate::types::FFIAccountType::ProviderPlatformKeys];
options.special_account_types = special_types.as_ptr();
options.special_account_types_count = special_types.len();

Expand Down Expand Up @@ -1248,7 +1248,7 @@ mod tests {
options.option_type = crate::types::FFIAccountCreationOptionType::AllAccounts;

// Add various special accounts
let special_types = vec![
let special_types = [
crate::types::FFIAccountType::ProviderVotingKeys,
crate::types::FFIAccountType::ProviderOwnerKeys,
crate::types::FFIAccountType::IdentityRegistration,
Expand All @@ -1258,10 +1258,10 @@ mod tests {
options.special_account_types_count = special_types.len();

// Configure standard accounts - store vectors in variables to keep them alive
let bip44_indices = vec![0, 4, 5, 8];
let bip32_indices = vec![0];
let coinjoin_indices = vec![0, 1];
let topup_indices = vec![0, 1, 2];
let bip44_indices = [0, 4, 5, 8];
let bip32_indices = [0];
let coinjoin_indices = [0, 1];
let topup_indices = [0, 1, 2];

options.bip44_indices = bip44_indices.as_ptr();
options.bip44_count = bip44_indices.len();
Expand Down Expand Up @@ -1392,7 +1392,7 @@ mod tests {
options.option_type = crate::types::FFIAccountCreationOptionType::AllAccounts;

// Add various special accounts
let special_types = vec![
let special_types = [
crate::types::FFIAccountType::ProviderVotingKeys,
crate::types::FFIAccountType::ProviderOwnerKeys,
crate::types::FFIAccountType::IdentityRegistration,
Expand All @@ -1402,10 +1402,10 @@ mod tests {
options.special_account_types_count = special_types.len();

// Configure standard accounts
let bip44_indices = vec![0, 4, 5, 8];
let bip32_indices = vec![0];
let coinjoin_indices = vec![0, 1];
let topup_indices = vec![0, 1, 2];
let bip44_indices = [0, 4, 5, 8];
let bip32_indices = [0];
let coinjoin_indices = [0, 1];
let topup_indices = [0, 1, 2];

options.bip44_indices = bip44_indices.as_ptr();
options.bip44_count = bip44_indices.len();
Expand Down
1 change: 1 addition & 0 deletions key-wallet-ffi/src/account_tests.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#[cfg(test)]
#[allow(clippy::module_inception)]
mod tests {
use super::super::*;
use crate::error::{FFIError, FFIErrorCode};
Expand Down
Loading