Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[pull] master from broxus:master #71

Open
wants to merge 73 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
73 commits
Select commit Hold shift + click to select a range
1959469
feat: add `count_leading`, `count_trailing` to slice
Rexagon Aug 13, 2024
6713ebc
feature(collator): updated processed_upto description
SmaGMan Aug 9, 2024
aa66eda
feature(tycho): store top processed to anchor id in shard descriptions
SmaGMan Aug 9, 2024
8c82294
feat: add out msg queue for tycho block new struct
serejkaaa512 Aug 15, 2024
3c3e613
feat: add qol stuff for block ids
Rexagon Aug 30, 2024
1e0542c
chore: bump rc version
Rexagon Aug 30, 2024
14066a4
feat: add benchmark for address mining
Rexagon Sep 18, 2024
3e7dcf6
feat(models): add support for base64-encoded `StdAddr`
Rexagon Sep 20, 2024
a512632
fix(models): disable crc check while fuzzing
Rexagon Sep 20, 2024
42d60f5
feat: require `checked_*` methods to warn if result was not used
Rexagon Sep 30, 2024
70068b0
feat: add `BocHeader::encode_to_writer`
Rexagon Sep 30, 2024
8a2410b
fix: fix an obviously incorrect level mask check
Rexagon Oct 12, 2024
c2f584e
feat(models): add `MsgType`
Rexagon Sep 2, 2024
06247be
feat: add `AugDict::find_by_extra`
Rexagon Sep 3, 2024
9073272
Merge branch 'master' into tycho
Rexagon Sep 30, 2024
175019b
added getters for previous and next validator set
SmaGMan Oct 11, 2024
74fb677
fix: use proper `max_roots` value in boc decoder debug assert
Rexagon Oct 15, 2024
9f46bfd
feat(boc): replace `OptionBoc` with a more powerful `Boc` serde impl
Rexagon Oct 18, 2024
b65137e
feat(models): add new consensus config
Rexagon Oct 18, 2024
20dc8b6
fix(boc): allow unsized boc-related types to serialize
Rexagon Oct 19, 2024
adb0acf
feat(models): add consensus info (under `tycho` feature)
Rexagon Oct 21, 2024
8ca119b
feat(models): split `ValidatorSet::compute_subset`
Rexagon Oct 21, 2024
d6a45e7
feat(abi): add `bytes` specialization for `[u8]`-like types
Rexagon Oct 23, 2024
7ca5c3e
added CollationConfig
SmaGMan Oct 28, 2024
4eb1411
feat(cell): add `WeakCell`
Rexagon Oct 26, 2024
a295c60
fix(models): fix serde impl for `AccountState`
Rexagon Oct 28, 2024
8a7fc22
feat(abi): add `[Named]AbiType::flatten`
Rexagon Oct 28, 2024
5a2c15d
feat(models): add `prev_shuffle_mc_validators` to `ConsensusInfo`
Rexagon Oct 31, 2024
dbc4920
Merge branch 'tycho'
Rexagon Oct 31, 2024
a795896
chore: bump version
Rexagon Oct 31, 2024
78d4a3f
fix(cell): don't ignore `hml_same` when writing empty label parts
Rexagon Nov 6, 2024
b661c9d
feat(dict): add `Dict::get_raw_owned`
Rexagon Nov 6, 2024
99ac0ed
chore: fix clippy warnings
Rexagon Nov 6, 2024
9cf3954
chore: bump version
Rexagon Nov 6, 2024
d433a6e
added empty_sc_block_timeout_s to CollationConfig
SmaGMan Nov 11, 2024
3024e32
feat(proc-macro): add support for multiple tags
Rexagon Nov 11, 2024
07374ee
test(cell): add tests for versioned fields
Rexagon Nov 12, 2024
9f26d07
chore: bump version
Rexagon Nov 12, 2024
799ca81
feat(cell): add `CellDescriptor::virtualize`
Rexagon Nov 18, 2024
c8d8d8a
feat(cell): add `CellSlice::new_allow_pruned` instead of `unsafe`
Rexagon Nov 21, 2024
92d5a8b
refactor(cell): use `std::mem::offset_of` instead of custom impl
Rexagon Nov 21, 2024
9f34fb0
chore(models): comments for consensus config
Mododo Nov 25, 2024
7b66f81
chore: make benchmarks more reproducible
0xdeafbeef Oct 12, 2024
2d8c5f0
chore: fix clippy warnings
Rexagon Dec 6, 2024
31ff4bc
refactor(models): genesis info
Mododo Nov 16, 2024
b127680
fix: add `serde` to `GenesisInfo`
Mododo Dec 27, 2024
488e427
feature: add impl to `GenesisInfo`
Mododo Jan 7, 2025
1482d53
feat(cell): add cell helpers
Rexagon Jan 7, 2025
8cb2789
chore: bump `tl-proto` and `everscale-crypto`
Rexagon Nov 28, 2024
6b462a4
feat(models): use flags for `ChangeLibraryMode` instead of enum
Rexagon Dec 19, 2024
b35f0ec
feat(models): extend models to compute fwd fee
Rexagon Dec 19, 2024
7d0fa01
feat(cell): add `CellSlice::load_{prefix,suffix}`
Rexagon Dec 20, 2024
e6f22bf
chore: bump dependencies
Rexagon Jan 9, 2025
e2d7ff8
fix(cell): fix `split_suffix` refs range
Rexagon Jan 13, 2025
7853ddb
feat: add `OutMsgQueueUpdates::tail_len`
Rexagon Oct 14, 2024
f36a78f
fix(models): add new tag for `OutMsgQueueUpdates`
Rexagon Nov 25, 2024
14d97d8
updated ProcessedUptoInfo model
SmaGMan Dec 14, 2024
7dd6e49
split ProcessedUpto state by partitions
SmaGMan Jan 13, 2025
4ddc9cc
more messages execution params
SmaGMan Jan 7, 2025
c6e1177
store actual messages execution params in the state after block colla…
SmaGMan Jan 7, 2025
cb952e0
removed versioning because of breaking changes
SmaGMan Jan 7, 2025
bbe12b8
feat(models): add TLB scheme for `ProcessedUpto*` models
Rexagon Jan 16, 2025
615756d
updated work units params
SmaGMan Jan 20, 2025
361eab4
use u16 to index partitions
SmaGMan Jan 22, 2025
c3d7cea
added more work units params
SmaGMan Jan 24, 2025
329ba41
refactor: use `&self` with context lifetimes for `CellContext`
Rexagon Jan 17, 2025
f3138e4
fix(models): fix `LibDescr` serialization
Rexagon Jan 18, 2025
1e81354
feat(models): extend config params
Rexagon Jan 20, 2025
416fc75
feat(models): add helpers for prices/limits
Rexagon Jan 21, 2025
5233eef
feat(models): add `clamp` for currency collections
Rexagon Jan 24, 2025
8c20e5f
fix(models): fix serde impl for config param 43 (`SizeLimitsConfig`)
Rexagon Jan 28, 2025
9c9296d
feat(num): add saturating math for custom numbers
Rexagon Jan 28, 2025
0f2fb69
feat(models): add `WorkchainFormatExtended::check_addr_len`
Rexagon Jan 29, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 46 additions & 9 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name = "everscale-types"
description = "A set of primitive types and utilities for the Everscale blockchain."
authors = ["Ivan Kalinin <[email protected]>"]
repository = "https://github.com/broxus/everscale-types"
version = "0.1.0-rc.6"
version = "0.1.2"
edition = "2021"
rust-version = "1.77"
include = ["src/**/*.rs", "benches/**/*.rs", "LICENSE-*", "README.md"]
Expand All @@ -13,31 +13,61 @@ license = "MIT OR Apache-2.0"
name = "boc"
harness = false

