Skip to content
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

Handle the app version when state syncing #3818

Open
evan-forbes opened this issue Aug 25, 2024 · 4 comments
Open

Handle the app version when state syncing #3818

evan-forbes opened this issue Aug 25, 2024 · 4 comments
Assignees
Labels
statesync WS: Maintenance 🔧 includes bugs, refactors, flakes, and tech debt etc

Comments

@evan-forbes
Copy link
Member

In:

we hacked around the issues of properly passing the app version to the kv store while mounting it for state sync

celestia-app/app/app.go

Lines 789 to 813 in ad250dd

// OfferSnapshot is a wrapper around the baseapp's OfferSnapshot method. It is
// needed to mount stores for the appropriate app version.
func (app *App) OfferSnapshot(req abci.RequestOfferSnapshot) abci.ResponseOfferSnapshot {
if app.IsSealed() {
// If the app is sealed, keys have already been mounted so this can
// delegate to the baseapp's OfferSnapshot.
return app.BaseApp.OfferSnapshot(req)
}
if app.upgradeHeightV2 == 0 {
app.Logger().Debug("v2 upgrade height not set, assuming app version 2")
app.mountKeysAndInit(v2)
return app.BaseApp.OfferSnapshot(req)
}
if req.Snapshot.Height >= uint64(app.upgradeHeightV2) {
app.Logger().Debug("snapshot height is greater than or equal to upgrade height, assuming app version 2")
app.mountKeysAndInit(v2)
return app.BaseApp.OfferSnapshot(req)
}
app.Logger().Debug("snapshot height is less than upgrade height, assuming app version 1")
app.mountKeysAndInit(v1)
return app.BaseApp.OfferSnapshot(req)
}

To close this issue, we should come up with a long term solution that works for all future app versions.

related to:

@evan-forbes evan-forbes added WS: Maintenance 🔧 includes bugs, refactors, flakes, and tech debt etc statesync labels Aug 25, 2024
@rootulp
Copy link
Collaborator

rootulp commented Aug 26, 2024

Notes from meeting:

  1. Try to implement this in a way that isn't breaking for v2.x.
  2. Consider adding this field:
type RequestOfferSnapshot struct {
	Snapshot *Snapshot `protobuf:"bytes,1,opt,name=snapshot,proto3" json:"snapshot,omitempty"`
	AppHash  []byte    `protobuf:"bytes,2,opt,name=app_hash,json=appHash,proto3" json:"app_hash,omitempty"`
+	AppVersion uint64
}
  1. If a node gets a snapshot that doesn't include AppVersion, fall back to the existing approach where we infer it based on --v2-upgrade-height
  2. [optional] since we're modifying ABCI types, consider adding AppVersion to RequestInfo

@cmwaters
Copy link
Contributor

If a node gets a snapshot that doesn't include AppVersion, fall back to the existing approach where we infer it based on --v2-upgrade-height

It can also potentially reject that snapshot and tendermint will search for another one but I think it's probably better that we fallback

I'm not sure if we should add it to the request like you've shown or to the Snapshot struct. I had a feeling when I looked at the plumbing that having it in the actual snapshot would be easier but would need to double check.

  1. Doesn't have to be coupled with this but it would be nice to have it with the multiapp and v3 as I believe this would clean up the initialisation a lot. (Remember we will still be doing this off the v0.34.x branch so regardless v2 will probably end up having the AppVersion in the request regardless of whether we use it or not

@rootulp
Copy link
Collaborator

rootulp commented Sep 5, 2024

Let's de-couple 4 from this issue: #3844

@rootulp rootulp self-assigned this Sep 9, 2024
@rootulp
Copy link
Collaborator

rootulp commented Sep 12, 2024

Notes from investigation:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
statesync WS: Maintenance 🔧 includes bugs, refactors, flakes, and tech debt etc
Projects
None yet
Development

No branches or pull requests

3 participants