Skip to content

Commit 7edd22d

Browse files
committed
Merge branch 'v3.1-dev' into chore/update-dashcore-08ade6e8
2 parents ba359d2 + a0dddb0 commit 7edd22d

4 files changed

Lines changed: 70 additions & 11 deletions

File tree

packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_masternode_list/update_state_masternode_list/v0/mod.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,10 +64,8 @@ where
6464
// the ban_height was changed
6565
validator.is_banned = maybe_ban_height.is_some();
6666
}
67-
if let Some(maybe_address) = dmn_state_diff.service {
68-
if let Some(address) = maybe_address {
69-
validator.node_ip = address.ip().to_string();
70-
}
67+
if let Some(Some(address)) = dmn_state_diff.service {
68+
validator.node_ip = address.ip().to_string();
7169
}
7270

7371
if let Some(p2p_port) = dmn_state_diff.platform_p2p_port {

packages/rs-sdk-ffi/build.rs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,16 @@ fn main() {
2323
"/* This file is auto-generated. Do not modify manually. */\n/* Unified Dash SDK - includes both Core (SPV) and Platform functionality */".to_string(),
2424
),
2525
after_includes: Some(
26-
"/* Forward declarations for opaque types */\nstruct ShieldedPoolClient;\n".to_string(),
26+
concat!(
27+
"/* Forward declarations for opaque types */\n",
28+
"struct ShieldedPoolClient;\n",
29+
"\n",
30+
"/* Forward declarations for dash-spv-ffi types used by the unified SDK.\n",
31+
" * These allow the header to compile standalone. The full iOS build\n",
32+
" * merges the complete dash_spv_ffi.h definitions via build_ios.sh. */\n",
33+
"typedef struct FFIClientConfig FFIClientConfig;\n",
34+
"typedef struct FFIDashSpvClient FFIDashSpvClient;\n",
35+
).to_string(),
2736
),
2837
includes: vec![],
2938
sys_includes: vec!["stdint.h".to_string(), "stdbool.h".to_string()],

packages/rs-sdk-ffi/build_ios.sh

Lines changed: 50 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,38 @@ RUST_DASHCORE_PATH="$PROJECT_ROOT/../rust-dashcore"
186186
KEY_WALLET_HEADER_PATH="$RUST_DASHCORE_PATH/key-wallet-ffi/include/key_wallet_ffi.h"
187187
SPV_HEADER_PATH="$RUST_DASHCORE_PATH/dash-spv-ffi/include/dash_spv_ffi.h"
188188

189+
# Generate missing FFI headers from rust-dashcore via a host build
190+
# The build.rs in each crate runs cbindgen to produce the header under include/
191+
if [ -d "$RUST_DASHCORE_PATH" ]; then
192+
if [ ! -f "$KEY_WALLET_HEADER_PATH" ] || [ ! -f "$SPV_HEADER_PATH" ]; then
193+
echo -e "${GREEN}Generating FFI headers from rust-dashcore (host build)...${NC}"
194+
pushd "$RUST_DASHCORE_PATH" >/dev/null
195+
DASHCORE_CARGO_CMD="cargo"
196+
if [ -n "${RUST_DASHCORE_TOOLCHAIN:-}" ]; then
197+
DASHCORE_CARGO_CMD="cargo +${RUST_DASHCORE_TOOLCHAIN}"
198+
fi
199+
if [ ! -f "$KEY_WALLET_HEADER_PATH" ]; then
200+
echo -ne " Generating key_wallet_ffi.h..."
201+
if $DASHCORE_CARGO_CMD build --release -p key-wallet-ffi > /tmp/cargo_build_kwffi_host.log 2>&1; then
202+
echo -e " ${GREEN}done${NC}"
203+
else
204+
echo -e " ${RED}failed${NC}"
205+
cat /tmp/cargo_build_kwffi_host.log
206+
fi
207+
fi
208+
if [ ! -f "$SPV_HEADER_PATH" ]; then
209+
echo -ne " Generating dash_spv_ffi.h..."
210+
if $DASHCORE_CARGO_CMD build --release -p dash-spv-ffi > /tmp/cargo_build_spvffi_host.log 2>&1; then
211+
echo -e " ${GREEN}done${NC}"
212+
else
213+
echo -e " ${RED}failed${NC}"
214+
cat /tmp/cargo_build_spvffi_host.log
215+
fi
216+
fi
217+
popd >/dev/null
218+
fi
219+
fi
220+
189221
if [ -f "$KEY_WALLET_HEADER_PATH" ] && [ -f "$SPV_HEADER_PATH" ]; then
190222
# Create merged header with unified include guard
191223
MERGED_HEADER="$OUTPUT_DIR/dash_unified_ffi.h"
@@ -348,9 +380,24 @@ EOF
348380
echo -e "${GREEN}✓ Headers merged successfully${NC}"
349381
else
350382
echo -e "${YELLOW}⚠ Key Wallet FFI or SPV FFI headers not found${NC}"
351-
echo -e "${YELLOW} Please build key-wallet-ffi and dash-spv-ffi first:${NC}"
352-
echo -e "${YELLOW} cd ../../../rust-dashcore/key-wallet-ffi && cargo build --release${NC}"
353-
echo -e "${YELLOW} cd ../../../rust-dashcore/dash-spv-ffi && cargo build --release${NC}"
383+
echo -e "${YELLOW} Patching dash_sdk_ffi.h with forward declarations as fallback...${NC}"
384+
# Replace the #include "dash_spv_ffi.h" with forward declarations for the
385+
# types that rs-sdk-ffi references from dash-spv-ffi, so the header compiles
386+
# even without the external header file.
387+
if [ -f "$OUTPUT_DIR/dash_sdk_ffi.h" ]; then
388+
TEMP_HEADER=$(mktemp)
389+
awk '
390+
/^#include "dash_spv_ffi\.h"/ {
391+
print "/* dash_spv_ffi.h not available; forward declarations injected */"
392+
print "typedef struct FFIClientConfig FFIClientConfig;"
393+
print "typedef struct FFIDashSpvClient { unsigned char _private[0]; } FFIDashSpvClient;"
394+
next
395+
}
396+
{ print }
397+
' "$OUTPUT_DIR/dash_sdk_ffi.h" > "$TEMP_HEADER"
398+
mv "$TEMP_HEADER" "$OUTPUT_DIR/dash_sdk_ffi.h"
399+
echo -e "${YELLOW} ⚠ Header patched with minimal forward declarations${NC}"
400+
fi
354401
fi
355402

356403
# Build dash-spv-ffi from local rust-dashcore for device and simulator

packages/rs-sdk-ffi/include/dash_sdk_ffi.h

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,14 @@
1111
#include <stdbool.h>
1212
#include <stdint.h>
1313
#include <stdlib.h>
14-
#include <stdint.h>
15-
#include <stdbool.h>
16-
#include "dash_spv_ffi.h"
14+
15+
/* Forward declarations for types from dash-spv-ffi.
16+
* When building the full unified SDK, the merge step in build_ios.sh replaces
17+
* this header with one that includes the complete dash_spv_ffi.h definitions.
18+
* These forward declarations keep the header self-contained for local use. */
19+
#ifndef DASH_SPV_FFI_H
20+
typedef struct FFIClientConfig FFIClientConfig;
21+
#endif
1722

1823
// Authorized action takers for token operations
1924
typedef enum DashSDKAuthorizedActionTakers {

0 commit comments

Comments
 (0)