[[bench]]
name = "mine"
harness = false

[[bench]]
name = "dict_from_slice"
harness = false

[[bench]]
name = "dict"
harness = false

[[bench]]
name = "slice_uniform"
harness = false

[[bench]]
name = "usage_cell"
harness = false

# callgrind benchmarks

[[bench]]
name = "dict_from_slice"
name = "callgrind_boc"
harness = false

[[bench]]
name = "callgrind_dict_from_slice"
harness = false

[[bench]]
name = "callgrind_dict"
harness = false

[[bench]]
name = "callgrind_slice_uniform"
harness = false

[[bench]]
name = "callgrind_usage_cell"
harness = false

[workspace]
members = ["proc"]

[dependencies]
ahash = "0.8"
ahash = "0.8.11"
anyhow = { version = "1.0", optional = true }
base64 = { version = "0.22", optional = true }
bitflags = "2.3"
blake3 = { version = "1.5", optional = true }
bytes = { version = "1.4", optional = true }
crc32c = "0.6"
ed25519-dalek = { version = "2.0", optional = true }
everscale-crypto = { version = "0.2", features = ["tl-proto"], optional = true }
crc32c = "0.6.8"
ed25519-dalek = { version = "2.1.1", optional = true }
everscale-crypto = { version = "0.3", features = ["tl-proto"], optional = true }
hex = "0.4"
num-bigint = { version = "0.4", optional = true }
num-traits = { version = "0.2", optional = true }
Expand All @@ -47,10 +77,11 @@ scc = { version = "2.1", optional = true }
serde = { version = "1", features = ["derive"], optional = true }
sha2 = "0.10"
smallvec = { version = "1.9", features = ["union"] }
thiserror = "1.0"
tl-proto = { version = "0.4", optional = true }
thiserror = "2.0"
tl-proto = { version = "0.5.1", optional = true }
typeid = { version = "1.0", optional = true }

