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

feat(collator): use tycho-executor #597

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
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
37 changes: 18 additions & 19 deletions Cargo.lock

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

7 changes: 3 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -118,9 +118,8 @@ weedb = "0.4.1"
zstd-safe = "7.2"
zstd-sys = "2.0"

# TODO: RIIR
ton_executor = { git = "https://github.com/broxus/ton-labs-executor.git", rev = "de566312176aa524d4afc26a04c931f97079b77f" }
tycho-vm = { git = "https://github.com/broxus/tycho-vm.git" }
tycho-executor = { git = "https://github.com/broxus/tycho-vm.git", rev = "b1e08e7e082ae66561ba14c7f9753ce1b168b5ff" }
tycho-vm = { git = "https://github.com/broxus/tycho-vm.git", rev = "b1e08e7e082ae66561ba14c7f9753ce1b168b5ff" }

# local deps
tycho-block-util = { path = "./block-util", version = "0.2.3" }
Expand All @@ -134,7 +133,7 @@ tycho-storage = { path = "./storage", version = "0.2.3" }
tycho-util = { path = "./util", version = "0.2.3" }

[patch.crates-io]
everscale-types = { git = "https://github.com/broxus/everscale-types.git", rev = "adada6e6539abd798dbbc5a7fc1d17cc31fa7eff" }
everscale-types = { git = "https://github.com/broxus/everscale-types.git", rev = "9dcfe1aa2ebeca82428cc860267653ec8036725e" }

