Skip to content

fix: eth_getBalance, eth_getCode & eth_getStorageAt: return default value if account is not found#259

Merged
fmoletta merged 2 commits into
mainfrom
get-balance-zero-default
Aug 16, 2024
Merged

fix: eth_getBalance, eth_getCode & eth_getStorageAt: return default value if account is not found#259
fmoletta merged 2 commits into
mainfrom
get-balance-zero-default

Conversation

@fmoletta

@fmoletta fmoletta commented Aug 14, 2024

Copy link
Copy Markdown
Contributor

Motivation

Rpc endpoint eth_getBalance should return 0 if the account is not present in the storage.
Rpc endpoint eth_getCode should return empty bytes if the account is not present in the storage.
Rpc endpoint eth_getStorageAt should return 0 if the account or storage slot is not present in the storage.

Description

  • eth_getBalance: return zero if the account is not part of the state
  • eth_getCode: return empty bytes if the account is not part of the state
  • eth_getStorageAt: return zero if the account or storage slot is not part of the state

Closes None, but makes hive test eth_getBalance/get-balance-unknown-account & eth_getCode/get-code-unknown-account pass. (eth_getStorageAt/get-storage-unknown-account would also pass if it weren't for formatting differences)

@fmoletta fmoletta marked this pull request as ready for review August 14, 2024 19:58
@fmoletta fmoletta requested a review from a team as a code owner August 14, 2024 19:58
@fmoletta fmoletta changed the title fix: eth_getBalance: return zero if account is not found fix: eth_getBalance, eth_getCode & eth_getStorageAt: return default value if account is not found Aug 14, 2024

@ElFantasma ElFantasma left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@fmoletta fmoletta added this pull request to the merge queue Aug 16, 2024
Merged via the queue into main with commit 8c7ba03 Aug 16, 2024
@fmoletta fmoletta deleted the get-balance-zero-default branch August 16, 2024 13:20
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.

2 participants