Skip to content

Commit 1b8277c

Browse files
fix: Update dependencies and add cardano-node 10.5.1 compatibility
1 parent 5aaaa77 commit 1b8277c

File tree

10 files changed

+1342
-608
lines changed

10 files changed

+1342
-608
lines changed

Cargo.lock

Lines changed: 1163 additions & 516 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 22 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "cncli"
3-
version = "6.5.1"
3+
version = "6.6.0"
44
authors = ["Andrew Westberg <andrewwestberg@gmail.com>"]
55
edition = "2021"
66
build = "build.rs"
@@ -10,42 +10,43 @@ build = "build.rs"
1010
[dependencies]
1111
async-std = "1.13"
1212
bech32 = "0.11"
13-
bincode = "1.3.3"
13+
bincode = "2"
1414
byteorder = "1.5"
15-
pallas-crypto = { git = "https://github.com/txpipe/pallas", rev = "b641c4e6862be447336429878f4e0a57a2281588" }
16-
pallas-math = { git = "https://github.com/txpipe/pallas", rev = "b641c4e6862be447336429878f4e0a57a2281588" }
17-
pallas-network = { git = "https://github.com/txpipe/pallas", rev = "b641c4e6862be447336429878f4e0a57a2281588" }
18-
pallas-traverse = { git = "https://github.com/txpipe/pallas", rev = "b641c4e6862be447336429878f4e0a57a2281588" }
19-
#pallas-crypto = "0.30"
20-
#pallas-math = "0.30"
21-
#pallas-network = "0.30"
22-
#pallas-traverse = "0.30"
15+
#pallas-crypto = { git = "https://github.com/txpipe/pallas", rev = "b641c4e6862be447336429878f4e0a57a2281588" }
16+
#pallas-math = { git = "https://github.com/txpipe/pallas", rev = "b641c4e6862be447336429878f4e0a57a2281588" }
17+
#pallas-network = { git = "https://github.com/txpipe/pallas", rev = "b641c4e6862be447336429878f4e0a57a2281588" }
18+
#pallas-traverse = { git = "https://github.com/txpipe/pallas", rev = "b641c4e6862be447336429878f4e0a57a2281588" }
19+
pallas-crypto = "0.32.1"
20+
pallas-math = "0.32.1"
21+
pallas-network = "0.32.1"
22+
pallas-traverse = "0.32.1"
23+
amaru-ouroboros = { git = "https://github.com/pragma-org/amaru", rev = "981381fb6bb980f27c244e9f80765f0d653bb212" }
2324
chrono = "0.4"
2425
chrono-tz = "0.10"
2526
futures = "0.3"
2627
hex = "0.4"
27-
malachite-base = "0.4.16"
28-
malachite = "0.4.16"
29-
minicbor = { version = "0.25", features = ["std"] }
30-
redb = "2.2.0"
28+
#malachite-base = "0.4.16"
29+
#malachite = "0.4.16"
30+
minicbor = { version = "0.26", features = ["std"] }
31+
redb = "2.6.1"
3132
regex = "1.11"
3233
reqwest = { version = "0.12", default-features = false, features = ["blocking", "rustls-tls-webpki-roots", "rustls-tls", "json", "gzip", "deflate"] }
33-
rusqlite = { version = "0.32", features = ["bundled"] }
34+
rusqlite = { version = "0.37", features = ["bundled"] }
3435
serde = { version = "1.0", features = ["derive"] }
3536
serde-aux = "4.5"
3637
serde_cbor = "0.11"
3738
serde_json = "1.0"
38-
socket2 = "0.5"
39+
socket2 = "0.6"
3940
structopt = "0.3"
40-
rand = "0.8"
41+
rand = "0.9"
4142
rayon = "1.10"
42-
itertools = "0.13"
43+
itertools = "0.14"
4344
tokio = { version = "1", features = ["rt", "rt-multi-thread", "net", "io-util", "time", "sync", "macros"] }
44-
thiserror = "1.0"
45+
thiserror = "2.0"
4546
tracing = "0.1"
4647
tracing-subscriber = "0.3"
4748
uuid = { version = "1", features = ["v7"] }
48-
log = "0.4.22"
49+
log = "0.4"
4950

