-
Notifications
You must be signed in to change notification settings - Fork 57
feat(json_rpc): improve and protect getSupplyInfo* methods #2664
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
base: master
Are you sure you want to change the base?
Conversation
…supply info was resolved
8d7e117 to
2744cb3
Compare
drcpu-github
left a comment
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 have not actually tested this branch, just added some questions based on a quick read through the code.
| let mut stream = start_client(addr)?; | ||
|
|
||
| let request = r#"{"jsonrpc": "2.0","method": "getSupplyInfo", "id": "1"}"#; | ||
| let request = r#"{"jsonrpc": "2.0","method": "getSupplyInfo2", "id": "1"}"#; |
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.
Any reason for completely replacing getSupplyInfo with getSupplyInfo2 in the CLI (instead of keeping both as functions)? I think it's kind of confusing the get_supply_info function here aliases to getSupplyInfo2 instead of both being present.
| let mut stream = start_client(addr)?; | ||
|
|
||
| let request = r#"{"jsonrpc": "2.0","method": "getSupplyInfo", "id": "1"}"#; | ||
| let request = r#"{"jsonrpc": "2.0","method": "getSupplyInfo2", "id": "1"}"#; |
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.
Any reason for replacing getSupplyInfo with getSupplyInfo instead of keeping both as separate functions? I think it's kind of confusing that get_supply_info aliases internally to getSupplyInfo2. I suppose getSupplyInfo is still accessible through the raw interface?
| initial_supply: u64, | ||
| /// Populate RAD hashes index | ||
| rad_hashes_index: bool, | ||
| /// Epoch when getSupplyInfo2 was last resolved. |
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 suppose these variables are not saved to storage (and we do not need storage migrations)? That does imply whenever a node restarts (after a manual intervention or crash), this call will be slow again for the first time?
| } else { | ||
| blocks_missing += 1; | ||
| blocks_missing_reward += block_reward; | ||
| blocks_minted_reward += if wit2_activated && epoch >= wit2_activation_epoch { |
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.
Is there a point to this double check?
No description provided.