-
Notifications
You must be signed in to change notification settings - Fork 3.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
LCD and API Specification / Documentation #1617
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just some initial review. Still going through it. Don't think it belongs in the spec
folder. We can merge and mark it as a WIP and move it to the docs - will keep reviewing from there
docs/spec/light/api.md
Outdated
|
||
url: /broadcast_tx_sync | ||
|
||
Functionality: Submit a signed transaction and wait for it to be committed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
doesn't wait for it to be committed. that's broadcast_tx_commit
. Should we have all three endpoints here? We certainly shouldn't use the same terms to refer to different things ...
docs/spec/light/api.md
Outdated
|
||
Functionality: Submit a signed transaction and wait for it to be committed. | ||
|
||
Parameters: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
these dont seem to be rendering properly in https://github.com/cosmos/cosmos-sdk/blob/adrian/lcd_spec_final/docs/spec/light/api.md#broadcast_tx_sync---post
This is the case for all these params tables ..
docs/spec/light/api.md
Outdated
"code":200, | ||
"error": "", | ||
"result": { | ||
"address":BD607C37147656A507A5A521AA9446EB72B2C907 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the address is missing quotes
docs/spec/light/api.md
Outdated
"code":200, | ||
"error": "", | ||
"result": { | ||
"seed":crime carpet recycle erase simple prepare moral dentist fee cause pitch trigger when velvet animal abandon |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
missing quotes ?
docs/spec/light/api.md
Outdated
"code":200, | ||
"error": "", | ||
"result": { | ||
"atom": 1000, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Amino v0.10 follows proto3 where integers are quoted as strings
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this apply to all integers? Will the error codes change as well?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should stick with integers here though, since it seems to be the standard for json. This API doesn't necessarily have to comply with amino encoding.
docs/spec/light/api.md
Outdated
"code":200, | ||
"error": "", | ||
"result": { | ||
"transaction": "TODO:<JSON sign bytes for the transaction>" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TODO
docs/spec/light/getting_started.md
Outdated
|
||
 | ||
|
||
First you need to get a new seed phrase :[get-seed](https://github.com/irisnet/cosmos-sdk/blob/bianjie/lcd_spec/docs/spec/lcd/api.md#keysseed---get) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
these links dont seem to be working
docs/spec/light/load_balancer.md
Outdated
@@ -0,0 +1,203 @@ | |||
# Load Balancing Module | |||
|
|||
The LCD will be an important bridge between service providers and cosmos blockchain network. Suppose |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure about this section. I don't think we want to build a load balancer in to the LCD.
More likely we need to work on streaming events out of Tendermint and into something like Postgres and load-balancing the access to postgres.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it could be useful that a single light-client distributes its requests over many full-nodes. That's what this section is mostly describing. I am not sure whether we want Gaia Light to include postgres (or some other database) as a dependency.
docs/spec/light/overview.md
Outdated
@@ -0,0 +1,55 @@ | |||
# Overview |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
isnt this just a copy of what's already in the readme?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've removed the overview.md
docs/spec/light/api.md
Outdated
Error messages my change and should be only used for display purposes. Error messages should not be | ||
used for determining the error type. | ||
|
||
## ICS0 - TendermintAPI - not yet implemented |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we want other endpoints to be part of this ? /status
, /net_info
, etc. ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, eventually we'll add those in as well.
* Move from specs to docs folder * Attempt to fix markdown links * Address general comments from the PR * Remove overview.md due to duplication with readme.md
Codecov Report
@@ Coverage Diff @@
## master #1617 +/- ##
=========================================
Coverage ? 63.71%
=========================================
Files ? 122
Lines ? 6774
Branches ? 0
=========================================
Hits ? 4316
Misses ? 2211
Partials ? 247 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Really great start. I think we should move it to lite
though to be consistent with Tendermint
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed on switching from light to lite.
Left several comments, nothing that needs to block this PR unless you want to make changes, but I don't think we should consider this API finalized yet (mostly because of HD keys).
} | ||
``` | ||
|
||
### /broadcast_tx_commit - POST |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We'll need either simulation options for these endpoints or a separate simulation endpoint, see #1246 (not yet implemented).
Doesn't need to block this PR.
@@ -0,0 +1,203 @@ | |||
# Load Balancing Module - WIP |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While we can include this, I'm not convinced client-side load balancing is all that useful.
It doesn't protect servers from malicious or misconfigured clients, and can't ever balance that effectively since it has no information about what requests other clients are making to the same full nodes. I think implementing a way for full nodes to provide a single endpoint (fullnode.myvalidator.com
) which balances to multiple Tendermint/SDK instances, fronted by a cache layer (don't need to write this, e.g. Varnish) will be more likely to work.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What we probably do want is client-side retry logic - switch to a different full node if one is down.
| Storage resource|Huge|Little|Full node will save all blocks and ABCI states. LCD just saves validator sets and some checkpoints| | ||
| Power consume|Huge|Little|Full nodes have to be deployed on machines which have high performance and will be running all the time. So power consume will be huge. LCD can be deployed on the same machines as users' applications, or on independent machines but with poor performance. Besides, LCD can be shutdown anytime when necessary. So LCD only consume very little power, even mobile devices can meet the power requirement| | ||
| Provide APIs|All cosmos APIs|Modular APIs|Full node supports all cosmos APIs. LCD provides modular APIs according to users' configuration| | ||
| Secuity level| High|High|Full node will verify all transactions and blocks by itself. LCD can't do this, but it can query any data from other full nodes and verify the data independently. So both full node and LCD don't need to trust any third nodes, they all can achieve high security| |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Worth mentioning weak subjectivity here. I would rate LCD security "Medium" personally (but note that it's way, way higher than e.g. Metamask).
} | ||
``` | ||
|
||
### /keys/recover - POST |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This doesn't seem to reflect HD derivation?
| Parameter | Type | Default | Required | Description | | ||
| --------- | ------ | ------- | -------- | ---------------- | | ||
| name | string | null | true | name of key | | ||
| password | string | null | true | password of key | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should add a way to specify an algorithm (ed25519/secp256k1).
} | ||
``` | ||
|
||
## ICS1 - KeyAPI |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This API needs to be refactored quite a bit for HD keys, which we probably want to encourage use of (do we want to support anything other than HD keys?)
Also, we support using the Ledger through the LCD API if you want to include that.
"code":200, | ||
"error":"", | ||
"result": { | ||
"atom":1000, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This isn't how Amino serializes numbers now, they're strings instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we want the API to return numbers, we need to check that we won't lose precision.
| chain-id | string | null | true | chain id of the full node to connect | | ||
| node | URL | "tcp://localhost:46657" | true | address of the full node to connect | | ||
| laddr | URL | "tcp://localhost:1317" | true | address to run the rest server on | | ||
| trust-node | bool | "false" | true | Whether this LCD is connected to a trusted full node | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What does this flag do? Enable/disable proof verification?
|
||
 | ||
|
||
### Trust propagation |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or that could go in a separate "Gaia lite formal spec" document.
Supercedes #1314 . All past discussion happened on that branch.
This branch squashes all commits into a single commit without force-pushing over public branches.