-
Notifications
You must be signed in to change notification settings - Fork 92
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(core-client)!: replace store_update_{time,height} by metadata update #972
Conversation
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## main #972 +/- ##
==========================================
- Coverage 66.78% 66.70% -0.08%
==========================================
Files 204 204
Lines 20473 20427 -46
==========================================
- Hits 13672 13626 -46
Misses 6801 6801 ☔ View full report in Codecov by Sentry. |
Thank you @mina86 for pointing those details out. To progress the PR, here are some points to consider:
|
@mina86 If you feel up to finishing this PR as well, we can include the second point (above) in our coming release as well. |
The change to store/delete-consensus-state was based on the observation that storing or deleting consensus state is always followed by update to the time and height. You say
but that means there’s no need for store_update_time and store_update_height at all? |
Great question! The rationale behind having these methods is rooted in the need to avoid making assumptions about how light client developers handle client metadata with each Btw, this got me thinking — we might be able to skip passing the Since this is an API-breaking change, let's give it more thought to ensure a robust API, so not imposing gradual adjustments on users. |
So if I understand correctly, this also means that implementations can
effectively ignore store_update_{time,height} calls and instead perform
the updates when handling store_consensus_state?
Btw, this got me thinking — we might be able to skip passing the `host_timestamp` and `host_height` to the `store_update_meta`. Tendermint clients already have internal access, and other clients potentially could follow a similar trait definition.
Makes sense to me. I’ve whipped out an alternative PR at
<#981>.
I think in the end it also means that implementations could have empty
store_update_meta implementations provided that they updated the time
and height in store_consensus_state.
…--
Best regards
ミハウ “𝓶𝓲𝓷𝓪86” ナザレヴイツ
«If at first you don’t succeed, give up skydiving»
|
With this PR we actually want to replace the two new paths ClientUpdateTimePath and ClientUpdateHeight with ClientUpdateMetadataPath, no? |
You've got a good point. I thought in the wrong direction. Let's stick with the current paths and keep the method signatures as is. So that, inside the implementation of these methods, whoever's working on it can decide whether or not to use the path types. |
In that case I think this PR is good as is. Though I struggle to imagine why any implementation would choose use those paths. There’s no benefit in having separate paths for the the height and timestamp since those two pieces of information are always accessed together. |
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.
Left a few comments, then all set 🙏
Good call. I'll check out what's happening with projects around ibc-rs to get a clearer picture so can before the next release, decide if we should keep the current signatures or define e.g. "ClientUpdateMetadataPath". |
Signed-off-by: Farhad Shabani <[email protected]>
…date (#972) * {store,delete}_update_meta * client_update_meta * log * clippy * error * review * fix unclog Signed-off-by: Farhad Shabani <[email protected]> --------- Signed-off-by: Farhad Shabani <[email protected]> Co-authored-by: Farhad Shabani <[email protected]>
Observe that update time and height are always read and manipulated
together. Replace pairs of methods for reading, updating and deleting
time and height with a single combined method for each operation.
Specifically, replace:
a) client_update_{time,height} by client_update_meta,
b) store_update_{time,height} by store_update_meta and
c) delete_update_{time,height} by delete_update_meta.
This allows better optimised implementations which, for example, keep
both pieces of information in a single map and perform a single lookup
to read or update them.
Closes: #973
PR author checklist:
unclog
.docs/
).Reviewer checklist:
Files changed
in the GitHub PR explorer.