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

UIP-6: App Version Safeguard #4919

Merged
merged 10 commits into from
Nov 15, 2024
5 changes: 5 additions & 0 deletions crates/core/app/src/app_version/component.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,11 @@ async fn write_app_version_safeguard<S: StateWrite>(s: &mut S, x: u64) -> anyhow
/// This will also result in the current app version being stored, so that future
/// calls to this function will be checked against this state.
pub async fn assert_latest_app_version(s: Storage) -> anyhow::Result<()> {
// If the storage is not initialized, avoid touching it at all,
// to avoid complaints about it already being initialized before the first genesis.
if s.latest_version() == u64::MAX {
cronokirby marked this conversation as resolved.
Show resolved Hide resolved
return Ok(());
}
let mut delta = StateDelta::new(s.latest_snapshot());
let found = read_app_version_safeguard(&delta).await?;
check_version(CheckContext::Running, APP_VERSION, found)?;
Expand Down
Loading