[workspace.lints.rust]
future_incompatible = "warn"
Expand Down
4 changes: 3 additions & 1 deletion block-util/src/block/block_proof_stuff.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ pub struct BlockProofStuff {
impl BlockProofStuff {
#[cfg(any(test, feature = "test"))]
pub fn new_empty(block_id: &BlockId) -> Self {
use everscale_types::cell::Lazy;

let block_info = BlockInfo {
shard: block_id.shard,
seqno: block_id.seqno,
Expand Down Expand Up @@ -101,7 +103,7 @@ impl BlockProofStuff {
}

pub fn virtualize_block_root(&self) -> Result<&DynCell> {
let merkle_proof = self.inner.proof.root.parse::<MerkleProofRef<'_>>()?;
let merkle_proof = self.inner.proof.root.parse_exotic::<MerkleProofRef<'_>>()?;
let block_virt_root = merkle_proof.cell.virtualize();

anyhow::ensure!(
Expand Down
1 change: 1 addition & 0 deletions block-util/src/block/block_stuff.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ impl BlockStuff {

#[cfg(any(test, feature = "test"))]
pub fn new_empty(shard: ShardIdent, seqno: u32) -> Self {
use everscale_types::cell::Lazy;
use everscale_types::merkle::MerkleUpdate;

const DATA_SIZE: usize = 1024; // ~1 KB of data for an empty block.
Expand Down
4 changes: 2 additions & 2 deletions block-util/src/dict.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
use everscale_types::cell::Lazy;
use everscale_types::dict::{
aug_dict_insert, aug_dict_remove_owned, build_aug_dict_from_sorted_iter, AugDictExtra, DictKey,
SetMode,
};
use everscale_types::error::Error;
use everscale_types::models::Lazy;
use everscale_types::prelude::*;

pub struct RelaxedAugDict<K, A, V> {
Expand Down Expand Up @@ -56,7 +56,7 @@ where
dict_root: build_aug_dict_from_sorted_iter(
iter.into_iter().map(|(k, a, v)| {
// SAFETY: We know that this cell is not a library cell.
let value = v.inner().as_slice_allow_pruned();
let value = v.inner().as_slice_allow_exotic();
(k, a, value)
}),
K::BITS,
Expand Down
2 changes: 1 addition & 1 deletion block-util/src/message/ext_msg_repr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ impl ExtMsgRepr {
}

// Start parsing the message (we are sure now that it is an ordinary cell).
let mut cs = msg_root.as_slice_allow_pruned();
let mut cs = msg_root.as_slice_allow_exotic();

// Parse info first.
let info = MsgInfo::load_from(&mut cs)?;
Expand Down
5 changes: 3 additions & 2 deletions block-util/src/queue/queue_diff.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ use std::collections::BTreeMap;
use std::sync::Arc;

use anyhow::Result;
use everscale_types::cell::Lazy;
use everscale_types::error::Error;
use everscale_types::models::*;
use everscale_types::prelude::*;
Expand Down Expand Up @@ -247,7 +248,7 @@ impl Iterator for QueueDiffMessagesIter {
let ref_count = out_msg.descriptor().reference_count();
if ref_count > 0 {
if let Some(cell) = out_msg.reference_cloned(ref_count - 1) {
return Some(Ok(Lazy::from_raw(cell)));
return Some(Lazy::from_raw(cell));
}
}

Expand Down Expand Up @@ -282,7 +283,7 @@ mod tests {
fn queue_diff_messages_iter() -> Result<()> {
let mut out_messages = Dict::<HashBytes, (CurrencyCollection, OutMsg)>::new();

let dummy_tx = Lazy::from_raw(Cell::default());
let dummy_tx = Lazy::from_raw(Cell::default())?;

// Fill with external messages
for i in 0..10 {
Expand Down
5 changes: 3 additions & 2 deletions block-util/src/state/shard_state_stuff.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use std::sync::Arc;

use anyhow::Result;
use everscale_types::cell::Lazy;
use everscale_types::models::*;
use everscale_types::prelude::*;

Expand All @@ -16,8 +17,8 @@ pub struct ShardStateStuff {
impl ShardStateStuff {
pub fn construct_split_root(left: Cell, right: Cell) -> Result<Cell> {
CellBuilder::build_from(ShardStateSplit {
left: Lazy::from_raw(left),
right: Lazy::from_raw(right),
left: Lazy::from_raw(left)?,
right: Lazy::from_raw(right)?,
})
.map_err(From::from)
}
Expand Down
2 changes: 0 additions & 2 deletions cli/src/cmd/tools/gen_account.rs
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,6 @@ impl WalletBuilder {
last_trans_lt: 0,
balance: self.balance.into(),
state: AccountState::Active(state_init),
init_code_hash: None,
};

account.storage_stat.used = compute_storage_used(&account)?;
Expand Down Expand Up @@ -332,7 +331,6 @@ impl MultisigBuilder {
last_trans_lt: 0,
balance: self.balance.into(),
state: AccountState::Active(state_init),
init_code_hash: None,
};

account.storage_stat.used = compute_storage_used(&account)?;
Expand Down
6 changes: 1 addition & 5 deletions cli/src/cmd/tools/gen_zerostate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ use std::sync::OnceLock;

use anyhow::{Context, Result};
use everscale_crypto::ed25519;
use everscale_types::cell::Lazy;
use everscale_types::models::*;
use everscale_types::num::Tokens;
use everscale_types::prelude::*;
Expand Down Expand Up @@ -410,8 +411,6 @@ impl ZerostateConfig {
split_merge_at: None,
fees_collected: CurrencyCollection::ZERO,
funds_created: CurrencyCollection::ZERO,
copyleft_rewards: Dict::new(),
proof_chain: None,
}));
}

Expand Down Expand Up @@ -446,7 +445,6 @@ impl ZerostateConfig {
last_key_block: None,
block_create_stats: None,
global_balance: state.total_balance.clone(),
copyleft_rewards: Dict::new(),
})?);

Ok(state)
Expand Down Expand Up @@ -852,7 +850,6 @@ fn build_config_account(
data: Some(data),
libraries: Dict::new(),
}),
init_code_hash: None,
};

account.storage_stat.used = compute_storage_used(&account)?;
Expand Down Expand Up @@ -887,7 +884,6 @@ fn build_elector_code(address: &HashBytes, balance: Tokens) -> Result<Account> {
data: Some(data),
libraries: Dict::new(),
}),
init_code_hash: None,
};

account.storage_stat.used = compute_storage_used(&account)?;
Expand Down
5 changes: 0 additions & 5 deletions cli/src/util/jrpc_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -123,11 +123,6 @@ where
last_trans_lt: <_>::load_from(s)?,
balance: <_>::load_from(s)?,
state: <_>::load_from(s)?,
init_code_hash: if s.is_data_empty() {
None
} else {
Some(<_>::load_from(s)?)
},
}))
}

Expand Down
3 changes: 0 additions & 3 deletions cli/src/util/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,6 @@ pub fn compute_storage_used(account: &Account) -> Result<StorageUsed> {
storage.store_u64(account.last_trans_lt)?;
account.balance.store_into(&mut storage, cx)?;
account.state.store_into(&mut storage, cx)?;
if account.init_code_hash.is_some() {
account.init_code_hash.store_into(&mut storage, cx)?;
}
storage.build_ext(cx)?
};

Expand Down
2 changes: 1 addition & 1 deletion collator/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ thiserror = { workspace = true }
tl-proto = { workspace = true }
tokio = { workspace = true, features = ["macros", "rt-multi-thread", "signal"] }
tokio-util = { workspace = true }
ton_executor = { workspace = true }
tracing = { workspace = true }
tracing-subscriber = { workspace = true }
trait-variant = { workspace = true }
Expand All @@ -45,6 +44,7 @@ trait-variant = { workspace = true }
tycho-block-util = { workspace = true }
tycho-consensus = { workspace = true }
tycho-core = { workspace = true }
tycho-executor = { workspace = true }
tycho-network = { workspace = true }
tycho-storage = { workspace = true }
tycho-util = { workspace = true }
Expand Down
Loading
Loading