context: remove verifier & trust node (#6805)

* remove verifier

* more removal of trustnode flag

* add todo

* fix lint

* remove file

* remove viper and add link to issue

* remve mention of trustnode
This commit is contained in:
Marko
2020-07-23 06:44:18 +00:00
committed by GitHub
parent e0a81d2cca
commit e6a56226a8
24 changed files with 17 additions and 303 deletions
+1 -1
View File
@@ -57,7 +57,7 @@ This query returns the address that owns a particular name. The getter function
+ The function should first initialize a new [`Context`](../interfaces/query-lifecycle.md#context) with the application `codec`.
+ If applicable, the `Context` is used to retrieve any parameters (e.g. the query originator's address to be used in the query) and marshal them with the query parameter type, in preparation to be relayed to a node. There are no `Context` parameters in this case because the query does not involve any information about the user.
+ The `queryRoute` is used to construct a `path` [`baseapp`](../core/baseapp.md) will use to route the query to the appropriate [querier](./querier.md). The expected format for a query `path` is "queryCategory/queryRoute/queryType/arg1/arg2/...", where `queryCategory` can be `p2p`, `store`, `app`, or `custom`, `queryRoute` is the name of the module, and `queryType` is the name of the query type defined within the module. [`baseapp`](../core/baseapp.md) can handle each type of `queryCategory` by routing it to a module querier or retrieving results directly from stores and functions for querying peer nodes. Module queries are `custom` type queries (some SDK modules have exceptions, such as `auth` and `gov` module queries).
+ The `Context` `QueryWithData()` function is used to relay the query to a node and retrieve the response. It requires the `path`. It returns the result and height of the query upon success or an error if the query fails. In addition, it will verify the returned proof if `TrustNode` is disabled. If proof verification fails or the query height is invalid, an error will be returned.
+ The `Context` `QueryWithData()` function is used to relay the query to a node and retrieve the response. It requires the `path`. It returns the result and height of the query upon success or an error if the query fails.
+ The `codec` is used to nmarshal the response and the `Context` is used to print the output back to the user.
- **Flags.** Add any [flags](#flags) to the command.
-2
View File
@@ -7,7 +7,6 @@
| chain-id | string | null | true | 要链接全节点的 chain id |
| node | URL | "tcp://localhost:46657" | true | 要链接全节点的地址和端口号 |
| laddr | URL | "tcp://localhost:1317" | true | 提供 REST 服务的地址和端口号 |
| trust-node | bool | "false" | true | 是否信任 LCD 连接的全节点 |
| trust-store | DIRECTORY | "\$HOME/.lcd" | false | 保存检查点和验证人集的目录 |
示例:
@@ -16,7 +15,6 @@
gaiacli rest-server --chain-id=test \
--laddr=tcp://localhost:1317 \
--node tcp://localhost:26657 \
--trust-node=false
```
有关 Gaia-Lite RPC 的更多信息,请参阅 [swagger documentation](https://cosmos.network/rpc/)
-1
View File
@@ -99,7 +99,6 @@ gaiacli rest-server --node=<full_node_address:full_node_port>
Flags:
- `--trust-node`: 布尔类型。如果为 `true`,轻节点校验将被禁用。如果为 `false`, 则会校验返回结果。 对于服务提供商,应将其设置为 `true`。默认情况下,它设置为 `true`
- `--node`: 全节点的 IP 地址和端口。格式为 `<full_node_address:full_node_port>`。如果全节点在同一台机器上,则地址应为 `tcp// localhost26657`
- `--laddr`: 此标识允许您指定 Rest 服务器的地址和端口(默认为“1317”)。通常只使用这个标识指定端口,此时只需输入 “localhost” 作为地址,格式为`<rest_server_address:port>`
-2
View File
@@ -7,7 +7,6 @@ To start a REST server, we need to specify the following parameters:
| 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 |
| trust-store | DIRECTORY | "$HOME/.lcd" | false | directory for save checkpoints and validator sets |
For example:
@@ -16,7 +15,6 @@ For example:
gaiacli rest-server --chain-id=test \
--laddr=tcp://localhost:1317 \
--node tcp://localhost:26657 \
--trust-node=false
```
For more information about the Gaia-Lite RPC, see the [swagger documentation](https://cosmos.network/rpc/)
+1 -1
View File
@@ -141,7 +141,7 @@ Once a result is received from the querier, `baseapp` begins the process of retu
## Response
Since `Query()` is an ABCI function, `baseapp` returns the response as an [`abci.ResponseQuery`](https://tendermint.com/docs/spec/abci/abci.html#messages) type. The `Context` `Query()` routine receives the response and, if `--trust-node` is toggled to `false` and a proof needs to be verified, the response is verified with the `Context` `verifyProof()` function before the response is returned.
Since `Query()` is an ABCI function, `baseapp` returns the response as an [`abci.ResponseQuery`](https://tendermint.com/docs/spec/abci/abci.html#messages) type. The `Context` `Query()` routine receives the response and.
+++ https://github.com/cosmos/cosmos-sdk/blob/7d7821b9af132b0f6131640195326aa02b6751db/client/context/query.go#L127-L165
+2 -4
View File
@@ -22,11 +22,9 @@ rootCmd.AddCommand(rest.ServeCommand(cdc, registerRoutes))
Users will then be able to use the application CLI to start a new REST server, a local server through which they can securely interact with the application without downloading the entire state. The command entered by users would look something like this:
```bash
appcli rest-server --chain-id <chainID> --trust-node
appcli rest-server --chain-id <chainID>
```
Note that if `trust-node` is set to `false`, the REST server will verify the query proof against the merkle root (contained in the block header).
## REST Server
A REST Server is used to receive and route HTTP Requests, obtain the results from the application, and return a response to the user. The REST Server defined by the SDK `rest` package contains the following:
@@ -68,5 +66,5 @@ rootCmd.AddCommand(rest.ServeCommand(cdc, registerRoutes))
gaiacli rest-server --chain-id=test \
--laddr=tcp://localhost:1317 \
--node tcp://localhost:26657 \
--trust-node=true --unsafe-cors
--unsafe-cors
```
+1 -3
View File
@@ -8,7 +8,6 @@ REST 서버를 가동하기 위해서는 다음과 같은 파라미터 값을
| chain-id | string | null | 필수 | 연결할 체인의 chain-id |
| node | URL | "tcp://localhost:46657" | 필수 | 연결할 풀노드의 주소 |
| laddr | URL | "tcp://localhost:1317" | 필수 | REST 서버를 가동할 주소 |
| trust-node | bool | "false" | 필수 | 연결할 풀노드의 신뢰가능 여부 |
| trust-store | DIRECTORY | "$HOME/.lcd" | 선택 | 체크포인트와 검증인 세트를 저장할 디렉터리 |
예를 들어::
@@ -16,8 +15,7 @@ REST 서버를 가동하기 위해서는 다음과 같은 파라미터 값을
```bash
gaiacli rest-server --chain-id=test \
--laddr=tcp://localhost:1317 \
--node tcp://localhost:26657 \
--trust-node=false
--node tcp://localhost:26657
```
Gaia-Lite RPC에 대한 추가적인 정보를 원하시면 [Swagger 문서](https://cosmos.network/rpc/)를 확인하세요.
-1
View File
@@ -93,7 +93,6 @@ gaiacli advanced rest-server --node=<full_node_address:full_node_port>
```
플래그:
- `--trust-node`: 불리언 값. `true`일 경우, 라이트 클라이언트 검증 절차가 비활성화 됩니다. 만약 `false`일 경우, 절차가 활성화됩니다. 서비스 제공자의 경우 `true` 값을 이용하시면 됩니다. 기본 값은 `true`입니다.
- `--node`: 플노드의 주소와 포트를 입력하시면 됩니다. 만약 풀노드와 REST 서버가 동일한 머신에서 운영될 경우 주소 값은 `tcp://localhost:26657`로 설정하시면 됩니다.
- `--laddr`: REST 서버의 주소와 포트를 정하는 플래그입니다(기본 값 `1317`). 대다수의 경우에는 포트를 정하기 위해서 사용됩니다, 이 경우 주소는 "localhost"로 입력하시면 됩니다. 포맷은 <rest_server_address:port>입니다.