Skip to content

Commit

Permalink
[deps] Upgrade toml
Browse files Browse the repository at this point in the history
  • Loading branch information
gregnazario committed Jul 11, 2023
1 parent a221217 commit 5756e11
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 11 deletions.
12 changes: 6 additions & 6 deletions Cargo.lock

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

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -580,15 +580,15 @@ tiny-bip39 = "0.8.2"
tiny-keccak = { version = "2.0.2", features = ["keccak", "sha3"] }
tracing = "0.1.34"
tracing-subscriber = { version = "0.3.17", features = ["json", "env-filter"] }
trybuild = "1.0.70"
trybuild = "1.0.80"
tokio = { version = "1.21.0", features = ["full"] }
tokio-io-timeout = "1.2.0"
tokio-metrics = "0.1.0"
tokio-retry = "0.3.0"
tokio-stream = "0.1.8"
tokio-test = "0.4.1"
tokio-util = { version = "0.7.2", features = ["compat", "codec"] }
toml = "0.5.9"
toml = "0.7.4"
tonic = { version = "0.8.3", features = [
"tls-roots",
"transport",
Expand Down
8 changes: 5 additions & 3 deletions execution/executor-benchmark/src/transaction_generator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -212,18 +212,20 @@ impl TransactionGenerator {
let metadata = TestCase::P2p(P2pTestCase {
num_accounts: self.num_existing_accounts + num_new_accounts,
});
let serialized = toml::to_vec(&metadata).unwrap();
let serialized = toml::ser::to_string(&metadata).unwrap();
let meta_file = path.as_ref().join(META_FILENAME);
let mut file = File::create(meta_file).unwrap();
file.write_all(&serialized).unwrap();
file.write_all(serialized.as_bytes()).unwrap();
}

pub fn read_meta<P: AsRef<Path>>(path: &P) -> usize {
let filename = path.as_ref().join(META_FILENAME);
File::open(filename).map_or(0, |mut file| {
let mut contents = vec![];
file.read_to_end(&mut contents).unwrap();
let test_case: TestCase = toml::from_slice(&contents).expect("Must exist.");
let test_case: TestCase =
toml::from_str(&String::from_utf8(contents).expect("Must be UTF8"))
.expect("Must exist.");
let TestCase::P2p(P2pTestCase { num_accounts }) = test_case;
num_accounts
})
Expand Down

0 comments on commit 5756e11

Please sign in to comment.