5051
[build-dependencies]
51-
built = { version = "0.7", features = ["git2"] }
52+
built = { version = "0.8", features = ["git2"] }

rust-toolchain.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[toolchain]
2+
channel = "nightly"

src/nodeclient/blockstore/mod.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ pub(crate) mod sqlite;
99
#[derive(Error, Debug)]
1010
pub enum Error {
1111
#[error("Redb error: {0}")]
12-
Redb(#[from] redb::Error),
12+
Redb(Box<redb::Error>),
1313

1414
#[error("Sqlite error: {0}")]
1515
Sqlite(#[from] sqlite::Error),
@@ -21,6 +21,12 @@ pub enum Error {
2121
Blockstore(String),
2222
}
2323

24+
impl From<redb::Error> for Error {
25+
fn from(err: redb::Error) -> Self {
26+
Error::Redb(Box::new(err))
27+
}
28+
}
29+
2430
pub(crate) struct Block {
2531
pub(crate) block_number: u64,
2632
pub(crate) slot_number: u64,

src/nodeclient/blockstore/redb.rs

Lines changed: 52 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -20,22 +20,22 @@ pub enum Error {
2020
Io(#[from] std::io::Error),
2121

2222
#[error("Redb error: {0}")]
23-
Redb(#[from] redb::Error),
23+
Redb(Box<redb::Error>),
2424

2525
#[error("Redb db error: {0}")]
26-
RedbDb(#[from] redb::DatabaseError),
26+
RedbDb(Box<redb::DatabaseError>),
2727

2828
#[error("Redb commit error: {0}")]
29-
RedbCommit(#[from] redb::CommitError),
29+
RedbCommit(Box<redb::CommitError>),
3030

3131
#[error("Redb transaction error: {0}")]
32-
RedbTransaction(#[from] redb::TransactionError),
32+
RedbTransaction(Box<redb::TransactionError>),
3333

3434
#[error("Redb table error: {0}")]
35-
RedbTable(#[from] redb::TableError),
35+
RedbTable(Box<redb::TableError>),
3636

3737
#[error("Redb storage error: {0}")]
38-
RedbStorage(#[from] redb::StorageError),
38+
RedbStorage(Box<redb::StorageError>),
3939

4040
#[error("FromHex error: {0}")]
4141
FromHex(#[from] hex::FromHexError),
@@ -44,7 +44,43 @@ pub enum Error {
4444
DataNotFound,
4545
}
4646

47-
#[derive(Debug, Clone, Serialize, Deserialize)]
47+
impl From<redb::Error> for Error {
48+
fn from(err: redb::Error) -> Self {
49+
Error::Redb(Box::new(err))
50+
}
51+
}
52+
53+
impl From<redb::DatabaseError> for Error {
54+
fn from(err: redb::DatabaseError) -> Self {
55+
Error::RedbDb(Box::new(err))
56+
}
57+
}
58+
59+
impl From<redb::CommitError> for Error {
60+
fn from(err: redb::CommitError) -> Self {
61+
Error::RedbCommit(Box::new(err))
62+
}
63+
}
64+
65+
impl From<redb::TransactionError> for Error {
66+
fn from(err: redb::TransactionError) -> Self {
67+
Error::RedbTransaction(Box::new(err))
68+
}
69+
}
70+
71+
impl From<redb::TableError> for Error {
72+
fn from(err: redb::TableError) -> Self {
73+
Error::RedbTable(Box::new(err))
74+
}
75+
}
76+
77+
impl From<redb::StorageError> for Error {
78+
fn from(err: redb::StorageError) -> Self {
79+
Error::RedbStorage(Box::new(err))
80+
}
81+
}
82+
83+
#[derive(Debug, Clone, Serialize, Deserialize, bincode::Encode, bincode::Decode)]
4884
struct ChainRecord {
4985
block_number: u64,
5086
slot_number: u64,
@@ -73,7 +109,8 @@ struct ChainRecord {
73109

74110
impl Value for ChainRecord {
75111
type SelfType<'a> = Self;
76-
type AsBytes<'a> = Vec<u8>
112+
type AsBytes<'a>
113+
= Vec<u8>
77114
where
78115
Self: 'a;
79116

@@ -86,23 +123,23 @@ impl Value for ChainRecord {
86123
where
87124
Self: 'a,
88125
{
89-
bincode::deserialize(data).unwrap()
126+
bincode::decode_from_slice(data, bincode::config::legacy()).unwrap().0
90127
}
91128

92129
fn as_bytes<'a, 'b: 'a>(value: &'a Self::SelfType<'b>) -> Self::AsBytes<'a>
93130
where
94131
Self: 'a,
95132
Self: 'b,
96133
{
97-
bincode::serialize(value).unwrap()
134+
bincode::encode_to_vec(value, bincode::config::legacy()).unwrap()
98135
}
99136

100137
fn type_name() -> TypeName {
101138
TypeName::new(stringify!(ChainRecord))
102139
}
103140
}
104141

105-
#[derive(Debug, Clone, Serialize, Deserialize)]
142+
#[derive(Debug, Clone, Serialize, Deserialize, bincode::Encode, bincode::Decode)]
106143
struct SlotsRecord {
107144
epoch: u64,
108145
pool_id: Vec<u8>,
@@ -113,7 +150,8 @@ struct SlotsRecord {
113150

114151
impl Value for SlotsRecord {
115152
type SelfType<'a> = Self;
116-
type AsBytes<'a> = Vec<u8>
153+
type AsBytes<'a>
154+
= Vec<u8>
117155
where
118156
Self: 'a;
119157

@@ -126,15 +164,15 @@ impl Value for SlotsRecord {
126164
where
127165
Self: 'a,
128166
{
129-
bincode::deserialize(data).unwrap()
167+
bincode::decode_from_slice(data, bincode::config::legacy()).unwrap().0
130168
}
131169

132170
fn as_bytes<'a, 'b: 'a>(value: &'a Self::SelfType<'b>) -> Self::AsBytes<'a>
133171
where
134172
Self: 'a,
135173
Self: 'b,
136174
{
137-
bincode::serialize(value).unwrap()
175+
bincode::encode_to_vec(value, bincode::config::legacy()).unwrap()
138176
}
139177

140178
fn type_name() -> TypeName {

src/nodeclient/leaderlog/mod.rs

Lines changed: 30 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,26 @@
1-
use std::fmt::Display;
2-
use std::fs::File;
3-
use std::io::{stdout, BufReader};
4-
use std::path::Path;
5-
use std::str::FromStr;
6-
71
use crate::nodeclient::blockstore;
82
use crate::nodeclient::blockstore::redb::{is_redb_database, RedbBlockStore};
93
use crate::nodeclient::blockstore::sqlite::SqLiteBlockStore;
104
use crate::nodeclient::blockstore::BlockStore;
115
use crate::nodeclient::leaderlog::deserialize::cbor_hex;
126
use crate::nodeclient::leaderlog::ledgerstate::calculate_ledger_state_sigma_d_and_extra_entropy;
137
use crate::{LedgerSet, PooltoolConfig};
8+
use amaru_ouroboros::vrf::{Input, Proof, SecretKey};
9+
use amaru_ouroboros::Hash;
1410
use chrono::{DateTime, NaiveDateTime, TimeDelta, TimeZone, Utc};
1511
use chrono_tz::Tz;
1612
use itertools::sorted;
17-
use pallas_crypto::hash::{Hash, Hasher};
13+
use pallas_crypto::hash::Hasher;
1814
use pallas_crypto::nonce::generate_epoch_nonce;
19-
use pallas_crypto::vrf::{VrfSecretKey, VRF_SECRET_KEY_SIZE};
2015
use pallas_math::math::{ExpOrdering, FixedDecimal, FixedPrecision, DEFAULT_PRECISION};
2116
use rayon::prelude::*;
2217
use serde::{Deserialize, Serialize};
2318
use serde_aux::prelude::deserialize_number_from_string;
19+
use std::fmt::Display;
20+
use std::fs::File;
21+
use std::io::{stdout, BufReader};
22+
use std::path::Path;
23+
use std::str::FromStr;
2424
use thiserror::Error;
2525
use tracing::{debug, error, info, span, trace, Level};
2626

@@ -48,10 +48,10 @@ pub enum Error {
4848
Leaderlog(String),
4949

5050
#[error("Blockstore error: {0}")]
51-
Blockstore(#[from] blockstore::Error),
51+
Blockstore(Box<blockstore::Error>),
5252

5353
#[error("Redb error: {0}")]
54-
Redb(#[from] blockstore::redb::Error),
54+
Redb(Box<blockstore::redb::Error>),
5555

5656
#[error("Sqlite error: {0}")]
5757
Sqlite(#[from] blockstore::sqlite::Error),
@@ -60,6 +60,18 @@ pub enum Error {
6060
ParseFloat(#[from] std::num::ParseFloatError),
6161
}
6262

63+
impl From<blockstore::Error> for Error {
64+
fn from(err: blockstore::Error) -> Self {
65+
Error::Blockstore(Box::new(err))
66+
}
67+
}
68+
69+
impl From<blockstore::redb::Error> for Error {
70+
fn from(err: blockstore::redb::Error) -> Self {
71+
Error::Redb(Box::new(err))
72+
}
73+
}
74+
6375
#[derive(Debug, Serialize)]
6476
#[serde(rename_all = "camelCase")]
6577
struct LeaderLogError {
@@ -293,10 +305,12 @@ fn mk_input_vrf(slot: u64, eta0: &[u8]) -> Vec<u8> {
293305
}
294306

295307
fn vrf_eval_certified(seed: &[u8], pool_vrf_skey: &[u8]) -> Result<Hash<64>, Error> {
296-
let vrf_skey: [u8; VRF_SECRET_KEY_SIZE] = pool_vrf_skey[..VRF_SECRET_KEY_SIZE].try_into().expect("Infallible");
297-
let vrf_skey: VrfSecretKey = VrfSecretKey::from(&vrf_skey);
298-
let certified_proof = vrf_skey.prove(seed);
299-
let certified_proof_hash = certified_proof.to_hash();
308+
let vrf_skey: &[u8; SecretKey::SIZE] = pool_vrf_skey[..SecretKey::SIZE].try_into().expect("Infallible");
309+
let vrf_skey = SecretKey::from(vrf_skey);
310+
let input_bytes: &[u8; Input::SIZE] = seed[..Input::SIZE].try_into().expect("Infallible");
311+
let input: Input = Input::from(input_bytes);
312+
let certified_proof: Proof = vrf_skey.prove(&input);
313+
let certified_proof_hash: Hash<{ Proof::HASH_SIZE }> = Hash::<{ Proof::HASH_SIZE }>::from(&certified_proof);
300314
trace!("certified_proof_hash: {}", hex::encode(certified_proof_hash));
301315
Ok(certified_proof_hash)
302316
}
@@ -578,10 +592,10 @@ pub(crate) fn calculate_leader_logs(
578592
)));
579593
}
580594

581-
let nc: Hash<32> = block_store.get_eta_v_before_slot(stability_window_start)?;
595+
let nc = block_store.get_eta_v_before_slot(stability_window_start)?;
582596
debug!("nc: {}", nc);
583597

584-
let nh: Hash<32> = block_store.get_prev_hash_before_slot(first_slot_of_prev_epoch)?;
598+
let nh = block_store.get_prev_hash_before_slot(first_slot_of_prev_epoch)?;
585599
debug!("nh: {}", nh);
586600

587601
debug!("extra_entropy: {:?}", &ledger_info.extra_entropy);

src/nodeclient/ping/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ mod tests {
162162
let regex = Regex::new(regex_str);
163163
let ping_result = std::str::from_utf8(&stdout).unwrap();
164164
// println!("ping_result: {}", ping_result);
165-
assert_eq!(regex.unwrap().is_match(ping_result), true);
165+
assert!(regex.unwrap().is_match(ping_result));
166166
}
167167

168168
#[tokio::test]
@@ -178,7 +178,7 @@ mod tests {
178178
let regex = Regex::new(regex_str);
179179
let ping_result = std::str::from_utf8(&stdout).unwrap();
180180
println!("ping_result: {}", ping_result);
181-
assert_eq!(regex.unwrap().is_match(ping_result), true);
181+
assert!(regex.unwrap().is_match(ping_result));
182182
}
183183

184184
#[tokio::test]

0 commit comments

Comments
 (0)