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

fix: use current exec state when querying validator table #1234

Merged
merged 1 commit into from
Dec 17, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions fendermint/app/src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -420,12 +420,15 @@ where

/// Replaces the current validators cache with a new one.
async fn refresh_validators_cache(&self) -> Result<()> {
let mut state = self
.read_only_view(None)?
.ok_or_else(|| anyhow!("exec state should be present"))?;
// TODO: This should be read only state, but we can't use the read-only view here
// because it hasn't been committed to state store yet.
self.modify_exec_state(|mut s| async {
let mut cache = self.validators_cache.lock().await;
*cache = Some(ValidatorCache::new_from_state(&mut s.1)?);
Ok((s, ()))
})
.await?;

let mut cache = self.validators_cache.lock().await;
*cache = Some(ValidatorCache::new_from_state(&mut state)?);
Ok(())
}

Expand Down
Loading