everscale-types-proc = { version = "=0.1.4", path = "proc" }
everscale-types-proc = { version = "=0.1.5", path = "proc" }

[dev-dependencies]
anyhow = "1.0"
Expand All @@ -60,6 +91,8 @@ rand = "0.8"
rand_xorshift = "0.3"
serde = { version = "1", features = ["derive"] }
serde_json = "1"
iai-callgrind = "0.14"
paste = "1.0.15"

[features]
default = ["base64", "serde", "models", "sync"]
Expand All @@ -77,6 +110,7 @@ abi = [
"dep:num-bigint",
"dep:num-traits",
"dep:serde",
"dep:typeid",
"models",
]
venom = []
Expand Down Expand Up @@ -104,3 +138,6 @@ opt-level = 1

[package.metadata.docs.rs]
features = ["base64", "serde", "models", "sync", "stats", "abi"]

[lints.rust]
unexpected_cfgs = { level = "warn", check-cfg = ['cfg(fuzzing)'] }
45 changes: 18 additions & 27 deletions benches/boc.rs

Large diffs are not rendered by default.

74 changes: 74 additions & 0 deletions benches/callgrind_boc.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
use everscale_types::boc::Boc;
use everscale_types::cell::Cell;
use iai_callgrind::{library_benchmark, library_benchmark_group, main};
use std::hint::black_box;

#[macro_export]
macro_rules! decl_boc_benches {
($(
$name:literal
),* $(,)?) => {
// generate setup functions for raw bytes
$(
paste::paste! {
fn [<$name _setup>]() -> &'static [u8] {
include_bytes!(concat!("data/", $name))
}
}
)*

// generate setup functions for cells
$(
paste::paste! {
fn [<$name _setup_de>]() -> Cell {
let bytes = include_bytes!(concat!("data/", $name));
Boc::decode(&bytes).unwrap()
}
}
)*

// generate benchmark functions attributes for decode / encode
paste::paste! {
#[library_benchmark]
$(
#[bench::[<$name>](setup = [<$name _setup>])]
)*
fn deserialize_boc(input: &[u8]) {
let result = Boc::decode(input);
_ = black_box(result);
}

#[library_benchmark]
$(
#[bench::[<$name>](setup = [<$name _setup_de>])]
)*
fn serialize_boc(input: Cell) {
let result = Boc::encode(&input);
_ = black_box(result);
std::mem::forget(input);
}
}
};
}

decl_boc_benches![
"external_message",
"internal_message_empty",
"internal_message_with_body",
"internal_message_with_deploy",
"masterchain_block",
"masterchain_key_block",
"shard_block_empty",
"shard_block_with_messages",
"masterchain_block_proof",
"shard_block_proof"
];

library_benchmark_group!(
name = benches;
benchmarks =
deserialize_boc,
serialize_boc
);

