-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
feat: eth_get_balance rpc endpoint #2100
Conversation
87c42d6
to
3054dcc
Compare
77fbde7
to
b5ff05d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure about the query that get_balance_as_of_block(address, :earliest)
executes.
from(coin_balance in CoinBalance, | ||
where: coin_balance.address_hash == ^address, | ||
where: not is_nil(coin_balance.value), | ||
where: coin_balance.block_number == 0, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't this get the first known coin_balance
for the address instead of the one at block 0?
This would fail for addresses whose first coin_balance
is not at block 0, is this the intended behavior?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As far as I know, the "earliest" block does actually mean the genesis block. When I tried this endpoint out I couldn't get any address to respond w/ a non-zero balance on POA with the exception of the master of ceremony, implying that it is just talking about the first block.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok if that's the case then there are no problems
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@zachdaniel could you please drop a line in the PR description how to call this API endpoint?
e2958bd
to
3023081
Compare
6145ff7
to
f998c13
Compare
f998c13
to
e40027e
Compare
Resolves #2015
Example:
Changelog
Enhancements
This mimics the
ethGetBalance
json rpc. The only issue is that we don't currently create balances for accounts that have a balance at the genesis block. A ticket for doing that is here: #2080CHANGELOG.md
with this PR