Skip to content

Commit 51cb78a

Browse files
committed
chore: add more rustfmt rules
1 parent 521ae89 commit 51cb78a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

75 files changed

+616
-686
lines changed

block-util/src/config/mod.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use anyhow::Result;
2-
3-
use everscale_types::{dict::Dict, models::BlockchainConfig};
2+
use everscale_types::dict::Dict;
3+
use everscale_types::models::BlockchainConfig;
44

55
pub trait BlockchainConfigExt {
66
/// Check that config is valid.
@@ -17,8 +17,8 @@ impl BlockchainConfigExt for BlockchainConfig {
1717
_relax_par0: bool,
1818
_mandatory_params: Option<Dict<u32, ()>>,
1919
) -> Result<bool> {
20-
//TODO: refer to https://github.com/everx-labs/ever-block/blob/master/src/config_params.rs#L452
21-
//STUB: currently should not be invoked in prototype
20+
// TODO: refer to https://github.com/everx-labs/ever-block/blob/master/src/config_params.rs#L452
21+
// STUB: currently should not be invoked in prototype
2222
todo!()
2323
}
2424
}

cli/src/node/mod.rs

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,11 @@ use tycho_network::{
3232
use tycho_storage::{BlockMetaData, Storage};
3333
use tycho_util::FastHashMap;
3434

35+
use self::config::{NodeConfig, NodeKeys};
3536
use crate::util::error::ResultExt;
3637
use crate::util::logger::LoggerConfig;
3738
use crate::util::signal;
3839

39-
use self::config::{NodeConfig, NodeKeys};
40-
4140
mod config;
4241

4342
const SERVICE_NAME: &str = "tycho-node";
@@ -440,14 +439,12 @@ impl Node {
440439
let state_storage = self.storage.shard_state_storage();
441440

442441
for state in to_import {
443-
let (handle, status) = handle_storage.create_or_load_handle(
444-
state.block_id(),
445-
BlockMetaData {
442+
let (handle, status) =
443+
handle_storage.create_or_load_handle(state.block_id(), BlockMetaData {
446444
is_key_block: true,
447445
gen_utime,
448446
mc_ref_seqno: 0,
449-
},
450-
);
447+
});
451448

452449
let stored = state_storage
453450
.store_state(&handle, &state)

cli/src/tools/gen_zerostate.rs

Lines changed: 110 additions & 134 deletions
Original file line numberDiff line numberDiff line change
@@ -308,31 +308,28 @@ impl ZerostateConfig {
308308
let mut shards = Vec::new();
309309
for entry in workchains.iter() {
310310
let (workchain, descr) = entry?;
311-
shards.push((
312-
ShardIdent::new_full(workchain),
313-
ShardDescription {
314-
seqno: 0,
315-
reg_mc_seqno: 0,
316-
start_lt: 0,
317-
end_lt: 0,
318-
root_hash: descr.zerostate_root_hash,
319-
file_hash: descr.zerostate_file_hash,
320-
before_split: false,
321-
before_merge: false,
322-
want_split: false,
323-
want_merge: false,
324-
nx_cc_updated: true,
325-
next_catchain_seqno: 0,
326-
next_validator_shard: ShardIdent::PREFIX_FULL,
327-
min_ref_mc_seqno: u32::MAX,
328-
gen_utime: now,
329-
split_merge_at: None,
330-
fees_collected: CurrencyCollection::ZERO,
331-
funds_created: CurrencyCollection::ZERO,
332-
copyleft_rewards: Dict::new(),
333-
proof_chain: None,
334-
},
335-
));
311+
shards.push((ShardIdent::new_full(workchain), ShardDescription {
312+
seqno: 0,
313+
reg_mc_seqno: 0,
314+
start_lt: 0,
315+
end_lt: 0,
316+
root_hash: descr.zerostate_root_hash,
317+
file_hash: descr.zerostate_file_hash,
318+
before_split: false,
319+
before_merge: false,
320+
want_split: false,
321+
want_merge: false,
322+
nx_cc_updated: true,
323+
next_catchain_seqno: 0,
324+
next_validator_shard: ShardIdent::PREFIX_FULL,
325+
min_ref_mc_seqno: u32::MAX,
326+
gen_utime: now,
327+
split_merge_at: None,
328+
fees_collected: CurrencyCollection::ZERO,
329+
funds_created: CurrencyCollection::ZERO,
330+
copyleft_rewards: Dict::new(),
331+
proof_chain: None,
332+
}));
336333
}
337334

338335
state.custom = Some(Lazy::new(&McStateExtra {
@@ -442,24 +439,21 @@ fn make_default_params() -> Result<BlockchainConfigParams> {
442439
// Param 12
443440
{
444441
let mut workchains = Dict::new();
445-
workchains.set(
446-
0,
447-
WorkchainDescription {
448-
enabled_since: 0,
449-
actual_min_split: 0,
450-
min_split: 0,
451-
max_split: 3,
452-
active: true,
453-
accept_msgs: true,
454-
zerostate_root_hash: HashBytes::ZERO,
455-
zerostate_file_hash: HashBytes::ZERO,
456-
version: 0,
457-
format: WorkchainFormat::Basic(WorkchainFormatBasic {
458-
vm_version: 0,
459-
vm_mode: 0,
460-
}),
461-
},
462-
)?;
442+
workchains.set(0, WorkchainDescription {
443+
enabled_since: 0,
444+
actual_min_split: 0,
445+
min_split: 0,
446+
max_split: 3,
447+
active: true,
448+
accept_msgs: true,
449+
zerostate_root_hash: HashBytes::ZERO,
450+
zerostate_file_hash: HashBytes::ZERO,
451+
version: 0,
452+
format: WorkchainFormat::Basic(WorkchainFormatBasic {
453+
vm_version: 0,
454+
vm_mode: 0,
455+
}),
456+
})?;
463457
params.set::<ConfigParam12>(&workchains)?;
464458
}
465459

@@ -502,106 +496,88 @@ fn make_default_params() -> Result<BlockchainConfigParams> {
502496
}])?;
503497

504498
// Param 20 (masterchain)
505-
params.set_gas_prices(
506-
true,
507-
&GasLimitsPrices {
508-
gas_price: 655360000,
509-
gas_limit: 1000000,
510-
special_gas_limit: 100000000,
511-
gas_credit: 10000,
512-
block_gas_limit: 11000000,
513-
freeze_due_limit: 100000000,
514-
delete_due_limit: 1000000000,
515-
flat_gas_limit: 1000,
516-
flat_gas_price: 10000000,
517-
},
518-
)?;
499+
params.set_gas_prices(true, &GasLimitsPrices {
500+
gas_price: 655360000,
501+
gas_limit: 1000000,
502+
special_gas_limit: 100000000,
503+
gas_credit: 10000,
504+
block_gas_limit: 11000000,
505+
freeze_due_limit: 100000000,
506+
delete_due_limit: 1000000000,
507+
flat_gas_limit: 1000,
508+
flat_gas_price: 10000000,
509+
})?;
519510

520511
// Param 21 (basechain)
521-
params.set_gas_prices(
522-
false,
523-
&GasLimitsPrices {
524-
gas_price: 65536000,
525-
gas_limit: 1000000,
526-
special_gas_limit: 1000000,
527-
gas_credit: 10000,
528-
block_gas_limit: 10000000,
529-
freeze_due_limit: 100000000,
530-
delete_due_limit: 1000000000,
531-
flat_gas_limit: 1000,
532-
flat_gas_price: 1000000,
533-
},
534-
)?;
512+
params.set_gas_prices(false, &GasLimitsPrices {
513+
gas_price: 65536000,
514+
gas_limit: 1000000,
515+
special_gas_limit: 1000000,
516+
gas_credit: 10000,
517+
block_gas_limit: 10000000,
518+
freeze_due_limit: 100000000,
519+
delete_due_limit: 1000000000,
520+
flat_gas_limit: 1000,
521+
flat_gas_price: 1000000,
522+
})?;
535523

536524
// Param 22 (masterchain)
537-
params.set_block_limits(
538-
true,
539-
&BlockLimits {
540-
bytes: BlockParamLimits {
541-
underload: 131072,
542-
soft_limit: 524288,
543-
hard_limit: 1048576,
544-
},
545-
gas: BlockParamLimits {
546-
underload: 900000,
547-
soft_limit: 1200000,
548-
hard_limit: 2000000,
549-
},
550-
lt_delta: BlockParamLimits {
551-
underload: 1000,
552-
soft_limit: 5000,
553-
hard_limit: 10000,
554-
},
525+
params.set_block_limits(true, &BlockLimits {
526+
bytes: BlockParamLimits {
527+
underload: 131072,
528+
soft_limit: 524288,
529+
hard_limit: 1048576,
530+
},
531+
gas: BlockParamLimits {
532+
underload: 900000,
533+
soft_limit: 1200000,
534+
hard_limit: 2000000,
555535
},
556-
)?;
536+
lt_delta: BlockParamLimits {
537+
underload: 1000,
538+
soft_limit: 5000,
539+
hard_limit: 10000,
540+
},
541+
})?;
557542

558543
// Param 23 (basechain)
559-
params.set_block_limits(
560-
false,
561-
&BlockLimits {
562-
bytes: BlockParamLimits {
563-
underload: 131072,
564-
soft_limit: 524288,
565-
hard_limit: 1048576,
566-
},
567-
gas: BlockParamLimits {
568-
underload: 900000,
569-
soft_limit: 1200000,
570-
hard_limit: 2000000,
571-
},
572-
lt_delta: BlockParamLimits {
573-
underload: 1000,
574-
soft_limit: 5000,
575-
hard_limit: 10000,
576-
},
544+
params.set_block_limits(false, &BlockLimits {
545+
bytes: BlockParamLimits {
546+
underload: 131072,
547+
soft_limit: 524288,
548+
hard_limit: 1048576,
549+
},
550+
gas: BlockParamLimits {
551+
underload: 900000,
552+
soft_limit: 1200000,
553+
hard_limit: 2000000,
554+
},
555+
lt_delta: BlockParamLimits {
556+
underload: 1000,
557+
soft_limit: 5000,
558+
hard_limit: 10000,
577559
},
578-
)?;
560+
})?;
579561

580562
// Param 24 (masterchain)
581-
params.set_msg_forward_prices(
582-
true,
583-
&MsgForwardPrices {
584-
lump_price: 10000000,
585-
bit_price: 655360000,
586-
cell_price: 65536000000,
587-
ihr_price_factor: 98304,
588-
first_frac: 21845,
589-
next_frac: 21845,
590-
},
591-
)?;
563+
params.set_msg_forward_prices(true, &MsgForwardPrices {
564+
lump_price: 10000000,
565+
bit_price: 655360000,
566+
cell_price: 65536000000,
567+
ihr_price_factor: 98304,
568+
first_frac: 21845,
569+
next_frac: 21845,
570+
})?;
592571

593572
// Param 25 (basechain)
594-
params.set_msg_forward_prices(
595-
false,
596-
&MsgForwardPrices {
597-
lump_price: 1000000,
598-
bit_price: 65536000,
599-
cell_price: 6553600000,
600-
ihr_price_factor: 98304,
601-
first_frac: 21845,
602-
next_frac: 21845,
603-
},
604-
)?;
573+
params.set_msg_forward_prices(false, &MsgForwardPrices {
574+
lump_price: 1000000,
575+
bit_price: 65536000,
576+
cell_price: 6553600000,
577+
ihr_price_factor: 98304,
578+
first_frac: 21845,
579+
next_frac: 21845,
580+
})?;
605581

606582
// Param 28
607583
params.set_catchain_config(&CatchainConfig {
@@ -681,7 +657,7 @@ fn build_elector_code(address: &HashBytes, balance: Tokens) -> Result<Account> {
681657
let code = Boc::decode(ELECTOR_CODE)?;
682658

683659
let mut data = CellBuilder::new();
684-
data.store_small_uint(0, 3)?; //empty dict, empty dict, empty dict
660+
data.store_small_uint(0, 3)?; // empty dict, empty dict, empty dict
685661
data.store_small_uint(0, 4)?; // tokens
686662
data.store_u32(0)?; // elections id
687663
data.store_zeros(256)?; // elections hash
@@ -743,11 +719,11 @@ fn zero_public_key() -> &'static ed25519::PublicKey {
743719
}
744720

745721
mod serde_account_states {
746-
use super::*;
747-
748722
use serde::de::Deserializer;
749723
use serde::ser::{SerializeMap, Serializer};
750724

725+
use super::*;
726+
751727
pub fn serialize<S>(
752728
value: &HashMap<HashBytes, OptionalAccount>,
753729
serializer: S,

0 commit comments

Comments
 (0)