From f598ab686c442d73a7072e4d2d83aec3d31f713a Mon Sep 17 00:00:00 2001 From: 0xfirefist Date: Thu, 25 Apr 2024 23:21:46 +0530 Subject: [PATCH] use seed and chain length --- apps/fortuna/provider-config.sample.yaml | 3 ++- apps/fortuna/src/command/run.rs | 7 ++----- apps/fortuna/src/config.rs | 3 ++- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/apps/fortuna/provider-config.sample.yaml b/apps/fortuna/provider-config.sample.yaml index 137c8dadc3..3504be7247 100644 --- a/apps/fortuna/provider-config.sample.yaml +++ b/apps/fortuna/provider-config.sample.yaml @@ -1,5 +1,6 @@ chains: lightlink-pegasus: commitments: - - metadata: db7dd9c5ea58d07815b5ac8fef6629e9a7d4ed6a25ffb8a5ee79e69b749ead301027000000000000 + - seed: [219,125,217,197,234,88,208,120,21,181,172,143,239,102,41,233,167,212,237,106,37,255,184,165,238,121,230,155,116,158,173,48] + chain_length: 10000 original_commitment_sequence_number: 104 \ No newline at end of file diff --git a/apps/fortuna/src/command/run.rs b/apps/fortuna/src/command/run.rs index 8046185ed4..951b2bcf00 100644 --- a/apps/fortuna/src/command/run.rs +++ b/apps/fortuna/src/command/run.rs @@ -24,7 +24,6 @@ use { Result, }, axum::Router, - hex, std::{ collections::HashMap, net::SocketAddr, @@ -153,15 +152,13 @@ pub async fn run(opts: &RunOptions) -> Result<()> { let mut hash_chains = provider_commitments .iter() .map(|x| { - let metadata = - bincode::deserialize::(hex::decode(&x.metadata)?.as_ref())?; PebbleHashChain::from_config( &secret, &chain_id, &opts.provider, &chain_config.contract_addr, - &metadata.seed, - metadata.chain_length, + &x.seed, + x.chain_length, ) }) .collect::>>()?; diff --git a/apps/fortuna/src/config.rs b/apps/fortuna/src/config.rs index ad505ee93e..c704346299 100644 --- a/apps/fortuna/src/config.rs +++ b/apps/fortuna/src/config.rs @@ -212,6 +212,7 @@ impl ProviderChainConfig { #[derive(Clone, Debug, serde::Serialize, serde::Deserialize)] pub struct Commitment { - pub metadata: String, + pub seed: [u8; 32], + pub chain_length: u64, pub original_commitment_sequence_number: u64, }