-
Notifications
You must be signed in to change notification settings - Fork 548
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
Don't compute staged ledger hash on every RPC call #16568
Conversation
Problem: RPC get_staged_ledger_aux_and_pending_coinbases_at_hash computes staged ledger hash on every call, which is unnecessary expensive. Solution: compute hash once and store it in the breadcrumb, then use on each invocation of RPC.
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.
nice find!
!ci-build-me |
For the genesis block staged ledger hash is computed differently than for other blocks, and it needs to be accounted for.
!ci-build-me |
; staged_ledger : Staged_ledger.t | ||
; just_emitted_a_proof : bool | ||
; transition_receipt_time : Time.t option | ||
; staged_ledger_hash : Staged_ledger_hash.t |
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.
nit it feels a little odd that the staged ledger and the hash are decoupled, but i understand why you don't want to stick a new field into the staged ledger.
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.
Yeah, staged ledger is a mutable structure, we'd need to think carefully about semantics of use
Breadcrumb
doesn't enforce immutability of underlying staged ledger in any way, but it's being assumed by convention
Problem: RPC get_staged_ledger_aux_and_pending_coinbases_at_hash computes staged ledger hash on every call, which is unnecessary expensive.
Solution: use staged ledger hash from breadcrumb on each invocation of RPC.
Explain how you tested your changes:
Checklist: