diff --git a/tig-protocol/src/context.rs b/tig-protocol/src/context.rs index 579f8c5f..fdc2aac2 100644 --- a/tig-protocol/src/context.rs +++ b/tig-protocol/src/context.rs @@ -62,7 +62,6 @@ pub trait Context { &self, settings: BenchmarkSettings, details: PrecommitDetails, - hyperparameters: Option>, ) -> Result; async fn get_proof_details(&self, benchmark_id: &String) -> Option; async fn get_proof_state(&self, benchmark_id: &String) -> Option; diff --git a/tig-protocol/src/contracts/benchmarks.rs b/tig-protocol/src/contracts/benchmarks.rs index 2a068899..1ec21f7c 100644 --- a/tig-protocol/src/contracts/benchmarks.rs +++ b/tig-protocol/src/contracts/benchmarks.rs @@ -12,6 +12,7 @@ pub async fn submit_precommit( player_id: String, settings: BenchmarkSettings, hyperparameters: Option>, + runtime: Runtime, num_nonces: u64, seed: u64, ) -> Result { @@ -90,8 +91,9 @@ pub async fn submit_precommit( num_nonces, rand_hash: hex::encode(StdRng::seed_from_u64(seed).gen::<[u8; 16]>()), fee_paid: submission_fee, + hyperparameters, + runtime, }, - hyperparameters, ) .await?; Ok(benchmark_id) @@ -162,8 +164,14 @@ pub async fn submit_benchmark( )); } - // check at least 2 sets of nonces are provided + // check solution_quality length let precommit_details = ctx.get_precommit_details(&benchmark_id).await.unwrap(); + if solution_quality.len() != precommit_details.num_nonces as usize { + return Err(anyhow!( + "Invalid solution_quality length. Should match number of nonces {}", + precommit_details.num_nonces + )); + } // random sample nonces let config = ctx.get_config().await; diff --git a/tig-structs/src/core.rs b/tig-structs/src/core.rs index f8fff5aa..9ef7e1f0 100644 --- a/tig-structs/src/core.rs +++ b/tig-structs/src/core.rs @@ -86,7 +86,6 @@ serializable_struct_with_getters! { details: PrecommitDetails, settings: BenchmarkSettings, state: PrecommitState, - hyperparameters: Option>, } } serializable_struct_with_getters! { @@ -404,12 +403,20 @@ serializable_struct_with_getters! { } // Precommit child structs +serializable_struct_with_getters! { + Runtime { + memory: u64, + fuel: u64, + } +} serializable_struct_with_getters! { PrecommitDetails { block_started: u32, num_nonces: u64, rand_hash: String, fee_paid: PreciseNumber, + runtime: Runtime, + hyperparameters: Option>, } } serializable_struct_with_getters! {