-
Notifications
You must be signed in to change notification settings - Fork 22
chore: add block info to some LP related rpc calls #6021
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: main
Are you sure you want to change the base?
Conversation
…s block info, such as block number, hash etc.
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the ✨ Finishing Touches🧪 Generate unit tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! |
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.
What do we do about this breaking change? @dandanlen
.client | ||
.number(block_hash) | ||
.map_err(|e| call_error(e, CfErrorCode::OtherError))? | ||
.ok_or(internal_error(format!("Could not fetch block number for block {:?}", at)))?; |
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.
It would be good to understand the circumstances that can cause this to fail: what if the rpc is called on a block that is no longer in the block cache? (Like on a light rpc node).
.header(block_hash) | ||
.map_err(|e| call_error(e, CfErrorCode::OtherError))? | ||
.ok_or_else(|| { | ||
internal_error(format!("Could not fetch block header for block {:?}", at)) |
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.
Same here - not sure we always want to error. It might be better to optimistically return as much metadata as we can rather than erroring.
at: Option<Hash>, | ||
) -> RpcResult<BlockUpdate<Data>> { | ||
let block_hash = self.rpc_backend.unwrap_or_best(at); | ||
let block_number = self |
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.
This is repeating/duplicating some work:
- when we call
with_runtime_api
we already have the hash - the header also contains the hash
- the header might also contain the height?
I would like us to think a little harder about how to integrate the block wrapper nicely, without minimsl futher backend queries.
Pull Request
Closes: PRO-2234
Checklist
Please conduct a thorough self-review before opening the PR.
Summary
Changed some LP rpc call's return type to BlockUpdate - which contains block info, such as block number, hash etc.