Skip to content

Commit d028d64

Browse files
committed
migrate to the 2024 edition
1 parent 6e5fdda commit d028d64

File tree

8 files changed

+30
-31
lines changed

8 files changed

+30
-31
lines changed

Cargo.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[package]
22
name = "chaindev"
3-
version = "0.53.1"
4-
edition = "2021"
3+
version = "0.54.0"
4+
edition = "2024"
55
authors = ["[email protected]"]
66
description = "Powerful development and testing utils for blockchain developers."
77
homepage = "https://github.com/rust-util-collections/chaindev"
@@ -23,8 +23,8 @@ serde = { version = "1.0", features = [ "derive" ] }
2323
serde_json = "1.0"
2424
serde_yml = "0.0.12"
2525

26-
ruc = { version = "7.8.5", features = [ "cmd", "ssh" ] }
27-
vsdb = { version = "3.0.0", default-features = false }
26+
ruc = { version = "8.0", features = [ "cmd", "ssh" ] }
27+
vsdb = { version = "4.0", default-features = false }
2828

2929
tendermint = { version = "0.40", optional = true }
3030
tendermint-config = { version = "0.40", optional = true }

src/beacon_based/ddev/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ pub mod remote;
77
use crate::check_errlist;
88
use crate::common::{
99
hosts::{Host, HostAddr, HostID, HostMeta, Hosts, Weight},
10-
remote::{exec_cmds_on_hosts, get_file_from_hosts, put_file_to_hosts, Remote},
10+
remote::{Remote, exec_cmds_on_hosts, get_file_from_hosts, put_file_to_hosts},
1111
};
1212
use parking_lot::RwLock;
1313
use rand::random;

src/beacon_based/ddev/remote.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
use crate::{
2+
NodeID,
23
beacon_based::{
34
common::CustomData,
45
ddev::{Env, EnvMeta, Node, NodeCmdGenerator, NodePorts},
56
},
67
check_errlist,
78
common::remote::Remote,
8-
NodeID,
99
};
1010
use ruc::*;
1111
use std::collections::BTreeMap;

