paritytech / substrate-api-sidecar

REST service that makes it easy to interact with blockchain nodes built using Substrate's FRAME framework.
https://paritytech.github.io/substrate-api-sidecar/dist/
GNU General Public License v3.0
245 stars 151 forks source link

v17.5.1 does not show correctly XCM messages #1401

Closed will-yjn closed 7 months ago

will-yjn commented 7 months ago

Description The subscan shows there is an XCM message that deposits 1 KSM to an account: https://kusama.subscan.io/xcm_message/kusama-68882b46f2567e950457e91afcf189c2cbfbf0a1 But querying the sidecar does not return expected result. Related to this issue: https://github.com/paritytech/substrate-api-sidecar/pull/1364

Steps to Reproduce

  1. Running the docker image v17.5.1 locally. docker run --rm -it --read-only --env SAS_SUBSTRATE_URL=wss://kusama-rpc.polkadot.io -p 8080:8080 parity/substrate-api-sidecar:v17.5.1
  2. Send the request to query block 21548602. curl -X GET "http://0.0.0.0:8080/blocks/21548602?decodedXcmMsgs=true" -H "accept: application/json"

Expected vs. Actual Behavior Expect to see messages in decodedXcmMsgs. Instead see empty arrays.

2024-02-26 11 46 53
Imod7 commented 7 months ago

Thank you for your question @will-yjn The reason you cannot find the upward message is because:

Typically, when you know the block in which an XCM message was processed, you can look back 1 or 2 blocks to find when this same XCM message was sent.

Let us know if this answer covers your question so we can close the issue.

will-yjn commented 7 months ago

Thank you very much! I still have two questions:

  1. Is it always true that XCM will be processed 1 or 2 blocks after it was sent? Not 3 or more blocks?
  2. Can sidecar be sure the XCM will succeed when it is sent, since it is processed 2 blocks later?
Imod7 commented 7 months ago
  1. While this is often true (1 or 2 blocks), it is not guaranteed (there might cases that it is 3 or more - I personally haven't found). You need to manually scan the next blocks to determine when it was processed.
  2. Sidecar does not provide such guarantees (about the success or failure of the XCM message) nor XCM itself (XCM is asymmetric).

Just to clarify, the decoded XCM messages in the blocks endpoint of Sidecar has the sole purpose of showing the XCM messages found/included within a block.

Below sharing some resources that can be helpful to understand better XCM and its functionalities:

Imod7 commented 7 months ago

@will-yjn I am closing this issue as resolved. If you encounter any bugs in the specific or other endpoint, don't hesitate to reopen it or submit a new issue. Thank you for your questions! 💯