dashpay / platform

L2 solution for seriously fast decentralized applications for the Dash network
https://dashplatform.readme.io/docs/introduction-what-is-dash-platform
MIT License
74 stars 39 forks source link

feat(dashmate): Add contract and block height data to `dashmate status` output #540

Open pshenmic opened 2 years ago

pshenmic commented 2 years ago

Expected Behavior

Dashmate status command have info about block height data

Current Behavior

It does not show block height data

Possible Solution

Add block height data to the status command. Additionally, the fallback strategy for obtaining best block height should be implemented. Call to the external blockchain explorer is used in dashmate status for obtaining the correct chain for best block height and its used as truth of source. This call can fail, server may be down, or other reasons, and this leads to the command fail as well. Add fallback to the getchaintips dashcore RPC method and mark the information as the local by coloring it in yellow.

pshenmic commented 1 year ago

Remote block height is currently broken in v24, because insight is answering too slow, shall we create another task for fallin back to getchaintips?

shumkov commented 1 year ago

Why it works in v0.23 then?

pshenmic commented 1 year ago

Why it works in v0.23 then?

In v23 there is no client timeout implemented and it simply waits for the response and it can take ages to receive the answer (that is why status command is slow in v23). If the request dropped by timeout with server, the command will throw an error

shumkov commented 1 year ago

I'm not sure getchaintips will help us to indicate that node is not actually syncing. @strophy what do you think?

strophy commented 1 year ago

getchaintips will usually show if a particular node has at least heard of nodes with a higher block height, but really we should treat insight (and a fallback) as a reliable external source of block height. We should diagnose why insight is replying slowly instead maybe, there has been an update there in the last few weeks.

shumkov commented 1 year ago

@strophy According to what you saying the fallback will confuse people because you don't know is it a view from outside or just vision of an isolated node.

strophy commented 1 year ago

In the event of a chain fork, everyone will be trying to figure out if they are on an isolated network or if the insight/fallback data is incorrect because the remote source ended up on a chain fork. I think the best option here in the status command is to provide multiple clearly labeled block heights to help people diagnose errors quickly, and highlight our height in green if matches insight.

shumkov commented 1 year ago

Sounds good to me!