Skip to content
Merged
Show file tree
Hide file tree
Changes from 21 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 .github/workflows/fuzz.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ jobs:
key: cache-${{ matrix.target }}-${{ hashFiles('**/Cargo.toml','**/Cargo.lock') }}
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Outdated
- uses: actions-rs/toolchain@v1
with:
toolchain: 1.85
toolchain: 1.89
override: true
profile: minimal
- name: fuzz

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

Migrate off actions-rs/toolchain and pin patch version (align with rust.yml).

actions-rs/toolchain is archived and increasingly incompatible with current runners. Also, pin the toolchain to 1.89.0 (not 1.89) for reproducibility and to match the rest of CI.

Apply this diff:

-      - uses: actions-rs/toolchain@v1
-        with:
-          toolchain: 1.89
-          override: true
-          profile: minimal
+      - uses: dtolnay/rust-toolchain@stable
+        with:
+          toolchain: 1.89.0
📝 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
- uses: actions-rs/toolchain@v1
with:
toolchain: 1.85
toolchain: 1.89
override: true
profile: minimal
- name: fuzz
- uses: dtolnay/rust-toolchain@stable
with:
toolchain: 1.89.0
🧰 Tools
🪛 actionlint (1.7.7)

51-51: the runner of "actions-rs/toolchain@v1" action is too old to run on GitHub Actions. update the action's version to fix this issue

(action)

🤖 Prompt for AI Agents
.github/workflows/fuzz.yml lines 51-56: replace the archived
actions-rs/toolchain step with the maintained GitHub action for setting up Rust
(e.g., actions/setup-rust@v1) and pin the patch version to 1.89.0 for
reproducibility; specifically remove the actions-rs/toolchain@v1 step and add a
step using actions/setup-rust@v1 (or another maintained setup action used in
rust.yml) with rust-version: 1.89.0 and remove/adjust override/profile fields as
appropriate.

Expand Down
133 changes: 130 additions & 3 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
AS_DEPENDENCY: true
DO_NO_STD: false
DO_DOCS: true
- rust: 1.85.0
- rust: 1.89.0
env:
AS_DEPENDENCY: true
steps:
Expand All @@ -41,6 +41,133 @@ jobs:
- name: Running test script
env: ${{ matrix.env }}
run: ./contrib/test.sh

workspace-tests:
name: Workspace Tests
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
rust: [stable, beta, nightly, 1.89.0]
steps:
- name: Checkout Crate
uses: actions/checkout@v4
- name: Setup Rust toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: ${{ matrix.rust }}
override: true
- name: Cache cargo registry
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Outdated
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-${{ matrix.rust }}-${{ hashFiles('**/Cargo.lock') }}
- name: Run workspace tests
run: cargo test --workspace --all-features
- name: Run workspace tests (no default features)
run: cargo test --workspace --no-default-features
- name: Build workspace (release mode)
run: cargo build --workspace --release

clippy:
name: Clippy (Non-strict)
runs-on: ubuntu-latest
steps:
- name: Checkout Crate
uses: actions/checkout@v4
- name: Setup Rust toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
components: clippy
- name: Run clippy (excluding strict-checked crates)
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Outdated
run: |
# Run clippy on all workspace members except the ones with strict checks
# We allow warnings for these crates
for crate in dash dash-network dash-network-ffi hashes internals fuzz rpc-client rpc-json rpc-integration-test dash-spv dash-spv-ffi test-utils; do
echo "Checking $crate (warnings allowed)..."
cargo clippy -p $crate --all-features --all-targets || true
done

strict-checks:
name: Strict Warnings and Clippy Checks
runs-on: ubuntu-latest
steps:
- name: Checkout Crate
uses: actions/checkout@v4
- name: Setup Rust toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
components: clippy
- name: Cache cargo registry
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Outdated
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-strict-${{ hashFiles('**/Cargo.lock') }}

# Check key-wallet with strict warnings
- name: Check key-wallet (deny warnings)
env:
RUSTFLAGS: "-D warnings"
run: |
cargo check -p key-wallet --all-features --lib --bins --tests
cargo build -p key-wallet --all-features --lib --bins
cargo test -p key-wallet --all-features --lib --bins

- name: Clippy key-wallet (deny all warnings)
run: cargo clippy -p key-wallet --all-features --lib --bins --tests -- -D warnings

# Check key-wallet-manager with strict warnings
- name: Check key-wallet-manager (deny warnings)
env:
RUSTFLAGS: "-D warnings"
run: |
cargo check -p key-wallet-manager --all-features --lib --bins --tests
cargo build -p key-wallet-manager --all-features --lib --bins
cargo test -p key-wallet-manager --all-features --lib --bins

- name: Clippy key-wallet-manager (deny all warnings)
run: cargo clippy -p key-wallet-manager --all-features --lib --bins --tests -- -D warnings

# Check key-wallet-ffi with strict warnings
- name: Check key-wallet-ffi (deny warnings)
env:
RUSTFLAGS: "-D warnings"
run: |
cargo check -p key-wallet-ffi --all-features --lib --bins --tests
cargo build -p key-wallet-ffi --all-features --lib --bins
cargo test -p key-wallet-ffi --all-features --lib --bins

