Skip to content

Commit

Permalink
feat(block-strider): state apply implimentation
Browse files Browse the repository at this point in the history
refactor(strider): ask `BlockStuffAug` instead of `BlockStuff` in provider
  • Loading branch information
0xdeafbeef committed Apr 19, 2024
1 parent 0e43c70 commit 2fc03ae
Show file tree
Hide file tree
Showing 19 changed files with 660 additions and 101 deletions.
2 changes: 2 additions & 0 deletions .clippy.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
allow-print-in-tests = true
allow-dbg-in-tests = true
27 changes: 23 additions & 4 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 5 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ members = [

[workspace.dependencies]
# crates.io deps
aarc = "0.2"
ahash = "0.8"
anyhow = "1.0.79"
arc-swap = "1.6.0"
Expand All @@ -46,6 +47,7 @@ humantime = "2"
itertools = "0.12"
libc = "0.2"
moka = { version = "0.12", features = ["sync"] }
metrics = "0.22.3"
num-traits = "0.2.18"
parking_lot = "0.12.1"
parking_lot_core = "0.9.9"
Expand Down Expand Up @@ -96,7 +98,7 @@ tycho-util = { path = "./util" }
# NOTE: use crates.io dependency when it is released
# https://github.com/sagebind/castaway/issues/18
castaway = { git = "https://github.com/sagebind/castaway.git" }
everscale-types = { git = "https://github.com/broxus/everscale-types.git", branch = "0xdeafbeef/push-yntmntzvxrlu" }
everscale-types = { git = "https://github.com/broxus/everscale-types.git" }

[workspace.lints.rust]
future_incompatible = "warn"
Expand Down Expand Up @@ -155,6 +157,8 @@ needless_for_each = "warn"
option_option = "warn"
path_buf_push_overwrite = "warn"
ptr_as_ptr = "warn"
print_stdout = "warn"
print_stderr = "warn"
rc_mutex = "warn"
ref_option_ref = "warn"
rest_pat_in_fully_bound_structs = "warn"
Expand Down
2 changes: 1 addition & 1 deletion block-util/src/block/top_blocks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ impl TopBlocks {
self.contains_shard_seqno(&block_id.shard, block_id.seqno)
}

/// Checks whether the given pair of [`ton_block::ShardIdent`] and seqno
/// Checks whether the given pair of [`ShardIdent`] and seqno
/// is equal to or greater than the last block for the given shard.
///
/// NOTE: Specified shard could be split or merged
Expand Down
9 changes: 7 additions & 2 deletions block-util/src/state/shard_state_stuff.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,13 +62,18 @@ impl ShardStateStuff {
let file_hash = sha2::Sha256::digest(bytes);
anyhow::ensure!(
id.file_hash.as_slice() == file_hash.as_slice(),
"file_hash mismatch for {id}"
"file_hash mismatch. Expected: {}, got: {}",
hex::encode(file_hash),
id.file_hash,
);

let root = Boc::decode(bytes)?;
anyhow::ensure!(
&id.root_hash == root.repr_hash(),
"root_hash mismatch for {id}"
"root_hash mismatch for {id}. Expected: {expected}, got: {got}",
id = id,
expected = id.root_hash,
got = root.repr_hash(),
);

Self::new(
Expand Down
9 changes: 8 additions & 1 deletion core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,16 @@ license.workspace = true

[dependencies]
anyhow = { workspace = true }
async-trait = { workspace = true }
castaway = { workspace = true }
everscale-types = { workspace = true }
futures-util = { workspace = true }
itertools = { workspace = true }
metrics = { workspace = true }
parking_lot = { workspace = true }
tokio = { workspace = true, features = ["rt"] }
tracing = { workspace = true }
thiserror = { workspace = true }
sha2 = { workspace = true }

# local deps
tycho-block-util = { workspace = true }
Expand All @@ -27,6 +29,11 @@ tycho-util = { workspace = true }

[dev-dependencies]
tycho-util = { workspace = true, features = ["test"] }
tempfile = { workspace = true }
tracing-test = { workspace = true }

[lints]
workspace = true

[features]
test = []
Loading

0 comments on commit 2fc03ae

Please sign in to comment.