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

AccountView should return computed balance as balance #1811

Closed
ilblackdragon opened this issue Dec 3, 2019 · 7 comments
Closed

AccountView should return computed balance as balance #1811

ilblackdragon opened this issue Dec 3, 2019 · 7 comments
Assignees
Labels
A-RPC Area: rpc C-enhancement Category: An issue proposing an enhancement or a PR with one. P-low Priority: low
Milestone

Comments

@ilblackdragon
Copy link
Member

Currently returned balance from RPC doesn't account for non subtracted yet storage rent.
We should rename that into something like onchain_balance and make balance = onchain_balance - storage_price * storage_usage * (height - storage_last_updated_at).

See section 4.3 of https://near.ai/economics for details on storage rent and charge_rent for actual function of how rent is updated.

CC: @kcole16

@lexfrl
Copy link
Contributor

lexfrl commented Jan 24, 2020

When client be able to read config trough RPC, then it'll be able to compute spendable balance on nearlib side and save unnecessary PRC call for the actual_amount for each time client want to send a transaction. I think also client would want to use not the current block_height to calculate spendable amount, but block_height + genesis.transaction_validity_period to cover the risk of TX being included with a delay.

@frol @nearmax @ilblackdragon @vgrichina WDYT?

@MaksymZavershynskyi MaksymZavershynskyi added C-bug Category: This is a bug and removed question labels Jan 27, 2020
@MaksymZavershynskyi
Copy link
Contributor

Talked to our customers that requested this feature, they actually suggested to compute the real balance on the front-end side.

Also, @frol had a concern that if we expose this through RPC it will create an intense RPC traffic, because real balance will be changing every second and so front-ends will be querying it frequently.

Closing this issue in favor of #2007

@ilblackdragon
Copy link
Member Author

I don't fully agree with reasoning that ppl will keep calling RPC for recent balance in case if it is computed. They will keep calling it whenever they needed.

We still should return the lazy computed balance to allow frontends to compute the current balance at any block in the future (which is just an approximation always, as money can be added or sent from another place).

Also we should add issues tracking to nearlib and near she'll to show current balance if we are deciding to compute it on the front end.

@lexfrl
Copy link
Contributor

lexfrl commented Feb 5, 2020

Ok, what if instead of changing of the meaning of the amount property we add a spendable_amount or even better add a unpaid_rent to make more clear?

@frol
Copy link
Collaborator

frol commented Feb 5, 2020

In any case, let me first finish #2007 (the PR will be ready today), which will make genesis and runtime configs available in jsonrpc.

@frol
Copy link
Collaborator

frol commented Mar 20, 2020

This is blocked on the decision for #2272.

@frol frol added C-enhancement Category: An issue proposing an enhancement or a PR with one. P-low Priority: low and removed C-bug Category: This is a bug P-high Priority: High labels Mar 20, 2020
@ilblackdragon
Copy link
Member Author

Closed due to #2272

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-RPC Area: rpc C-enhancement Category: An issue proposing an enhancement or a PR with one. P-low Priority: low
Projects
None yet
Development

No branches or pull requests

4 participants