Skip to content

Commit

Permalink
docs: Docs theme bump, Algolia DocSearch (#7164)
Browse files Browse the repository at this point in the history
* bump docs theme to 1.0.171

* Fix typo, chinese character in URL
* update dead doc links

* bump docs theme to 1.0.172

* [favicons] add favicons

Co-authored-by: vms <[email protected]>
Co-authored-by: Federico Kunze <[email protected]>
  • Loading branch information
3 people authored Aug 25, 2020
1 parent 7b52911 commit d9fd4d2
Show file tree
Hide file tree
Showing 15 changed files with 94 additions and 8 deletions.
10 changes: 10 additions & 0 deletions docs/.vuepress/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,16 @@ module.exports = {
}
},
base: process.env.VUEPRESS_BASE || "/",
head: [
['link', { rel: "apple-touch-icon", sizes: "180x180", href: "/apple-touch-icon.png" }],
['link', { rel: "icon", type: "image/png", sizes: "32x32", href: "/favicon-32x32.png" }],
['link', { rel: "icon", type: "image/png", sizes: "16x16", href: "/favicon-16x16.png" }],
['link', { rel: "manifest", href: "/site.webmanifest" }],
['meta', { name: "msapplication-TileColor", content: "#2e3148" }],
['meta', { name: "theme-color", content: "#ffffff" }],
['link', { rel: "icon", type: "image/svg+xml", href: "/favicon-svg.svg" }],
['link', { rel: "apple-touch-icon-precomposed", href: "/apple-touch-icon-precomposed.png" }],
],
themeConfig: {
repo: "cosmos/cosmos-sdk",
docsRepo: "cosmos/cosmos-sdk",
Expand Down
Binary file added docs/.vuepress/public/android-chrome-192x192.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/.vuepress/public/android-chrome-256x256.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/.vuepress/public/apple-touch-icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 9 additions & 0 deletions docs/.vuepress/public/browserconfig.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<browserconfig>
<msapplication>
<tile>
<square150x150logo src="/mstile-150x150.png"/>
<TileColor>#da532c</TileColor>
</tile>
</msapplication>
</browserconfig>
Binary file added docs/.vuepress/public/favicon-16x16.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/.vuepress/public/favicon-32x32.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
21 changes: 21 additions & 0 deletions docs/.vuepress/public/favicon-svg.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/.vuepress/public/mstile-150x150.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
25 changes: 25 additions & 0 deletions docs/.vuepress/public/safari-pinned-tab.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
19 changes: 19 additions & 0 deletions docs/.vuepress/public/site.webmanifest
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"name": "Cosmos SDK Documentation",
"short_name": "Cosmos SDK",
"icons": [
{
"src": "/android-chrome-192x192.png",
"sizes": "192x192",
"type": "image/png"
},
{
"src": "/android-chrome-256x256.png",
"sizes": "256x256",
"type": "image/png"
}
],
"theme_color": "#ffffff",
"background_color": "#ffffff",
"display": "standalone"
}
4 changes: 2 additions & 2 deletions docs/building-modules/simulator.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ Operations on the simulation are simulated using the full [transaction cycle](..

Shown below is how weights are set:

+++ https://github.com/cosmos/cosmos-sdk/blob/release%2Fv0.38.0/x/staking/simulation/operations.go#L18-L92
+++ https://github.com/cosmos/cosmos-sdk/blob/master/x/staking/simulation/operations.go#L18

As you can see the weights are predefined in this case but there are options on how to override this behavior with different weights. One is allowing `*rand.Rand` to define a random weight for the operation, or you can inject your own predefined weights.

Expand All @@ -83,7 +83,7 @@ them to be used on the parameters.

Now that all the required functions are defined, we need to integrate them into the module pattern within the `module.go`:

+++ https://github.com/cosmos/cosmos-sdk/blob/release%2Fv0.38.0/x/distribution/module.go#L156-L185
+++ https://github.com/cosmos/cosmos-sdk/blob/master/x/distribution/module.go

## App Simulator manager

Expand Down
10 changes: 6 additions & 4 deletions docs/cn/basics/accounts.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

Cosmos SDK 使用一套称之为 [BIP32](https://github.com/bitcoin/bips/blob/master/bip-0032.mediawiki) 的标准来生成公私钥。这个标准定义了怎么去创建一个 HD 钱包(钱包就是一批账户的集合)。每一个账户的核心,都有一个种子,每一个种子都有一个 12 或 24 个字的助记符。使用这个助记符,使用一种单向的加密方法可以派生出任意数量的私钥。公钥可以通过私钥推导出来。当然,助记符是最敏感的信息,因为可以不停通过助记符来重新生成私钥。

```
```md
Account 0 Account 1 Account 2

+------------------+ +------------------+ +------------------+
Expand Down Expand Up @@ -58,7 +58,7 @@ Cosmos SDK 使用一套称之为 [BIP32](https://github.com/bitcoin/bips/blob/ma

`Keybase` 是储存和管理账户的对象,在 Cosmos SDK 中,`Keybase` 要实现以下接口

+++ https://githubcom/cosmos/cosmos-sdk/blob/7d7821b9af132b0f6131640195326aa02b6751db/crypto/keys/types.go#L13-L86
+++ https://github.com/cosmos/cosmos-sdk/blob/7d7821b9af132b0f6131640195326aa02b6751db/crypto/keys/types.go#L13-L86

在 Cosmos SDK 中,`Keybase` 接口的默认实现对象是 `dbKeybase`

Expand All @@ -67,7 +67,9 @@ Cosmos SDK 使用一套称之为 [BIP32](https://github.com/bitcoin/bips/blob/ma
`dbKeybase` 上面对 `Keybase` 接口中方法实现的笔记:

- `Sign(name, passphrase string, msg []byte) ([]byte, crypto.PubKey, error)``message` 字节进行签名。需要做一些准备工作将 `message` 编码成 []byte 类型,可以参考 `auth` 模块 `message` 准备的例子。注意,SDK 上面没有实现签名的验证,签名验证被推迟到[`anteHandler`](#antehandler)中进行
+++ https://github.com/cosmos/cosmos-sdk/blob/7d7821b9af132b0f6131640195326aa02b6751db/x/auth/types/txbuilder.go#L176-L209

+++ https://github.com/cosmos/cosmos-sdk/blob/7d7821b9af132b0f6131640195326aa02b6751db/x/auth/types/txbuilder.go#L176-L209

- `CreateMnemonic(name string, language Language, passwd string, algo SigningAlgo) (info Info, seed string, err error)`创建一个新的助记符并打印在日志里,但是**并不保存在磁盘上**
- `CreateAccount(name, mnemonic, bip39Passwd, encryptPasswd string, account uint32, index uint32) (Info, error)` 基于[`bip44 path`](https://github.com/bitcoin/bips/blob/master/bip-0044.mediawiki)创建一个新的账户并将其保存在磁盘上。注意私钥在[保存前用密码加密](https://github.com/cosmos/cosmos-sdk/blob/7d7821b9af132b0f6131640195326aa02b6751db/crypto/keys/mintkey/mintkey.go),**永远不会储存未加密的私钥**.在这个方法的上下文中, `account`和 `address` 参数指的是 BIP44 派生路径的段(例如`0`, `1`, `2`, ...)用于从助记符派生出私钥和公钥(注意:给相同的助记符和 `account` 将派生出相同的私钥,给相同的 `account` 和 `address` 也会派生出相同的公钥和 `Address`)。最后注意 `CreateAccount` 方法使用在 [Tendermint library](https://github.com/tendermint/tendermint/tree/bc572217c07b90ad9cee851f193aaa8e9557cbc7/crypto/secp256k1) 中的 `secp256k1` 派生出公私钥和 `Address`。总之,这个方法是用来创建用户的钥匙和地址的,并不是共识秘钥,参见[`Addresses`](#addresses) 获取更多信息

Expand Down Expand Up @@ -95,7 +97,7 @@ Cosmos SDK 使用一套称之为 [BIP32](https://github.com/bitcoin/bips/blob/ma

在 Cosmos SDK 里面 `PubKey` 遵循在 tendermint 的 `crypto` 包中定义的 `Pubkey` 接口

+++ https://githubcom/tendermint/tendermint/blob/bc572217c07b90ad9cee851f193aaa8e9557cbc7/crypto/crypto.go#L22-L27
+++ https://github.com/tendermint/tendermint/blob/bc572217c07b90ad9cee851f193aaa8e9557cbc7/crypto/crypto.go#L22-L27

对于 `secp256k1` 类型的秘钥,具体的实现可以在[这里](https://github.com/tendermint/tendermint/blob/bc572217c07b90ad9cee851f193aaa8e9557cbc7/crypto/secp256k1/secp256k1.go#L140)找到。对于`ed25519`类型的密钥,具体实现可以在[这里](https://github.com/tendermint/tendermint/blob/bc572217c07b90ad9cee851f193aaa8e9557cbc7/crypto/ed25519/ed25519.go#L135)找到。

Expand Down
4 changes: 2 additions & 2 deletions docs/cn/intro/sdk-design.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Cosmos SDK 是一个框架,可以促进基于 Tendermint 的安全状态机的

`baseapp` 是 Cosmos SDK 应用程序的样本实现,它拥有能够处理和底层共识引擎的连接的 ABCI 实现。通常,Cosmos SDK 应用程序通过嵌入[`app.go`](https://docs.cosmos.network/master/basics/app-anatomy.html#core-application-file)来实现拓展。查看示例请参考 SDK 应用教程:

+++ https://github.com/cosmos/sdk-tutorials/blob/c6754a1e313eb1ed973c5c91dcc606f2fd288811/app.go#L72-L9
+++ https://github.com/cosmos/sdk-tutorials/blob/c6754a1e313eb1ed973c5c91dcc606f2fd288811/app.go

`baseapp` 的目标是在存储和可拓展状态机之间提供安全的接口,同时尽可能少地定义状态机(对 ABCI 保持不变)。

Expand All @@ -31,7 +31,7 @@ Cosmos SDK 的强大之处在于其模块化开发的理念。SDK 应用程序

以下的简化视图展示了应用链中的每个全节点如何处理有效区块中的 Transaction。

```
```md
+
|
| Transaction relayed from the full-node's Tendermint engine
Expand Down

0 comments on commit d9fd4d2

Please sign in to comment.