diff --git a/Cargo.lock b/Cargo.lock index 6b8877b3e..b86174b5f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2109,16 +2109,16 @@ checksum = "1d674e81391d1e1ab681a28d99df07927c6d4aa5b027d7da16ba32d1d21ecd99" [[package]] name = "fjall" -version = "3.0.0-rc.0" +version = "3.0.0-rc.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91e1ca518f9bb71f845bcd3d8d556c202f9f9c75195deff725cd85b2421aa84a" +checksum = "01bb8eb92dbc28a7d88067f8cea62efb55077c71fcc49768f89e71932872de0d" dependencies = [ "byteorder-lite", "byteview 0.9.1", "dashmap", "flume", "log", - "lsm-tree 3.0.0-rc.0", + "lsm-tree 3.0.0-rc.2", "lz4_flex 0.11.5", "tempfile", "xxhash-rust", @@ -2462,9 +2462,9 @@ checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" [[package]] name = "hex-conservative" -version = "0.2.1" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5313b072ce3c597065a808dbf612c4c8e8590bdbf8b579508bf7a762c5eae6cd" +checksum = "fda06d18ac606267c40c04e41b9947729bf8b9efe74bd4e82b61a5f26a510b9f" dependencies = [ "arrayvec", ] @@ -3009,9 +3009,9 @@ dependencies = [ [[package]] name = "lsm-tree" -version = "3.0.0-rc.0" +version = "3.0.0-rc.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f963f5e7b4f8f79fbb28d0fd49ab5f04939b31d1e65cb99577e17805fe25dde2" +checksum = "a30a998e3e8165bcc466e6c13a1e7de6c8431dd41a78a60f5cf426720241aef8" dependencies = [ "byteorder-lite", "byteview 0.9.1", @@ -3020,6 +3020,7 @@ dependencies = [ "interval-heap", "log", "lz4_flex 0.11.5", + "mutants", "quick_cache", "rustc-hash", "self_cell", @@ -3112,6 +3113,12 @@ dependencies = [ "windows-sys 0.61.2", ] +[[package]] +name = "mutants" +version = "0.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bc0287524726960e07b119cebd01678f852f147742ae0d925e6a520dca956126" + [[package]] name = "nibble_vec" version = "0.1.0" @@ -5181,9 +5188,9 @@ dependencies = [ [[package]] name = "tracing-attributes" -version = "0.1.30" +version = "0.1.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81383ab64e72a7a8b8e13130c49e3dab29def6d0c7d76a03087b3cf71c5c6903" +checksum = "7490cfa5ec963746568740651ac6781f701c9c5ea257c58e057f3ba8cf69e8da" dependencies = [ "proc-macro2", "quote", @@ -5203,9 +5210,9 @@ dependencies = [ [[package]] name = "tracing-core" -version = "0.1.34" +version = "0.1.35" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9d12581f227e93f094d3af2ae690a574abb8a2b9b7a96e7cfe9647b2b617678" +checksum = "7a04e24fab5c89c6a36eb8558c9656f30d81de51dfa4d3b45f26b21d61fa0a6c" dependencies = [ "once_cell", "valuable", @@ -5882,9 +5889,9 @@ checksum = "d6bbff5f0aada427a1e5a6da5f1f98158182f26556f345ac9e04d36d0ebed650" [[package]] name = "winnow" -version = "0.7.13" +version = "0.7.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "21a0236b59786fed61e2a80582dd500fe61f18b5dca67a4a067d0bc9039339cf" +checksum = "5a5364e9d77fcdeeaa6062ced926ee3381faa2ee02d3eb83a5c27a8825540829" dependencies = [ "memchr", ] diff --git a/Cargo.toml b/Cargo.toml index 5252eb710..99ba449f8 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -8,7 +8,6 @@ package.version = "0.0.111" package.homepage = "https://bitcoinresearchkit.org" package.repository = "https://github.com/bitcoinresearchkit/brk" package.readme = "README.md" -package.rust-version = "1.90" [profile.dev] lto = "thin" @@ -64,7 +63,7 @@ derive_deref = "1.1.1" fjall2 = { version = "2.11.8", package = "brk_fjall" } # fjall2 = { path = "../fjall2", package = "brk_fjall" } # fjall2 = { version = "2.11.2", package = "fjall" } -fjall3 = { version = "3.0.0-rc.0", package = "fjall" } +fjall3 = { version = "3.0.0-rc.2", package = "fjall" } # fjall3 = { path = "../fjall3", package = "fjall" } # fjall3 = { git = "https://github.com/fjall-rs/fjall.git", rev = "f0bf96c2017b3543eb176012b8eff69c639dff1d", package = "fjall" } jiff = "0.2.16" diff --git a/crates/brk/Cargo.toml b/crates/brk/Cargo.toml index 9afdc1e84..0700c40be 100644 --- a/crates/brk/Cargo.toml +++ b/crates/brk/Cargo.toml @@ -6,7 +6,6 @@ homepage.workspace = true repository.workspace = true edition.workspace = true version.workspace = true -rust-version.workspace = true build = "build.rs" [features] diff --git a/crates/brk_bencher/Cargo.toml b/crates/brk_bencher/Cargo.toml index 4d59c8a81..04eba1b8b 100644 --- a/crates/brk_bencher/Cargo.toml +++ b/crates/brk_bencher/Cargo.toml @@ -6,7 +6,6 @@ edition.workspace = true license.workspace = true homepage.workspace = true repository.workspace = true -rust-version.workspace = true build = "build.rs" [dependencies] diff --git a/crates/brk_bencher_visualizer/Cargo.toml b/crates/brk_bencher_visualizer/Cargo.toml index 9cf3a18fb..cbe8b553f 100644 --- a/crates/brk_bencher_visualizer/Cargo.toml +++ b/crates/brk_bencher_visualizer/Cargo.toml @@ -6,7 +6,6 @@ edition.workspace = true license.workspace = true homepage.workspace = true repository.workspace = true -rust-version.workspace = true build = "build.rs" [dependencies] diff --git a/crates/brk_binder/Cargo.toml b/crates/brk_binder/Cargo.toml index 2504459e4..0900f2f80 100644 --- a/crates/brk_binder/Cargo.toml +++ b/crates/brk_binder/Cargo.toml @@ -6,7 +6,6 @@ edition.workspace = true license.workspace = true homepage.workspace = true repository.workspace = true -rust-version.workspace = true build = "build.rs" [dependencies] diff --git a/crates/brk_bundler/Cargo.toml b/crates/brk_bundler/Cargo.toml index 0e89be4c6..8655aff3b 100644 --- a/crates/brk_bundler/Cargo.toml +++ b/crates/brk_bundler/Cargo.toml @@ -6,7 +6,6 @@ edition.workspace = true license.workspace = true homepage.workspace = true repository.workspace = true -rust-version.workspace = true build = "build.rs" [dependencies] diff --git a/crates/brk_cli/Cargo.toml b/crates/brk_cli/Cargo.toml index a1b8a3ecb..e2eece151 100644 --- a/crates/brk_cli/Cargo.toml +++ b/crates/brk_cli/Cargo.toml @@ -6,7 +6,6 @@ edition.workspace = true license.workspace = true homepage.workspace = true repository.workspace = true -rust-version.workspace = true build = "build.rs" [dependencies] diff --git a/crates/brk_computer/Cargo.toml b/crates/brk_computer/Cargo.toml index 25873accd..a48502e1f 100644 --- a/crates/brk_computer/Cargo.toml +++ b/crates/brk_computer/Cargo.toml @@ -6,7 +6,6 @@ edition.workspace = true license.workspace = true homepage.workspace = true repository.workspace = true -rust-version.workspace = true build = "build.rs" [dependencies] diff --git a/crates/brk_computer/src/blks.rs b/crates/brk_computer/src/blks.rs index 333afa75c..05ae399cb 100644 --- a/crates/brk_computer/src/blks.rs +++ b/crates/brk_computer/src/blks.rs @@ -6,7 +6,7 @@ use brk_reader::Reader; use brk_traversable::Traversable; use brk_types::{BlkPosition, Height, TxIndex, Version}; use vecdb::{ - AnyStoredVec, AnyVec, Database, Exit, GenericStoredVec, Importable, PAGE_SIZE, PcoVec, + AnyStoredVec, AnyVec, Database, Exit, GenericStoredVec, ImportableVec, PAGE_SIZE, PcoVec, TypedVecIterator, }; diff --git a/crates/brk_computer/src/chain.rs b/crates/brk_computer/src/chain.rs index f2cd07507..1cb9b4d6c 100644 --- a/crates/brk_computer/src/chain.rs +++ b/crates/brk_computer/src/chain.rs @@ -10,7 +10,7 @@ use brk_types::{ TxVersion, Version, WeekIndex, Weight, YearIndex, }; use vecdb::{ - Database, EagerVec, Exit, GenericStoredVec, Importable, IterableCloneableVec, IterableVec, + Database, EagerVec, Exit, GenericStoredVec, ImportableVec, IterableCloneableVec, IterableVec, LazyVecFrom1, LazyVecFrom2, PAGE_SIZE, PcoVec, TypedVecIterator, VecIndex, unlikely, }; diff --git a/crates/brk_computer/src/fetched.rs b/crates/brk_computer/src/fetched.rs index 3905777c3..2c95e4ed4 100644 --- a/crates/brk_computer/src/fetched.rs +++ b/crates/brk_computer/src/fetched.rs @@ -6,7 +6,7 @@ use brk_indexer::Indexer; use brk_traversable::Traversable; use brk_types::{DateIndex, Height, OHLCCents, Version}; use vecdb::{ - AnyStoredVec, AnyVec, BytesVec, Database, Exit, GenericStoredVec, Importable, IterableVec, + AnyStoredVec, AnyVec, BytesVec, Database, Exit, GenericStoredVec, ImportableVec, IterableVec, PAGE_SIZE, TypedVecIterator, VecIndex, }; diff --git a/crates/brk_computer/src/grouped/builder_eager.rs b/crates/brk_computer/src/grouped/builder_eager.rs index 65d9cf98a..d9da570b9 100644 --- a/crates/brk_computer/src/grouped/builder_eager.rs +++ b/crates/brk_computer/src/grouped/builder_eager.rs @@ -2,7 +2,7 @@ use brk_error::{Error, Result}; use brk_traversable::Traversable; use brk_types::{CheckedSub, StoredU64, Version}; use vecdb::{ - AnyStoredVec, AnyVec, Database, EagerVec, Exit, GenericStoredVec, Importable, IterableVec, + AnyStoredVec, AnyVec, Database, EagerVec, Exit, GenericStoredVec, ImportableVec, IterableVec, PcoVec, VecIndex, VecValue, }; diff --git a/crates/brk_computer/src/grouped/from_dateindex.rs b/crates/brk_computer/src/grouped/from_dateindex.rs index 607bd667a..da6bf94c9 100644 --- a/crates/brk_computer/src/grouped/from_dateindex.rs +++ b/crates/brk_computer/src/grouped/from_dateindex.rs @@ -5,7 +5,7 @@ use brk_types::{ DateIndex, DecadeIndex, MonthIndex, QuarterIndex, SemesterIndex, Version, WeekIndex, YearIndex, }; use vecdb::{ - AnyExportableVec, Database, EagerVec, Exit, Importable, IterableCloneableVec, IterableVec, + AnyExportableVec, Database, EagerVec, Exit, ImportableVec, IterableCloneableVec, IterableVec, PcoVec, }; diff --git a/crates/brk_computer/src/grouped/from_height.rs b/crates/brk_computer/src/grouped/from_height.rs index 284076181..2e48b1b78 100644 --- a/crates/brk_computer/src/grouped/from_height.rs +++ b/crates/brk_computer/src/grouped/from_height.rs @@ -6,7 +6,7 @@ use brk_types::{ Version, WeekIndex, YearIndex, }; use vecdb::{ - AnyExportableVec, Database, EagerVec, Exit, Importable, IterableCloneableVec, IterableVec, + AnyExportableVec, Database, EagerVec, Exit, ImportableVec, IterableCloneableVec, IterableVec, PcoVec, }; diff --git a/crates/brk_computer/src/grouped/from_height_strict.rs b/crates/brk_computer/src/grouped/from_height_strict.rs index 71521e5d8..822678a56 100644 --- a/crates/brk_computer/src/grouped/from_height_strict.rs +++ b/crates/brk_computer/src/grouped/from_height_strict.rs @@ -2,7 +2,7 @@ use brk_error::Result; use brk_traversable::Traversable; use brk_types::{DifficultyEpoch, Height, Version}; -use vecdb::{AnyExportableVec, Database, EagerVec, Exit, Importable, PcoVec}; +use vecdb::{AnyExportableVec, Database, EagerVec, Exit, ImportableVec, PcoVec}; use crate::{Indexes, indexes}; diff --git a/crates/brk_computer/src/grouped/from_txindex.rs b/crates/brk_computer/src/grouped/from_txindex.rs index 90182e888..961c6ad26 100644 --- a/crates/brk_computer/src/grouped/from_txindex.rs +++ b/crates/brk_computer/src/grouped/from_txindex.rs @@ -7,7 +7,7 @@ use brk_types::{ }; use vecdb::{ AnyExportableVec, AnyVec, CollectableVec, Database, EagerVec, Exit, GenericStoredVec, - Importable, IterableCloneableVec, PcoVec, TypedVecIterator, VecIndex, + ImportableVec, IterableCloneableVec, PcoVec, TypedVecIterator, VecIndex, }; use crate::{ diff --git a/crates/brk_computer/src/grouped/value_height.rs b/crates/brk_computer/src/grouped/value_height.rs index 14903f418..5fd6322cb 100644 --- a/crates/brk_computer/src/grouped/value_height.rs +++ b/crates/brk_computer/src/grouped/value_height.rs @@ -1,7 +1,7 @@ use brk_error::Result; use brk_traversable::Traversable; use brk_types::{Bitcoin, Dollars, Height, Sats, Version}; -use vecdb::{CollectableVec, Database, EagerVec, Exit, Importable, PcoVec}; +use vecdb::{CollectableVec, Database, EagerVec, Exit, ImportableVec, PcoVec}; use crate::{ Indexes, diff --git a/crates/brk_computer/src/indexes.rs b/crates/brk_computer/src/indexes.rs index cd6d8762b..176ea2d0e 100644 --- a/crates/brk_computer/src/indexes.rs +++ b/crates/brk_computer/src/indexes.rs @@ -13,7 +13,7 @@ use brk_types::{ YearIndex, }; use vecdb::{ - Database, EagerVec, Exit, GenericStoredVec, Importable, IterableCloneableVec, LazyVecFrom1, + Database, EagerVec, Exit, GenericStoredVec, ImportableVec, IterableCloneableVec, LazyVecFrom1, PAGE_SIZE, PcoVec, TypedVecIterator, unlikely, }; diff --git a/crates/brk_computer/src/lib.rs b/crates/brk_computer/src/lib.rs index 4afc9a791..2e9051c5b 100644 --- a/crates/brk_computer/src/lib.rs +++ b/crates/brk_computer/src/lib.rs @@ -229,6 +229,8 @@ impl Computer { )?; info!("Computed pools in {:?}", i.elapsed()); + return Ok(()); + info!("Computing stateful..."); self.stateful.compute( indexer, diff --git a/crates/brk_computer/src/market.rs b/crates/brk_computer/src/market.rs index 34c1ac7c1..858fd3cd1 100644 --- a/crates/brk_computer/src/market.rs +++ b/crates/brk_computer/src/market.rs @@ -4,7 +4,7 @@ use brk_error::Result; use brk_traversable::Traversable; use brk_types::{Date, DateIndex, Dollars, Height, Sats, StoredF32, StoredU16, Version}; use vecdb::{ - Database, EagerVec, Exit, GenericStoredVec, Importable, PAGE_SIZE, PcoVec, TypedVecIterator, + Database, EagerVec, Exit, GenericStoredVec, ImportableVec, PAGE_SIZE, PcoVec, TypedVecIterator, VecIndex, }; diff --git a/crates/brk_computer/src/pools/mod.rs b/crates/brk_computer/src/pools/mod.rs index b9512ec33..f642eff08 100644 --- a/crates/brk_computer/src/pools/mod.rs +++ b/crates/brk_computer/src/pools/mod.rs @@ -7,7 +7,7 @@ use brk_traversable::Traversable; use brk_types::{Address, AddressBytes, Height, OutputType, PoolId, Pools, TxOutIndex, pools}; use rayon::prelude::*; use vecdb::{ - AnyStoredVec, AnyVec, BytesVec, Database, Exit, GenericStoredVec, Importable, IterableVec, + AnyStoredVec, AnyVec, BytesVec, Database, Exit, GenericStoredVec, ImportableVec, IterableVec, PAGE_SIZE, TypedVecIterator, VecIndex, Version, }; diff --git a/crates/brk_computer/src/price.rs b/crates/brk_computer/src/price.rs index c6872dfb8..b78da158f 100644 --- a/crates/brk_computer/src/price.rs +++ b/crates/brk_computer/src/price.rs @@ -6,7 +6,7 @@ use brk_types::{ Cents, Close, DateIndex, DecadeIndex, DifficultyEpoch, Dollars, Height, High, Low, MonthIndex, OHLCDollars, OHLCSats, Open, QuarterIndex, Sats, SemesterIndex, Version, WeekIndex, YearIndex, }; -use vecdb::{BytesVec, Database, EagerVec, Exit, Importable, PAGE_SIZE, PcoVec}; +use vecdb::{BytesVec, Database, EagerVec, Exit, ImportableVec, PAGE_SIZE, PcoVec}; use crate::{fetched, grouped::Source}; diff --git a/crates/brk_computer/src/stateful/address_cohort.rs b/crates/brk_computer/src/stateful/address_cohort.rs index ed892db6d..ecf71308b 100644 --- a/crates/brk_computer/src/stateful/address_cohort.rs +++ b/crates/brk_computer/src/stateful/address_cohort.rs @@ -4,7 +4,7 @@ use brk_error::Result; use brk_traversable::Traversable; use brk_types::{Bitcoin, DateIndex, Dollars, Height, StoredU64, Version}; use vecdb::{ - AnyStoredVec, AnyVec, Database, EagerVec, Exit, GenericStoredVec, Importable, IterableVec, + AnyStoredVec, AnyVec, Database, EagerVec, Exit, GenericStoredVec, ImportableVec, IterableVec, PcoVec, TypedVecIterator, }; diff --git a/crates/brk_computer/src/stateful/common.rs b/crates/brk_computer/src/stateful/common.rs index f89adf57a..3c219ee9a 100644 --- a/crates/brk_computer/src/stateful/common.rs +++ b/crates/brk_computer/src/stateful/common.rs @@ -4,7 +4,7 @@ use brk_types::{ Bitcoin, DateIndex, Dollars, Height, Sats, StoredF32, StoredF64, StoredU64, Version, }; use vecdb::{ - AnyStoredVec, AnyVec, Database, EagerVec, Exit, GenericStoredVec, Importable, + AnyStoredVec, AnyVec, Database, EagerVec, Exit, GenericStoredVec, ImportableVec, IterableCloneableVec, IterableVec, PcoVec, TypedVecIterator, }; diff --git a/crates/brk_computer/src/stateful/mod.rs b/crates/brk_computer/src/stateful/mod.rs index 7c4635b12..04a185a0e 100644 --- a/crates/brk_computer/src/stateful/mod.rs +++ b/crates/brk_computer/src/stateful/mod.rs @@ -17,8 +17,8 @@ use rustc_hash::FxHashMap; use smallvec::SmallVec; use vecdb::{ AnyStoredVec, AnyVec, BoxedVecIterator, BytesVec, CollectableVec, Database, EagerVec, Exit, - GenericStoredVec, ImportOptions, Importable, IterableCloneableVec, IterableVec, LazyVecFrom1, - PAGE_SIZE, PcoVec, Reader, Stamp, TypedVecIterator, VecIndex, + GenericStoredVec, ImportOptions, ImportableVec, IterableCloneableVec, IterableVec, + LazyVecFrom1, PAGE_SIZE, PcoVec, Reader, Stamp, TypedVecIterator, VecIndex, }; use crate::{ diff --git a/crates/brk_computer/src/states/supply.rs b/crates/brk_computer/src/states/supply.rs index 134eda781..310362350 100644 --- a/crates/brk_computer/src/states/supply.rs +++ b/crates/brk_computer/src/states/supply.rs @@ -64,18 +64,19 @@ impl Formattable for SupplyState { } impl Bytes for SupplyState { - fn to_bytes(&self) -> Vec { - let mut bytes = Vec::new(); - bytes.extend_from_slice(&self.utxo_count.to_bytes()); - bytes.extend_from_slice(&self.value.to_bytes()); - bytes + type Array = [u8; size_of::()]; + + fn to_bytes(&self) -> Self::Array { + let mut arr = [0u8; size_of::()]; + arr[0..8].copy_from_slice(self.utxo_count.to_bytes().as_ref()); + arr[8..16].copy_from_slice(self.value.to_bytes().as_ref()); + arr } fn from_bytes(bytes: &[u8]) -> vecdb::Result { - let mut offset = 0; - let utxo_count = u64::from_bytes(&bytes[offset..])?; - offset += utxo_count.to_bytes().len(); - let value = Sats::from_bytes(&bytes[offset..])?; - Ok(Self { utxo_count, value }) + Ok(Self { + utxo_count: u64::from_bytes(&bytes[0..])?, + value: Sats::from_bytes(&bytes[8..])?, + }) } } diff --git a/crates/brk_error/Cargo.toml b/crates/brk_error/Cargo.toml index 7afb14222..836bb2a26 100644 --- a/crates/brk_error/Cargo.toml +++ b/crates/brk_error/Cargo.toml @@ -6,7 +6,6 @@ edition.workspace = true license.workspace = true homepage.workspace = true repository.workspace = true -rust-version.workspace = true build = "build.rs" [dependencies] diff --git a/crates/brk_fetcher/Cargo.toml b/crates/brk_fetcher/Cargo.toml index 34c07e184..5548e230a 100644 --- a/crates/brk_fetcher/Cargo.toml +++ b/crates/brk_fetcher/Cargo.toml @@ -6,7 +6,6 @@ edition.workspace = true license.workspace = true homepage.workspace = true repository.workspace = true -rust-version.workspace = true build = "build.rs" [dependencies] diff --git a/crates/brk_grouper/Cargo.toml b/crates/brk_grouper/Cargo.toml index fdddd07e0..ba5491a81 100644 --- a/crates/brk_grouper/Cargo.toml +++ b/crates/brk_grouper/Cargo.toml @@ -6,7 +6,6 @@ edition.workspace = true license.workspace = true homepage.workspace = true repository.workspace = true -rust-version.workspace = true build = "build.rs" [dependencies] diff --git a/crates/brk_indexer/Cargo.toml b/crates/brk_indexer/Cargo.toml index 2e09e8a4f..d45c4affb 100644 --- a/crates/brk_indexer/Cargo.toml +++ b/crates/brk_indexer/Cargo.toml @@ -6,7 +6,6 @@ edition.workspace = true license.workspace = true homepage.workspace = true repository.workspace = true -rust-version.workspace = true build = "build.rs" [dependencies] diff --git a/crates/brk_indexer/src/vecs.rs b/crates/brk_indexer/src/vecs.rs index 0886c1d05..8e78e4d75 100644 --- a/crates/brk_indexer/src/vecs.rs +++ b/crates/brk_indexer/src/vecs.rs @@ -12,7 +12,7 @@ use brk_types::{ }; use rayon::prelude::*; use vecdb::{ - AnyStoredVec, BytesVec, Database, GenericStoredVec, Importable, PAGE_SIZE, PcoVec, Stamp, + AnyStoredVec, BytesVec, Database, GenericStoredVec, ImportableVec, PAGE_SIZE, PcoVec, Stamp, }; use crate::Indexes; diff --git a/crates/brk_iterator/Cargo.toml b/crates/brk_iterator/Cargo.toml index 32ceb2829..45bb62dc4 100644 --- a/crates/brk_iterator/Cargo.toml +++ b/crates/brk_iterator/Cargo.toml @@ -6,7 +6,6 @@ edition.workspace = true license.workspace = true homepage.workspace = true repository.workspace = true -rust-version.workspace = true build = "build.rs" [dependencies] diff --git a/crates/brk_logger/Cargo.toml b/crates/brk_logger/Cargo.toml index e7db1a85b..4facc3dfc 100644 --- a/crates/brk_logger/Cargo.toml +++ b/crates/brk_logger/Cargo.toml @@ -6,7 +6,6 @@ edition.workspace = true license.workspace = true homepage.workspace = true repository.workspace = true -rust-version.workspace = true build = "build.rs" [dependencies] diff --git a/crates/brk_mcp/Cargo.toml b/crates/brk_mcp/Cargo.toml index ed79c1277..d71bbb262 100644 --- a/crates/brk_mcp/Cargo.toml +++ b/crates/brk_mcp/Cargo.toml @@ -6,7 +6,6 @@ edition.workspace = true license.workspace = true homepage.workspace = true repository.workspace = true -rust-version.workspace = true build = "build.rs" [dependencies] diff --git a/crates/brk_monitor/Cargo.toml b/crates/brk_monitor/Cargo.toml index 7f65ddbb5..709607cc9 100644 --- a/crates/brk_monitor/Cargo.toml +++ b/crates/brk_monitor/Cargo.toml @@ -6,7 +6,6 @@ edition.workspace = true license.workspace = true homepage.workspace = true repository.workspace = true -rust-version.workspace = true build = "build.rs" [dependencies] diff --git a/crates/brk_query/Cargo.toml b/crates/brk_query/Cargo.toml index 14a19c9dc..0cd296157 100644 --- a/crates/brk_query/Cargo.toml +++ b/crates/brk_query/Cargo.toml @@ -6,7 +6,6 @@ edition.workspace = true version.workspace = true homepage.workspace = true repository.workspace = true -rust-version.workspace = true build = "build.rs" [features] diff --git a/crates/brk_reader/Cargo.toml b/crates/brk_reader/Cargo.toml index 0614da64b..7ff55d418 100644 --- a/crates/brk_reader/Cargo.toml +++ b/crates/brk_reader/Cargo.toml @@ -8,7 +8,6 @@ edition.workspace = true license.workspace = true homepage.workspace = true repository.workspace = true -rust-version.workspace = true build = "build.rs" [dependencies] diff --git a/crates/brk_rpc/Cargo.toml b/crates/brk_rpc/Cargo.toml index c4ea7d1f4..d34220be7 100644 --- a/crates/brk_rpc/Cargo.toml +++ b/crates/brk_rpc/Cargo.toml @@ -6,7 +6,6 @@ edition.workspace = true license.workspace = true homepage.workspace = true repository.workspace = true -rust-version.workspace = true build = "build.rs" [dependencies] diff --git a/crates/brk_server/Cargo.toml b/crates/brk_server/Cargo.toml index 2fd44c873..af50692c3 100644 --- a/crates/brk_server/Cargo.toml +++ b/crates/brk_server/Cargo.toml @@ -6,7 +6,6 @@ edition.workspace = true license.workspace = true homepage.workspace = true repository.workspace = true -rust-version.workspace = true build = "build.rs" [dependencies] diff --git a/crates/brk_store/Cargo.toml b/crates/brk_store/Cargo.toml index bb9073886..161a75620 100644 --- a/crates/brk_store/Cargo.toml +++ b/crates/brk_store/Cargo.toml @@ -8,7 +8,6 @@ edition.workspace = true license.workspace = true homepage.workspace = true repository.workspace = true -rust-version.workspace = true build = "build.rs" [dependencies] diff --git a/crates/brk_traversable/Cargo.toml b/crates/brk_traversable/Cargo.toml index 5aca32eb1..dd9eb3c54 100644 --- a/crates/brk_traversable/Cargo.toml +++ b/crates/brk_traversable/Cargo.toml @@ -6,7 +6,6 @@ edition.workspace = true license.workspace = true homepage.workspace = true repository.workspace = true -rust-version.workspace = true build = "build.rs" [features] diff --git a/crates/brk_traversable/src/lib.rs b/crates/brk_traversable/src/lib.rs index c5be26485..90d163051 100644 --- a/crates/brk_traversable/src/lib.rs +++ b/crates/brk_traversable/src/lib.rs @@ -35,7 +35,7 @@ where impl Traversable for vecdb::ZeroCopyVec where I: VecIndex, - T: vecdb::ZeroCopyVecValue + Formattable, + T: vecdb::ZeroCopyVecValue + Formattable + Serialize, { fn iter_any_exportable(&self) -> impl Iterator { std::iter::once(self as &dyn AnyExportableVec) @@ -67,7 +67,7 @@ where impl Traversable for vecdb::LZ4Vec where I: VecIndex, - T: vecdb::LZ4VecValue + Formattable, + T: vecdb::LZ4VecValue + Formattable + Serialize, { fn iter_any_exportable(&self) -> impl Iterator { std::iter::once(self as &dyn AnyExportableVec) @@ -83,7 +83,7 @@ where impl Traversable for vecdb::ZstdVec where I: VecIndex, - T: vecdb::ZstdVecValue + Formattable, + T: vecdb::ZstdVecValue + Formattable + Serialize, { fn iter_any_exportable(&self) -> impl Iterator { std::iter::once(self as &dyn AnyExportableVec) diff --git a/crates/brk_traversable_derive/Cargo.toml b/crates/brk_traversable_derive/Cargo.toml index 2f6e7d719..b525d99c6 100644 --- a/crates/brk_traversable_derive/Cargo.toml +++ b/crates/brk_traversable_derive/Cargo.toml @@ -6,7 +6,6 @@ edition.workspace = true license.workspace = true homepage.workspace = true repository.workspace = true -rust-version.workspace = true build = "build.rs" [lib] diff --git a/crates/brk_types/Cargo.toml b/crates/brk_types/Cargo.toml index 68942520a..9a5a20107 100644 --- a/crates/brk_types/Cargo.toml +++ b/crates/brk_types/Cargo.toml @@ -6,7 +6,6 @@ edition.workspace = true license.workspace = true homepage.workspace = true repository.workspace = true -rust-version.workspace = true build = "build.rs" [dependencies] diff --git a/crates/brk_types/src/emptyaddressdata.rs b/crates/brk_types/src/emptyaddressdata.rs index 64a549f9a..697675b39 100644 --- a/crates/brk_types/src/emptyaddressdata.rs +++ b/crates/brk_types/src/emptyaddressdata.rs @@ -55,25 +55,21 @@ impl Formattable for EmptyAddressData { } impl Bytes for EmptyAddressData { - fn to_bytes(&self) -> Vec { - let mut bytes = Vec::new(); - bytes.extend_from_slice(&self.tx_count.to_bytes()); - bytes.extend_from_slice(&self.funded_txo_count.to_bytes()); - bytes.extend_from_slice(&self.transfered.to_bytes()); - bytes + type Array = [u8; size_of::()]; + + fn to_bytes(&self) -> Self::Array { + let mut arr = [0u8; size_of::()]; + arr[0..4].copy_from_slice(self.tx_count.to_bytes().as_ref()); + arr[4..8].copy_from_slice(self.funded_txo_count.to_bytes().as_ref()); + arr[8..16].copy_from_slice(self.transfered.to_bytes().as_ref()); + arr } fn from_bytes(bytes: &[u8]) -> vecdb::Result { - let mut offset = 0; - let tx_count = u32::from_bytes(&bytes[offset..])?; - offset += tx_count.to_bytes().len(); - let funded_txo_count = u32::from_bytes(&bytes[offset..])?; - offset += funded_txo_count.to_bytes().len(); - let transfered = Sats::from_bytes(&bytes[offset..])?; Ok(Self { - tx_count, - funded_txo_count, - transfered, + tx_count: u32::from_bytes(&bytes[0..])?, + funded_txo_count: u32::from_bytes(&bytes[4..])?, + transfered: Sats::from_bytes(&bytes[8..])?, }) } } diff --git a/crates/brk_types/src/loadedaddressdata.rs b/crates/brk_types/src/loadedaddressdata.rs index 27b8fce7e..963bc4dfa 100644 --- a/crates/brk_types/src/loadedaddressdata.rs +++ b/crates/brk_types/src/loadedaddressdata.rs @@ -147,41 +147,29 @@ impl Formattable for LoadedAddressData { } impl Bytes for LoadedAddressData { - fn to_bytes(&self) -> Vec { - let mut bytes = Vec::new(); - bytes.extend_from_slice(&self.tx_count.to_bytes()); - bytes.extend_from_slice(&self.funded_txo_count.to_bytes()); - bytes.extend_from_slice(&self.spent_txo_count.to_bytes()); - bytes.extend_from_slice(&self.padding.to_bytes()); - bytes.extend_from_slice(&self.received.to_bytes()); - bytes.extend_from_slice(&self.sent.to_bytes()); - bytes.extend_from_slice(&self.realized_cap.to_bytes()); - bytes + type Array = [u8; size_of::()]; + + fn to_bytes(&self) -> Self::Array { + let mut arr = [0u8; size_of::()]; + arr[0..4].copy_from_slice(self.tx_count.to_bytes().as_ref()); + arr[4..8].copy_from_slice(self.funded_txo_count.to_bytes().as_ref()); + arr[8..12].copy_from_slice(self.spent_txo_count.to_bytes().as_ref()); + arr[12..16].copy_from_slice(self.padding.to_bytes().as_ref()); + arr[16..24].copy_from_slice(self.received.to_bytes().as_ref()); + arr[24..32].copy_from_slice(self.sent.to_bytes().as_ref()); + arr[32..40].copy_from_slice(self.realized_cap.to_bytes().as_ref()); + arr } fn from_bytes(bytes: &[u8]) -> vecdb::Result { - let mut offset = 0; - let tx_count = u32::from_bytes(&bytes[offset..])?; - offset += tx_count.to_bytes().len(); - let funded_txo_count = u32::from_bytes(&bytes[offset..])?; - offset += funded_txo_count.to_bytes().len(); - let spent_txo_count = u32::from_bytes(&bytes[offset..])?; - offset += spent_txo_count.to_bytes().len(); - let padding = u32::from_bytes(&bytes[offset..])?; - offset += padding.to_bytes().len(); - let received = Sats::from_bytes(&bytes[offset..])?; - offset += received.to_bytes().len(); - let sent = Sats::from_bytes(&bytes[offset..])?; - offset += sent.to_bytes().len(); - let realized_cap = Dollars::from_bytes(&bytes[offset..])?; Ok(Self { - tx_count, - funded_txo_count, - spent_txo_count, - padding, - received, - sent, - realized_cap, + tx_count: u32::from_bytes(&bytes[0..])?, + funded_txo_count: u32::from_bytes(&bytes[4..])?, + spent_txo_count: u32::from_bytes(&bytes[8..])?, + padding: u32::from_bytes(&bytes[12..])?, + received: Sats::from_bytes(&bytes[16..])?, + sent: Sats::from_bytes(&bytes[24..])?, + realized_cap: Dollars::from_bytes(&bytes[32..])?, }) } } diff --git a/crates/brk_types/src/ohlc.rs b/crates/brk_types/src/ohlc.rs index af300d7c8..8b86f9524 100644 --- a/crates/brk_types/src/ohlc.rs +++ b/crates/brk_types/src/ohlc.rs @@ -77,29 +77,23 @@ impl Formattable for OHLCCents { } impl Bytes for OHLCCents { - fn to_bytes(&self) -> Vec { - let mut bytes = Vec::new(); - bytes.extend_from_slice(&self.open.to_bytes()); - bytes.extend_from_slice(&self.high.to_bytes()); - bytes.extend_from_slice(&self.low.to_bytes()); - bytes.extend_from_slice(&self.close.to_bytes()); - bytes + type Array = [u8; size_of::()]; + + fn to_bytes(&self) -> Self::Array { + let mut arr = [0u8; size_of::()]; + arr[0..8].copy_from_slice(self.open.to_bytes().as_ref()); + arr[8..16].copy_from_slice(self.high.to_bytes().as_ref()); + arr[16..24].copy_from_slice(self.low.to_bytes().as_ref()); + arr[24..32].copy_from_slice(self.close.to_bytes().as_ref()); + arr } fn from_bytes(bytes: &[u8]) -> vecdb::Result { - let mut offset = 0; - let open = Open::::from_bytes(&bytes[offset..])?; - offset += open.to_bytes().len(); - let high = High::::from_bytes(&bytes[offset..])?; - offset += high.to_bytes().len(); - let low = Low::::from_bytes(&bytes[offset..])?; - offset += low.to_bytes().len(); - let close = Close::::from_bytes(&bytes[offset..])?; Ok(Self { - open, - high, - low, - close, + open: Open::::from_bytes(&bytes[0..])?, + high: High::::from_bytes(&bytes[8..])?, + low: Low::::from_bytes(&bytes[16..])?, + close: Close::::from_bytes(&bytes[24..])?, }) } } @@ -195,29 +189,23 @@ impl Formattable for OHLCDollars { } impl Bytes for OHLCDollars { - fn to_bytes(&self) -> Vec { - let mut bytes = Vec::new(); - bytes.extend_from_slice(&self.open.to_bytes()); - bytes.extend_from_slice(&self.high.to_bytes()); - bytes.extend_from_slice(&self.low.to_bytes()); - bytes.extend_from_slice(&self.close.to_bytes()); - bytes + type Array = [u8; size_of::()]; + + fn to_bytes(&self) -> Self::Array { + let mut arr = [0u8; size_of::()]; + arr[0..8].copy_from_slice(self.open.to_bytes().as_ref()); + arr[8..16].copy_from_slice(self.high.to_bytes().as_ref()); + arr[16..24].copy_from_slice(self.low.to_bytes().as_ref()); + arr[24..32].copy_from_slice(self.close.to_bytes().as_ref()); + arr } fn from_bytes(bytes: &[u8]) -> vecdb::Result { - let mut offset = 0; - let open = Open::::from_bytes(&bytes[offset..])?; - offset += open.to_bytes().len(); - let high = High::::from_bytes(&bytes[offset..])?; - offset += high.to_bytes().len(); - let low = Low::::from_bytes(&bytes[offset..])?; - offset += low.to_bytes().len(); - let close = Close::::from_bytes(&bytes[offset..])?; Ok(Self { - open, - high, - low, - close, + open: Open::::from_bytes(&bytes[0..])?, + high: High::::from_bytes(&bytes[8..])?, + low: Low::::from_bytes(&bytes[16..])?, + close: Close::::from_bytes(&bytes[24..])?, }) } } @@ -294,29 +282,23 @@ impl Formattable for OHLCSats { } impl Bytes for OHLCSats { - fn to_bytes(&self) -> Vec { - let mut bytes = Vec::new(); - bytes.extend_from_slice(&self.open.to_bytes()); - bytes.extend_from_slice(&self.high.to_bytes()); - bytes.extend_from_slice(&self.low.to_bytes()); - bytes.extend_from_slice(&self.close.to_bytes()); - bytes + type Array = [u8; size_of::()]; + + fn to_bytes(&self) -> Self::Array { + let mut arr = [0u8; size_of::()]; + arr[0..8].copy_from_slice(self.open.to_bytes().as_ref()); + arr[8..16].copy_from_slice(self.high.to_bytes().as_ref()); + arr[16..24].copy_from_slice(self.low.to_bytes().as_ref()); + arr[24..32].copy_from_slice(self.close.to_bytes().as_ref()); + arr } fn from_bytes(bytes: &[u8]) -> vecdb::Result { - let mut offset = 0; - let open = Open::::from_bytes(&bytes[offset..])?; - offset += open.to_bytes().len(); - let high = High::::from_bytes(&bytes[offset..])?; - offset += high.to_bytes().len(); - let low = Low::::from_bytes(&bytes[offset..])?; - offset += low.to_bytes().len(); - let close = Close::::from_bytes(&bytes[offset..])?; Ok(Self { - open, - high, - low, - close, + open: Open::::from_bytes(&bytes[0..])?, + high: High::::from_bytes(&bytes[8..])?, + low: Low::::from_bytes(&bytes[16..])?, + close: Close::::from_bytes(&bytes[24..])?, }) } } diff --git a/crates/brk_types/src/outputtype.rs b/crates/brk_types/src/outputtype.rs index 2a2a73728..9fb15ea50 100644 --- a/crates/brk_types/src/outputtype.rs +++ b/crates/brk_types/src/outputtype.rs @@ -902,14 +902,16 @@ impl Formattable for OutputType { } impl Bytes for OutputType { + type Array = [u8; size_of::()]; + #[inline] - fn to_bytes(&self) -> Vec { - vec![*self as u8] + fn to_bytes(&self) -> Self::Array { + [*self as u8] } #[inline] fn from_bytes(bytes: &[u8]) -> vecdb::Result { - if bytes.len() != 1 { + if bytes.is_empty() { return Err(vecdb::Error::WrongLength); } // SAFETY: OutputType is repr(u8) and we're transmuting from u8 diff --git a/crates/brk_types/src/poolid.rs b/crates/brk_types/src/poolid.rs index f7476ca6c..5f5744990 100644 --- a/crates/brk_types/src/poolid.rs +++ b/crates/brk_types/src/poolid.rs @@ -291,17 +291,19 @@ impl Formattable for PoolId { } impl Bytes for PoolId { + type Array = [u8; size_of::()]; + #[inline] - fn to_bytes(&self) -> Vec { - vec![*self as u8] + fn to_bytes(&self) -> Self::Array { + [*self as u8] } #[inline] fn from_bytes(bytes: &[u8]) -> vecdb::Result { - if bytes.len() != 1 { + if bytes.is_empty() { return Err(vecdb::Error::WrongLength); } - // SAFETY: OutputType is repr(u8) and we're transmuting from u8 + // SAFETY: PoolId is repr(u8) and we're transmuting from u8 // All values 0-255 are valid (includes dummy variants) let s: Self = unsafe { std::mem::transmute(bytes[0]) }; Ok(s)