Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error attempting a cast send transaction: (code: -32602, message: Invalid block range, data: None) #1977

Closed
1 task done
ryanorendorff opened this issue Mar 25, 2023 · 5 comments
Assignees
Labels
A-rpc Related to the RPC implementation C-bug An unexpected or incorrect behavior

Comments

@ryanorendorff
Copy link
Contributor

ryanorendorff commented Mar 25, 2023

Describe the bug

When attempting to use cast send to transfer eth from one account to another on a testnet, the call fails with an error about an improper type.

Expected Output

Successful transfer of value from one account to another.

Actual Output

The cast responds with

(code: -32602, message: Invalid block range, data: None)

while the reth node, with the debug statements turned on, prints

2023-03-24T23:03:52.014116Z DEBUG connection{remote_addr=127.0.0.1:56284 conn_id=27}: incoming body completed
2023-03-24T23:03:52.014129Z ERROR connection{remote_addr=127.0.0.1:56284 conn_id=27}: [next_inner] Deserialization to "ethereum_types::uint::U64" failed. Error: Error("invalid type: integer `10`, expected a (both 0x-prefixed or not) hex string or byte array containing between (0; 8] bytes", line: 1, column: 2), input JSON: "10,\"latest\",[5.0]]"
2023-03-24T23:03:52.014137Z ERROR connection{remote_addr=127.0.0.1:56284 conn_id=27}: Error parsing "block_count" as "U64": InvalidParams(invalid type: integer `10`, expected a (both 0x-prefixed or not) hex string or byte array containing between (0; 8] bytes at line 1 column 2)

Steps to reproduce

  1. Use the genesis file mentioned in this gist to generate a database called node1.

  2. Call the reth with the following node subcommand (note that the secret-key and jwtsecret can be removed)

 RUST_LOG=info,sync::stages=trace,downloaders=trace,debug reth node --chain genesis.json --db node1 -vvvvv -d --http.addr 127.0.0.1 --ws.addr 127.0.0.1 --authrpc.addr 127.0.0.1 --discovery.port 30303 --port 30303 --http --debug.tip dc58c6e5c98d17d5a7b4add2990fe802fc6c8ced3c70a9a2e6cf5a5adef111b7 --secret-key secret1 --authrpc.jwtsecret jwt1.hex
  1. Attempt the following cast:
cast send --value 1ether --from 0xde156C5bBB3EcdA5DFd12de7E34e4A08AB8e9e2B -i --json --rpc-url http://127.0.0.1:8545 0xc6Ba77E8c77e0762A323A8c5c36213062373136C

Node logs

2023-03-24T23:03:52.013221Z  INFO connection{remote_addr=127.0.0.1:56284 conn_id=27}: Accepting new connection 1/100
2023-03-24T23:03:52.013371Z DEBUG connection{remote_addr=127.0.0.1:56284 conn_id=27}: parsed 4 headers
2023-03-24T23:03:52.013380Z DEBUG connection{remote_addr=127.0.0.1:56284 conn_id=27}: incoming body is content-length (47 bytes)
2023-03-24T23:03:52.013391Z DEBUG connection{remote_addr=127.0.0.1:56284 conn_id=27}: incoming body completed
2023-03-24T23:03:52.013434Z DEBUG connection{remote_addr=127.0.0.1:56284 conn_id=27}: flushed 166 bytes
2023-03-24T23:03:52.013676Z DEBUG connection{remote_addr=127.0.0.1:56284 conn_id=27}: parsed 4 headers
2023-03-24T23:03:52.013686Z DEBUG connection{remote_addr=127.0.0.1:56284 conn_id=27}: incoming body is content-length (82 bytes)
2023-03-24T23:03:52.013692Z DEBUG connection{remote_addr=127.0.0.1:56284 conn_id=27}: incoming body completed
2023-03-24T23:03:52.013752Z DEBUG connection{remote_addr=127.0.0.1:56284 conn_id=27}: flushed 1662 bytes
2023-03-24T23:03:52.013945Z DEBUG connection{remote_addr=127.0.0.1:56284 conn_id=27}: parsed 4 headers
2023-03-24T23:03:52.013949Z DEBUG connection{remote_addr=127.0.0.1:56284 conn_id=27}: incoming body is content-length (82 bytes)
2023-03-24T23:03:52.013953Z DEBUG connection{remote_addr=127.0.0.1:56284 conn_id=27}: incoming body completed
2023-03-24T23:03:52.013985Z DEBUG connection{remote_addr=127.0.0.1:56284 conn_id=27}: flushed 203 bytes
2023-03-24T23:03:52.014108Z DEBUG connection{remote_addr=127.0.0.1:56284 conn_id=27}: parsed 4 headers
2023-03-24T23:03:52.014112Z DEBUG connection{remote_addr=127.0.0.1:56284 conn_id=27}: incoming body is content-length (79 bytes)
2023-03-24T23:03:52.014116Z DEBUG connection{remote_addr=127.0.0.1:56284 conn_id=27}: incoming body completed
2023-03-24T23:03:52.014129Z ERROR connection{remote_addr=127.0.0.1:56284 conn_id=27}: [next_inner] Deserialization to "ethereum_types::uint::U64" failed. Error: Error("invalid type: integer `10`, expected a (both 0x-prefixed or not) hex string or byte array containing between (0; 8] bytes", line: 1, column: 2), input JSON: "10,\"latest\",[5.0]]"
2023-03-24T23:03:52.014137Z ERROR connection{remote_addr=127.0.0.1:56284 conn_id=27}: Error parsing "block_count" as "U64": InvalidParams(invalid type: integer `10`, expected a (both 0x-prefixed or not) hex string or byte array containing between (0; 8] bytes at line 1 column 2)
2023-03-24T23:03:52.014150Z DEBUG connection{remote_addr=127.0.0.1:56284 conn_id=27}: flushed 325 bytes
2023-03-24T23:03:52.014262Z DEBUG connection{remote_addr=127.0.0.1:56284 conn_id=27}: read eof
2023-03-24T23:03:53.650042Z DEBUG connection{remote_addr=127.0.0.1:53386 conn_id=0}: parsed 5 headers
2023-03-24T23:03:53.650099Z DEBUG connection{remote_addr=127.0.0.1:53386 conn_id=0}: incoming body is content-length (63 bytes)
2023-03-24T23:03:53.650220Z DEBUG connection{remote_addr=127.0.0.1:53386 conn_id=0}: incoming body completed
2023-03-24T23:03:53.650446Z DEBUG connection{remote_addr=127.0.0.1:53386 conn_id=0}: flushed 162 bytes
2023-03-24T23:04:00.653571Z DEBUG connection{remote_addr=127.0.0.1:53386 conn_id=0}: parsed 5 headers
2023-03-24T23:04:00.653622Z DEBUG connection{remote_addr=127.0.0.1:53386 conn_id=0}: incoming body is content-length (63 bytes)
2023-03-24T23:04:00.653739Z DEBUG connection{remote_addr=127.0.0.1:53386 conn_id=0}: incoming body completed
2023-03-24T23:04:00.654000Z DEBUG connection{remote_addr=127.0.0.1:53386 conn_id=0}: flushed 162 bytes

Platform(s)

Mac (Apple Silicon)

What version/commit are you on?

b913b6e from PR #1946

Code of Conduct

  • I agree to follow the Code of Conduct
@ryanorendorff ryanorendorff added C-bug An unexpected or incorrect behavior S-needs-triage This issue needs to be labelled labels Mar 25, 2023
@mattsse
Copy link
Collaborator

mattsse commented Mar 25, 2023

thanks for this, I believe this is an issue with eth_feeHistory
currently in process of ironing out all RPC bugs.
on #1880 we also have mining support for testing purposes

@mattsse mattsse added A-rpc Related to the RPC implementation and removed S-needs-triage This issue needs to be labelled labels Mar 25, 2023
@mattsse mattsse self-assigned this Mar 25, 2023
@ryanorendorff
Copy link
Contributor Author

ryanorendorff commented Mar 31, 2023

I believe this is an issue with eth_feeHistory

Seems to be! This could be because there is no prior block. Edited log for more information.

 INFO Starting consensus engine
 INFO connection: Accepting new connection 1/100
TRACE connection: Conn::read_head
TRACE connection: flushed({role=server}): State { reading: Init, writing: Init, keep_alive: Busy }
TRACE connection: Conn::read_head
TRACE connection: received 153 bytes
TRACE connection: parse_headers: Request.parse bytes=153
TRACE connection: parse_headers: Request.parse Complete(106)
DEBUG connection: parsed 4 headers
DEBUG connection: incoming body is content-length (47 bytes)
TRACE connection: Request { method: POST, uri: /, version: HTTP/1.1, headers: {"content-type": "application/json", "accept": "*/*", "host": "127.0.0.1:8545", "content-length": "47"}, body: Body(Streaming) }
TRACE connection: decode; state=Length(47)
DEBUG connection: incoming body completed
TRACE connection: method_call{method="eth_chainId"}: recv="{\"jsonrpc\":\"2.0\",\"id\":1,\"method\":\"eth_chainId\",\"params\":null}"
TRACE connection: method_call{method="eth_chainId"}: Serving eth_chainId
TRACE connection: method_call{method="eth_chainId"}: send="{\"jsonrpc\":\"2.0\",\"result\":\"0x1e240\",\"id\":1}"
TRACE connection: encode_headers: Server::encode status=200, body=Some(Known(43)), req_method=Some(POST)
TRACE connection: buffer.queue self.len=123 buf.len=43
DEBUG connection: flushed 166 bytes
TRACE connection: flushed({role=server}): State { reading: Init, writing: Init, keep_alive: Idle }
TRACE connection: Conn::read_head
TRACE connection: flushed({role=server}): State { reading: Init, writing: Init, keep_alive: Idle }
TRACE connection: Conn::read_head
TRACE connection: received 188 bytes
TRACE connection: parse_headers: Request.parse bytes=188
TRACE connection: parse_headers: Request.parse Complete(106)
DEBUG connection: parsed 4 headers
DEBUG connection: incoming body is content-length (82 bytes)
TRACE connection: Request { method: POST, uri: /, version: HTTP/1.1, headers: {"content-type": "application/json", "accept": "*/*", "host": "127.0.0.1:8545", "content-length": "82"}, body: Body(Streaming) }
TRACE connection: decode; state=Length(82)
DEBUG connection: incoming body completed
TRACE connection: method_call{method="eth_getBlockByNumber"}: recv="{\"jsonrpc\":\"2.0\",\"id\":2,\"method\":\"eth_getBlockByNumber\",\"params\":[\"latest\",false]}"
TRACE connection: method_call{method="eth_getBlockByNumber"}: [next_inner] Params JSON: "[\"latest\",false]"
TRACE connection: method_call{method="eth_getBlockByNumber"}: [next_inner] Params JSON: ",false]"
TRACE connection: method_call{method="eth_getBlockByNumber"}: Serving eth_getBlockByNumber number=Latest full=false
TRACE connection: method_call{method="eth_getBlockByNumber"}: send="{\"jsonrpc\":\"2.0\",\"result\":{\"hash\":\"0xdc58c6e5c98d17d5a7b4add2990fe802fc6c8ced3c70a9a2e6cf5a5adef111b7\",\"parentHash\":\"0x0000000000000000000000000000000000000000000000000000000000000000\",\"sha3Uncles\":\"0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347\",\"miner\":\"0x0000000000000000000000000000000000000000\",\"stateRoot\":\"0xec0baf9a826ea4a7f86aa4e9efc972a671c0b5165c6b709752990e87ea82a3df\",\"transactionsRoot\":\"0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421\",\"receiptsRoot\":\"0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421\",\"withdrawalsRoot\":\"0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421\",\"number\":\"0x0\",\"gasUsed\":\"0x0\",\"gasLimit\":\"0x17d7840\",\"extraData\":\"0x\",\"logsBloom\":\"0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\",\"timestamp\":\"0x1675263480\",\"difficulty\":\"0x1\",\"mixHash\":\"0x0000000000000000000000000000000000000000000000000000000000000000\",\"nonce\":\"0x0000000000001234\",\"totalDifficulty\":\"0x1\",\"uncles\":[],\"transactions\":[],\"size\":\"0x225\",\"baseFeePerGas\":\"0x3b9aca00\",\"withdrawals\":[]},\"id\":2}"
TRACE connection: encode_headers: Server::encode status=200, body=Some(Known(1537)), req_method=Some(POST)
TRACE connection: buffer.queue self.len=125 buf.len=1537
DEBUG connection: flushed 1662 bytes
TRACE connection: flushed({role=server}): State { reading: Init, writing: Init, keep_alive: Idle }
TRACE connection: Conn::read_head
TRACE connection: flushed({role=server}): State { reading: Init, writing: Init, keep_alive: Idle }
TRACE connection: Conn::read_head
TRACE connection: received 188 bytes
TRACE connection: parse_headers: Request.parse bytes=188
TRACE connection: parse_headers: Request.parse Complete(106)
DEBUG connection: parsed 4 headers
DEBUG connection: incoming body is content-length (82 bytes)
TRACE connection: Request { method: POST, uri: /, version: HTTP/1.1, headers: {"content-type": "application/json", "accept": "*/*", "host": "127.0.0.1:8545", "content-length": "82"}, body: Body(Streaming) }
TRACE connection: decode; state=Length(82)
DEBUG connection: incoming body completed
TRACE connection: method_call{method="eth_feeHistory"}: recv="{\"jsonrpc\":\"2.0\",\"id\":3,\"method\":\"eth_feeHistory\",\"params\":[\"0xa\",\"latest\",[5.0]]}"
TRACE connection: method_call{method="eth_feeHistory"}: [next_inner] Params JSON: "[\"0xa\",\"latest\",[5.0]]"
TRACE connection: method_call{method="eth_feeHistory"}: [next_inner] Params JSON: ",\"latest\",[5.0]]"
TRACE connection: method_call{method="eth_feeHistory"}: [next_inner] Params JSON: ",[5.0]]"
TRACE connection: method_call{method="eth_feeHistory"}: Serving eth_feeHistory block_count=10 newest_block=Number(Latest) reward_percentiles=Some([5.0])
TRACE connection: method_call{method="eth_feeHistory"}: send="{\"jsonrpc\":\"2.0\",\"error\":{\"code\":-32602,\"message\":\"Invalid block range\"},\"id\":3}"
TRACE connection: encode_headers: Server::encode status=200, body=Some(Known(80)), req_method=Some(POST)
TRACE connection: buffer.queue self.len=123 buf.len=80
DEBUG connection: flushed 203 bytes
TRACE connection: flushed({role=server}): State { reading: Init, writing: Init, keep_alive: Idle }
TRACE connection: Conn::read_head
TRACE connection: flushed({role=server}): State { reading: Init, writing: Init, keep_alive: Idle }
TRACE connection: Conn::read_head
TRACE connection: received 185 bytes
TRACE connection: parse_headers: Request.parse bytes=185
TRACE connection: parse_headers: Request.parse Complete(106)
DEBUG connection: parsed 4 headers
DEBUG connection: incoming body is content-length (79 bytes)
TRACE connection: Request { method: POST, uri: /, version: HTTP/1.1, headers: {"content-type": "application/json", "accept": "*/*", "host": "127.0.0.1:8545", "content-length": "79"}, body: Body(Streaming) }
TRACE connection: decode; state=Length(79)
DEBUG connection: incoming body completed
TRACE connection: method_call{method="eth_feeHistory"}: recv="{\"jsonrpc\":\"2.0\",\"id\":4,\"method\":\"eth_feeHistory\",\"params\":[10,\"latest\",[5.0]]}"
TRACE connection: method_call{method="eth_feeHistory"}: [next_inner] Params JSON: "[10,\"latest\",[5.0]]"
ERROR connection: method_call{method="eth_feeHistory"}: [next_inner] Deserialization to "ethereum_types::uint::U64" failed. Error: Error("invalid type: integer `10`, expected a (both 0x-prefixed or not) hex string or byte array containing between (0; 8] bytes", line: 1, column: 2), input JSON: "10,\"latest\",[5.0]]"
ERROR connection: method_call{method="eth_feeHistory"}: Error parsing "block_count" as "U64": InvalidParams(invalid type: integer `10`, expected a (both 0x-prefixed or not) hex string or byte array containing between (0; 8] bytes at line 1 column 2)
TRACE connection: method_call{method="eth_feeHistory"}: send="{\"jsonrpc\":\"2.0\",\"error\":{\"code\":-32602,\"message\":\"invalid type: integer `10`, expected a (both 0x-prefixed or not) hex string or byte array containing between (0; 8] bytes at line 1 column 2\"},\"id\":4}"
TRACE connection: encode_headers: Server::encode status=200, body=Some(Known(201)), req_method=Some(POST)
TRACE connection: buffer.queue self.len=124 buf.len=201
DEBUG connection: flushed 325 bytes

@ryanorendorff
Copy link
Contributor Author

With #1880 and using --auto-mine, the cast returns a different error

cast send --value 1ether --from 0xf39Fd6e51aad88F6F4ce6aB8827279cff
Fb92266 --json --rpc-url http://127.0.0.1:8545 0xc6Ba77E8c77e0762A323A8
c5c36213062373136C --interactive

Error:
custom error: EIP-1559 not activated

and prints out a whole bunch of the following:

2023-03-31T22:18:40.449438Z  WARN execute{stage=Headers}: Stage reached maximum block, skipping. stage=Headers
2023-03-31T22:18:40.449470Z  WARN execute{stage=TotalDifficulty}: Stage reached maximum block, skipping. stage=TotalDifficulty
2023-03-31T22:18:40.449495Z  WARN execute{stage=Bodies}: Stage reached maximum block, skipping. stage=Bodies
2023-03-31T22:18:40.449530Z  WARN execute{stage=SenderRecovery}: Stage reached maximum block, skipping. stage=SenderRecovery
2023-03-31T22:18:40.449556Z  WARN execute{stage=Execution}: Stage reached maximum block, skipping. stage=Execution
2023-03-31T22:18:40.449584Z  WARN execute{stage=AccountHashing}: Stage reached maximum block, skipping. stage=AccountHashing
2023-03-31T22:18:40.449616Z  WARN execute{stage=StorageHashing}: Stage reached maximum block, skipping. stage=StorageHashing
2023-03-31T22:18:40.449651Z  WARN execute{stage=TransactionLookup}: Stage reached maximum block, skipping. stage=TransactionLookup
2023-03-31T22:18:40.449679Z  WARN execute{stage=IndexStorageHistory}: Stage reached maximum block, skipping. stage=IndexStorageHistory
2023-03-31T22:18:40.449705Z  WARN execute{stage=IndexAccountHistory}: Stage reached maximum block, skipping. stage=IndexAccountHistory
2023-03-31T22:18:40.449731Z  WARN execute{stage=Finish}: Stage reached maximum block, skipping. stage=Finish

@pistomat
Copy link
Contributor

I think this is fixed by #3288 (or at least I cannot reproduce this error anymore).

@onbjerg
Copy link
Member

onbjerg commented Jul 11, 2023

Thanks for the ping on this, will close this issue, but let us know if it is still persistent for you on the latest alpha @ryanorendorff 🙇🏻

@onbjerg onbjerg closed this as completed Jul 11, 2023
@github-project-automation github-project-automation bot moved this from Todo to Done in Reth Tracker Jul 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-rpc Related to the RPC implementation C-bug An unexpected or incorrect behavior
Projects
Archived in project
Development

No branches or pull requests

4 participants