fix(tx-history): token information and query#2404
Conversation
Signed-off-by: onur-ozkan <work@onurozkan.dev>
Signed-off-by: onur-ozkan <work@onurozkan.dev>
Signed-off-by: onur-ozkan <work@onurozkan.dev>
8dde850 to
eae2619
Compare
Signed-off-by: onur-ozkan <work@onurozkan.dev>
ab18e1f to
c0af309
Compare
| // it can be the platform ticker instead of the token ticker for a pre-saved record | ||
| if details.coin != request.coin { | ||
| details.coin = request.coin.clone(); | ||
| } |
There was a problem hiding this comment.
I have no idea how this helps to other protocols but it's buggy (hiding actual token tickers) on Tendermint, so I moved it here.
There was a problem hiding this comment.
Apparently this was added for BCH and SLP tx history, SLP tokens are included in a BCH transaction and it might be saved with a BCH ticker. EVMs were not added to v2 tx history so the only tokens protocol that uses this is slp, maybe we should specify this.
There was a problem hiding this comment.
awesome let's please add a comment about this then.
There was a problem hiding this comment.
I would actually use the BCH/SLP protocol instead of _ wildcard, otherwise this will cause a similar bug that will be hard to detect when we add other protocols with tokens. I am fixing it now in a commit.
There was a problem hiding this comment.
Done here 2812ff8 can one of you @mariocynicys @onur-ozkan please check it and resolve this commit if it's fine. I will then merge the PR.
c0af309 to
5b8e290
Compare
Signed-off-by: onur-ozkan <work@onurozkan.dev>
5e2e150 to
3fc5e0e
Compare
|
Would be nice to have an approval from the QA team. cc @KomodoPlatform/qa |
|
Error in response: and console log: After moving DB/ folder to backup (i.e. clean slate), response returned expected result. After restoring backup, on second attempt, response returned expected result. If this is intended (repaired on second restart), I can approve. |
This comment was marked as outdated.
This comment was marked as outdated.
|
Can you re-check? That shouldn't happen anymore @smk762 |
49f3587 to
a78a316
Compare
Signed-off-by: onur-ozkan <work@onurozkan.dev>
Signed-off-by: onur-ozkan <work@onurozkan.dev>
… into fix-token-query-and-info
smk762
left a comment
There was a problem hiding this comment.
Confirmed history now returns for IBC tokens. Thanks!
mariocynicys
left a comment
There was a problem hiding this comment.
Thanks!
First review iter, getting to know things.
d1ae3f1 to
971b405
Compare
mariocynicys
left a comment
There was a problem hiding this comment.
Thanks!
~zero or one last iter for these comments and that's it :)
| @@ -513,9 +519,11 @@ impl MmCoin for TendermintToken { | |||
| internal_id, | |||
There was a problem hiding this comment.
in withdraw, the internal ID for the token case doesn't seem to consider the token_id https://github.com/KomodoPlatform/komodo-defi-framework/blob/971b40529d076969ad1b4391594876b463de6510/mm2src/coins/tendermint/tendermint_token.rs#L497-L500
...
| TransactionType::TendermintIBCTransfer { token_id } | ||
| | TransactionType::CustomTendermintMsg { token_id, .. } => { | ||
| if let Some(token_id) = token_id { | ||
| let mut bytes_for_hash = tx_hash.0.clone(); | ||
| bytes_for_hash.extend_from_slice(&token_id.0); |
There was a problem hiding this comment.
where as here in tx_hist, we do embed token_id into the internal identifer
There was a problem hiding this comment.
That looks weird. 🤔 We shouldn't do that probably, but I don't want remove it and go that far in this PR...
| for id in [old_internal_id, old_internal_id_for_fees] { | ||
| if let Ok(Some(_)) = storage.get_tx_from_history(&wallet_id, &id).await { | ||
| if let Err(e) = storage.remove_tx_from_history(&wallet_id, &id).await { | ||
| log::debug!("Failed to remove old transaction history record. {e:?}"); |
There was a problem hiding this comment.
this shouldn't happen, but if it happened it is worthy to be logged as an error!.
There was a problem hiding this comment.
I don't think we should do that.
There was a problem hiding this comment.
why don't u think so?
| let old_internal_id_for_fees: BytesJson = H256::from(old_internal_id_hash).to_vec().into(); | ||
|
|
||
| for id in [old_internal_id, old_internal_id_for_fees] { | ||
| if let Ok(Some(_)) = storage.get_tx_from_history(&wallet_id, &id).await { |
There was a problem hiding this comment.
shouldn't we also log errors from here?
There was a problem hiding this comment.
No we shouldn't. It's totally fine to skip this silently.
There was a problem hiding this comment.
ummm, if it't just not found, that's OK,
but if we encounter a DB error, we probably wanna know why such an error occurs.
| } | ||
|
|
||
| fn history_sync_status(&self) -> HistorySyncState { HistorySyncState::NotEnabled } | ||
| fn history_sync_status(&self) -> HistorySyncState { self.platform_coin.history_sync_status() } |
There was a problem hiding this comment.
quoting from the PR's post:
Previously it was not possible to query history of Tendermint tokens. This PR makes that
possible.
Q: is this the change that made it possible to query tendermint token history? if not, could you guide me to the change please, as there is no dedicated commit for it.
There was a problem hiding this comment.
No, not this. It's the changes made in mm2src/coins/tendermint/tendermint_tx_history_v2.rs.
971b405 to
3aea946
Compare
| // it can be the platform ticker instead of the token ticker for a pre-saved record | ||
| if details.coin != request.coin { | ||
| details.coin = request.coin.clone(); | ||
| } |
There was a problem hiding this comment.
Apparently this was added for BCH and SLP tx history, SLP tokens are included in a BCH transaction and it might be saved with a BCH ticker. EVMs were not added to v2 tx history so the only tokens protocol that uses this is slp, maybe we should specify this.
mariocynicys
left a comment
There was a problem hiding this comment.
My previous comment threads are non-blocking. Will continue the convo in them later.
LGTM
Signed-off-by: onur-ozkan <work@onurozkan.dev>
04392d2
* dev: (26 commits) chore(deps): remove base58 and replace it completely with bs58 (GLEECBTC#2427) feat(tron): initial groundwork for full TRON integration (GLEECBTC#2425) fix(UTXO): improve tx fee calculation and min relay fee handling (GLEECBTC#2316) deps(timed-map): bump to 1.3.1 (GLEECBTC#2413) improvement(tendermint): safer IBC channel handler (GLEECBTC#2298) chore(release): complete v2.4.0-beta changelogs (GLEECBTC#2436) fix(event-streaming): initial addresses registration in utxo balance streaming (GLEECBTC#2431) improvement(watchers): re-write use-watchers handling (GLEECBTC#2430) fix(evm): make withdraw_nft work in HD mode (GLEECBTC#2424) feat(taproot): support parsing taproot output address types chore(RPC): use consistent param name for QTUM delegation (GLEECBTC#2419) fix(makerbot): add LiveCoinWatch price provider (GLEECBTC#2416) chore(release): add changelog entries for v2.4.0-beta (GLEECBTC#2415) fix(wallets): prevent path traversal in `wallet_file_path` and update file extension (GLEECBTC#2400) fix(nft): make `update_nft` work with hd wallets using the enabled address (GLEECBTC#2386) fix(wasm): unify error handling for mm2_main (GLEECBTC#2389) fix(tx-history): token information and query (GLEECBTC#2404) test(electrums): fix failing test_one_unavailable_electrum_proto_version (GLEECBTC#2412) improvement(network): remove static IPs from seed lists (GLEECBTC#2407) improvement(best-orders): return an rpc error when we can't find best orders (GLEECBTC#2318) ...
Previously it was not possible to query history of Tendermint tokens. This PR makes that
possible. It also breaks the tx-history logic due to the new internal ID computation. But still users will not notice this change as it will be handled silently in the background.
Fixes: #2395 and #2315