docs: miner namespace (#481)

* miner_namespace docs

* use GetConfig to maintain user configuration instead of the default

* Minimal changes to the docs

* Changelog updated

Co-authored-by: ramacarlucho <ramirocarlucho@gmail.com>
This commit is contained in:
Guillermo Paoletti 2021-08-23 19:47:09 +02:00 committed by GitHub
parent ea18cae9aa
commit 204c361043
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 45 additions and 11 deletions

View File

@ -44,6 +44,7 @@ Ref: https://keepachangelog.com/en/1.0.0/
### Bug Fixes
* (encoding) [tharsis#478](https://github.com/tharsis/ethermint/pull/478) Register `Evidence` to amino codec.
* (rpc) [tharsis#478](https://github.com/tharsis/ethermint/pull/481) Getting the node configuration when calling the `miner` rpc methods.
## [v0.5.0] - 2021-08-20

View File

@ -977,3 +977,43 @@ curl -X POST --data '{"jsonrpc":"2.0","method":"personal_ecRecover","params":["0
// Result
{"jsonrpc":"2.0","id":1,"result":"0x3b7252d007059ffc82d16d022da3cbf9992d2f70"}
```
## Miner Methods
### `miner_setGasPrice`
Sets the minimal gas price used to accept transactions. Any transaction below this limit is excluded from the validator block proposal process.
This method requires a `node` restart after being called because it changes the configuration file.
Make sure your `ethermintd start` call is not using the flag `minimum-gas-prices` because this value will be used instead of the one set on the configuration file.
#### Parameters
- Hex Gas Price
```json
// Request
curl -X POST --data '{"jsonrpc":"2.0","method":"miner_setGasPrice","params":["0x0"],"id":1}' -H "Content-Type: application/json" http://localhost:8545
// Result
{"jsonrpc":"2.0","id":1,"result":true}
```
### `miner_setEtherbase`
Sets the etherbase. It changes the wallet where the validator rewards will be deposited.
#### Parameters
- Account Address
```json
// Request
curl -X POST --data '{"jsonrpc":"2.0","method":"miner_setEtherbase","params":["0x3b7252d007059ffc82d16d022da3cbf9992d2f70"],"id":1}' -H "Content-Type: application/json" http://localhost:8545
// Result
{"jsonrpc":"2.0","id":1,"result":true}
```

View File

@ -20,7 +20,7 @@ Check the JSON-RPC namespaces supported on Ethermint. {synopsis}
| `clique` | The `clique` API provides access to the state of the clique consensus engine. You can use this API to manage signer votes and to check the health of a private network. | ❌ | |
| `debug` | The `debug` API gives you access to several non-standard RPC methods, which will allow you to inspect, debug and set certain debugging flags during runtime. | ✔ | |
| `les` | The `les` API allows you to manage LES server settings, including client parameters and payment settings for prioritized clients. It also provides functions to query checkpoint information in both server and client mode. | ❌ | |
| `miner` | The `miner` API allows you to remote control the nodes mining operation and set various mining specific settings. | ✔ | ❌ |
| [`miner`](./endpoints#miner-methods) | The `miner` API allows you to remote control the nodes mining operation and set various mining specific settings. | ✔ | ❌ |
| [`txpool`](./endpoints#txpool-methods) | The `txpool` API gives you access to several non-standard RPC methods to inspect the contents of the transaction pool containing all the currently pending transactions as well as the ones queued for future processing. | ✔ | ❌ |
| `admin` | The `admin` API gives you access to several non-standard RPC methods, which will allow you to have a fine grained control over your nodeinstance, including but not limited to network peer and RPC endpoint management. | ❌ | |
| [`personal`](./endpoints#personal-methods) | The `personal` API manages private keys in the key store. | ✔ | ❌ |

View File

@ -80,11 +80,7 @@ func (api *API) SetEtherbase(etherbase common.Address) bool {
}
// Fetch minimun gas price to calculate fees using the configuration.
appConf, err := config.ParseConfig(api.ctx.Viper)
if err != nil {
api.logger.Error("failed to parse file.", "file", api.ctx.Viper.ConfigFileUsed(), "error:", err.Error())
return false
}
appConf := config.GetConfig(api.ctx.Viper)
minGasPrices := appConf.GetMinGasPrices()
if len(minGasPrices) == 0 || minGasPrices.Empty() {
@ -164,17 +160,14 @@ func (api *API) SetEtherbase(etherbase common.Address) bool {
// to use float values, the gas prices must be configured using the configuration file
func (api *API) SetGasPrice(gasPrice hexutil.Big) bool {
api.logger.Info(api.ctx.Viper.ConfigFileUsed())
appConf, err := config.ParseConfig(api.ctx.Viper)
if err != nil {
api.logger.Debug("failed to parse config file", "file", api.ctx.Viper.ConfigFileUsed(), "error", err.Error())
return false
}
appConf := config.GetConfig(api.ctx.Viper)
var unit string
minGasPrices := appConf.GetMinGasPrices()
// fetch the base denom from the sdk Config in case it's not currently defined on the node config
if len(minGasPrices) == 0 || minGasPrices.Empty() {
var err error
unit, err = sdk.GetBaseDenom()
if err != nil {
api.logger.Debug("could not get the denom of smallest unit registered", "error", err.Error())