Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(ctx): replace gstuff constructible with oncelock #2267

Merged
merged 6 commits into from
Dec 10, 2024
Merged

Conversation

borngraced
Copy link
Member

@borngraced borngraced commented Nov 6, 2024

#1309

Replaced Constructible from the gstuff crate with once_cell::sync::OnceCell for managing lazy-initialized values in mm_ctx for better performance and stronger thread safety.

also add a slight improvement to from_ctx

@borngraced borngraced self-assigned this Nov 6, 2024
use lazy_static::lazy_static;
use libp2p::PeerId;
use mm2_event_stream::{controller::Controller, Event, EventStreamConfiguration};
use mm2_metrics::{MetricsArc, MetricsOps};
use once_cell::sync::OnceCell;
Copy link
Member

Choose a reason for hiding this comment

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

Why not OnceLock from the standard library?

Copy link
Member Author

@borngraced borngraced Nov 7, 2024

Choose a reason for hiding this comment

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

ah thanks!, I promise, I didn't know this is stable already..also I've had OnceCell on my mind for a long time.

@borngraced borngraced changed the title chore(ctx): replace gstuff constructible with once_cell chore(ctx): replace gstuff constructible with oncelock Nov 8, 2024
mariocynicys
mariocynicys previously approved these changes Dec 9, 2024
Copy link
Collaborator

@mariocynicys mariocynicys left a comment

Choose a reason for hiding this comment

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

One comment inline, LGTM otherwise :)

mariocynicys
mariocynicys previously approved these changes Dec 9, 2024
Copy link
Collaborator

@mariocynicys mariocynicys left a comment

Choose a reason for hiding this comment

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

non-blockers.
LGTM :)

Copy link
Collaborator

@shamardy shamardy left a comment

Choose a reason for hiding this comment

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

LGTM!