main!(library_benchmark_groups = benches);
35 changes: 35 additions & 0 deletions benches/callgrind_dict.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
use everscale_types::{cell::*, dict::*};
use iai_callgrind::{library_benchmark, library_benchmark_group, main};
use rand::distributions::{Distribution, Standard};
use rand::{Rng, SeedableRng};
use std::hint::black_box;

fn build_dict<K, V>(num_elements: usize) -> Dict<K, V>
where
Standard: Distribution<K> + Distribution<V>,
K: Store + DictKey,
V: Store,
{
let mut rng = rand_xorshift::XorShiftRng::from_seed([0u8; 16]);

let mut result = Dict::<K, V>::new();
for _ in 0..num_elements {
let key = rng.gen::<K>();
let value = rng.gen::<V>();
result.set(key, value).unwrap();
}
result
}

#[library_benchmark]
#[bench::small(10)]
#[bench::medium(100)]
#[bench::large(1000)]
#[bench::xlarge(10000)]
fn bench_build_dict_u64_u64(num_elements: usize) -> Dict<u64, u64> {
black_box(build_dict(num_elements))
}

library_benchmark_group!(name = build_dict; benchmarks = bench_build_dict_u64_u64);

main!(library_benchmark_groups = build_dict);
63 changes: 63 additions & 0 deletions benches/callgrind_dict_from_slice.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
use everscale_types::{cell::*, dict::*};
use iai_callgrind::{library_benchmark, library_benchmark_group, main};
use rand::distributions::{Distribution, Standard};
use rand::{Rng, SeedableRng};
use std::hint::black_box;

fn build_dict_inserts<K, V>(num_elements: usize) -> Dict<K, V>
where
Standard: Distribution<K> + Distribution<V>,
K: Store + DictKey,
V: Store,
{
let mut rng = rand_xorshift::XorShiftRng::from_seed([0u8; 16]);

let mut result = Dict::<K, V>::new();
for _ in 0..num_elements {
let key = rng.gen::<K>();
let value = rng.gen::<V>();
result.add(key, value).unwrap();
}
result
}

fn build_dict_leaves<K, V>(num_elements: usize) -> Dict<K, V>
where
Standard: Distribution<K> + Distribution<V>,
K: Store + DictKey + Ord,
V: Store,
{
let mut rng = rand_xorshift::XorShiftRng::from_seed([0u8; 16]);

let mut values = (0..num_elements)
.map(|_| (rng.gen::<K>(), rng.gen::<V>()))
.collect::<Vec<_>>();
values.sort_by(|(l, _), (r, _)| l.cmp(r));

Dict::<K, V>::try_from_sorted_slice(&values).unwrap()
}

#[library_benchmark]
#[bench::small(10)]
#[bench::medium(100)]
#[bench::large(1000)]
#[bench::xlarge(10000)]
fn bench_build_dict_u64_u64_inserts(num_elements: usize) -> Dict<u64, u64> {
black_box(build_dict_inserts(num_elements))
}

#[library_benchmark]
#[bench::small(10)]
#[bench::medium(100)]
#[bench::large(1000)]
#[bench::xlarge(10000)]
fn bench_build_dict_u64_u64_leaves(num_elements: usize) -> Dict<u64, u64> {
black_box(build_dict_leaves(num_elements))
}

library_benchmark_group!(
name = build_dict;
benchmarks = bench_build_dict_u64_u64_inserts, bench_build_dict_u64_u64_leaves
);

main!(library_benchmark_groups = build_dict);
24 changes: 24 additions & 0 deletions benches/callgrind_slice_uniform.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
use everscale_types::prelude::*;
use iai_callgrind::{library_benchmark, library_benchmark_group, main};
use std::hint::black_box;

#[library_benchmark]
#[bench::small(2)]
#[bench::medium(4)]
#[bench::large(8)]
#[bench::xlarge(10)]
fn test(bits: u32) {
let mut builder = CellBuilder::new();
builder.store_zeros(2u16.pow(bits) - 1u16).unwrap();
let cell = builder.build().unwrap();

let slice = cell.as_slice().unwrap();
black_box(slice.test_uniform());
}

library_benchmark_group!(
name = test_uniform;
benchmarks = test
);

main!(library_benchmark_groups = test_uniform);
Loading