Conversation
timed-map crate instead of internal ExpirableMap typetimed-map crate instead of internal ExpirableMap
Signed-off-by: onur-ozkan <work@onurozkan.dev>
e2b814e to
ff4038d
Compare
timed-map crate instead of internal ExpirableMaptimed-map migration
| tx: Mutex::new(None), | ||
| establishing_connection: AsyncMutex::new(()), | ||
| responses: Mutex::new(JsonRpcPendingRequests::new()), | ||
| responses: Mutex::new(JsonRpcPendingRequests::new_with_map_kind(MapKind::BTreeMap)), |
There was a problem hiding this comment.
Picked BTreeMap intentionally to process entries in order.
There was a problem hiding this comment.
wdym by processing entries in order? what processing?
There was a problem hiding this comment.
wdym by processing entries in order? what processing?
Making sure to process responses in the FIFO way.
There was a problem hiding this comment.
yeah where is that 😂
There was a problem hiding this comment.
Fell into this terrible naming (there is no separation at all at the first glance)
thought this was the loop iterating over the responses map..
There was a problem hiding this comment.
Honestly I still believe we should prefer BTreeMap here to avoid difficult-to-debug magical future bugs. If we add any logic with the expectation of running FIFO processing, it will accidentally run in a random order and that will be super annoying to catch on runtime. The fact that I already falled in this trap makes it very likely to happen again to me or anyone in the team.
There was a problem hiding this comment.
aha cool, im fine with BTree or others, i only nitted to make sure im not missing something with the in-order comment.
Signed-off-by: onur-ozkan <work@onurozkan.dev>
mariocynicys
left a comment
There was a problem hiding this comment.
Thanks!
One comment inline. LGTM otherwise.
|
|
mariocynicys
left a comment
There was a problem hiding this comment.
labeled the never checked maps below
The order trie logic highly depends on timecache internals, which is covered in the We have 3 options:
I am ok with any of them. |
Signed-off-by: onur-ozkan <work@onurozkan.dev>
5094612 to
5563e9d
Compare
|
I think the problem with Index: mm2src/mm2_main/src/lp_ordermatch.rs
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/mm2src/mm2_main/src/lp_ordermatch.rs b/mm2src/mm2_main/src/lp_ordermatch.rs
--- a/mm2src/mm2_main/src/lp_ordermatch.rs (revision 5563e9d6c99366dd19d256d52ef6ba49c7481225)
+++ b/mm2src/mm2_main/src/lp_ordermatch.rs (date 1737460248340)
@@ -2550,7 +2550,10 @@
if prev_root != H64::default() {
let history = match pubkey_state.order_pairs_trie_state_history.get_mut(&alb_ordered) {
- Some(t) => t,
+ Some(t) => {
+ pubkey_state.order_pairs_trie_state_history.update_expiration(alb_ordered, Duration::from_secs(TRIE_STATE_HISTORY_TIMEOUT));
+ t
+ },
None => {
pubkey_state.order_pairs_trie_state_history.insert_expirable(
alb_ordered.clone(),P.S. I am going with option 1 if we can |
I tried that too but it didn't work either; like I said, time-cache internal logic is tightly coupled with the test expectations. |
Signed-off-by: onur-ozkan <work@onurozkan.dev>
… into use-timed-map-crate
Signed-off-by: onur-ozkan <work@onurozkan.dev>
… into use-timed-map-crate
|
trie test expectation logic is 1:1 ported now |
Signed-off-by: onur-ozkan <work@onurozkan.dev>
|
@onur-ozkan please resolve conflicts so that I can approve the PR. It LGTM now. |
… into use-timed-map-crate Signed-off-by: onur-ozkan <work@onurozkan.dev>
* dev: fix(hash-types): remove panic, enforce fixed-size arrays (GLEECBTC#2279) fix(ARRR): store unconfirmed change output (GLEECBTC#2276) feat(tendermint): staking/delegation (GLEECBTC#2322) chore(deps): `timed-map` migration (GLEECBTC#2247) fix(mem-leak): `running_swap` never shrinks (GLEECBTC#2301) chore(dep-bump): libp2p (GLEECBTC#2326) refactor(build script): rewrite the main build script (GLEECBTC#2319)
* dev: fix(hash-types): remove panic, enforce fixed-size arrays (GLEECBTC#2279) fix(ARRR): store unconfirmed change output (GLEECBTC#2276) feat(tendermint): staking/delegation (GLEECBTC#2322) chore(deps): `timed-map` migration (GLEECBTC#2247) fix(mem-leak): `running_swap` never shrinks (GLEECBTC#2301) chore(dep-bump): libp2p (GLEECBTC#2326) refactor(build script): rewrite the main build script (GLEECBTC#2319)
* dev: fix(derive_key_from_path): check length of current_key_material (#2356) chore(release): bump mm2 version to 2.4.0-beta (#2346) fix(tests): add additional testnet sepolia nodes to test code (#2358) fix(swaps): maintain legacy compatibility for negotiation messages (#2353) refactor(SwapOps): impl defaults for protocol specific swapops fns (#2354) feat(tpu-v2): provide swap protocol versioning (#2324) feat(wallet): add change mnemonic password rpc (#2317) fix(tpu-v2): fix tpu-v2 wait for payment spend and extract secret (#2261) feat(tendermint): unstaking/undelegation (#2330) fix(utxo-withdraw): get hw ctx only when `PrivKeyPolicy` is trezor (#2333) feat(event-streaming): API-driven subscription management (#2172) fix(hash-types): remove panic, enforce fixed-size arrays (#2279) fix(ARRR): store unconfirmed change output (#2276) feat(tendermint): staking/delegation (#2322) chore(deps): `timed-map` migration (#2247) fix(mem-leak): `running_swap` never shrinks (#2301) chore(dep-bump): libp2p (#2326) refactor(build script): rewrite the main build script (#2319)
* dev: fix(derive_key_from_path): check length of current_key_material (#2356) chore(release): bump mm2 version to 2.4.0-beta (#2346) fix(tests): add additional testnet sepolia nodes to test code (#2358) fix(swaps): maintain legacy compatibility for negotiation messages (#2353) refactor(SwapOps): impl defaults for protocol specific swapops fns (#2354) feat(tpu-v2): provide swap protocol versioning (#2324) feat(wallet): add change mnemonic password rpc (#2317) fix(tpu-v2): fix tpu-v2 wait for payment spend and extract secret (#2261) feat(tendermint): unstaking/undelegation (#2330) fix(utxo-withdraw): get hw ctx only when `PrivKeyPolicy` is trezor (#2333) feat(event-streaming): API-driven subscription management (#2172) fix(hash-types): remove panic, enforce fixed-size arrays (#2279) fix(ARRR): store unconfirmed change output (#2276) feat(tendermint): staking/delegation (#2322) chore(deps): `timed-map` migration (#2247) fix(mem-leak): `running_swap` never shrinks (#2301) chore(dep-bump): libp2p (#2326) refactor(build script): rewrite the main build script (#2319)
* dev: (24 commits) fix(eth-tpu): remove state from funding validation (GLEECBTC#2334) improvement(rpc-server): rpc server dynamic port allocation (GLEECBTC#2342) fix(tests): fix or ignore unstable tests (GLEECBTC#2365) fix(fs): make `filter_files_by_extension` return only files (GLEECBTC#2364) fix(derive_key_from_path): check length of current_key_material (GLEECBTC#2356) chore(release): bump mm2 version to 2.4.0-beta (GLEECBTC#2346) fix(tests): add additional testnet sepolia nodes to test code (GLEECBTC#2358) fix(swaps): maintain legacy compatibility for negotiation messages (GLEECBTC#2353) refactor(SwapOps): impl defaults for protocol specific swapops fns (GLEECBTC#2354) feat(tpu-v2): provide swap protocol versioning (GLEECBTC#2324) feat(wallet): add change mnemonic password rpc (GLEECBTC#2317) fix(tpu-v2): fix tpu-v2 wait for payment spend and extract secret (GLEECBTC#2261) feat(tendermint): unstaking/undelegation (GLEECBTC#2330) fix(utxo-withdraw): get hw ctx only when `PrivKeyPolicy` is trezor (GLEECBTC#2333) feat(event-streaming): API-driven subscription management (GLEECBTC#2172) fix(hash-types): remove panic, enforce fixed-size arrays (GLEECBTC#2279) fix(ARRR): store unconfirmed change output (GLEECBTC#2276) feat(tendermint): staking/delegation (GLEECBTC#2322) chore(deps): `timed-map` migration (GLEECBTC#2247) fix(mem-leak): `running_swap` never shrinks (GLEECBTC#2301) ...
Complete timed-map migration from
TimeCache,DuplicateCache,ExpirableMapandExpirableEntry.