- name: Clippy key-wallet-ffi (deny all warnings)
run: cargo clippy -p key-wallet-ffi --all-features --lib --bins --tests -- -D warnings

fmt:
name: Format
runs-on: ubuntu-latest
steps:
- name: Checkout Crate
uses: actions/checkout@v4
- name: Setup Rust toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
components: rustfmt
- name: Check formatting

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

fmt job: migrate toolchain action.

Apply this diff:

-      - name: Setup Rust toolchain
-        uses: actions-rs/toolchain@v1
-        with:
-          profile: minimal
-          toolchain: stable
-          override: true
-          components: rustfmt
+      - name: Setup Rust toolchain
+        uses: dtolnay/rust-toolchain@stable
+        with:
+          toolchain: stable
+          components: rustfmt
📝 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
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
components: rustfmt
- name: Check formatting
- name: Setup Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
components: rustfmt
- name: Check formatting
🧰 Tools
🪛 actionlint (1.7.7)

163-163: the runner of "actions-rs/toolchain@v1" action is too old to run on GitHub Actions. update the action's version to fix this issue

(action)

🤖 Prompt for AI Agents
.github/workflows/rust.yml around lines 163 to 169: the toolchain action block
currently ends with an extra deletion marker causing the next step name to be
malformed; update the actions-rs/toolchain step to include profile: minimal,
toolchain: stable, override: true and components: rustfmt as shown, and remove
the stray '-' before "name: Check formatting" so the following step is a normal
job step (correct indentation and YAML structure).

run: cargo fmt --all -- --check

# TODO: need to support compiling rust-x11-hash under s390x
# Cross:
Expand Down Expand Up @@ -88,7 +215,7 @@ jobs:
# run: cd hashes/embedded && cargo run --target thumbv7m-none-eabi --features=alloc

rpc-tests:
name: Tests
name: RPC Tests
runs-on: ubuntu-latest
strategy:
matrix:
Expand All @@ -99,7 +226,7 @@ jobs:
- rust: nightly
env:
RUSTFMTCHK: false
- rust: 1.85.0
- rust: 1.89.0
env:
PIN_VERSIONS: true
steps:
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Expand Down
4 changes: 2 additions & 2 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,13 @@ rust-dashcore is a Rust implementation of the Dash cryptocurrency protocol libra

### Network & SPV
- `dash-network/` - Network protocol abstractions
- `dash-network-ffi/` - Network FFI bindings using UniFFI
- `dash-network-ffi/` - C-compatible FFI bindings for network types
- `dash-spv/` - SPV client implementation
- `dash-spv-ffi/` - C-compatible FFI bindings for SPV client

### Wallet & Keys
- `key-wallet/` - HD wallet implementation
- `key-wallet-ffi/` - FFI bindings for wallet functionality
- `key-wallet-ffi/` - C-compatible FFI bindings for wallet functionality

### RPC & Integration
- `rpc-client/` - JSON-RPC client for Dash Core nodes
Expand Down
7 changes: 0 additions & 7 deletions dash-network-ffi/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,12 @@ readme = "README.md"

[dependencies]
dash-network = { path = "../dash-network", default-features = false }
uniffi = { version = "0.29.3", features = ["cli"] }
thiserror = "2.0.12"

[build-dependencies]
uniffi = { version = "0.29.3", features = ["build"] }

[dev-dependencies]
hex = "0.4"

[lib]
crate-type = ["cdylib", "staticlib"]
name = "dash_network_ffi"

[[bin]]
name = "uniffi-bindgen"
path = "uniffi-bindgen.rs"
14 changes: 2 additions & 12 deletions dash-network-ffi/README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
# dash-network-ffi

FFI bindings for the dash-network crate, providing language bindings via UniFFI.
FFI bindings for the dash-network crate, providing C-compatible language bindings.

## Overview

This crate provides Foreign Function Interface (FFI) bindings for the `dash-network` types, allowing them to be used from other programming languages like Swift, Python, Kotlin, and Ruby.

## Features

- UniFFI-based bindings for the Network enum
- C-compatible FFI bindings for the Network enum
- Network information and utilities exposed through FFI
- Support for magic bytes operations
- Core version activation queries
Expand All @@ -21,16 +21,6 @@ This crate provides Foreign Function Interface (FFI) bindings for the `dash-netw
cargo build --release
```

### Generating Bindings

To generate bindings for your target language:

```bash
cargo run --bin uniffi-bindgen generate src/dash_network.udl --language swift
cargo run --bin uniffi-bindgen generate src/dash_network.udl --language python
cargo run --bin uniffi-bindgen generate src/dash_network.udl --language kotlin
```

### Example Usage (Swift)

```swift
Expand Down
3 changes: 2 additions & 1 deletion dash-network-ffi/build.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
fn main() {
uniffi::generate_scaffolding("src/dash_network.udl").unwrap();
// Build script for dash-network-ffi
// Standard FFI compilation without uniffi
}
41 changes: 0 additions & 41 deletions dash-network-ffi/src/dash_network.udl

This file was deleted.

Loading
Loading