mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-07-12 05:15:44 +00:00
PVF: Remove artifact persistence across restarts (#2895)
Considering the complexity of https://github.com/paritytech/polkadot-sdk/pull/2871 and the discussion therein, as well as the further complexity introduced by the hardening in https://github.com/paritytech/polkadot-sdk/pull/2742, as well as the eventual replacement of wasmtime by PolkaVM, it seems best to remove this persistence as it is creating more problems than it solves. ## Related Closes https://github.com/paritytech/polkadot-sdk/issues/2863
This commit is contained in:
@@ -218,7 +218,7 @@ pub async fn start(
|
||||
gum::debug!(target: LOG_TARGET, ?config, "starting PVF validation host");
|
||||
|
||||
// Make sure the cache is initialized before doing anything else.
|
||||
let artifacts = Artifacts::new_and_prune(&config.cache_path).await;
|
||||
let artifacts = Artifacts::new(&config.cache_path).await;
|
||||
|
||||
// Run checks for supported security features once per host startup. If some checks fail, warn
|
||||
// if Secure Validator Mode is disabled and return an error otherwise.
|
||||
@@ -884,14 +884,13 @@ fn pulse_every(interval: std::time::Duration) -> impl futures::Stream<Item = ()>
|
||||
#[cfg(test)]
|
||||
pub(crate) mod tests {
|
||||
use super::*;
|
||||
use crate::PossiblyInvalidError;
|
||||
use crate::{artifacts::generate_artifact_path, PossiblyInvalidError};
|
||||
use assert_matches::assert_matches;
|
||||
use futures::future::BoxFuture;
|
||||
use polkadot_node_core_pvf_common::{
|
||||
error::PrepareError,
|
||||
prepare::{PrepareStats, PrepareSuccess},
|
||||
};
|
||||
use sp_core::hexdisplay::AsBytesRef;
|
||||
|
||||
const TEST_EXECUTION_TIMEOUT: Duration = Duration::from_secs(3);
|
||||
pub(crate) const TEST_PREPARATION_TIMEOUT: Duration = Duration::from_secs(30);
|
||||
@@ -915,14 +914,6 @@ pub(crate) mod tests {
|
||||
ArtifactId::from_pvf_prep_data(&PvfPrepData::from_discriminator(discriminator))
|
||||
}
|
||||
|
||||
fn artifact_path(discriminator: u32) -> PathBuf {
|
||||
let pvf = PvfPrepData::from_discriminator(discriminator);
|
||||
let checksum = blake3::hash(pvf.code().as_bytes_ref());
|
||||
artifact_id(discriminator)
|
||||
.path(&PathBuf::from(std::env::temp_dir()), checksum.to_hex().as_str())
|
||||
.to_owned()
|
||||
}
|
||||
|
||||
struct Builder {
|
||||
cleanup_pulse_interval: Duration,
|
||||
artifact_ttl: Duration,
|
||||
@@ -1110,19 +1101,23 @@ pub(crate) mod tests {
|
||||
#[tokio::test]
|
||||
async fn pruning() {
|
||||
let mock_now = SystemTime::now() - Duration::from_millis(1000);
|
||||
let tempdir = tempfile::tempdir().unwrap();
|
||||
let cache_path = tempdir.path();
|
||||
|
||||
let mut builder = Builder::default();
|
||||
builder.cleanup_pulse_interval = Duration::from_millis(100);
|
||||
builder.artifact_ttl = Duration::from_millis(500);
|
||||
let path1 = generate_artifact_path(cache_path);
|
||||
let path2 = generate_artifact_path(cache_path);
|
||||
builder.artifacts.insert_prepared(
|
||||
artifact_id(1),
|
||||
artifact_path(1),
|
||||
path1.clone(),
|
||||
mock_now,
|
||||
PrepareStats::default(),
|
||||
);
|
||||
builder.artifacts.insert_prepared(
|
||||
artifact_id(2),
|
||||
artifact_path(2),
|
||||
path2.clone(),
|
||||
mock_now,
|
||||
PrepareStats::default(),
|
||||
);
|
||||
@@ -1135,7 +1130,7 @@ pub(crate) mod tests {
|
||||
run_until(
|
||||
&mut test.run,
|
||||
async {
|
||||
assert_eq!(to_sweeper_rx.next().await.unwrap(), artifact_path(2));
|
||||
assert_eq!(to_sweeper_rx.next().await.unwrap(), path2);
|
||||
}
|
||||
.boxed(),
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user