@shamardy shamardy merged commit ac926dd into dev Dec 10, 2024
35 of 46 checks passed
@shamardy shamardy deleted the improve-mm_ctx branch December 10, 2024 17:59
onur-ozkan added a commit that referenced this pull request Dec 19, 2024
* feat(LRAPI): add 1inch classic swap rpc (#2222)

This commit adds initial code to connect to 1inch Liquidity Routing API (LRAPI) provider and two new RPCs to use 1inch classic swap API. It also adds 'approve' and 'allowance' RPCs (for ERC20 tokens).

* chore(release): bump mm2 version to 2.3.0-beta (#2285)

* improvement(error-handling): main files (#2288)

Makes KDF to check main files (config/coins/etc..) before reading them to prevent potential panics.

* fix(rpc): remove character check blocking password input (#2287)

This commit removes check for <, >, & characters in RPC request bodies that was incorrectly blocking valid password characters in get_mnemonic RPC call. These special characters should be allowed in passwords.

This aligns native behavior with WASM implementation.

* don't rely on core (#2289)

Signed-off-by: onur-ozkan <work@onurozkan.dev>

* chore(ctx): replace gstuff constructible with oncelock (#2267)

* chore(adex-cli): use "Komodo DeFi Framework" name in adex_cli  (#2290)

* bump libp2p (#2296)

Signed-off-by: onur-ozkan <work@onurozkan.dev>

---------

Signed-off-by: onur-ozkan <work@onurozkan.dev>
Co-authored-by: dimxy <dimxy@komodoplatform.com>
Co-authored-by: Onur Özkan <work@onurozkan.dev>
Co-authored-by: Samuel Onoja <samiodev@icloud.com>
Co-authored-by: DeckerSU <support@decker.su>
dimxy added a commit to dimxy/komodo-defi-framework that referenced this pull request Jan 17, 2025
* dev: (35 commits)
  fix(crypto): allow non bip39 mnemonics storage (KomodoPlatform#2312)
  fix(legacy_swap): check for existing maker/taker payment before timeout (KomodoPlatform#2283)
  feat(tendermint): validators RPC (KomodoPlatform#2310)
  chore(CI): validate Cargo lock file (KomodoPlatform#2309)
  test(P2P): add test for peer time sync validation (KomodoPlatform#2304)
  fix mm2_p2p dev build (KomodoPlatform#2311)
  update Cargo.lock (KomodoPlatform#2308)
  chore(CI): unlock wasm-pack version (KomodoPlatform#2307)
  add `wasm` feature on WASM for timed-map (KomodoPlatform#2306)
  replace broken rpc link (KomodoPlatform#2305)
  chore(eth-websocket): remove some unnecessary wrappers (KomodoPlatform#2291)
  improvement(CI): switch to proper rust caching (KomodoPlatform#2303)
  fix(wasm): add test-ext-api feature to mm2_main and mm2_bin_lib tomls (KomodoPlatform#2295)
  chore(ci): Update docker build for wasm (KomodoPlatform#2294)
  chore(p2p): follow-up nits (KomodoPlatform#2302)
  feat(p2p): ensure time synchronization in the network (KomodoPlatform#2255)
  bump libp2p (KomodoPlatform#2296)
  chore(adex-cli): use "Komodo DeFi Framework" name in adex_cli  (KomodoPlatform#2290)
  chore(ctx): replace gstuff constructible with oncelock (KomodoPlatform#2267)
  don't rely on core (KomodoPlatform#2289)
  ...
shamardy added a commit that referenced this pull request Jan 30, 2025
* feat(LRAPI): add 1inch classic swap rpc (#2222)

This commit adds initial code to connect to 1inch Liquidity Routing API (LRAPI) provider and two new RPCs to use 1inch classic swap API. It also adds 'approve' and 'allowance' RPCs (for ERC20 tokens).

* chore(release): bump mm2 version to 2.3.0-beta (#2285)

* improvement(error-handling): main files (#2288)

Makes KDF to check main files (config/coins/etc..) before reading them to prevent potential panics.

* fix(rpc): remove character check blocking password input (#2287)

This commit removes check for <, >, & characters in RPC request bodies that was incorrectly blocking valid password characters in get_mnemonic RPC call. These special characters should be allowed in passwords.

This aligns native behavior with WASM implementation.

* don't rely on core (#2289)

Signed-off-by: onur-ozkan <work@onurozkan.dev>

* chore(ctx): replace gstuff constructible with oncelock (#2267)

* chore(adex-cli): use "Komodo DeFi Framework" name in adex_cli  (#2290)

* bump libp2p (#2296)

Signed-off-by: onur-ozkan <work@onurozkan.dev>

---------

Signed-off-by: onur-ozkan <work@onurozkan.dev>
Co-authored-by: dimxy <dimxy@komodoplatform.com>
Co-authored-by: Onur Özkan <work@onurozkan.dev>
Co-authored-by: Samuel Onoja <samiodev@icloud.com>
Co-authored-by: DeckerSU <support@decker.su>
shamardy added a commit that referenced this pull request Jan 30, 2025
shamardy added a commit that referenced this pull request Jan 30, 2025
* feat(LRAPI): add 1inch classic swap rpc (#2222)

This commit adds initial code to connect to 1inch Liquidity Routing API (LRAPI) provider and two new RPCs to use 1inch classic swap API. It also adds 'approve' and 'allowance' RPCs (for ERC20 tokens).

* chore(release): bump mm2 version to 2.3.0-beta (#2285)

* improvement(error-handling): main files (#2288)

Makes KDF to check main files (config/coins/etc..) before reading them to prevent potential panics.

* fix(rpc): remove character check blocking password input (#2287)

This commit removes check for <, >, & characters in RPC request bodies that was incorrectly blocking valid password characters in get_mnemonic RPC call. These special characters should be allowed in passwords.

This aligns native behavior with WASM implementation.

* don't rely on core (#2289)

Signed-off-by: onur-ozkan <work@onurozkan.dev>

* chore(ctx): replace gstuff constructible with oncelock (#2267)

* chore(adex-cli): use "Komodo DeFi Framework" name in adex_cli  (#2290)

* bump libp2p (#2296)

Signed-off-by: onur-ozkan <work@onurozkan.dev>

---------

Signed-off-by: onur-ozkan <work@onurozkan.dev>
Co-authored-by: dimxy <dimxy@komodoplatform.com>
Co-authored-by: Onur Özkan <work@onurozkan.dev>
Co-authored-by: Samuel Onoja <samiodev@icloud.com>
Co-authored-by: DeckerSU <support@decker.su>
shamardy added a commit that referenced this pull request Jan 30, 2025
shamardy added a commit that referenced this pull request Jan 30, 2025
* feat(LRAPI): add 1inch classic swap rpc (#2222)

This commit adds initial code to connect to 1inch Liquidity Routing API (LRAPI) provider and two new RPCs to use 1inch classic swap API. It also adds 'approve' and 'allowance' RPCs (for ERC20 tokens).

* chore(release): bump mm2 version to 2.3.0-beta (#2285)

* improvement(error-handling): main files (#2288)

Makes KDF to check main files (config/coins/etc..) before reading them to prevent potential panics.

* fix(rpc): remove character check blocking password input (#2287)

This commit removes check for <, >, & characters in RPC request bodies that was incorrectly blocking valid password characters in get_mnemonic RPC call. These special characters should be allowed in passwords.

This aligns native behavior with WASM implementation.

* don't rely on core (#2289)

Signed-off-by: onur-ozkan <work@onurozkan.dev>

* chore(ctx): replace gstuff constructible with oncelock (#2267)

* chore(adex-cli): use "Komodo DeFi Framework" name in adex_cli  (#2290)

* bump libp2p (#2296)

Signed-off-by: onur-ozkan <work@onurozkan.dev>

---------

Signed-off-by: onur-ozkan <work@onurozkan.dev>
Co-authored-by: dimxy <dimxy@komodoplatform.com>
Co-authored-by: Onur Özkan <work@onurozkan.dev>
Co-authored-by: Samuel Onoja <samiodev@icloud.com>
Co-authored-by: DeckerSU <support@decker.su>
shamardy added a commit that referenced this pull request Jan 30, 2025
shamardy added a commit that referenced this pull request Jan 30, 2025
* feat(LRAPI): add 1inch classic swap rpc (#2222)

This commit adds initial code to connect to 1inch Liquidity Routing API (LRAPI) provider and two new RPCs to use 1inch classic swap API. It also adds 'approve' and 'allowance' RPCs (for ERC20 tokens).

* chore(release): bump mm2 version to 2.3.0-beta (#2285)

* improvement(error-handling): main files (#2288)

Makes KDF to check main files (config/coins/etc..) before reading them to prevent potential panics.

* fix(rpc): remove character check blocking password input (#2287)

This commit removes check for <, >, & characters in RPC request bodies that was incorrectly blocking valid password characters in get_mnemonic RPC call. These special characters should be allowed in passwords.

This aligns native behavior with WASM implementation.

* don't rely on core (#2289)

Signed-off-by: onur-ozkan <work@onurozkan.dev>

* chore(ctx): replace gstuff constructible with oncelock (#2267)

* chore(adex-cli): use "Komodo DeFi Framework" name in adex_cli  (#2290)

* bump libp2p (#2296)

Signed-off-by: onur-ozkan <work@onurozkan.dev>

---------

Signed-off-by: onur-ozkan <work@onurozkan.dev>
Co-authored-by: dimxy <dimxy@komodoplatform.com>
Co-authored-by: Onur Özkan <work@onurozkan.dev>
Co-authored-by: Samuel Onoja <samiodev@icloud.com>
Co-authored-by: DeckerSU <support@decker.su>
shamardy added a commit that referenced this pull request Jan 30, 2025
shamardy added a commit that referenced this pull request Jan 30, 2025
* feat(LRAPI): add 1inch classic swap rpc (#2222)

This commit adds initial code to connect to 1inch Liquidity Routing API (LRAPI) provider and two new RPCs to use 1inch classic swap API. It also adds 'approve' and 'allowance' RPCs (for ERC20 tokens).

* chore(release): bump mm2 version to 2.3.0-beta (#2285)

* improvement(error-handling): main files (#2288)

Makes KDF to check main files (config/coins/etc..) before reading them to prevent potential panics.

* fix(rpc): remove character check blocking password input (#2287)

This commit removes check for <, >, & characters in RPC request bodies that was incorrectly blocking valid password characters in get_mnemonic RPC call. These special characters should be allowed in passwords.

This aligns native behavior with WASM implementation.

* don't rely on core (#2289)

Signed-off-by: onur-ozkan <work@onurozkan.dev>

* chore(ctx): replace gstuff constructible with oncelock (#2267)

* chore(adex-cli): use "Komodo DeFi Framework" name in adex_cli  (#2290)

* bump libp2p (#2296)

Signed-off-by: onur-ozkan <work@onurozkan.dev>

---------

Signed-off-by: onur-ozkan <work@onurozkan.dev>
Co-authored-by: dimxy <dimxy@komodoplatform.com>
Co-authored-by: Onur Özkan <work@onurozkan.dev>
Co-authored-by: Samuel Onoja <samiodev@icloud.com>
Co-authored-by: DeckerSU <support@decker.su>
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.

4 participants