Skip to content

Error when trying to restore old sessions #359

@Catrya

Description

@Catrya

I tried restoring an old user I have with mostro-cli. mostrod reports that there are 8 orders in total, and although the app receives them, it only shows 2 orders in the UI.

This is the message that mostrod sends:

2025-11-19T00:51:22.892070Z  INFO mostrod::db: Background restore session completed with 8 orders, 0 disputes
2025-11-19T00:51:22.892199Z  INFO mostrod::app::restore_session: Restore session response sent to user 519c20f0dc60797d3a8b344123d035bd2f8e80d838fd9729a6cc2774d3de97bf
2025-11-19T00:51:23.075859Z  INFO mostrod::util: sender key 82fa8cb978b43c79b2156585bac2c011176a21d2aead6d9f7c575c005be88390 - receiver key 519c20f0dc60797d3a8b344123d035bd2f8e80d838fd9729a6cc2774d3de97bf
2025-11-19T00:51:23.076892Z  INFO mostrod::util: Sending DM, Event ID: 591055211d95706748533330d3f61db97af3a8cc86034c95329e80e6aeb160b4 to 519c20f0dc60797d3a8b344123d035bd2f8e80d838fd9729a6cc2774d3de97bf with payload: "{\"restore\":{\"version\":1,\"request_id\":null,\"trade_index\":null,\"action\":\"restore-session\",\"payload\":{\"restore_data\":{\"orders\":[{\"order_id\":\"d4950e52-cc57-41b9-bb69-fc58228f05d9\",\"trade_index\":51,\"status\":\"active\"},{\"order_id\":\"1400e742-7db4-4363-b315-03b6b6918111\",\"trade_index\":33,\"status\":\"active\"},{\"order_id\":\"8221930d-bf6b-40bb-b2da-a8f4e9315dfb\",\"trade_index\":34,\"status\":\"active\"},{\"order_id\":\"e186ee33-a264-4503-a25c-06e4397a82cf\",\"trade_index\":37,\"status\":\"active\"},{\"order_id\":\"f6ea4b1d-f92c-49b9-a777-d3b472a6e036\",\"trade_index\":38,\"status\":\"active\"},{\"order_id\":\"abfa3fb4-01fb-469a-b763-9f8e3ff7de1e\",\"trade_index\":40,\"status\":\"active\"},{\"order_id\":\"2dfd3da6-a189-445e-9fdc-a11c7c6a1f24\",\"trade_index\":43,\"status\":\"fiat-sent\"},{\"order_id\":\"45c02db6-5d21-4c43-919c-eb194c76ca0f\",\"trade_index\":48,\"status\":\"pending\"}],\"disputes\":[]}}}}"
2025-11-19T00:51:23.434725Z  INFO mostrod::util: sender key 82fa8cb978b43c79b2156585bac2c011176a21d2aead6d9f7c575c005be88390 - receiver key 519c20f0dc60797d3a8b344123d035bd2f8e80d838fd9729a6cc2774d3de97bf
2025-11-19T00:51:23.436443Z  INFO mostrod::util: Sending DM, Event ID: 59406aae5651422cccf7bc63eddeae80870b309d2de58f305fb73720820b179b to 519c20f0dc60797d3a8b344123d035bd2f8e80d838fd9729a6cc2774d3de97bf with payload: "{\"order\":{\"version\":1,\"request_id\":1763513483241,\"trade_index\":null,\"action\":\"orders\",\"payload\":{\"orders\":[{\"id\":\"d4950e52-cc57-41b9-bb69-fc58228f05d9\",\"kind\":\"sell\",\"status\":\"active\",\"amount\":903,\"fiat_code\":\"ARS\",\"min_amount\":null,\"max_amount\":null,\"fiat_amount\":1234,\"payment_method\":\"MODO\",\"premium\":0,\"buyer_trade_pubkey\":\"9b708fc76cdfa7556166bdfe1949f51890dc83036d98ba6ec23b5382d40ffa1b\",\"seller_trade_pubkey\":\"620ea3eebbd2d7bfca0fbe37b6e1b5a55dbe8075aa5fb9cbb0bde371ee456419\",\"buyer_invoice\":\"spiralboot92@walletofsatoshi.com\",\"created_at\":null,\"expires_at\":null},{\"id\":\"1400e742-7db4-4363-b315-03b6b6918111\",\"kind\":\"buy\",\"status\":\"active\",\"amount\":656,\"fiat_code\":\"CUP\",\"min_amount\":300,\"max_amount\":1000,\"fiat_amount\":300,\"payment_method\":\"Transfermovil\",\"premium\":0,\"buyer_trade_pubkey\":\"f0518eb155b46e633fa5ad52f2636a266c49958b150597dc8032943d0501b9e8\",\"seller_trade_pubkey\":\"a36641acae07b0f9f2f25a3369492f16fdbb9e3294e028ef300e89775a30dd46\",\"buyer_invoice\":\"lnbc6540n1p53yq72pp5ca39ncfqwe7ea5vmthpg8cc5f78vye88vrt6qr3tqdc9vw9gu8kqdqqcqzzsxqyz5vqsp5nj0ha0k3mhz5c95taecwtd7uwhswmmryyjvxyulffmj3kqp7d64s9qxpqysgq7p6qe9qcankt8x035kh3g3t3s2p5jautxjyz3elk29vf7tzzedrkc4dr384urfc7exzjynelr0eag93gvgsjsx5422m3nmr4l3jxmfgpqtnphx\",\"created_at\":null,\"expires_at\":null},{\"id\":\"8221930d-bf6b-40bb-b2da-a8f4e9315dfb\",\"kind\":\"buy\",\"status\":\"active\",\"amount\":895,\"fiat_code\":\"MLC\",\"min_amount\":2,\"max_amount\":10,\"fiat_amount\":2,\"payment_method\":\"Transferencia Bancaria,Efectivo\",\"premium\":0,\"buyer_trade_pubkey\":\"d138f22eaef17793cf4e544b4206c8b7916c8fac93a936d88e6921c42458d1b1\",\"seller_trade_pubkey\":\"d8b2dbaa02889fa7f0d81d5fdd684182a063eec6e83f32c63dd517bd539cc4fc\",\"buyer_invoice\":\"spiralboot92@walletofsatoshi.com\",\"created_at\":null,\"expires_at\":null},{\"id\":\"e186ee33-a264-4503-a25c-06e4397a82cf\",\"kind\":\"buy\",\"status\":\"active\",\"amount\":644,\"fiat_code\":\"CUP\",\"min_amount\":300,\"max_amount\":1000,\"fiat_amount\":300,\"payment_method\":\"EnZona\",\"premium\":0,\"buyer_trade_pubkey\":\"4ef51a823e6b6b79244abe28d7b777fc912aba7e52b65fdb9dfd4ce64d051b7a\",\"seller_trade_pubkey\":\"a640eaa86053198a0d6079da122aaa4327b4efe6d7370faf6ebef3a0e11a976e\",\"buyer_invoice\":\"spiralboot92@walletofsatoshi.com\",\"created_at\":null,\"expires_at\":null},{\"id\":\"f6ea4b1d-f92c-49b9-a777-d3b472a6e036\",\"kind\":\"buy\",\"status\":\"active\",\"amount\":881,\"fiat_code\":\"MLC\",\"min_amount\":null,\"max_amount\":null,\"fiat_amount\":2,\"payment_method\":\"Transferencia Bancaria\",\"premium\":0,\"buyer_trade_pubkey\":\"32b89ba2bc14d9a93ae39cf51ca5a24a9cb3eb9eaba672fee6bc19d318eca034\",\"seller_trade_pubkey\":\"cd0bba88405fadb96aa481b34f9acdffbfe9a6ec09f620f833d883a077d59dad\",\"buyer_invoice\":\"spiralboot92@walletofsatoshi.com\",\"created_at\":null,\"expires_at\":null},{\"id\":\"abfa3fb4-01fb-469a-b763-9f8e3ff7de1e\",\"kind\":\"buy\",\"status\":\"active\",\"amount\":856,\"fiat_code\":\"CUP\",\"min_amount\":null,\"max_amount\":null,\"fiat_amount\":400,\"payment_method\":\"EnZona\",\"premium\":0,\"buyer_trade_pubkey\":\"0aaa43d21584548f8929cf01f0b93e4e15b22c158a7af14661390cc036ccbf64\",\"seller_trade_pubkey\":\"8c20092c30445ca76f1c1a7b0e6e796d04436517b641baccc1763229bbcf4e5f\",\"buyer_invoice\":\"spiralboot92@walletofsatoshi.com\",\"created_at\":null,\"expires_at\":null},{\"id\":\"2dfd3da6-a189-445e-9fdc-a11c7c6a1f24\",\"kind\":\"buy\",\"status\":\"fiat-sent\",\"amount\":645,\"fiat_code\":\"CUP\",\"min_amount\":null,\"max_amount\":null,\"fiat_amount\":300,\"payment_method\":\"Transfermovil\",\"premium\":0,\"buyer_trade_pubkey\":\"ad593988f36a07dc004ac3e12fad465acf8d34b649b65babe0c49b9a9a3f1ff0\",\"seller_trade_pubkey\":\"b016c0fdedd78975a8fa39f397fe4fdd8a89b6cbfd51a107ec39c3fcfdeb4616\",\"buyer_invoice\":\"spiralboot92@walletofsatoshi.com\",\"created_at\":null,\"expires_at\":null},{\"id\":\"45c02db6-5d21-4c43-919c-eb194c76ca0f\",\"kind\":\"sell\",\"status\":\"pending\",\"amount\":0,\"fiat_code\":\"CUP\",\"min_amount\":null,\"max_amount\":null,\"fiat_amount\":500,\"payment_method\":\"test\",\"premium\":0,\"seller_trade_pubkey\":\"de66228dbb847eb3f04a720e6e63573c42c6767cee0e40b48740ff69c38f3f2e\",\"created_at\":null,\"expires_at\":null}]}}}"
2025-11-19T00:51:23.785434Z  INFO mostrod::app::last_trade_index: User with pubkey: d1ebe4b36e251d5f30da171e6df700b616030775929eb0bc1e32b830ac82640e requested last trade index
2025-11-19T00:51:23.785710Z  INFO mostrod::app::last_trade_index: Last trade index: 51
2025-11-19T00:51:23.785804Z  INFO mostrod::util: sender key 82fa8cb978b43c79b2156585bac2c011176a21d2aead6d9f7c575c005be88390 - receiver key 519c20f0dc60797d3a8b344123d035bd2f8e80d838fd9729a6cc2774d3de97bf
2025-11-19T00:51:23.786363Z  INFO mostrod::util: Sending DM, Event ID: 4494a94cb215108b21ecea5440956e6246aeaf18a2dfa158cdcef0c17efde444 to 519c20f0dc60797d3a8b344123d035bd2f8e80d838fd9729a6cc2774d3de97bf with payload: "{\"restore\":{\"version\":1,\"request_id\":null,\"trade_index\":51,\"action\":\"last-trade-index\",\"payload\":null}}"