src/beacon_based/dev.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
55
use nix::{
66
sys::socket::{
7-
self, setsockopt, socket, sockopt, AddressFamily, SockFlag, SockType,
8-
SockaddrIn,
7+
self, AddressFamily, SockFlag, SockType, SockaddrIn, setsockopt, socket,
8+
sockopt,
99
},
1010
unistd::{self, ForkResult},
1111
};
@@ -18,7 +18,7 @@ use std::{
1818
fs::{self, OpenOptions},
1919
io::{ErrorKind, Write},
2020
os::unix::io::AsRawFd,
21-
process::{exit, Command, Stdio},
21+
process::{Command, Stdio, exit},
2222
sync::LazyLock,
2323
};
2424
use vsdb::MapxOrd;
@@ -1028,8 +1028,7 @@ impl<Ports: NodePorts> Node<Ports> {
10281028
} else {
10291029
println!(
10301030
"This node(ID {}) may be in a partial failed state, less than 3 live processes({}) detected, enter the restart process.",
1031-
self.id,
1032-
process_cnt
1031+
self.id, process_cnt
10331032
);
10341033
// Probably a partial failure
10351034
self.stop(env, false).c(d!())?;

src/tendermint_based/ddev/mod.rs

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ pub mod remote;
77
use crate::check_errlist;
88
use crate::common::{
99
hosts::{HostExpression, HostExpressionRef, HostID, HostMeta, Hosts, Weight},
10-
remote::{exec_cmds_on_hosts, get_file_from_hosts, put_file_to_hosts, Remote},
10+
remote::{Remote, exec_cmds_on_hosts, get_file_from_hosts, put_file_to_hosts},
1111
};
1212
use rand::random;
1313
use ruc::{cmd, *};
@@ -21,11 +21,11 @@ use std::{
2121
sync::LazyLock,
2222
thread,
2323
};
24-
use tendermint::{validator::Info as TmValidator, vote::Power as TmPower, Genesis};
24+
use tendermint::{Genesis, validator::Info as TmValidator, vote::Power as TmPower};
2525
use tendermint_config::{
2626
NodeKey, PrivValidatorKey as TmValidatorKey, TendermintConfig as TmConfig,
2727
};
28-
use toml_edit::{value as toml_value, Array, DocumentMut as Document};
28+
use toml_edit::{Array, DocumentMut as Document, value as toml_value};
2929
use vsdb::MapxOrd;
3030

3131
pub use super::common::*;
@@ -1086,7 +1086,7 @@ where
10861086
})
10871087
.map(|key| TmValidator::new(key.pub_key, TmPower::from(PRESET_POWER)))
10881088
};
1089-
let gen = |genesis_file: String| {
1089+
let genit = |genesis_file: String| {
10901090
thread::scope(|s| {
10911091
let hdrs = self
10921092
.meta
@@ -1141,7 +1141,7 @@ where
11411141
.map_err(|e| eg!(e))
11421142
})
11431143
.and_then(|cfg| cfg.genesis_file.to_str().map(|f| f.to_owned()).c(d!()))
1144-
.and_then(gen)
1144+
.and_then(genit)
11451145
.and_then(|_| fs::remove_dir_all(tmp_home).c(d!()))
11461146
}
11471147

@@ -1625,9 +1625,11 @@ impl PortsCache {
16251625

16261626
fn set(&self, ports: &[String]) {
16271627
for p in ports {
1628-
assert!(unsafe { self.port_set.shadow() }
1629-
.insert(&p.to_owned(), &())
1630-
.is_none());
1628+
assert!(
1629+
unsafe { self.port_set.shadow() }
1630+
.insert(&p.to_owned(), &())
1631+
.is_none()
1632+
);
16311633
}
16321634
}
16331635

src/tendermint_based/ddev/remote.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
use crate::{
2-
check_errlist,
2+
NodeID, check_errlist,
33
common::remote::Remote,
44
tendermint_based::ddev::{Env, EnvMeta, Node, NodeCmdGenerator, NodePorts},
5-
NodeID,
65
};
76
use ruc::*;
87
use serde::{Deserialize, Serialize};

src/tendermint_based/dev.rs

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
55
use nix::{
66
sys::socket::{
7-
self, setsockopt, socket, sockopt, AddressFamily, SockFlag, SockType,
8-
SockaddrIn,
7+
self, AddressFamily, SockFlag, SockType, SockaddrIn, setsockopt, socket,
8+
sockopt,
99
},
1010
unistd::{self, ForkResult},
1111
};
@@ -20,15 +20,15 @@ use std::{
2020
io::{ErrorKind, Write},
2121
os::unix::io::AsRawFd,
2222
path::PathBuf,
23-
process::{exit, Command, Stdio},
23+
process::{Command, Stdio, exit},
2424
str::FromStr,
2525
sync::LazyLock,
2626
};
27-
use tendermint::{validator::Info as TmValidator, vote::Power as TmPower, Genesis};
27+
use tendermint::{Genesis, validator::Info as TmValidator, vote::Power as TmPower};
2828
use tendermint_config::{
2929
PrivValidatorKey as TmValidatorKey, TendermintConfig as TmConfig,
3030
};
31-
use toml_edit::{value as toml_value, Array, DocumentMut as Document};
31+
use toml_edit::{Array, DocumentMut as Document, value as toml_value};
3232

3333
pub use super::common::*;
3434
use crate::common::NodeCmdGenerator;
@@ -674,7 +674,7 @@ where
674674
let tmp_id = NodeID::MAX;
675675
let tmp_home = format!("{}/{}", &self.meta.home, tmp_id);
676676

677-
let gen = |genesis_file: String| {
677+
let genit = |genesis_file: String| {
678678
self.meta
679679
.nodes
680680
.values()
@@ -735,7 +735,7 @@ where
735735
.map_err(|e| eg!(e))
736736
})
737737
.and_then(|cfg| cfg.genesis_file.to_str().map(|f| f.to_owned()).c(d!()))
738-
.and_then(gen)
738+
.and_then(genit)
739739
.and_then(|_| fs::remove_dir_all(tmp_home).c(d!()))
740740
}
741741

@@ -859,8 +859,7 @@ impl<P: NodePorts> Node<P> {
859859
} else {
860860
println!(
861861
"This node(ID {}) may be in a partial failed state, less than 3 live processes({}) detected, enter the restart process.",
862-
self.id,
863-
process_cnt
862+
self.id, process_cnt
864863
);
865864
// Probably a partial failure
866865
self.stop(env, false).c(d!())?;

tools/fmt.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,4 +56,4 @@ for file in $(find .. -path "../target" -a -prune \
5656
echo $file | grep -c '\.md$'>/dev/null || perl -pi -e 's/ +$//g' $file
5757
done
5858

59-
cargo +nightly fmt
59+
cargo fmt

0 commit comments

Comments
 (0)