-
Notifications
You must be signed in to change notification settings - Fork 101
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
Conversation
mm2src/mm2_core/src/mm_ctx.rs
Outdated
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; |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this 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 :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
non-blockers.
LGTM :)
ad5dc59
to
72018af
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
* 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>
* 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) ...
* 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>
* 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>
* 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>
* 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>
* 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>
#1309
Replaced
Constructible
from thegstuff
crate withonce_cell::sync::OnceCell
for managing lazy-initialized values inmm_ctx
for better performance and stronger thread safety.also add a slight improvement to
from_ctx