From b0e5533040ebd43f8401592c1573069f1c6ca900 Mon Sep 17 00:00:00 2001 From: bgallois <benjamin@gallois.cc> Date: Thu, 28 Nov 2024 11:41:04 +0100 Subject: [PATCH] add oracle file versioning --- client/distance/src/lib.rs | 5 ++++- distance-oracle/src/lib.rs | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/client/distance/src/lib.rs b/client/distance/src/lib.rs index df2e2451b..c36091612 100644 --- a/client/distance/src/lib.rs +++ b/client/distance/src/lib.rs @@ -40,6 +40,9 @@ use sp_runtime::{generic::BlockId, traits::Block as BlockT, AccountId32}; use std::path::PathBuf; /// The file version that should match the distance oracle one. +/// This ensures that the smith avoids accidentally submitting invalid data +/// in case there are changes in logic between the runtime and the oracle, +/// thereby preventing potential penalties. const VERSION_PREFIX: &str = "001-"; type IdtyIndex = u32; @@ -152,7 +155,7 @@ where Err(e) => { match e.kind() { std::io::ErrorKind::NotFound => { - log::debug!("🧙 [distance oracle] Evaluation result file not found"); + log::debug!("🧙 [distance oracle] Evaluation result file not found. Please ensure that the oracle version matches {}", VERSION_PREFIX); } _ => { log::error!( diff --git a/distance-oracle/src/lib.rs b/distance-oracle/src/lib.rs index a80103775..93b8298f8 100644 --- a/distance-oracle/src/lib.rs +++ b/distance-oracle/src/lib.rs @@ -64,7 +64,10 @@ use log::{debug, info, warn}; use rayon::iter::{IntoParallelRefIterator, ParallelIterator}; use std::{io::Write, path::PathBuf}; -/// The file version that must match the version used by the inherent data provider. +/// The file version must match the version used by the inherent data provider. +/// This ensures that the smith avoids accidentally submitting invalid data +/// in case there are changes in logic between the runtime and the oracle, +/// thereby preventing potential penalties. const VERSION_PREFIX: &str = "001-"; #[subxt::subxt(runtime_metadata_path = "../resources/metadata.scale")] -- GitLab