-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
ADR 17: Historical header module #5340
Conversation
Codecov Report
@@ Coverage Diff @@
## master #5340 +/- ##
==========================================
+ Coverage 54.8% 54.81% +0.01%
==========================================
Files 311 311
Lines 18385 18385
==========================================
+ Hits 10075 10077 +2
+ Misses 7539 7537 -2
Partials 771 771 |
Decided to scrap this in favour of just duplicating state. I will revise. |
Seems like we're scrapping this idea for a new one? Is there a short description of the new approach anywhere? Seems pretty trivial to handle this completely on the application side rather than making any changes to ABCI. Since func BeginBlock(ctx sdk.Context, req abci.RequestBeginBlock) abci.ResponseBeginBlock {
h := HistoricalInfo{
Header: ctx.BlockHeader(),
ValSet: keeper.StakingKeeper.GetAllValidators(ctx),
}
keeper.SetHistoricalInfo(ctx, key=ctx.BlockHeight(), val=encode(h))
keeper.PruneHistoricalInfo(ctx, key = ctx.BlockHeight() - params.N)
} This can then be queried by the IBC modules. If this is already the new approach we're going for, I'm in favor of it 👍 |
Yes; precisely. I might just copy your code! (I had written the previous version in an attempt to save space, since we will now be storing headers on disk in both Tendermint and the SDK - duplicating data - but after discussion with the Tendermint team we agreed that the complexity wasn't worth it.) |
Technically we don't need to store the validator set; we can just store the hash and have the handshake require the validator set be provided as an additional parameter (store abstraction in Thoughts @AdityaSripal? |
Co-Authored-By: Federico Kunze <31522760+fedekunze@users.noreply.github.com>
Agreed, we can just store the hash if there's a simple way to retrieve the validator set for a given height. How would the relayer get the validator set. Is there already a query for it on the staking store? |
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.
ACK
It needs to be queried from Tendermint, I expect, as the SDK can't necessarily calculate it (information is lost if a validator unbonds, rebonds, for example). |
OK, so long as its queryable by the relayer as-needed rather than forcing the relayer to keep track of the validator sets themselves in their own local db; I am ok with storing hash |
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.
ACK
…mos-sdk into cwgoes/adr-historical-headers
I think I've addressed all the comments - not sure what the SDK merge process is these days - @alexanderbez did you want to quickly review (+ merge if satisfactory)? |
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.
ACK.
- Can you add the ADR to the TOC in
docs/architecture/README.MD
? - Since this doesn't process any txs, is it worth having it as a new module or can we retrofit into
x/staking
? Not a blocker, mainly just a question of best design.
|
|
||
Alternatively, the application MAY store only the hash of the validator set. | ||
|
||
The application MUST make these past `n` committed headers available for querying by SDK modules through the `Keeper`'s `GetHistoricalInfo` function. This MAY be implemented in a new module, or it MAY also be integrated into an existing one (likely `x/staking`). |
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 about storing it on the canonical IBC Keeper? I don't see the need for blockchains that are not using IBC to store the extra headers. @alexanderbez
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.
Sure, added x/ibc
as another suggestion.
(also, why does the simulation fail in some of the above CI runs? this PR only alters |
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.
ACK 🎉
@cwgoes most likely because each successive commit kills any previous CI pipeline (so we only have 1 CI pipeline running per commit/per PR). |
Closes #5078
docs/
)Files changed
in the github PR explorerFor Admin Use: