Skip to content

Conversation

@lightclient
Copy link
Member

@lightclient lightclient commented Aug 6, 2021

Currently geth returns 0 null(console converts to 0) for gasPrice for pending transactions:

> params = { from: me, to: me, maxFeePerGas: "0x1000000000", maxTipPerGas: "0x0", gas: "0x5208" }
{
  from: "0xc0ffee61108b46c8b84c63df14e3a607ac981e93",
  gas: "0x5208",
  maxFeePerGas: "0x1000000000",
  maxTipPerGas: "0x0",
  to: "0xc0ffee61108b46c8b84c63df14e3a607ac981e93"
}
> personal.sendTransaction(params)
"0xd7291f16ce57eb4e6aaae4b3d81f3f16ed947763cbed230eef3d9d1cb395fa5d"
> eth.getTransaction("0xd7291f16ce57eb4e6aaae4b3d81f3f16ed947763cbed230eef3d9d1cb395fa5d")
{
  accessList: [],
  blockHash: null,
  blockNumber: null,
  chainId: "0x5",
  from: "0xc0ffee61108b46c8b84c63df14e3a607ac981e93",
  gas: 21000,
  gasPrice: 0,
  hash: "0xd7291f16ce57eb4e6aaae4b3d81f3f16ed947763cbed230eef3d9d1cb395fa5d",
  input: "0x",
  maxFeePerGas: "0x1000000000",
  maxPriorityFeePerGas: "0x12a05f1f9",
  nonce: 0,
  r: "0x10f320d15d1d8c84ae687c9f446379d5c4c76e16146361349002e0af77996fc0",
  s: "0x23c3e3bf21d272a1978f8923603171e462740764f5e03c1ef859f318fc72b34d",
  to: "0xc0ffee61108b46c8b84c63df14e3a607ac981e93",
  transactionIndex: null,
  type: "0x2",
  v: "0x1",
  value: 0
}

After this change, it will return maxFeePerGas as specified by the RPC spec:

> params = { from: me, to: me, maxFeePerGas: "0x1000000000", maxTipPerGas: "0x0", gas: "0x5208" }
{
  from: "0xc0ffee61108b46c8b84c63df14e3a607ac981e93",
  gas: "0x5208",
  maxFeePerGas: "0x1000000000",
  maxTipPerGas: "0x0",
  to: "0xc0ffee61108b46c8b84c63df14e3a607ac981e93"
}
> personal.sendTransaction(params)
"0x646d8b7343e06c3f944c022c7f2c898a7ff8a84c714f967bd75f60d3ca04710b"
> eth.getTransaction("0x646d8b7343e06c3f944c022c7f2c898a7ff8a84c714f967bd75f60d3ca04710b")
{
  accessList: [],
  blockHash: null,
  blockNumber: null,
  chainId: "0x5",
  from: "0xc0ffee61108b46c8b84c63df14e3a607ac981e93",
  gas: 21000,
  gasPrice: 68719476736,
  hash: "0x646d8b7343e06c3f944c022c7f2c898a7ff8a84c714f967bd75f60d3ca04710b",
  input: "0x",
  maxFeePerGas: "0x1000000000",
  maxPriorityFeePerGas: "0x12a05f1f9",
  nonce: 1,
  r: "0xf755782c9d7455ce2ffddafbb974faabc24801062d86ff471b3d7a132c3bb88d",
  s: "0x28fee09dc49d86c0214ee7c95cce30fd658494ee5810ccfe2649fbd3035ae370",
  to: "0xc0ffee61108b46c8b84c63df14e3a607ac981e93",
  transactionIndex: null,
  type: "0x2",
  v: "0x1",
  value: 0
}

edit: I realize I included an invalid value maxTipPerGas, but it ended up just estimating a priority fee so I don't think it affects the overall issue at all.

@lightclient
Copy link
Member Author

lightclient commented Aug 6, 2021

Turns out, gasPrice is actually null. The console just coerced it into 0.

$ curl http://localhost:8645 -H 'Content-Type: application/json' -d '{"method":"eth_getTransactionByHash","id":1,"jsonrpc":"2.0", "params":["0xad8ca38344e48648b322d87c64ae4c4e3d9a8c055069abe507cf1d43d3d5bdc1"]}'

{"jsonrpc":"2.0","id":1,"result":{"blockHash":null,"blockNumber":null,"from":"0xc0ffee61108b46c8b84c63df14e3a607ac981e93","gas":"0x5208","gasPrice":null,"maxFeePerGas":"0x1000000000","maxPriorityFeePerGas":"0x0","hash":"0xad8ca38344e48648b322d87c64ae4c4e3d9a8c055069abe507cf1d43d3d5bdc1","input":"0x","nonce":"0x2","to":"0xc0ffee61108b46c8b84c63df14e3a607ac981e93","transactionIndex":null,"value":"0x0","type":"0x2","accessList":[],"chainId":"0x5","v":"0x1","r":"0x8d404089a6a6394f4095b33faac73e7cc32b23527c35a976a56b56fca29d6eeb","s":"0x4d26600698e6c81e3e9f2dcc4645d9b142b42328eec4ee50b411c6ac00b18d8d"}}

@karalabe karalabe added this to the 1.10.7 milestone Aug 10, 2021
@karalabe karalabe merged commit 39fe7ec into ethereum:master Aug 10, 2021
atif-konasl pushed a commit to frozeman/pandora-execution-engine that referenced this pull request Oct 15, 2021
gzliudan added a commit to gzliudan/XDPoSChain that referenced this pull request Nov 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants