-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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
Dump UpgradeProof to file before upgrade #8116
Conversation
// ProofInfo contains the upgraded client and consensus state along with the associated proofs | ||
// This will be useful for relayers who want to upgrade IBC clients of this chain on other counterparty chains | ||
type ProofInfo struct { | ||
ClientState *codectypes.Any `json:"client_state"` |
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.
These use the types that are required by upgrade client msg so relayers have to do no converting
Codecov Report
@@ Coverage Diff @@
## master #8116 +/- ##
==========================================
- Coverage 61.88% 61.78% -0.10%
==========================================
Files 609 609
Lines 35096 35158 +62
==========================================
+ Hits 21718 21722 +4
- Misses 11096 11154 +58
Partials 2282 2282
|
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 a great!! Didn't realize producing proofs with the keeper was possible
return nil, err | ||
} | ||
clientRes := queryableMs.Query(abci.RequestQuery{ | ||
Path: "store/upgrade/key", |
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: use module name const instead of upgrade
return nil, err | ||
} | ||
consStateRes := queryableMs.Query(abci.RequestQuery{ | ||
Path: "store/upgrade/key", |
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.
ditto
if err != nil { | ||
return nil, err | ||
} | ||
clientRes := queryableMs.Query(abci.RequestQuery{ |
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.
can we check if the abci response is valid (no wrapped err)?
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.
ditto with the others
@@ -265,6 +271,98 @@ func (k Keeper) GetUpgradeInfoPath() (string, error) { | |||
return filepath.Join(upgradeInfoFileDir, UpgradeInfoFileName), nil | |||
} | |||
|
|||
// CreateUpgradeProofInfo creates the proof info struct with all necessary information | |||
// for relayers to upgrade counterparty's IBC clients. | |||
func (k Keeper) CreateUpgradeProofInfo(ctx sdk.Context, height int64) (*types.ProofInfo, error) { |
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, can we split the components of this PR into private funcs?
- Get client state and pack (any)
- get client state proof and check err
- get cons state and pack (any)
- get cons state proof and check err
// GetUpgradeProofPath returns the upgrade proof file path | ||
func (k Keeper) GetUpgradeProofPath() (string, error) { | ||
upgradeInfoFileDir := path.Join(k.getHomeDir(), "data") | ||
err := tmos.EnsureDir(upgradeInfoFileDir, os.ModePerm) |
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.
q: what's this tendermint dep?
if err != nil { | ||
return err | ||
} | ||
return ioutil.WriteFile(upgradeProofFilePath, info, 0600) |
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.
I'd add a comment on why 0600 was chosen instead of 0644
This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Bump, should we close this, or is it still useful for some reason? |
We can close this. Not necessary since it turns out the full node will continue to serve query requests with proofs during an upgrade |
Description
closes: #XXXX
Before we can merge this PR, please make sure that all the following items have been
checked off. If any of the checklist items are not applicable, please leave them but
write a little note why.
docs/
) or specification (x/<module>/spec/
)godoc
comments.Unreleased
section inCHANGELOG.md
Files changed
in the Github PR explorerCodecov Report
in the comment section below once CI passes