Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@

All notable changes to this project will be documented in this file.

## [2.24.6] - 2025-11-10
## Fixed
- Hash used for calculating BOC depth when applying BOC size limits
- Modified tests to match Rust 2024 Standard

## [2.24.5] - 2025-11-03
## Fixed
- Fix mvreward
Expand Down
2 changes: 1 addition & 1 deletion tvm_block/src/tests/test_merkle_update.rs
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,7 @@ fn test_merkle_update4() {
let mut root1 = BuilderData::new();
root1.append_raw(&[0], 8).unwrap();

for i in 0..1024 {
for i in 0..800 {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's new depth limit? Can we use common static const var here?

let mut new_root = BuilderData::new();
new_root.append_raw(&[i as u8], 8).unwrap();
new_root.checked_append_reference(root1.clone().into_cell().unwrap()).unwrap();
Expand Down
4 changes: 2 additions & 2 deletions tvm_client/src/crypto/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1294,7 +1294,7 @@ async fn test_crypto_box_signing_boxes() -> tvm_types::Result<()> {
}

client
.request_async(
.request_async::<_, ()>(
"crypto.clear_crypto_box_secret_cache",
RegisteredCryptoBox { handle: crypto_box.handle },
)
Expand Down Expand Up @@ -1421,7 +1421,7 @@ async fn test_crypto_box_encryption_boxes() -> tvm_types::Result<()> {
}

client
.request_async(
.request_async::<_, ()>(
"crypto.clear_crypto_box_secret_cache",
RegisteredCryptoBox { handle: crypto_box.handle },
)
Expand Down
8 changes: 4 additions & 4 deletions tvm_client/src/proofs/tests/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -763,7 +763,7 @@ async fn test_proof_block_data() -> Result<()> {
.await?;

client
.request_async(
.request_async::<_, ()>(
"proofs.proof_block_data",
ParamsOfProofBlockData { block: block_json.clone() },
)
Expand All @@ -772,7 +772,7 @@ async fn test_proof_block_data() -> Result<()> {
block_json["boc"] = Value::Null;

client
.request_async(
.request_async::<_, ()>(
"proofs.proof_block_data",
ParamsOfProofBlockData { block: block_json.clone() },
)
Expand Down Expand Up @@ -968,7 +968,7 @@ async fn test_proof_block_data() -> Result<()> {
.await?;

client
.request_async(
.request_async::<_, ()>(
"proofs.proof_block_data",
ParamsOfProofBlockData { block: block_json.clone() },
)
Expand All @@ -983,7 +983,7 @@ async fn test_proof_block_data() -> Result<()> {
.await?;

client
.request_async(
.request_async::<_, ()>(
"proofs.proof_block_data",
ParamsOfProofBlockData { block: block_json.clone() },
)
Expand Down
14 changes: 2 additions & 12 deletions tvm_types/src/cell/data_cell.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ impl Default for DataCell {
}

thread_local! {
static UNIQUE_CELLS: RefCell<BTreeSet<HashableCell>> = const { RefCell::new(BTreeSet::new()) };
static UNIQUE_BLOOM: RefCell<BloomFilter> = RefCell::new(BloomFilter::with_false_pos(0.00001).expected_items(1000000));
}

Expand Down Expand Up @@ -137,15 +136,11 @@ impl DataCell {
let mut count = 0u64;
let mut counts = Vec::new();
for r in references.iter() {
// if unique_cells.contains(r) {
// } else {
// UNIQUE_CELLS. (|x: BTreeSet<Cell>| x.contains(r));
// }
if UNIQUE_BLOOM.with_borrow(|x| x.contains(&HashableCell::Any(r.clone()))) {
// println!("repeat cell");
// Do not count cells we've already seen.
} else {
UNIQUE_BLOOM.with_borrow_mut(|x| x.insert(&HashableCell::Any(r.clone())));
// println!("new cell");
// Count new cell exactly once
depths.push(r.depths());
depth = depth.max(r.depths().iter().sum::<u16>());
depth2 = depth2.saturating_add(r.tree_cell_count());
Expand All @@ -166,11 +161,6 @@ impl DataCell {
if let Some(c) = extern_tree_cell_count {
tree_cell_count = tree_cell_count.saturating_add(c)
}
// for reference in &references {
// tree_bits_count =
// tree_bits_count.saturating_add(reference.tree_bits_count());
// tree_cell_count =
// tree_cell_count.saturating_add(reference.tree_cell_count()); }
if tree_bits_count > MAX_56_BITS {
tree_bits_count = MAX_56_BITS;
}
Expand Down
4 changes: 3 additions & 1 deletion tvm_types/src/cell/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,9 @@ lazy_static::lazy_static! {

impl std::hash::Hash for HashableCell {
fn hash<H: std::hash::Hasher>(&self, state: &mut H) {
core::mem::discriminant(self).hash(state);
match self {
HashableCell::Any(cell) => cell.hash(MAX_LEVEL).hash(state),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change should be tested well, it can seriously affect performance

}
}

fn hash_slice<H: std::hash::Hasher>(data: &[Self], state: &mut H)
Expand Down
16 changes: 11 additions & 5 deletions tvm_vm/src/tests/test_executor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ use std::collections::HashSet;
use std::time::Duration;
use std::time::Instant;

use log4rs::append;
use rand::Rng;
use rand::RngCore;
use rand::thread_rng;
Expand Down Expand Up @@ -1447,13 +1448,18 @@ fn test_run_wasm_fuel_error_from_hash() {

#[test]
fn test_bocdepth() {
// let mut cell = BuilderData::new();
// cell.append_raw(&[0u8; 10230], 10230).unwrap();
// cell.finalize(2048).unwrap();
let _cell = TokenValue::write_bytes(&[100u8; 128 * 2000], &ABI_VERSION_2_4)
.unwrap()
let mut data = [100u8; 98 * 1024 + 1248].to_vec();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

100 KB cell is maximum now?

let _cell = TokenValue::write_bytes(&data.as_slice(), &ABI_VERSION_2_4)
.unwrap() //1398101
.into_cell()
.unwrap();

data.append(&mut [100u8].to_vec());
let res = TokenValue::write_bytes(&data.as_slice(), &ABI_VERSION_2_4)
.unwrap() //1398101
.into_cell();
assert!(res.is_err());

println!("Success");
}

Expand Down
Loading