But the app only shows 2 orders.

Image

These are the app logs from two different moments when I tried restoring that user.

1st attempt:

logs.txt

In this one, something caught my attention — something that didn’t appear the second time I tried:

[ERROR:flutter/runtime/dart_vm_initializer.cc(40)] Unhandled Exception: Invalid argument(s): Trade key does not match derived key
#0      SessionStorage._decodeSession (package:mostro_mobile/data/repositories/session_storage.dart:40:7)
#1      SessionStorage.fromDbMap (package:mostro_mobile/data/repositories/session_storage.dart:25:12)
#2      BaseStorage.find.<anonymous closure> (package:mostro_mobile/data/repositories/base_storage.dart:75:23)
#3      MappedListIterable.elementAt (dart:_internal/iterable.dart:442:31)
#4      ListIterator.moveNext (dart:_internal/iterable.dart:371:26)
#5      new _List._ofEfficientLengthIterable (dart:core-patch/array.dart:170:27)
#6      new _List.of (dart:core-patch/array.dart:134:20)
#7      new List.of (dart:core-patch/array_patch.dart:39:50)
#8      ListIterable.toList (dart:_internal/iterable.dart:224:7)
#9      BaseStorage.find (package:mostro_mobile/data/repositories/base_storage.dart:76:10)
<asynchronous suspension>
#10     SessionNotifier._cleanup (package:mostro_mobile/shared/notifiers/session_notifier.dart:73:29)
<asynchronous suspension>

2nd attempt:
logs1.txt

These are the 8 orders; the ones shown in the UI are the ones with trade index 51 and 48:

  1. Order ID: d4950e52-cc57-41b9-bb69-fc58228f05d9
     Trade Index: 51
     Status: "active"

  2. Order ID: 1400e742-7db4-4363-b315-03b6b6918111
     Trade Index: 33
     Status: "active"

  3. Order ID: 8221930d-bf6b-40bb-b2da-a8f4e9315dfb
     Trade Index: 34
     Status: "active"

  4. Order ID: e186ee33-a264-4503-a25c-06e4397a82cf
     Trade Index: 37
     Status: "active"

  5. Order ID: f6ea4b1d-f92c-49b9-a777-d3b472a6e036
     Trade Index: 38
     Status: "active"

  6. Order ID: abfa3fb4-01fb-469a-b763-9f8e3ff7de1e
     Trade Index: 40
     Status: "active"

  7. Order ID: 2dfd3da6-a189-445e-9fdc-a11c7c6a1f24
     Trade Index: 43
     Status: "fiat-sent"

  8. Order ID: 45c02db6-5d21-4c43-919c-eb194c76ca0f
     Trade Index: 48
     Status: "pending"

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions