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

eth_getBalance returns 0 balance instead of 1 #1951

Closed
1 task done
Tracked by #1579
Rjected opened this issue Mar 24, 2023 · 1 comment · Fixed by #1958
Closed
1 task done
Tracked by #1579

eth_getBalance returns 0 balance instead of 1 #1951

Rjected opened this issue Mar 24, 2023 · 1 comment · Fixed by #1958
Assignees
Labels
A-rpc Related to the RPC implementation C-bug An unexpected or incorrect behavior

Comments

@Rjected
Copy link
Member

Rjected commented Mar 24, 2023

Describe the bug

Currently the rpc-compat hive test for eth_getBalance/get-balance-blockhash fails, returning the incorrect balance:

>>  {"jsonrpc":"2.0","id":1,"method":"eth_getBalance","params":["0xaa00000000000000000000000000000000000000","0x898753d8fdd8d92c1907ca21e68c7970abd290c647a202091181deec3f30a0b2"]}
<<  {"jsonrpc":"2.0","result":"0x0","id":1}
response differs from expected:
 {
   "id": 1,
   "jsonrpc": "2.0",
-  "result": "0x0"
+  "result": "0x1"
 }

Steps to reproduce

Run hive:

./hive --client reth --sim ethereum/rpc-compat --sim.limit "/eth_getBalance"

Node logs

No response

Platform(s)

No response

What version/commit are you on?

No response

Code of Conduct

  • I agree to follow the Code of Conduct
@Rjected Rjected added C-bug An unexpected or incorrect behavior S-needs-triage This issue needs to be labelled A-rpc Related to the RPC implementation and removed S-needs-triage This issue needs to be labelled labels Mar 24, 2023
@Rjected Rjected self-assigned this Mar 24, 2023
@Rjected
Copy link
Member Author

Rjected commented Mar 24, 2023

Did some debugging, and we the call is failing here, returning Ok(None):

// history key to search IntegerList of transition id changesets.
let history_key = ShardedKey::new(address, self.transition);
let Some(changeset_transition_id) = self.tx.cursor_read::<tables::AccountHistory>()?
.seek(history_key)?
.filter(|(key,_)| key.key == address)
.map(|(_,list)| list.0.enable_rank().successor(self.transition as usize).map(|i| i as u64)) else {
return Ok(None)
};

custom traces:

2023-03-24T00:34:40.422816Z TRACE connection{remote_addr=172.17.0.3:58894 conn_id=1}:method_call{method="eth_getBalance"}: Serving eth_getBalance address=0xaa00000000000000000000000000000000000000 block_number=Some(Hash(BlockHash { block_hash: 0x898753d8fdd8d92c1907ca21e68c7970abd290c647a202091181deec3f30a0b2, require_canonical: None }))
2023-03-24T00:34:40.422846Z TRACE connection{remote_addr=172.17.0.3:58894 conn_id=1}:method_call{method="eth_getBalance"}: Getting balance for address address=0xaa00000000000000000000000000000000000000
2023-03-24T00:34:40.422857Z TRACE connection{remote_addr=172.17.0.3:58894 conn_id=1}:method_call{method="eth_getBalance"}: Getting basic account information address=0xaa00000000000000000000000000000000000000
2023-03-24T00:34:40.422860Z TRACE connection{remote_addr=172.17.0.3:58894 conn_id=1}:method_call{method="eth_getBalance"}: Using history key history_key=ShardedKey { key: 0xaa00000000000000000000000000000000000000, highest_transition_id: 1 }
2023-03-24T00:34:40.422874Z TRACE connection{remote_addr=172.17.0.3:58894 conn_id=1}:method_call{method="eth_getBalance"}: Could not find account info

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

Successfully merging a pull request may close this issue.

1 participant