You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

253 lines
6.4 KiB

limit number of /subscribe clients and queries per client (#3269) * limit number of /subscribe clients and queries per client Add the following config variables (under [rpc] section): * max_subscription_clients * max_subscriptions_per_client * timeout_broadcast_tx_commit Fixes #2826 new HTTPClient interface for subscriptions finalize HTTPClient events interface remove EventSubscriber fix data race ``` WARNING: DATA RACE Read at 0x00c000a36060 by goroutine 129: github.com/tendermint/tendermint/rpc/client.(*Local).Subscribe.func1() /go/src/github.com/tendermint/tendermint/rpc/client/localclient.go:168 +0x1f0 Previous write at 0x00c000a36060 by goroutine 132: github.com/tendermint/tendermint/rpc/client.(*Local).Subscribe() /go/src/github.com/tendermint/tendermint/rpc/client/localclient.go:191 +0x4e0 github.com/tendermint/tendermint/rpc/client.WaitForOneEvent() /go/src/github.com/tendermint/tendermint/rpc/client/helpers.go:64 +0x178 github.com/tendermint/tendermint/rpc/client_test.TestTxEventsSentWithBroadcastTxSync.func1() /go/src/github.com/tendermint/tendermint/rpc/client/event_test.go:139 +0x298 testing.tRunner() /usr/local/go/src/testing/testing.go:827 +0x162 Goroutine 129 (running) created at: github.com/tendermint/tendermint/rpc/client.(*Local).Subscribe() /go/src/github.com/tendermint/tendermint/rpc/client/localclient.go:164 +0x4b7 github.com/tendermint/tendermint/rpc/client.WaitForOneEvent() /go/src/github.com/tendermint/tendermint/rpc/client/helpers.go:64 +0x178 github.com/tendermint/tendermint/rpc/client_test.TestTxEventsSentWithBroadcastTxSync.func1() /go/src/github.com/tendermint/tendermint/rpc/client/event_test.go:139 +0x298 testing.tRunner() /usr/local/go/src/testing/testing.go:827 +0x162 Goroutine 132 (running) created at: testing.(*T).Run() /usr/local/go/src/testing/testing.go:878 +0x659 github.com/tendermint/tendermint/rpc/client_test.TestTxEventsSentWithBroadcastTxSync() /go/src/github.com/tendermint/tendermint/rpc/client/event_test.go:119 +0x186 testing.tRunner() /usr/local/go/src/testing/testing.go:827 +0x162 ================== ``` lite client works (tested manually) godoc comments httpclient: do not close the out channel use TimeoutBroadcastTxCommit no timeout for unsubscribe but 1s Local (5s HTTP) timeout for resubscribe format code change Subscribe#out cap to 1 and replace config vars with RPCConfig TimeoutBroadcastTxCommit can't be greater than rpcserver.WriteTimeout rpc: Context as first parameter to all functions reformat code fixes after my own review fixes after Ethan's review add test stubs fix config.toml * fixes after manual testing - rpc: do not recommend to use BroadcastTxCommit because it's slow and wastes Tendermint resources (pubsub) - rpc: better error in Subscribe and BroadcastTxCommit - HTTPClient: do not resubscribe if err = ErrAlreadySubscribed * fixes after Ismail's review * Update rpc/grpc/grpc_test.go Co-Authored-By: melekes <anton.kalyaev@gmail.com>
6 years ago
limit number of /subscribe clients and queries per client (#3269) * limit number of /subscribe clients and queries per client Add the following config variables (under [rpc] section): * max_subscription_clients * max_subscriptions_per_client * timeout_broadcast_tx_commit Fixes #2826 new HTTPClient interface for subscriptions finalize HTTPClient events interface remove EventSubscriber fix data race ``` WARNING: DATA RACE Read at 0x00c000a36060 by goroutine 129: github.com/tendermint/tendermint/rpc/client.(*Local).Subscribe.func1() /go/src/github.com/tendermint/tendermint/rpc/client/localclient.go:168 +0x1f0 Previous write at 0x00c000a36060 by goroutine 132: github.com/tendermint/tendermint/rpc/client.(*Local).Subscribe() /go/src/github.com/tendermint/tendermint/rpc/client/localclient.go:191 +0x4e0 github.com/tendermint/tendermint/rpc/client.WaitForOneEvent() /go/src/github.com/tendermint/tendermint/rpc/client/helpers.go:64 +0x178 github.com/tendermint/tendermint/rpc/client_test.TestTxEventsSentWithBroadcastTxSync.func1() /go/src/github.com/tendermint/tendermint/rpc/client/event_test.go:139 +0x298 testing.tRunner() /usr/local/go/src/testing/testing.go:827 +0x162 Goroutine 129 (running) created at: github.com/tendermint/tendermint/rpc/client.(*Local).Subscribe() /go/src/github.com/tendermint/tendermint/rpc/client/localclient.go:164 +0x4b7 github.com/tendermint/tendermint/rpc/client.WaitForOneEvent() /go/src/github.com/tendermint/tendermint/rpc/client/helpers.go:64 +0x178 github.com/tendermint/tendermint/rpc/client_test.TestTxEventsSentWithBroadcastTxSync.func1() /go/src/github.com/tendermint/tendermint/rpc/client/event_test.go:139 +0x298 testing.tRunner() /usr/local/go/src/testing/testing.go:827 +0x162 Goroutine 132 (running) created at: testing.(*T).Run() /usr/local/go/src/testing/testing.go:878 +0x659 github.com/tendermint/tendermint/rpc/client_test.TestTxEventsSentWithBroadcastTxSync() /go/src/github.com/tendermint/tendermint/rpc/client/event_test.go:119 +0x186 testing.tRunner() /usr/local/go/src/testing/testing.go:827 +0x162 ================== ``` lite client works (tested manually) godoc comments httpclient: do not close the out channel use TimeoutBroadcastTxCommit no timeout for unsubscribe but 1s Local (5s HTTP) timeout for resubscribe format code change Subscribe#out cap to 1 and replace config vars with RPCConfig TimeoutBroadcastTxCommit can't be greater than rpcserver.WriteTimeout rpc: Context as first parameter to all functions reformat code fixes after my own review fixes after Ethan's review add test stubs fix config.toml * fixes after manual testing - rpc: do not recommend to use BroadcastTxCommit because it's slow and wastes Tendermint resources (pubsub) - rpc: better error in Subscribe and BroadcastTxCommit - HTTPClient: do not resubscribe if err = ErrAlreadySubscribed * fixes after Ismail's review * Update rpc/grpc/grpc_test.go Co-Authored-By: melekes <anton.kalyaev@gmail.com>
6 years ago
7 years ago
limit number of /subscribe clients and queries per client (#3269) * limit number of /subscribe clients and queries per client Add the following config variables (under [rpc] section): * max_subscription_clients * max_subscriptions_per_client * timeout_broadcast_tx_commit Fixes #2826 new HTTPClient interface for subscriptions finalize HTTPClient events interface remove EventSubscriber fix data race ``` WARNING: DATA RACE Read at 0x00c000a36060 by goroutine 129: github.com/tendermint/tendermint/rpc/client.(*Local).Subscribe.func1() /go/src/github.com/tendermint/tendermint/rpc/client/localclient.go:168 +0x1f0 Previous write at 0x00c000a36060 by goroutine 132: github.com/tendermint/tendermint/rpc/client.(*Local).Subscribe() /go/src/github.com/tendermint/tendermint/rpc/client/localclient.go:191 +0x4e0 github.com/tendermint/tendermint/rpc/client.WaitForOneEvent() /go/src/github.com/tendermint/tendermint/rpc/client/helpers.go:64 +0x178 github.com/tendermint/tendermint/rpc/client_test.TestTxEventsSentWithBroadcastTxSync.func1() /go/src/github.com/tendermint/tendermint/rpc/client/event_test.go:139 +0x298 testing.tRunner() /usr/local/go/src/testing/testing.go:827 +0x162 Goroutine 129 (running) created at: github.com/tendermint/tendermint/rpc/client.(*Local).Subscribe() /go/src/github.com/tendermint/tendermint/rpc/client/localclient.go:164 +0x4b7 github.com/tendermint/tendermint/rpc/client.WaitForOneEvent() /go/src/github.com/tendermint/tendermint/rpc/client/helpers.go:64 +0x178 github.com/tendermint/tendermint/rpc/client_test.TestTxEventsSentWithBroadcastTxSync.func1() /go/src/github.com/tendermint/tendermint/rpc/client/event_test.go:139 +0x298 testing.tRunner() /usr/local/go/src/testing/testing.go:827 +0x162 Goroutine 132 (running) created at: testing.(*T).Run() /usr/local/go/src/testing/testing.go:878 +0x659 github.com/tendermint/tendermint/rpc/client_test.TestTxEventsSentWithBroadcastTxSync() /go/src/github.com/tendermint/tendermint/rpc/client/event_test.go:119 +0x186 testing.tRunner() /usr/local/go/src/testing/testing.go:827 +0x162 ================== ``` lite client works (tested manually) godoc comments httpclient: do not close the out channel use TimeoutBroadcastTxCommit no timeout for unsubscribe but 1s Local (5s HTTP) timeout for resubscribe format code change Subscribe#out cap to 1 and replace config vars with RPCConfig TimeoutBroadcastTxCommit can't be greater than rpcserver.WriteTimeout rpc: Context as first parameter to all functions reformat code fixes after my own review fixes after Ethan's review add test stubs fix config.toml * fixes after manual testing - rpc: do not recommend to use BroadcastTxCommit because it's slow and wastes Tendermint resources (pubsub) - rpc: better error in Subscribe and BroadcastTxCommit - HTTPClient: do not resubscribe if err = ErrAlreadySubscribed * fixes after Ismail's review * Update rpc/grpc/grpc_test.go Co-Authored-By: melekes <anton.kalyaev@gmail.com>
6 years ago
limit number of /subscribe clients and queries per client (#3269) * limit number of /subscribe clients and queries per client Add the following config variables (under [rpc] section): * max_subscription_clients * max_subscriptions_per_client * timeout_broadcast_tx_commit Fixes #2826 new HTTPClient interface for subscriptions finalize HTTPClient events interface remove EventSubscriber fix data race ``` WARNING: DATA RACE Read at 0x00c000a36060 by goroutine 129: github.com/tendermint/tendermint/rpc/client.(*Local).Subscribe.func1() /go/src/github.com/tendermint/tendermint/rpc/client/localclient.go:168 +0x1f0 Previous write at 0x00c000a36060 by goroutine 132: github.com/tendermint/tendermint/rpc/client.(*Local).Subscribe() /go/src/github.com/tendermint/tendermint/rpc/client/localclient.go:191 +0x4e0 github.com/tendermint/tendermint/rpc/client.WaitForOneEvent() /go/src/github.com/tendermint/tendermint/rpc/client/helpers.go:64 +0x178 github.com/tendermint/tendermint/rpc/client_test.TestTxEventsSentWithBroadcastTxSync.func1() /go/src/github.com/tendermint/tendermint/rpc/client/event_test.go:139 +0x298 testing.tRunner() /usr/local/go/src/testing/testing.go:827 +0x162 Goroutine 129 (running) created at: github.com/tendermint/tendermint/rpc/client.(*Local).Subscribe() /go/src/github.com/tendermint/tendermint/rpc/client/localclient.go:164 +0x4b7 github.com/tendermint/tendermint/rpc/client.WaitForOneEvent() /go/src/github.com/tendermint/tendermint/rpc/client/helpers.go:64 +0x178 github.com/tendermint/tendermint/rpc/client_test.TestTxEventsSentWithBroadcastTxSync.func1() /go/src/github.com/tendermint/tendermint/rpc/client/event_test.go:139 +0x298 testing.tRunner() /usr/local/go/src/testing/testing.go:827 +0x162 Goroutine 132 (running) created at: testing.(*T).Run() /usr/local/go/src/testing/testing.go:878 +0x659 github.com/tendermint/tendermint/rpc/client_test.TestTxEventsSentWithBroadcastTxSync() /go/src/github.com/tendermint/tendermint/rpc/client/event_test.go:119 +0x186 testing.tRunner() /usr/local/go/src/testing/testing.go:827 +0x162 ================== ``` lite client works (tested manually) godoc comments httpclient: do not close the out channel use TimeoutBroadcastTxCommit no timeout for unsubscribe but 1s Local (5s HTTP) timeout for resubscribe format code change Subscribe#out cap to 1 and replace config vars with RPCConfig TimeoutBroadcastTxCommit can't be greater than rpcserver.WriteTimeout rpc: Context as first parameter to all functions reformat code fixes after my own review fixes after Ethan's review add test stubs fix config.toml * fixes after manual testing - rpc: do not recommend to use BroadcastTxCommit because it's slow and wastes Tendermint resources (pubsub) - rpc: better error in Subscribe and BroadcastTxCommit - HTTPClient: do not resubscribe if err = ErrAlreadySubscribed * fixes after Ismail's review * Update rpc/grpc/grpc_test.go Co-Authored-By: melekes <anton.kalyaev@gmail.com>
6 years ago
limit number of /subscribe clients and queries per client (#3269) * limit number of /subscribe clients and queries per client Add the following config variables (under [rpc] section): * max_subscription_clients * max_subscriptions_per_client * timeout_broadcast_tx_commit Fixes #2826 new HTTPClient interface for subscriptions finalize HTTPClient events interface remove EventSubscriber fix data race ``` WARNING: DATA RACE Read at 0x00c000a36060 by goroutine 129: github.com/tendermint/tendermint/rpc/client.(*Local).Subscribe.func1() /go/src/github.com/tendermint/tendermint/rpc/client/localclient.go:168 +0x1f0 Previous write at 0x00c000a36060 by goroutine 132: github.com/tendermint/tendermint/rpc/client.(*Local).Subscribe() /go/src/github.com/tendermint/tendermint/rpc/client/localclient.go:191 +0x4e0 github.com/tendermint/tendermint/rpc/client.WaitForOneEvent() /go/src/github.com/tendermint/tendermint/rpc/client/helpers.go:64 +0x178 github.com/tendermint/tendermint/rpc/client_test.TestTxEventsSentWithBroadcastTxSync.func1() /go/src/github.com/tendermint/tendermint/rpc/client/event_test.go:139 +0x298 testing.tRunner() /usr/local/go/src/testing/testing.go:827 +0x162 Goroutine 129 (running) created at: github.com/tendermint/tendermint/rpc/client.(*Local).Subscribe() /go/src/github.com/tendermint/tendermint/rpc/client/localclient.go:164 +0x4b7 github.com/tendermint/tendermint/rpc/client.WaitForOneEvent() /go/src/github.com/tendermint/tendermint/rpc/client/helpers.go:64 +0x178 github.com/tendermint/tendermint/rpc/client_test.TestTxEventsSentWithBroadcastTxSync.func1() /go/src/github.com/tendermint/tendermint/rpc/client/event_test.go:139 +0x298 testing.tRunner() /usr/local/go/src/testing/testing.go:827 +0x162 Goroutine 132 (running) created at: testing.(*T).Run() /usr/local/go/src/testing/testing.go:878 +0x659 github.com/tendermint/tendermint/rpc/client_test.TestTxEventsSentWithBroadcastTxSync() /go/src/github.com/tendermint/tendermint/rpc/client/event_test.go:119 +0x186 testing.tRunner() /usr/local/go/src/testing/testing.go:827 +0x162 ================== ``` lite client works (tested manually) godoc comments httpclient: do not close the out channel use TimeoutBroadcastTxCommit no timeout for unsubscribe but 1s Local (5s HTTP) timeout for resubscribe format code change Subscribe#out cap to 1 and replace config vars with RPCConfig TimeoutBroadcastTxCommit can't be greater than rpcserver.WriteTimeout rpc: Context as first parameter to all functions reformat code fixes after my own review fixes after Ethan's review add test stubs fix config.toml * fixes after manual testing - rpc: do not recommend to use BroadcastTxCommit because it's slow and wastes Tendermint resources (pubsub) - rpc: better error in Subscribe and BroadcastTxCommit - HTTPClient: do not resubscribe if err = ErrAlreadySubscribed * fixes after Ismail's review * Update rpc/grpc/grpc_test.go Co-Authored-By: melekes <anton.kalyaev@gmail.com>
6 years ago
  1. package core
  2. import (
  3. "fmt"
  4. "github.com/pkg/errors"
  5. "github.com/tendermint/tendermint/p2p"
  6. ctypes "github.com/tendermint/tendermint/rpc/core/types"
  7. rpctypes "github.com/tendermint/tendermint/rpc/lib/types"
  8. )
  9. // Get network info.
  10. //
  11. // ```shell
  12. // curl 'localhost:26657/net_info'
  13. // ```
  14. //
  15. // ```go
  16. // client := client.NewHTTP("tcp://0.0.0.0:26657", "/websocket")
  17. // err := client.Start()
  18. // if err != nil {
  19. // // handle error
  20. // }
  21. // defer client.Stop()
  22. // info, err := client.NetInfo()
  23. // ```
  24. //
  25. // > The above command returns JSON structured like this:
  26. //
  27. // ```json
  28. // {
  29. // "jsonrpc": "2.0",
  30. // "id": "",
  31. // "result": {
  32. // "listening": true,
  33. // "listeners": [
  34. // "Listener(@)"
  35. // ],
  36. // "n_peers": "3",
  37. // "peers": [
  38. // {
  39. // "node_info": {
  40. // "protocol_version": {
  41. // "p2p": "7",
  42. // "block": "8",
  43. // "app": "1"
  44. // },
  45. // "id": "93529da3435c090d02251a050342b6a488d4ab56",
  46. // "listen_addr": "tcp://0.0.0.0:26656",
  47. // "network": "chain-RFo6qC",
  48. // "version": "0.30.0",
  49. // "channels": "4020212223303800",
  50. // "moniker": "fc89e4ed23f2",
  51. // "other": {
  52. // "tx_index": "on",
  53. // "rpc_address": "tcp://0.0.0.0:26657"
  54. // }
  55. // },
  56. // "is_outbound": true,
  57. // "connection_status": {
  58. // "Duration": "3475230558",
  59. // "SendMonitor": {
  60. // "Active": true,
  61. // "Start": "2019-02-14T12:40:47.52Z",
  62. // "Duration": "3480000000",
  63. // "Idle": "240000000",
  64. // "Bytes": "4512",
  65. // "Samples": "9",
  66. // "InstRate": "1338",
  67. // "CurRate": "2046",
  68. // "AvgRate": "1297",
  69. // "PeakRate": "6570",
  70. // "BytesRem": "0",
  71. // "TimeRem": "0",
  72. // "Progress": 0
  73. // },
  74. // "RecvMonitor": {
  75. // "Active": true,
  76. // "Start": "2019-02-14T12:40:47.52Z",
  77. // "Duration": "3480000000",
  78. // "Idle": "280000000",
  79. // "Bytes": "4489",
  80. // "Samples": "10",
  81. // "InstRate": "1821",
  82. // "CurRate": "1663",
  83. // "AvgRate": "1290",
  84. // "PeakRate": "5512",
  85. // "BytesRem": "0",
  86. // "TimeRem": "0",
  87. // "Progress": 0
  88. // },
  89. // "Channels": [
  90. // {
  91. // "ID": 48,
  92. // "SendQueueCapacity": "1",
  93. // "SendQueueSize": "0",
  94. // "Priority": "5",
  95. // "RecentlySent": "0"
  96. // },
  97. // {
  98. // "ID": 64,
  99. // "SendQueueCapacity": "1000",
  100. // "SendQueueSize": "0",
  101. // "Priority": "10",
  102. // "RecentlySent": "14"
  103. // },
  104. // {
  105. // "ID": 32,
  106. // "SendQueueCapacity": "100",
  107. // "SendQueueSize": "0",
  108. // "Priority": "5",
  109. // "RecentlySent": "619"
  110. // },
  111. // {
  112. // "ID": 33,
  113. // "SendQueueCapacity": "100",
  114. // "SendQueueSize": "0",
  115. // "Priority": "10",
  116. // "RecentlySent": "1363"
  117. // },
  118. // {
  119. // "ID": 34,
  120. // "SendQueueCapacity": "100",
  121. // "SendQueueSize": "0",
  122. // "Priority": "5",
  123. // "RecentlySent": "2145"
  124. // },
  125. // {
  126. // "ID": 35,
  127. // "SendQueueCapacity": "2",
  128. // "SendQueueSize": "0",
  129. // "Priority": "1",
  130. // "RecentlySent": "0"
  131. // },
  132. // {
  133. // "ID": 56,
  134. // "SendQueueCapacity": "1",
  135. // "SendQueueSize": "0",
  136. // "Priority": "5",
  137. // "RecentlySent": "0"
  138. // },
  139. // {
  140. // "ID": 0,
  141. // "SendQueueCapacity": "10",
  142. // "SendQueueSize": "0",
  143. // "Priority": "1",
  144. // "RecentlySent": "10"
  145. // }
  146. // ]
  147. // },
  148. // "remote_ip": "192.167.10.3"
  149. // },
  150. // ...
  151. // }
  152. // ```
  153. func NetInfo(ctx *rpctypes.Context) (*ctypes.ResultNetInfo, error) {
  154. out, in, _ := p2pPeers.NumPeers()
  155. peers := make([]ctypes.Peer, 0, out+in)
  156. for _, peer := range p2pPeers.Peers().List() {
  157. nodeInfo, ok := peer.NodeInfo().(p2p.DefaultNodeInfo)
  158. if !ok {
  159. return nil, fmt.Errorf("peer.NodeInfo() is not DefaultNodeInfo")
  160. }
  161. peers = append(peers, ctypes.Peer{
  162. NodeInfo: nodeInfo,
  163. IsOutbound: peer.IsOutbound(),
  164. ConnectionStatus: peer.Status(),
  165. RemoteIP: peer.RemoteIP().String(),
  166. })
  167. }
  168. // TODO: Should we include PersistentPeers and Seeds in here?
  169. // PRO: useful info
  170. // CON: privacy
  171. return &ctypes.ResultNetInfo{
  172. Listening: p2pTransport.IsListening(),
  173. Listeners: p2pTransport.Listeners(),
  174. NPeers: len(peers),
  175. Peers: peers,
  176. }, nil
  177. }
  178. func UnsafeDialSeeds(ctx *rpctypes.Context, seeds []string) (*ctypes.ResultDialSeeds, error) {
  179. if len(seeds) == 0 {
  180. return &ctypes.ResultDialSeeds{}, errors.New("No seeds provided")
  181. }
  182. // starts go routines to dial each peer after random delays
  183. logger.Info("DialSeeds", "addrBook", addrBook, "seeds", seeds)
  184. err := p2pPeers.DialPeersAsync(addrBook, seeds, false)
  185. if err != nil {
  186. return &ctypes.ResultDialSeeds{}, err
  187. }
  188. return &ctypes.ResultDialSeeds{Log: "Dialing seeds in progress. See /net_info for details"}, nil
  189. }
  190. func UnsafeDialPeers(ctx *rpctypes.Context, peers []string, persistent bool) (*ctypes.ResultDialPeers, error) {
  191. if len(peers) == 0 {
  192. return &ctypes.ResultDialPeers{}, errors.New("No peers provided")
  193. }
  194. // starts go routines to dial each peer after random delays
  195. logger.Info("DialPeers", "addrBook", addrBook, "peers", peers, "persistent", persistent)
  196. err := p2pPeers.DialPeersAsync(addrBook, peers, persistent)
  197. if err != nil {
  198. return &ctypes.ResultDialPeers{}, err
  199. }
  200. return &ctypes.ResultDialPeers{Log: "Dialing peers in progress. See /net_info for details"}, nil
  201. }
  202. // Get genesis file.
  203. //
  204. // ```shell
  205. // curl 'localhost:26657/genesis'
  206. // ```
  207. //
  208. // ```go
  209. // client := client.NewHTTP("tcp://0.0.0.0:26657", "/websocket")
  210. // err := client.Start()
  211. // if err != nil {
  212. // // handle error
  213. // }
  214. // defer client.Stop()
  215. // genesis, err := client.Genesis()
  216. // ```
  217. //
  218. // > The above command returns JSON structured like this:
  219. //
  220. // ```json
  221. // {
  222. // "error": "",
  223. // "result": {
  224. // "genesis": {
  225. // "app_hash": "",
  226. // "validators": [
  227. // {
  228. // "name": "",
  229. // "power": "10",
  230. // "pub_key": {
  231. // "data": "68DFDA7E50F82946E7E8546BED37944A422CD1B831E70DF66BA3B8430593944D",
  232. // "type": "ed25519"
  233. // }
  234. // }
  235. // ],
  236. // "chain_id": "test-chain-6UTNIN",
  237. // "genesis_time": "2017-05-29T15:05:41.671Z"
  238. // }
  239. // },
  240. // "id": "",
  241. // "jsonrpc": "2.0"
  242. // }
  243. // ```
  244. func Genesis(ctx *rpctypes.Context) (*ctypes.ResultGenesis, error) {
  245. return &ctypes.ResultGenesis{Genesis: genDoc}, nil
  246. }