Skip to content

0.9.3#292

Merged
ca333 merged 15 commits intomainfrom
dev
Nov 13, 2025
Merged

0.9.3#292
ca333 merged 15 commits intomainfrom
dev

Conversation

@ca333
Copy link
Copy Markdown
Contributor

@ca333 ca333 commented Nov 13, 2025

sync main

Summary by CodeRabbit

  • New Features

    • Added security filtering for Electrum servers, keeping only SSL connections.
    • Implemented caching for activated assets to improve performance (10-second TTL).
  • Bug Fixes

    • Improved localhost address normalization in RPC URL handling.
  • Chores

    • Updated build configuration with new API commit hash, enabled API fetching at build time, and updated dependency checksums across all platforms.

ca333 and others added 15 commits November 2, 2025 01:25
chore: sync hot-fixes to `dev`
…tivation checks

- Refactor activation logic in ActivationManager and SmartAssetActivator to utilize ActivatedAssetsCache, reducing direct RPC calls and improving performance.
- Update activation strategy factory to include ActivatedAssetsCache as a parameter.
- Increase cache TTL from 2 seconds to 10 seconds for better efficiency in asset activation status checks.
…rums

fix(config): add ssl-only transform for native platforms
…tivation checks (#282)

- Refactor activation logic in ActivationManager and SmartAssetActivator to utilize ActivatedAssetsCache, reducing direct RPC calls and improving performance.
- Update activation strategy factory to include ActivatedAssetsCache as a parameter.
- Increase cache TTL from 2 seconds to 10 seconds for better efficiency in asset activation status checks.
…r-2683

update build config to use kdf_1874d43
Copilot AI review requested due to automatic review settings November 13, 2025 10:40
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Nov 13, 2025

Caution

Review failed

The pull request is closed.

Walkthrough

This PR adds SSL/HTTPS security filtering for electrum and node servers, integrates an ActivatedAssetsCache dependency throughout the activation pipeline, refines host normalization logic, updates build configurations with new checksums and API commit hashes, and increases the activated assets cache TTL from 2 to 10 seconds.

Changes

Cohort / File(s) Change Summary
Security Filtering Transform
packages/komodo_coin_updates/lib/src/coins_config/config_transform.dart
Introduces SslElectrumTransform class that filters electrum entries (SSL only), node URLs (HTTPS only), and light\_wallet\_d\_servers (HTTPS only) on non-web/non-Wasm platforms; logs warnings if all entries are filtered away. Integrates into the CoinConfigTransformer pipeline.
Build Configuration & Checksums
packages/komodo_defi_framework/app_build/build_config.json
Updates API commit hash, enables fetch\_at\_build, removes duplicate source URL, and updates valid\_zip\_sha256\_checksums for all platforms (web, iOS, macOS, Windows, Android, Linux). Updates bundled\_coins\_repo\_commit.
Host Normalization
packages/komodo_defi_framework/lib/src/operations/kdf_operations_remote.dart
Changes \\\_safeRpcUrl\\ to use exact equality checks instead of substring matching for "localhost" and "127.0.0.1" hosts; converts exact "localhost" to "127.0.0.1" only.
Activation Cache Integration
packages/komodo_defi_sdk/lib/src/activation/activation_manager.dart, packages/komodo_defi_sdk/lib/src/activation/base_strategies/activation_strategy_base.dart, packages/komodo_defi_sdk/lib/src/activation/base_strategies/activation_strategy_factory.dart
Injects ActivatedAssetsCache dependency into ActivationManager and SmartAssetActivator; replaces direct RPC-based activation checks with cache-based lookups; passes cache through factory method and constructor chain; invalidates cache on successful activation.
Cache Configuration
packages/komodo_defi_sdk/lib/src/sdk/komodo_defi_sdk_config.dart
Increases default \activatedAssetsCacheTtl\\ from 2 seconds to 10 seconds in KomodoDefiSdkConfig constructor.

Sequence Diagram(s)

sequenceDiagram
    participant AM as ActivationManager
    participant Cache as ActivatedAssetsCache
    participant Factory as ActivationStrategyFactory
    participant Activator as SmartAssetActivator

    Note over AM,Cache: New Cache-Based Activation Flow

    AM->>Cache: getActivatedAssetIds()
    Cache-->>AM: activated asset IDs (cached)

    AM->>Factory: createStrategy(..., cache)
    Factory->>Activator: new SmartAssetActivator(..., cache)
    Activator-->>Factory: activator instance

    AM->>Activator: activate asset
    Activator->>Cache: check isActive (containment check)
    Cache-->>Activator: activation status
    Activator-->>AM: activation complete

    AM->>Cache: invalidate()
    Note over Cache: Cache cleared for next check
Loading

Estimated Code Review Effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

  • Dependency injection patterns: Verify cache integration across three activation-related files maintains consistency and thread-safety
  • Host normalization logic: Confirm exact equality checks don't break existing localhost/loopback handling in different environments
  • SSL filtering logic: Validate filtering behavior for edge cases (empty server lists, mixed protocols, warning logs)
  • Configuration values: Spot-check updated checksums and commit hashes align with build artifacts

Possibly related PRs

Suggested Labels

enhancement

Suggested Reviewers

  • gcharang
  • smk762
  • CharlVS

Poem

🐰 Beep boop, SSL hops,
Filters secure, the filtering stops,
Cache now whispers what coins can be,
No RPC calls for you or me!
Config checksums bounce and gleam,
A safer, faster DeFi dream.

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch dev

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between bd25579 and 5a7050f.

📒 Files selected for processing (7)
  • packages/komodo_coin_updates/lib/src/coins_config/config_transform.dart (3 hunks)
  • packages/komodo_defi_framework/app_build/build_config.json (3 hunks)
  • packages/komodo_defi_framework/lib/src/operations/kdf_operations_remote.dart (1 hunks)
  • packages/komodo_defi_sdk/lib/src/activation/activation_manager.dart (2 hunks)
  • packages/komodo_defi_sdk/lib/src/activation/base_strategies/activation_strategy_base.dart (3 hunks)
  • packages/komodo_defi_sdk/lib/src/activation/base_strategies/activation_strategy_factory.dart (3 hunks)
  • packages/komodo_defi_sdk/lib/src/sdk/komodo_defi_sdk_config.dart (1 hunks)

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@ca333 ca333 merged commit 7c1f9aa into main Nov 13, 2025
10 of 13 checks passed
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR syncs main with version 0.9.3, introducing performance optimizations to reduce excessive RPC calls through caching, security improvements for non-web platforms, and Android-specific DNS resolution fixes.

  • Increased activated assets cache TTL from 2 to 10 seconds to reduce unnecessary RPC requests
  • Added new SslElectrumTransform to filter insecure connections on non-web platforms
  • Fixed localhost DNS resolution issues on Android by normalizing to 127.0.0.1
  • Updated API binaries and coin configurations to latest versions

Reviewed Changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
packages/komodo_defi_sdk/lib/src/sdk/komodo_defi_sdk_config.dart Increased cache TTL from 2 to 10 seconds for activated assets
packages/komodo_defi_sdk/lib/src/activation/base_strategies/activation_strategy_factory.dart Added activatedAssetsCache parameter to strategy factory
packages/komodo_defi_sdk/lib/src/activation/base_strategies/activation_strategy_base.dart Updated SmartAssetActivator to use cache instead of direct RPC calls for activation checks
packages/komodo_defi_sdk/lib/src/activation/activation_manager.dart Refactored to use cached asset activation status instead of direct RPC calls
packages/komodo_defi_framework/lib/src/operations/kdf_operations_remote.dart Fixed localhost normalization to use exact matching instead of substring contains
packages/komodo_defi_framework/app_build/build_config.json Updated API commit hash, platform checksums, coins repo commit, and build configuration
packages/komodo_coin_updates/lib/src/coins_config/config_transform.dart Added SslElectrumTransform to filter non-SSL/HTTPS connections on non-web platforms

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

final electrum = config.valueOrNull<JsonList>('electrum');
if (electrum != null) {
final originalCount = electrum.length;
final filteredElectrums = electrum.where((JsonMap e) {
Copy link

Copilot AI Nov 13, 2025

Choose a reason for hiding this comment

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

The where clause explicitly casts list elements to JsonMap without validation. If the electrum list contains non-map elements, this will cause a runtime type error. Consider using safer type checking:

final filteredElectrums = electrum.where((e) {
  if (e is! Map<String, dynamic>) return false;
  final protocol = (e as JsonMap).valueOrNull<String>('protocol');
  return protocol == 'SSL';
}).cast<JsonMap>().toList();

The same issue exists on line 265 for rpcNodes.

Copilot uses AI. Check for mistakes.
Comment on lines +265 to +268
final filteredRpcNodes = rpcNodes.where((JsonMap node) {
final url = node.valueOrNull<String>('url');
return url != null && url.startsWith('https://');
}).toList();
Copy link

Copilot AI Nov 13, 2025

Choose a reason for hiding this comment

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

Similar to the electrum filtering issue above, the where clause explicitly casts list elements to JsonMap without validation. If the nodes list contains non-map elements, this will cause a runtime type error. Consider using safer type checking:

final filteredRpcNodes = rpcNodes.where((node) {
  if (node is! Map<String, dynamic>) return false;
  final url = (node as JsonMap).valueOrNull<String>('url');
  return url != null && url.startsWith('https://');
}).cast<JsonMap>().toList();
Suggested change
final filteredRpcNodes = rpcNodes.where((JsonMap node) {
final url = node.valueOrNull<String>('url');
return url != null && url.startsWith('https://');
}).toList();
final filteredRpcNodes = rpcNodes.where((node) {
if (node is! Map<String, dynamic>) return false;
final url = (node as JsonMap).valueOrNull<String>('url');
return url != null && url.startsWith('https://');
}).cast<JsonMap>().toList();

Copilot uses AI. Check for mistakes.
@github-actions
Copy link
Copy Markdown
Contributor

Visit the preview URL for this PR (updated for commit 5a7050f):

https://kdf-sdk--pr292-dev-c5h9v2g2.web.app

(expires Thu, 20 Nov 2025 10:45:11 GMT)

🔥 via Firebase Hosting GitHub Action 🌎

Sign: 9c1b6e6c010cf0b965c455ba7a69c4aedafa8a1d

@github-actions
Copy link
Copy Markdown
Contributor

Visit the preview URL for this PR (updated for commit 5a7050f):

https://komodo-playground--pr292-dev-ybun53a5.web.app

(expires Thu, 20 Nov 2025 10:45:16 GMT)

🔥 via Firebase Hosting GitHub Action 🌎

Sign: 2bfedd77fdea45b25ba7c784416e81f177aa5c47

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.

6 participants