Skip to content

Commit 35e47fd

Browse files
chore: update GitHub Actions to use ubuntu-22.04-arm for all jobs (#169)
* chore: update GitHub Actions to use ubuntu-22.04-arm for all jobs * fix(ffi): use c_char instead of i8 for platform-agnostic FFI types Replace hardcoded i8 casts with c_char to fix ARM compilation errors. On ARM architectures, c_char is u8 (not i8 as on x86/x86_64), causing type mismatches in FFI test code. - Replace all *mut i8 and *const i8 casts with c_char equivalents - Update array declarations from [0i8; N] to [0u8; N] with proper casting - Add c_char import to all affected test files * fix(ffi): use .cast() instead of as cast for raw pointer conversion Replace 'as *mut u8' casts with .cast::<u8>() method to fix clippy warnings about unnecessary casts on ARM architectures. On ARM, c_char is u8, making the explicit cast unnecessary. Using .cast::<u8>() is the modern Rust approach and avoids clippy warnings while maintaining platform compatibility.
1 parent bba5e0c commit 35e47fd

File tree

8 files changed

+64
-54
lines changed

8 files changed

+64
-54
lines changed

.github/workflows/fuzz.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ concurrency:
1818
jobs:
1919
fuzz:
2020
if: ${{ !github.event.act }}
21-
runs-on: ubuntu-latest
21+
runs-on: ubuntu-22.04-arm
2222
strategy:
2323
fail-fast: false
2424
matrix:
@@ -66,7 +66,7 @@ jobs:
6666
verify-execution:
6767
if: ${{ !github.event.act }}
6868
needs: fuzz
69-
runs-on: ubuntu-latest
69+
runs-on: ubuntu-22.04-arm
7070
steps:
7171
- uses: actions/checkout@v4
7272
- uses: actions/download-artifact@v4

.github/workflows/rust.yml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
permissions:
2121
contents: read
2222
pull-requests: write
23-
runs-on: ubuntu-latest
23+
runs-on: ubuntu-22.04-arm
2424
steps:
2525
- name: Checkout Crate
2626
uses: actions/checkout@v4
@@ -140,7 +140,7 @@ jobs:
140140

141141
key_wallet_tests:
142142
name: Key Wallet Components Tests
143-
runs-on: ubuntu-latest
143+
runs-on: ubuntu-22.04-arm
144144
steps:
145145
- name: Checkout Crate
146146
uses: actions/checkout@v4
@@ -157,7 +157,7 @@ jobs:
157157

158158
core_components_tests:
159159
name: Core Components Tests
160-
runs-on: ubuntu-latest
160+
runs-on: ubuntu-22.04-arm
161161
steps:
162162
- name: Checkout Crate
163163
uses: actions/checkout@v4
@@ -178,7 +178,7 @@ jobs:
178178

179179
clippy:
180180
name: Clippy (Non-strict)
181-
runs-on: ubuntu-latest
181+
runs-on: ubuntu-22.04-arm
182182
steps:
183183
- name: Checkout Crate
184184
uses: actions/checkout@v4
@@ -201,7 +201,7 @@ jobs:
201201
202202
strict-checks:
203203
name: Strict Warnings and Clippy Checks
204-
runs-on: ubuntu-latest
204+
runs-on: ubuntu-22.04-arm
205205
steps:
206206
- name: Checkout Crate
207207
uses: actions/checkout@v4
@@ -298,7 +298,7 @@ jobs:
298298

299299
fmt:
300300
name: Format
301-
runs-on: ubuntu-latest
301+
runs-on: ubuntu-22.04-arm
302302
steps:
303303
- name: Checkout Crate
304304
uses: actions/checkout@v4
@@ -311,7 +311,7 @@ jobs:
311311

312312
rpc_tests:
313313
name: RPC Tests
314-
runs-on: ubuntu-latest
314+
runs-on: ubuntu-22.04-arm
315315
strategy:
316316
matrix:
317317
include:
@@ -330,7 +330,7 @@ jobs:
330330
integrations_tests:
331331
name: Integration Tests
332332
if: ${{ false }} # Temporarily disabled
333-
runs-on: ubuntu-latest
333+
runs-on: ubuntu-22.04-arm
334334
strategy:
335335
matrix:
336336
rust: [stable]
@@ -347,7 +347,7 @@ jobs:
347347

348348
actionlint:
349349
name: Lint GitHub Actions
350-
runs-on: ubuntu-latest
350+
runs-on: ubuntu-22.04-arm
351351
permissions:
352352
contents: read
353353
steps:

.github/workflows/verify-ffi-docs.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ on:
2222

2323
jobs:
2424
verify-key-wallet-docs:
25-
runs-on: ubuntu-latest
25+
runs-on: ubuntu-22.04-arm
2626
steps:
2727
- name: Checkout repository
2828
uses: actions/checkout@v4
@@ -53,7 +53,7 @@ jobs:
5353
fi
5454
5555
verify-dash-spv-docs:
56-
runs-on: ubuntu-latest
56+
runs-on: ubuntu-22.04-arm
5757
steps:
5858
- name: Checkout repository
5959
uses: actions/checkout@v4
@@ -84,7 +84,7 @@ jobs:
8484
fi
8585
8686
update-docs-comment:
87-
runs-on: ubuntu-latest
87+
runs-on: ubuntu-22.04-arm
8888
if: failure() && github.event_name == 'pull_request'
8989
needs:
9090
- verify-key-wallet-docs

key-wallet-ffi/src/account_derivation_tests.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ mod tests {
99
use crate::keys::{extended_private_key_free, private_key_free};
1010
use crate::types::{FFIAccountType, FFINetworks};
1111
use crate::wallet;
12+
use std::ffi::CString;
13+
use std::os::raw::c_char;
1214

1315
const MNEMONIC: &str =
1416
"abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon about";
@@ -215,7 +217,7 @@ mod tests {
215217
}
216218

217219
// Helper to make C string pointers
218-
fn c_str(s: &str) -> *const i8 {
220+
fn c_str(s: &str) -> *const c_char {
219221
std::ffi::CString::new(s).unwrap().as_ptr()
220222
}
221223
}

key-wallet-ffi/src/derivation.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ pub extern "C" fn derivation_bip44_account_path(
131131
}
132132

133133
unsafe {
134-
ptr::copy_nonoverlapping(bytes.as_ptr(), path_out as *mut u8, bytes.len());
134+
ptr::copy_nonoverlapping(bytes.as_ptr(), path_out.cast::<u8>(), bytes.len());
135135
}
136136

137137
FFIError::set_success(error);
@@ -189,7 +189,7 @@ pub extern "C" fn derivation_bip44_payment_path(
189189
}
190190

191191
unsafe {
192-
ptr::copy_nonoverlapping(bytes.as_ptr(), path_out as *mut u8, bytes.len());
192+
ptr::copy_nonoverlapping(bytes.as_ptr(), path_out.cast::<u8>(), bytes.len());
193193
}
194194

195195
FFIError::set_success(error);
@@ -244,7 +244,7 @@ pub extern "C" fn derivation_coinjoin_path(
244244
}
245245

246246
unsafe {
247-
ptr::copy_nonoverlapping(bytes.as_ptr(), path_out as *mut u8, bytes.len());
247+
ptr::copy_nonoverlapping(bytes.as_ptr(), path_out.cast::<u8>(), bytes.len());
248248
}
249249

250250
FFIError::set_success(error);
@@ -299,7 +299,7 @@ pub extern "C" fn derivation_identity_registration_path(
299299
}
300300

301301
unsafe {
302-
ptr::copy_nonoverlapping(bytes.as_ptr(), path_out as *mut u8, bytes.len());
302+
ptr::copy_nonoverlapping(bytes.as_ptr(), path_out.cast::<u8>(), bytes.len());
303303
}
304304

305305
FFIError::set_success(error);
@@ -356,7 +356,7 @@ pub extern "C" fn derivation_identity_topup_path(
356356
}
357357

358358
unsafe {
359-
ptr::copy_nonoverlapping(bytes.as_ptr(), path_out as *mut u8, bytes.len());
359+
ptr::copy_nonoverlapping(bytes.as_ptr(), path_out.cast::<u8>(), bytes.len());
360360
}
361361

362362
FFIError::set_success(error);
@@ -417,7 +417,7 @@ pub extern "C" fn derivation_identity_authentication_path(
417417
}
418418

419419
unsafe {
420-
ptr::copy_nonoverlapping(bytes.as_ptr(), path_out as *mut u8, bytes.len());
420+
ptr::copy_nonoverlapping(bytes.as_ptr(), path_out.cast::<u8>(), bytes.len());
421421
}
422422

423423
FFIError::set_success(error);

0 commit comments

Comments
 (0)