From 1ee4d2f53be6e8f6c234dc1f6db53e23cf6546f1 Mon Sep 17 00:00:00 2001 From: BoredApe8461 Date: Sat, 23 Dec 2023 18:18:06 +0100 Subject: [PATCH 1/8] Track timestamp --- bin/tracker/src/main.rs | 38 ++++++++++++++++++++++++++++++++------ routes/src/consumption.rs | 6 ++++-- types/src/lib.rs | 7 +++++++ 3 files changed, 43 insertions(+), 8 deletions(-) diff --git a/bin/tracker/src/main.rs b/bin/tracker/src/main.rs index f93188a..123f24a 100644 --- a/bin/tracker/src/main.rs +++ b/bin/tracker/src/main.rs @@ -34,9 +34,9 @@ //! The data stored is the 2D weight consumption per each dispatch class. //! The data is stored in the CSV file within the following sequence: //! -//! | block_number | normal_dispatch_ref_time | operational_dispatch_ref_time | mandatory_dispatch_ref_time | normal_proof_size | operational_proof_size | mandatory_proof_size | -//! |--------------|---------------------------|-------------------------------|-----------------------------|-------------------|-------------------------|-----------------------| -//! | ... | ... | ... | ... | ... | ... | ... | +//! | block_number | timestamp | normal_dispatch_ref_time | operational_dispatch_ref_time | mandatory_dispatch_ref_time | normal_proof_size | operational_proof_size | mandatory_proof_size | +//! |--------------|-----------------------|---------------------------|-------------------------------|-----------------------------|-------------------|-------------------------|-----------------------| +//! | ... | ... | ... | ... | ... | ... | ... | ... | //! //! The percentages themselves are stored by representing them as decimal numbers; //! for example, 50.5% is stored as 0.505 with a precision of three decimals. @@ -44,8 +44,8 @@ use csv::WriterBuilder; use shared::{file_path, parachains, round_to}; use std::fs::OpenOptions; -use subxt::{OnlineClient, PolkadotConfig}; -use types::{Parachain, WeightConsumption}; +use subxt::{utils::H256, OnlineClient, PolkadotConfig}; +use types::{Parachain, Timestamp, WeightConsumption}; #[subxt::subxt(runtime_metadata_path = "../../artifacts/metadata.scale")] mod polkadot {} @@ -77,7 +77,13 @@ async fn track_weight_consumption(para: Parachain) { // Wait for new finalized blocks, then fetch and output the weight consumption accordingly. while let Some(Ok(block)) = blocks_sub.next().await { let block_number = block.header().number; - if let Ok(consumption) = weight_consumption(api.clone(), block_number).await { + + // TODO: handle error. + let timestamp = timestamp_at(api.clone(), block.hash()).await.unwrap(); + + if let Ok(consumption) = weight_consumption(api.clone(), block_number, timestamp).await + { + // TODO: write into logs in case of error let _ = write_consumption(para.clone(), consumption); } } @@ -97,6 +103,8 @@ fn write_consumption( wtr.write_record(&[ // Block number: consumption.block_number.to_string(), + // Timestamp: + consumption.timestamp.to_string(), // Reftime consumption: consumption.ref_time.normal.to_string(), consumption.ref_time.operational.to_string(), @@ -113,6 +121,7 @@ fn write_consumption( async fn weight_consumption( api: OnlineClient, block_number: u32, + timestamp: Timestamp, ) -> Result> { let weight_query = polkadot::storage().system().block_weight(); let weight_consumed = api @@ -141,6 +150,7 @@ async fn weight_consumption( let consumption = WeightConsumption { block_number, + timestamp, ref_time: ( round_to(normal_ref_time as f32 / ref_time_limit as f32, 3), round_to(operational_ref_time as f32 / ref_time_limit as f32, 3), @@ -157,3 +167,19 @@ async fn weight_consumption( Ok(consumption) } + +async fn timestamp_at( + api: OnlineClient, + block_hash: H256, +) -> Result> { + let timestamp_query = polkadot::storage().timestamp().now(); + + let timestamp = api + .storage() + .at(block_hash) + .fetch(×tamp_query) + .await? + .ok_or("Failed to query consumption")?; + + Ok(timestamp) +} diff --git a/routes/src/consumption.rs b/routes/src/consumption.rs index 1769613..1e16467 100644 --- a/routes/src/consumption.rs +++ b/routes/src/consumption.rs @@ -18,15 +18,17 @@ use csv::ReaderBuilder; use rocket::get; use shared::{file_path, parachain}; use std::fs::File; -use types::{ParaId, WeightConsumption}; +use types::{ParaId, Timestamp, WeightConsumption}; /// Query the consumption data of a parachain. /// /// This will return an error in case there is no data associated with the specific parachain. -#[get("/consumption//?&")] +#[get("/consumption//?&&&")] pub fn consumption( relay: &str, para_id: ParaId, + start: Option, + end: Option, page: Option, page_size: Option, ) -> Result { diff --git a/types/src/lib.rs b/types/src/lib.rs index 7dbc301..bc53312 100644 --- a/types/src/lib.rs +++ b/types/src/lib.rs @@ -16,6 +16,11 @@ use serde::{Deserialize, Serialize}; use std::fmt; +/// Timestamp based on the 1 Jan 1970 UNIX base, which is persistent across node restarts and OS +/// reboots. +pub type Timestamp = u64; + +/// Type used for identifying parachains. pub type ParaId = u32; #[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)] @@ -63,6 +68,8 @@ pub struct Parachain { pub struct WeightConsumption { /// The block number for which the weight consumption is related to. pub block_number: u32, + /// The timestamp of the block. + pub timestamp: Timestamp, /// The ref_time consumption over all the dispatch classes. pub ref_time: DispatchClassConsumption, /// The proof size over all dispatch classes. From 0f862a1f67206d880353c66312d1219fb6857f14 Mon Sep 17 00:00:00 2001 From: BoredApe8461 Date: Sat, 23 Dec 2023 18:24:24 +0100 Subject: [PATCH 2/8] fixes --- README.md | 6 +++--- bin/tracker/src/main.rs | 6 +++--- routes/src/consumption.rs | 6 +++--- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index b438904..2f3d070 100644 --- a/README.md +++ b/README.md @@ -17,9 +17,9 @@ successfully queried. The data stored is the 2D weight consumption per each dispatch class. The data is stored in the CSV file within the following sequence: -| block_number | normal_dispatch_ref_time | operational_dispatch_ref_time | mandatory_dispatch_ref_time | normal_proof_size | operational_proof_size | mandatory_proof_size | -|--------------|---------------------------|-------------------------------|-----------------------------|-------------------|-------------------------|-----------------------| -| ... | ... | ... | ... | ... | ... | ... | +| block_number | timestamp | normal_dispatch_ref_time | operational_dispatch_ref_time | mandatory_dispatch_ref_time | normal_proof_size | operational_proof_size | mandatory_proof_size | +|--------------|-----------------------|---------------------------|-------------------------------|-----------------------------|-------------------|-------------------------|-----------------------| +| ... | ... | ... | ... | ... | ... | ... | ... | The percentages themselves are stored by representing them as decimal numbers; for example, 50.5% is stored as 0.505 with a precision of three decimals. diff --git a/bin/tracker/src/main.rs b/bin/tracker/src/main.rs index 123f24a..eb1c1b4 100644 --- a/bin/tracker/src/main.rs +++ b/bin/tracker/src/main.rs @@ -78,12 +78,12 @@ async fn track_weight_consumption(para: Parachain) { while let Some(Ok(block)) = blocks_sub.next().await { let block_number = block.header().number; - // TODO: handle error. - let timestamp = timestamp_at(api.clone(), block.hash()).await.unwrap(); + // TODO: https://github.com/RegionX-Labs/CorespaceWeigher/issues/8 + let timestamp = timestamp_at(api.clone(), block.hash()).await.unwrap_or_default(); if let Ok(consumption) = weight_consumption(api.clone(), block_number, timestamp).await { - // TODO: write into logs in case of error + // TODO: https://github.com/RegionX-Labs/CorespaceWeigher/issues/8 let _ = write_consumption(para.clone(), consumption); } } diff --git a/routes/src/consumption.rs b/routes/src/consumption.rs index 1e16467..df888c6 100644 --- a/routes/src/consumption.rs +++ b/routes/src/consumption.rs @@ -23,12 +23,12 @@ use types::{ParaId, Timestamp, WeightConsumption}; /// Query the consumption data of a parachain. /// /// This will return an error in case there is no data associated with the specific parachain. -#[get("/consumption//?&&&")] +#[get("/consumption//?<_start>&<_end>&&")] pub fn consumption( relay: &str, para_id: ParaId, - start: Option, - end: Option, + _start: Option, + _end: Option, page: Option, page_size: Option, ) -> Result { From 102aa22afc13f7bbf3499331d35afd8405974761 Mon Sep 17 00:00:00 2001 From: BoredApe8461 Date: Sat, 23 Dec 2023 21:06:00 +0100 Subject: [PATCH 3/8] Add Logging --- Cargo.lock | 39 +++++++++++++++++++++++++ bin/tracker/Cargo.toml | 2 ++ bin/tracker/src/main.rs | 63 +++++++++++++++++++++++++++++------------ parachains.json | 6 ++++ 4 files changed, 92 insertions(+), 18 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 8e17a63..ffa1a94 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -937,6 +937,19 @@ dependencies = [ "cfg-if", ] +[[package]] +name = "env_logger" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "95b3f3e67048839cb0d0781f445682a35113da7121f7c949db0e2be96a4fbece" +dependencies = [ + "humantime", + "is-terminal", + "log", + "regex", + "termcolor", +] + [[package]] name = "equivalent" version = "1.0.1" @@ -1368,6 +1381,12 @@ version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9" +[[package]] +name = "humantime" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" + [[package]] name = "hyper" version = "0.14.28" @@ -3292,6 +3311,15 @@ dependencies = [ "windows-sys 0.48.0", ] +[[package]] +name = "termcolor" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff1bc3d3f05aff0403e8ac0d92ced918ec05b666a43f83297ccef5bea8a3d449" +dependencies = [ + "winapi-util", +] + [[package]] name = "thiserror" version = "1.0.51" @@ -3600,6 +3628,8 @@ name = "tracker" version = "0.1.0" dependencies = [ "csv", + "env_logger", + "log", "shared", "subxt", "subxt-metadata", @@ -3832,6 +3862,15 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" +[[package]] +name = "winapi-util" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f29e6f9198ba0d26b4c9f07dbe6f9ed633e1f3d5b8b414090084349e46a52596" +dependencies = [ + "winapi", +] + [[package]] name = "winapi-x86_64-pc-windows-gnu" version = "0.4.0" diff --git a/bin/tracker/Cargo.toml b/bin/tracker/Cargo.toml index 9f30637..03403c0 100644 --- a/bin/tracker/Cargo.toml +++ b/bin/tracker/Cargo.toml @@ -7,6 +7,8 @@ edition = "2021" [dependencies] csv = "1.3.0" +log = "0.4" +env_logger = "0.10.1" subxt = "0.32.1" subxt-metadata = "0.32.1" tokio = { version = "1", features = ["full"] } diff --git a/bin/tracker/src/main.rs b/bin/tracker/src/main.rs index eb1c1b4..b03bdba 100644 --- a/bin/tracker/src/main.rs +++ b/bin/tracker/src/main.rs @@ -45,6 +45,7 @@ use csv::WriterBuilder; use shared::{file_path, parachains, round_to}; use std::fs::OpenOptions; use subxt::{utils::H256, OnlineClient, PolkadotConfig}; +use subxt::blocks::Block; use types::{Parachain, Timestamp, WeightConsumption}; #[subxt::subxt(runtime_metadata_path = "../../artifacts/metadata.scale")] @@ -52,6 +53,8 @@ mod polkadot {} #[tokio::main] async fn main() -> Result<(), Box> { + env_logger::init(); + // Asynchronously subscribes to follow the latest finalized block of each parachain // and continuously fetches the weight consumption. let tasks: Vec<_> = parachains() @@ -68,32 +71,56 @@ async fn main() -> Result<(), Box> { async fn track_weight_consumption(para: Parachain) { if let Ok(api) = OnlineClient::::from_url(¶.rpc_url).await { - let mut blocks_sub = api - .blocks() - .subscribe_finalized() - .await - .expect("Failed to subscribe to finalized blocks"); - - // Wait for new finalized blocks, then fetch and output the weight consumption accordingly. - while let Some(Ok(block)) = blocks_sub.next().await { - let block_number = block.header().number; - - // TODO: https://github.com/RegionX-Labs/CorespaceWeigher/issues/8 - let timestamp = timestamp_at(api.clone(), block.hash()).await.unwrap_or_default(); - - if let Ok(consumption) = weight_consumption(api.clone(), block_number, timestamp).await - { - // TODO: https://github.com/RegionX-Labs/CorespaceWeigher/issues/8 - let _ = write_consumption(para.clone(), consumption); - } + if let Err(err) = track_blocks(api, para).await { + log::error!( + target: "tracker", + "Failed to track new block: {:?}", + err + ); } } } +async fn track_blocks(api: OnlineClient, para: Parachain) -> Result<(), Box> { + let mut blocks_sub = api + .blocks() + .subscribe_finalized() + .await + .map_err(|_| "Failed to subscribe to finalized blocks")?; + + // Wait for new finalized blocks, then fetch and output the weight consumption accordingly. + while let Some(Ok(block)) = blocks_sub.next().await { + note_new_block(api.clone(), para.clone(), block).await?; + } + + Ok(()) +} + +async fn note_new_block( + api: OnlineClient, + para: Parachain, + block: Block>, +) -> Result<(), Box> { + let block_number = block.header().number; + + let timestamp = timestamp_at(api.clone(), block.hash()).await?; + let consumption = weight_consumption(api, block_number, timestamp).await?; + + write_consumption(para, consumption)?; + + Ok(()) +} + fn write_consumption( para: Parachain, consumption: WeightConsumption, ) -> Result<(), std::io::Error> { + log::info!( + target: "tracker", + "Writing weight consumption for Para {}-{} for block: #{}", + para.relay_chain, para.para_id, consumption.block_number + ); + let file_path = file_path(para); let file = OpenOptions::new().write(true).create(true).append(true).open(file_path)?; diff --git a/parachains.json b/parachains.json index 7585d2a..c9f51c8 100644 --- a/parachains.json +++ b/parachains.json @@ -4,5 +4,11 @@ "rpc_url": "wss://acala-rpc.dwellir.com", "para_id": 2000, "relay_chain": "Polkadot" + }, + { + "name": "Coretime", + "rpc_url": "wss://rococo-rpc.polkadot.io/", + "para_id": 1005, + "relay_chain": "Polkadot" } ] \ No newline at end of file From ee0d2cfa1d3ed4bef9de782b851fa2fb64803a47 Mon Sep 17 00:00:00 2001 From: BoredApe8461 Date: Sat, 23 Dec 2023 21:09:15 +0100 Subject: [PATCH 4/8] fmt --- bin/tracker/src/main.rs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/bin/tracker/src/main.rs b/bin/tracker/src/main.rs index b03bdba..37adaf5 100644 --- a/bin/tracker/src/main.rs +++ b/bin/tracker/src/main.rs @@ -44,8 +44,7 @@ use csv::WriterBuilder; use shared::{file_path, parachains, round_to}; use std::fs::OpenOptions; -use subxt::{utils::H256, OnlineClient, PolkadotConfig}; -use subxt::blocks::Block; +use subxt::{blocks::Block, utils::H256, OnlineClient, PolkadotConfig}; use types::{Parachain, Timestamp, WeightConsumption}; #[subxt::subxt(runtime_metadata_path = "../../artifacts/metadata.scale")] @@ -71,7 +70,7 @@ async fn main() -> Result<(), Box> { async fn track_weight_consumption(para: Parachain) { if let Ok(api) = OnlineClient::::from_url(¶.rpc_url).await { - if let Err(err) = track_blocks(api, para).await { + if let Err(err) = track_blocks(api, para).await { log::error!( target: "tracker", "Failed to track new block: {:?}", @@ -81,7 +80,10 @@ async fn track_weight_consumption(para: Parachain) { } } -async fn track_blocks(api: OnlineClient, para: Parachain) -> Result<(), Box> { +async fn track_blocks( + api: OnlineClient, + para: Parachain, +) -> Result<(), Box> { let mut blocks_sub = api .blocks() .subscribe_finalized() From 1e63df5e0a32619eefb3eeb39664b334643f512d Mon Sep 17 00:00:00 2001 From: BoredApe8461 Date: Sun, 24 Dec 2023 17:46:19 +0100 Subject: [PATCH 5/8] add logging to server --- Cargo.lock | 1 + bin/tracker/src/main.rs | 6 ++++-- parachains.json | 6 ++++++ routes/Cargo.toml | 1 + routes/src/lib.rs | 2 ++ routes/src/register.rs | 28 +++++++++++++++++++++------- 6 files changed, 35 insertions(+), 9 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index ffa1a94..067729e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2498,6 +2498,7 @@ name = "routes" version = "0.1.0" dependencies = [ "csv", + "log", "rocket", "rocket_cors", "serde_json", diff --git a/bin/tracker/src/main.rs b/bin/tracker/src/main.rs index 37adaf5..fb76025 100644 --- a/bin/tracker/src/main.rs +++ b/bin/tracker/src/main.rs @@ -41,6 +41,8 @@ //! The percentages themselves are stored by representing them as decimal numbers; //! for example, 50.5% is stored as 0.505 with a precision of three decimals. +const LOG_TARGET: &str = "tracker"; + use csv::WriterBuilder; use shared::{file_path, parachains, round_to}; use std::fs::OpenOptions; @@ -72,7 +74,7 @@ async fn track_weight_consumption(para: Parachain) { if let Ok(api) = OnlineClient::::from_url(¶.rpc_url).await { if let Err(err) = track_blocks(api, para).await { log::error!( - target: "tracker", + target: LOG_TARGET, "Failed to track new block: {:?}", err ); @@ -118,7 +120,7 @@ fn write_consumption( consumption: WeightConsumption, ) -> Result<(), std::io::Error> { log::info!( - target: "tracker", + target: LOG_TARGET, "Writing weight consumption for Para {}-{} for block: #{}", para.relay_chain, para.para_id, consumption.block_number ); diff --git a/parachains.json b/parachains.json index c9f51c8..3546390 100644 --- a/parachains.json +++ b/parachains.json @@ -10,5 +10,11 @@ "rpc_url": "wss://rococo-rpc.polkadot.io/", "para_id": 1005, "relay_chain": "Polkadot" + }, + { + "name": "Acala", + "rpc_url": "https://fdsafdas", + "para_id": 2005, + "relay_chain": "Polkadot" } ] \ No newline at end of file diff --git a/routes/Cargo.toml b/routes/Cargo.toml index 88494bf..28d51fa 100644 --- a/routes/Cargo.toml +++ b/routes/Cargo.toml @@ -7,6 +7,7 @@ edition = "2021" [dependencies] csv = "1.3.0" +log = "0.4" rocket = { version = "0.5.0", features=["json"] } rocket_cors = "0.6.0" serde_json = "1.0.108" diff --git a/routes/src/lib.rs b/routes/src/lib.rs index 47dc7b4..eb673f0 100644 --- a/routes/src/lib.rs +++ b/routes/src/lib.rs @@ -15,6 +15,8 @@ use rocket::{http::Status, response::Responder, Request, Response}; +const LOG_TARGET: &str = "server"; + /// Web API for interacting with the Consumption Tracker service. /// /// This API exposes two main endpoints: diff --git a/routes/src/register.rs b/routes/src/register.rs index e9079a2..d38e8cb 100644 --- a/routes/src/register.rs +++ b/routes/src/register.rs @@ -17,14 +17,14 @@ use crate::*; use rocket::{post, serde::json::Json}; use shared::{parachain, PARACHAINS}; use std::{ - fs::OpenOptions, + fs::{File, OpenOptions}, io::{Read, Seek, Write}, }; use types::Parachain; /// Register a parachain for resource utilization tracking. #[post("/register_para", data = "")] -pub fn register_para(para: Json) -> Result { +pub fn register_para(para: Json) -> Result<(), Error> { let mut file = OpenOptions::new() .read(true) .write(true) @@ -43,12 +43,26 @@ pub fn register_para(para: Json) -> Result { } paras.push(para.into_inner()); - let json_data = serde_json::to_string_pretty(¶s).expect("Failed to serialize"); - file.set_len(0).expect("Failed to truncate file"); - file.seek(std::io::SeekFrom::Start(0)).expect("Failed to seek to the beginning"); + if let Err(err) = update_paras_file(&mut file, paras) { + log::error!( + target: LOG_TARGET, + "Failed to register para: {:?}", + err + ); + } + + Ok(()) +} + +fn update_paras_file(file: &mut File, paras: Vec) -> Result<(), String> { + let json_data = serde_json::to_string_pretty(¶s).map_err(|_| "Failed to serialize")?; + + file.set_len(0).map_err(|_| "Failed to truncate file")?; + file.seek(std::io::SeekFrom::Start(0)) + .map_err(|_| "Failed to seek to the beginning")?; - file.write_all(json_data.as_bytes()).unwrap(); + file.write_all(json_data.as_bytes()).map_err(|_| "Failed to write into file")?; - Ok(Default::default()) + Ok(()) } From c9e139641568d119f8623897f975b93d7eb59e98 Mon Sep 17 00:00:00 2001 From: BoredApe8461 Date: Sun, 24 Dec 2023 17:48:18 +0100 Subject: [PATCH 6/8] revert paras file --- parachains.json | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/parachains.json b/parachains.json index 3546390..7585d2a 100644 --- a/parachains.json +++ b/parachains.json @@ -4,17 +4,5 @@ "rpc_url": "wss://acala-rpc.dwellir.com", "para_id": 2000, "relay_chain": "Polkadot" - }, - { - "name": "Coretime", - "rpc_url": "wss://rococo-rpc.polkadot.io/", - "para_id": 1005, - "relay_chain": "Polkadot" - }, - { - "name": "Acala", - "rpc_url": "https://fdsafdas", - "para_id": 2005, - "relay_chain": "Polkadot" } ] \ No newline at end of file From 2d7eeef34733c843b64f8bba9941e71a70fd00da Mon Sep 17 00:00:00 2001 From: Smart Dev Date: Mon, 19 Aug 2024 13:47:36 -0400 Subject: [PATCH 7/8] Update Cargo.lock --- Cargo.lock | 160 ++++++++++++++++++++++++++++++++++++++++++----------- 1 file changed, 127 insertions(+), 33 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 5165100..822ef0c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3006,18 +3006,6 @@ dependencies = [ "uncased", ] -[[package]] -name = "routes" -version = "0.1.0" -dependencies = [ - "csv", - "rocket", - "rocket_cors", - "serde_json", - "shared", - "types", -] - [[package]] name = "rustc-demangle" version = "0.1.23" @@ -4209,15 +4197,6 @@ dependencies = [ "windows-sys", ] -[[package]] -name = "termcolor" -version = "1.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ff1bc3d3f05aff0403e8ac0d92ced918ec05b666a43f83297ccef5bea8a3d449" -dependencies = [ - "winapi-util", -] - [[package]] name = "thiserror" version = "1.0.50" @@ -4624,8 +4603,6 @@ name = "tracker" version = "0.1.0" dependencies = [ "csv", - "env_logger", - "log", "shared", "subxt", "subxt-metadata", @@ -4920,18 +4897,135 @@ dependencies = [ ] [[package]] -name = "weigher-backend" -version = "0.1.0" +name = "wasmtime" +version = "8.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f907fdead3153cb9bfb7a93bbd5b62629472dc06dee83605358c64c52ed3dda9" dependencies = [ - "csv", - "parity-scale-codec", - "rocket", - "rocket_cors", + "anyhow", + "bincode", + "cfg-if", + "indexmap 1.9.3", + "libc", + "log", + "object 0.30.4", + "once_cell", + "paste", + "psm", "serde", - "serde_json", - "subxt", - "subxt-metadata", - "tokio", + "target-lexicon", + "wasmparser", + "wasmtime-environ", + "wasmtime-jit", + "wasmtime-runtime", + "windows-sys 0.45.0", +] + +[[package]] +name = "wasmtime-asm-macros" +version = "8.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3b9daa7c14cd4fa3edbf69de994408d5f4b7b0959ac13fa69d465f6597f810d" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "wasmtime-environ" +version = "8.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a990198cee4197423045235bf89d3359e69bd2ea031005f4c2d901125955c949" +dependencies = [ + "anyhow", + "cranelift-entity", + "gimli 0.27.3", + "indexmap 1.9.3", + "log", + "object 0.30.4", + "serde", + "target-lexicon", + "thiserror", + "wasmparser", + "wasmtime-types", +] + +[[package]] +name = "wasmtime-jit" +version = "8.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0de48df552cfca1c9b750002d3e07b45772dd033b0b206d5c0968496abf31244" +dependencies = [ + "addr2line 0.19.0", + "anyhow", + "bincode", + "cfg-if", + "cpp_demangle", + "gimli 0.27.3", + "log", + "object 0.30.4", + "rustc-demangle", + "serde", + "target-lexicon", + "wasmtime-environ", + "wasmtime-jit-icache-coherence", + "wasmtime-runtime", + "windows-sys 0.45.0", +] + +[[package]] +name = "wasmtime-jit-debug" +version = "8.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e0554b84c15a27d76281d06838aed94e13a77d7bf604bbbaf548aa20eb93846" +dependencies = [ + "once_cell", +] + +[[package]] +name = "wasmtime-jit-icache-coherence" +version = "8.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aecae978b13f7f67efb23bd827373ace4578f2137ec110bbf6a4a7cde4121bbd" +dependencies = [ + "cfg-if", + "libc", + "windows-sys 0.45.0", +] + +[[package]] +name = "wasmtime-runtime" +version = "8.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "658cf6f325232b6760e202e5255d823da5e348fdea827eff0a2a22319000b441" +dependencies = [ + "anyhow", + "cc", + "cfg-if", + "indexmap 1.9.3", + "libc", + "log", + "mach", + "memfd", + "memoffset", + "paste", + "rand 0.8.5", + "rustix 0.36.17", + "wasmtime-asm-macros", + "wasmtime-environ", + "wasmtime-jit-debug", + "windows-sys 0.45.0", +] + +[[package]] +name = "wasmtime-types" +version = "8.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4f6fffd2a1011887d57f07654dd112791e872e3ff4a2e626aee8059ee17f06f" +dependencies = [ + "cranelift-entity", + "serde", + "thiserror", + "wasmparser", ] [[package]] From 98a274528ff34050a8601bfb23cad4b51db8a416 Mon Sep 17 00:00:00 2001 From: Smart Dev Date: Mon, 19 Aug 2024 13:47:56 -0400 Subject: [PATCH 8/8] Update Cargo.lock --- Cargo.lock | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/Cargo.lock b/Cargo.lock index 822ef0c..9a219a4 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1231,6 +1231,25 @@ dependencies = [ "cfg-if", ] +[[package]] +name = "env_logger" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "95b3f3e67048839cb0d0781f445682a35113da7121f7c949db0e2be96a4fbece" +dependencies = [ + "humantime", + "is-terminal", + "log", + "regex", + "termcolor", +] + +[[package]] +name = "environmental" +version = "1.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e48c92028aaa870e83d51c64e5d4e0b6981b360c522198c23959f219a4e1b15b" + [[package]] name = "equivalent" version = "1.0.1"