Cosmos-sdk: LCD Scope/Documentation

Created on 20 Jun 2018  路  6Comments  路  Source: cosmos/cosmos-sdk

It should be clear to users where to get network as well as ledger information from the gaiad process. It sounds like this should come out of an lcd instance. There should be some clear documentation around what information comes out of the lcd as well as an understanding of what lives there and what lives on gaiad.

cc @faboweb @nylira

docs

Most helpful comment

As we don't have socket support in the LCD I propose NewRoundStep should come from tendermint for now.
In the end, everything should go through the LCD I guess so developers only need to interface with one thing.
Which information is missing in the LCD apart from getting a list of nodes?

All 6 comments

As we don't have socket support in the LCD I propose NewRoundStep should come from tendermint for now.
In the end, everything should go through the LCD I guess so developers only need to interface with one thing.
Which information is missing in the LCD apart from getting a list of nodes?

Missing Endpoints

There some critical RPC endpoints missing from the LCD:

/net_info
/dump_consensus_state
/consensus_state
/subscribe
/unsubscribe

Subscribe is a critical part of the network monitor backend. I subscribe to newBlock and NewRoundStep to give information to the user about what's happening in the most recent and upcoming blocks. Examples:

client.subscribe({ query: "tm.event = 'NewBlock'" }
client.subscribe({ query: `tm.event = 'NewRoundStep` }

Compatibility

The Tendermint RPC is not entirely compatible with the Cosmos LCD because the former does not support bech32 addresses. This makes it a huge pain to correlate the validator info in Tendermint's /dump_consensus_state compared to the LCD's /stake/validators. Validator addresses and public keys are in entirely different formats. This is what I'm talking about:

https://rpc.nylira.net/dump_consensus_state (hex)
https://lcd.nylira.net/stake/validators (bech32)

Accum Bug

The accum values for gaia-6002 are changing constantly, but the /validatorsets/latest endpoint is not refreshing that value. Check out these two pages, and try refreshing the page.

https://lcd.nylira.net/validatorsets/latest (bugged)
https://rpc.nylira.net/validators (bugged)

Not sure where the bug is coming from, but a working accum value from these endpoints would be immensely helpful. I can get working accum values from:

https://rpc.nylira.net/dump_consensus_state

But again, the dump_consensus_state from the Tendermint RPC does not show bech32 addresses, so I cannot correlate these values with validator addresses from the LCD.

cc @adrianbrink 鈽濓笍

Thank you for the detailed listing of requirements. Are all of these endpoints launch critical?

Yes, they are all being used right now in the block explorer. It would be nice if I only needed the LCD to get all of this.

@zmanian wrote a function to convert RPC hex validator addresses to LCD bech32 addresses, so the "Compatibility" point may be resolved:

function extractAndDecode(val:Validator) {
    var key= Buffer.from(val.pub_key.value,'base64')
    var encoded_key = Buffer.concat([Buffer.from('1624DE62','hex'),Buffer.from('20','hex'), key])
    return bech32.encode("cosmosvalpub",bech32.toWords(encoded_key))   
}

Moved to #2113. Please add remaining endpoints there if any

Was this page helpful?
0 / 5 - 0 ratings

Related issues

cwgoes picture cwgoes  路  3Comments

fedekunze picture fedekunze  路  3Comments

rigelrozanski picture rigelrozanski  路  3Comments

mossid picture mossid  路  3Comments

rigelrozanski picture rigelrozanski  路  3Comments