Skip to content

Commit

Permalink
chore: upgrad
Browse files Browse the repository at this point in the history
  • Loading branch information
driftluo committed Oct 25, 2024
1 parent c49fdbf commit 1cfea3d
Show file tree
Hide file tree
Showing 6 changed files with 56 additions and 30 deletions.
72 changes: 49 additions & 23 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 network/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ bs58 = { version = "0.5.0", optional = true }
sentry = { version = "0.34.0", optional = true }
faster-hex = { version = "0.6", optional = true }
ckb-hash = { path = "../util/hash", version = "= 0.119.0-pre" }
secp256k1 = { version = "0.29", features = ["recovery"], optional = true }
secp256k1 = { version = "0.30", features = ["recovery"], optional = true }
trust-dns-resolver = { version = "0.23", optional = true }
snap = "1"
ckb-types = { path = "../util/types", version = "= 0.119.0-pre" }
Expand All @@ -36,7 +36,7 @@ ckb-spawn = { path = "../util/spawn", version = "= 0.119.0-pre" }
socket2 = "0.5"
bitflags = "1.0"

p2p = { version = "0.6.1", package = "tentacle", features = [
p2p = { version = "0.6.2", package = "tentacle", features = [
"upnp",
"parking_lot",
"openssl-vendored",
Expand Down
2 changes: 1 addition & 1 deletion network/src/services/dns_seeding/seed_record.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ impl SeedRecord {
return Err(SeedRecordError::InvalidRecord);
}

let recid = RecoveryId::from_i32(i32::from(sig[64]))
let recid = RecoveryId::try_from(i32::from(sig[64]))
.map_err(|_| SeedRecordError::InvalidSignature)?;
let signature = RecoverableSignature::from_compact(&sig[0..64], recid)
.map_err(|_| SeedRecordError::InvalidSignature)?;
Expand Down
2 changes: 1 addition & 1 deletion network/src/services/dns_seeding/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ impl SeedRecord {
let (recid, signed_data) = signature.serialize_compact();
let mut sig = [0u8; 65];
sig[0..64].copy_from_slice(&signed_data[0..64]);
sig[64] = recid.to_i32() as u8;
sig[64] = Into::<i32>::into(rec_id) as u8;
let signature_string = bs58::encode(&sig[..]).into_string();
Ok([data, signature_string].join(&SEP.to_string()))
}
Expand Down
2 changes: 1 addition & 1 deletion util/crypto/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ repository = "https://github.com/nervosnetwork/ckb"

[dependencies]
ckb-fixed-hash = { path = "../fixed-hash", version = "= 0.119.0-pre" }
secp256k1 = { version = "0.29", features = ["recovery"], optional = true }
secp256k1 = { version = "0.30", features = ["recovery"], optional = true }
thiserror = "1.0.22"
rand = { version = "0.8", features = ["small_rng"] }
faster-hex = "0.6"
Expand Down
4 changes: 2 additions & 2 deletions util/crypto/src/secp/signature.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ impl Signature {
pub fn from_compact(rec_id: RecoveryId, ret: [u8; 64]) -> Self {
let mut data = [0; 65];
data[0..64].copy_from_slice(&ret[0..64]);
data[64] = rec_id.to_i32() as u8;
data[64] = Into::<i32>::into(rec_id) as u8;
Signature(data)
}

Expand Down Expand Up @@ -79,7 +79,7 @@ impl Signature {

/// Converts compact signature to a recoverable signature
pub fn to_recoverable(&self) -> Result<RecoverableSignature, Error> {
let recovery_id = RecoveryId::from_i32(i32::from(self.0[64]))?;
let recovery_id = RecoveryId::try_from(i32::from(self.0[64]))?;
Ok(RecoverableSignature::from_compact(
&self.0[0..64],
recovery_id,
Expand Down

0 comments on commit 1cfea3d

Please sign in to comment.