-
Notifications
You must be signed in to change notification settings - Fork 122
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
Consumer client created with initial consensus state with wrong timestamp #690
Comments
Thank you for investigating and opening this issue, this is great feedback! To mitigate this issue in running testnets we can instruct participants to always set their genesis time so it walls within the |
Not sure that this is possible as the provider doesn't know when the consumer will start. I think the best we can do it to clearly document this. |
Not sure if the genesis and proposal used in the scenario are typical. But if |
I'm not that familiar with bootstrapping chains. Is there a way to set a chain's genesis time in advance, regardless of when the chain actually starts? |
Yes, it is part of genesis.json file. The first lines are something like (see the example used in the test):
The The proposal (example from test) includes an initial height but not a time:
It does have however a There is also a question around Haven't looked at the other parameters in the proposal (on my todo, together with a review of the code). |
Looked at the code more. Seems that the timestamp of the consensus state used when client is created is the provider chain time when proposal is executed, i.e. neither High level, iiuc, when the proposal is executed, in addition to creating the consumer client, the consumer genesis parameters are determined. These can then be exported and some tool might be available to generate the consumer chain genesis file (Is there one?). Then validators are expected to start the nodes with this, ideally correct, consumer genesis file. Could this maybe work?
Note: I made other changes so the tests pass, however the ones related to how the revision number is determined are not perfect as the tests create a chain with revision number |
The current implementation guarantees the following invariant:
The |
I agree. That would simplify the UX. |
This would definitely work. But where is |
It's the block time on the provider when the proposal is handled, see
|
Ah, I saw that one. But thought it is explicitly defined someplace. So yes as you siad, exporting that time for use in consumer genesis would work. |
Another question is about upgrade from sovereign to consumer. Will the new consumer client be also created during proposal execution? Probably to be clarified or addressed elsewhere but was curious about it :) |
Sorry for the late reply. For sovereign to consumer, the CCV channel will be built on already existing clients. Actually, my preference would be to build on top of an already existing connection as the two chains most likely are already connected via IBC. |
Closing as #2280 better explains the change needed. |
Problem
[cc: @MSalopek , thanks for helping with this!]
We were debugging an issue with expired consumer client while setting up a connection using hermes CLI. The handshake was failing with this error message:
It indicated that the consumer client on the provider chain could not be updated because it was expired.
The relevant proposal and genesis parameters that were used are:
And the client parameters are:
Here is the summary of the findings:
The consumer client on the provider is created here:
https://github.com/cosmos/interchain-security/blob/main/x/ccv/provider/keeper/proposal.go#L87-L94
Not clear where all the params are taken from but from the client state output, it seems that it is created with a consensus state at height
1
but a timestamp ( afterspawn_time
?) that it is not the one of the block at height1
on the consumer chain (genesis_time
).When hermes tries to update a client, it first checks that the client state is not expired. For this it gets the timestamp of the latest consensus state (height
1
in our case) from provider chain (from the IBC client module store), i.e. the one the client was created with. As mentioned above this timestamp is different than the timestamp at height1
as seen on the consumer chain. So this check passes on hermes.Then hermes tries to verify the new header (let’s say height
100
). The error we see comes from this step.This check is part of the light client code that is in
tendermint-rs
repository. The API takes a trusted height (1
) and the target height (100
). It then fetches the blocks from the consumer chain. First it checks that the block at trusted height (1
) is still recent enough (not older than thetrusting period
). This part of the code generates the error message that is seen above.Closing criteria
Ideally the client created on the provider should be done with a consensus state with same timestamp as the corresponding block on the consumer chain (
genesis_time
for height1
).In addition, something should ensure that
spawn_time - genesis_time < trusting period
and the consumer client on the provider is updated withintrusting_period
of thegenesis_time
.This should be clearly documented.
Problem details
Please describe the problem in all detail.
TODOs
The text was updated successfully, but these errors were encountered: