Skip to content

Commit

Permalink
feat: workers provide a price at connection
Browse files Browse the repository at this point in the history
  • Loading branch information
delehef committed Nov 27, 2024
1 parent 281f545 commit e64476f
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions lgn-worker/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ use lgn_messages::types::UpstreamPayload;
use lgn_worker::avs::utils::read_keystore;
use metrics::counter;
use mimalloc::MiMalloc;
use rand::distributions::Uniform;
use rand::prelude::Distribution;
use serde_json::Number;
use tokio::io::AsyncWriteExt;
use tokio_stream::StreamExt;
use tonic::metadata::MetadataValue;
Expand Down Expand Up @@ -622,6 +625,10 @@ fn get_claims(config: &Config) -> Result<Claims>
};

let version = env!("CARGO_PKG_VERSION");
let price_range = Uniform::new(
3000,
5000,
);
let private = [
(
"version".to_string(),
Expand All @@ -636,6 +643,10 @@ fn get_claims(config: &Config) -> Result<Claims>
.to_string(),
),
),
(
"price".to_string(),
serde_json::Value::Number(Number::from(price_range.sample(&mut rand::thread_rng()))),
),
]
.into_iter()
.collect::<BTreeMap<String, serde_json::Value>>();
Expand Down

0 comments on commit e64476f

Please sign in to comment.