Skip to content

miner_setGasLimit / miner_setGasPrice parameter typing diverges from the documented *rpc.HexNumber Go signature #35548

Description

@BenWhite713

1. miner_setGasLimit: miner_setGasLimit takes hexutil.Uint64 rather than the documented number *rpc.HexNumber signature

  • Statement: miner_setGasLimit takes hexutil.Uint64 rather than the documented number *rpc.HexNumber signature.
  • URL: https://geth.ethereum.org/docs/interacting-with-geth/rpc/ns-miner
  • Code location:
    • eth/api_miner.go:55-58
      func (api *MinerAPI) SetGasLimit(gasLimit hexutil.Uint64) bool {
      api.e.Miner().SetGasCeil(uint64(gasLimit))
      return true
      }
    • miner/miner.go:124-128

      go-ethereum/miner/miner.go

      Lines 124 to 128 in 81ab8b5

      func (miner *Miner) SetGasCeil(ceil uint64) {
      miner.confMu.Lock()
      miner.config.GasCeil = ceil
      miner.confMu.Unlock()
      }
  • Description: Root cause — MinerAPI.SetGasLimit(gasLimit hexutil.Uint64) bool declares its parameter with the modern hexutil.Uint64 hex-quantity wrapper — a non-pointer, always-required value type — and forwards the converted uint64 straight into Miner.SetGasCeil. No *rpc.HexNumber type (the older, pointer-based legacy hex-number wrapper) appears in the handler; the documented signature is a stale reference to that superseded type rather than the one actually registered for this RPC method.
  • Method: miner_setGasLimit

2. miner_setGasPrice: miner_setGasPrice takes hexutil.Big rather than the documented number *rpc.HexNumber signature

  • Statement: miner_setGasPrice takes hexutil.Big rather than the documented number *rpc.HexNumber signature.
  • URL: https://geth.ethereum.org/docs/interacting-with-geth/rpc/ns-miner
  • Code location:
    • eth/api_miner.go:44-52
      func (api *MinerAPI) SetGasPrice(gasPrice hexutil.Big) bool {
      api.e.lock.Lock()
      api.e.gasPrice = (*big.Int)(&gasPrice)
      api.e.lock.Unlock()
      api.e.txPool.SetGasTip((*big.Int)(&gasPrice))
      api.e.Miner().SetGasTip((*big.Int)(&gasPrice))
      return true
      }
    • common/hexutil/json.go:171-188
      func (b *Big) UnmarshalText(input []byte) error {
      raw, err := checkNumberText(input)
      if err != nil {
      return err
      }
      if len(raw) > 64 {
      return ErrBig256Range
      }
      words := make([]big.Word, len(raw)/bigWordNibbles+1)
      end := len(raw)
      for i := range words {
      start := end - bigWordNibbles
      if start < 0 {
      start = 0
      }
      for ri := start; ri < end; ri++ {
      nib := decodeNibble(raw[ri])
      if nib == badNibble {
  • Description: Root cause — MinerAPI.SetGasPrice(gasPrice hexutil.Big) bool declares its parameter as hexutil.Big, whose UnmarshalText/hex-string decoding builds an arbitrary-precision big.Int (needed because gas price can exceed 64 bits), and the value is applied directly to both the transaction pool's and the miner's gas-tip settings. As with SetGasLimit, the legacy *rpc.HexNumber pointer type named in the documentation does not appear anywhere in this call path — it was replaced by hexutil.Big without the documentation being updated.
  • Method: miner_setGasPrice

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions