From df121ba82ffed4af67f4a5bf73f0f803792db81e Mon Sep 17 00:00:00 2001 From: ramacarlucho Date: Mon, 23 Aug 2021 13:24:25 -0300 Subject: [PATCH 1/4] miner_namespace docs --- docs/api/json-rpc/endpoints.md | 36 +++++++++++++++++++++++++++++++++ docs/api/json-rpc/namespaces.md | 2 +- 2 files changed, 37 insertions(+), 1 deletion(-) diff --git a/docs/api/json-rpc/endpoints.md b/docs/api/json-rpc/endpoints.md index d2a947500b..b4a26a6d8b 100644 --- a/docs/api/json-rpc/endpoints.md +++ b/docs/api/json-rpc/endpoints.md @@ -977,3 +977,39 @@ 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 accepted gas price when accepting transactions. Any transactions that are below this limit are excluded from the validator block proposal process. + +#### 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, where validator rewards will go. + +#### 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} +``` diff --git a/docs/api/json-rpc/namespaces.md b/docs/api/json-rpc/namespaces.md index 91153a9d66..afcfd3d14f 100644 --- a/docs/api/json-rpc/namespaces.md +++ b/docs/api/json-rpc/namespaces.md @@ -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 node’s mining operation and set various mining specific settings. | ✔ | ❌ | +| [`miner`](./endpoints#miner-methods) | The `miner` API allows you to remote control the node’s 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. | ✔ | ❌ | From a0201c42baeadea5c2c0550fd6ab44ddcffa2a05 Mon Sep 17 00:00:00 2001 From: ramacarlucho Date: Mon, 23 Aug 2021 13:47:34 -0300 Subject: [PATCH 2/4] use GetConfig to maintain user configuration instead of the default --- ethereum/rpc/namespaces/miner/api.go | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/ethereum/rpc/namespaces/miner/api.go b/ethereum/rpc/namespaces/miner/api.go index 47e9ac8832..223ed0e71e 100644 --- a/ethereum/rpc/namespaces/miner/api.go +++ b/ethereum/rpc/namespaces/miner/api.go @@ -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()) From 9d13b71d46af6eb4a60eb6f614f91306cd2bef6e Mon Sep 17 00:00:00 2001 From: Guillermo Date: Mon, 23 Aug 2021 19:14:35 +0200 Subject: [PATCH 3/4] Minimal changes to the docs --- docs/api/json-rpc/endpoints.md | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/docs/api/json-rpc/endpoints.md b/docs/api/json-rpc/endpoints.md index b4a26a6d8b..1c763ab199 100644 --- a/docs/api/json-rpc/endpoints.md +++ b/docs/api/json-rpc/endpoints.md @@ -982,7 +982,11 @@ curl -X POST --data '{"jsonrpc":"2.0","method":"personal_ecRecover","params":["0 ### `miner_setGasPrice` -Sets the minimal accepted gas price when accepting transactions. Any transactions that are below this limit are excluded from the validator block proposal process. +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 @@ -999,7 +1003,7 @@ curl -X POST --data '{"jsonrpc":"2.0","method":"miner_setGasPrice","params":["0x ### `miner_setEtherbase` -Sets the etherbase, where validator rewards will go. +Sets the etherbase. It changes the wallet where the validator rewards will be deposited. #### Parameters From 12444dfa15dff804f063a03985d4c291d247ae57 Mon Sep 17 00:00:00 2001 From: Guillermo Date: Mon, 23 Aug 2021 19:33:17 +0200 Subject: [PATCH 4/4] Changelog updated --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index eaf9f55f00..c2e669271f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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