Skip to content

feat: add DEFAULT_GAP_LIMIT core default + accessor#110

Merged
coreyphillips merged 4 commits into
masterfrom
feat/gap-limit-default
Jun 24, 2026
Merged

feat: add DEFAULT_GAP_LIMIT core default + accessor#110
coreyphillips merged 4 commits into
masterfrom
feat/gap-limit-default

Conversation

@coreyphillips

Copy link
Copy Markdown
Collaborator

Summary

Subtask 3 of #107. The address gap limit of 20 is duplicated as a bare literal across core's watcher and account-info paths, and each mobile platform also hardcodes gapLimit: 20 in HwWalletManager and its watcher params. This makes it a core default with one source of truth.

What changed

  • New pub const DEFAULT_GAP_LIMIT: u32 = 20 in the onchain module, documented (20 = BIP44 standard and BDK's hardcoded Electrum stop-gap floor).
  • Replaced the bare 20 literals with the constant:
    • listener.rsgap_limit.unwrap_or(...) and the .max(...) sync floor.
    • implementation.rsget_account_info's gap_limit.unwrap_or(...).
  • New #[uniffi::export] pub fn get_default_gap_limit() -> u32 (mirrors get_default_wallet_id), so platforms read the default instead of hardcoding 20.

Behaviour is unchanged — the effective default was already 20; this just removes the duplication and exposes it.

Tests

cargo test default_gap_limit_is_twenty — asserts the constant and that the exported accessor returns it.

🤖 Generated with Claude Code

Subtask 3 of #107. The gap limit of 20 was repeated as a literal across the
watcher and account-info paths, and each mobile platform also hardcodes
gapLimit: 20. Introduce a single `DEFAULT_GAP_LIMIT` constant (= 20, matching
BIP44 and BDK's stop-gap floor), use it everywhere the literal appeared, and
expose `get_default_gap_limit()` via UniFFI so platforms read one source of
truth instead of hardcoding it.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 4c0a0c54a6

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread src/lib.rs
Addresses Codex review on #110: the new UniFFI accessor was Rust-only.
Regenerated the checked-in Swift and Python bindings so consumers can call
get_default_gap_limit(). (iOS xcframework / Android Kotlin / dylib are
rebuilt at release via build.sh, per repo convention.)

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

@ben-kaufman ben-kaufman left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Looks like the Python binding artifacts are out of sync. bitkitcore.py now references uniffi_bitkitcore_fn_func_get_default_gap_limit, but the bundled libbitkitcore.dylib does not export that symbol, so importing bitkitcore from the checked-in package fails with a missing dlsym symbol.

Could we regenerate the Python native artifact too, or leave the generated Python wrapper out until the dylib is updated?

…fault_gap_limit

Addresses @ben-kaufman review: the committed Python libbitkitcore.dylib (and the
iOS/Android artifacts) did not export get_default_gap_limit, so importing the
packaged bindings failed with a missing symbol. Regenerated everything from this
Rust head via build.sh all (Swift + bitkitcoreFFI.h + XCFramework, Kotlin +
jniLibs .so, Python wrapper + libbitkitcore.dylib).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@coreyphillips

Copy link
Copy Markdown
Collaborator Author

@ben-kaufman regenerated all platform bindings and native artifacts from the Rust head (3704081), not just the Python wrapper, so the dylib/XCFramework/jniLibs all export the new symbol now. Confirmed present in the committed libbitkitcore.dylib.

@ben-kaufman ben-kaufman left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Verified the regenerated artifacts are in sync now and the Python package imports successfully. Looks good.

# Conflicts:
#	Package.swift
#	bindings/android/lib/src/main/jniLibs/arm64-v8a/libbitkitcore.so
#	bindings/android/lib/src/main/jniLibs/armeabi-v7a/libbitkitcore.so
#	bindings/android/lib/src/main/jniLibs/x86/libbitkitcore.so
#	bindings/android/lib/src/main/jniLibs/x86_64/libbitkitcore.so
#	bindings/ios/BitkitCore.xcframework.zip
#	bindings/ios/BitkitCore.xcframework/ios-arm64-simulator/libbitkitcore.a
#	bindings/ios/BitkitCore.xcframework/ios-arm64/libbitkitcore.a
#	bindings/python/bitkitcore/libbitkitcore.dylib
#	src/lib.rs
@coreyphillips coreyphillips merged commit 68ff3a2 into master Jun 24, 2026
@coreyphillips coreyphillips deleted the feat/gap-limit-default branch June 24, 2026 15:56
@ovitrif

ovitrif commented Jun 24, 2026

Copy link
Copy Markdown
Collaborator

LGTM, thank you guys 🥇

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants