Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[current/v5.3.x] 5.3.x Version of Rust 1.80 updates #3797

Merged
merged 11 commits into from
Sep 16, 2024
File renamed without changes.
1,014 changes: 579 additions & 435 deletions Cargo.lock

Large diffs are not rendered by default.

28 changes: 14 additions & 14 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "grin"
version = "5.3.2"
version = "5.3.3"
authors = ["Grin Developers <mimblewimble@lists.launchpad.net>"]
description = "Simple, private and scalable cryptocurrency implementation based on the Mimblewimble chain format."
license = "Apache-2.0"
Expand All @@ -24,31 +24,31 @@ blake2-rfc = "0.2"
chrono = "0.4.11"
clap = { version = "2.33", features = ["yaml"] }
ctrlc = { version = "3.1", features = ["termination"] }
cursive_table_view = "0.14.0"
cursive_table_view = "0.15.0"
humansize = "1.1.0"
serde = "1"
futures = "0.3.19"
serde_json = "1"
log = "0.4"
term = "0.6"

grin_api = { path = "./api", version = "5.3.2" }
grin_config = { path = "./config", version = "5.3.2" }
grin_chain = { path = "./chain", version = "5.3.2" }
grin_core = { path = "./core", version = "5.3.2" }
grin_keychain = { path = "./keychain", version = "5.3.2" }
grin_p2p = { path = "./p2p", version = "5.3.2" }
grin_servers = { path = "./servers", version = "5.3.2" }
grin_util = { path = "./util", version = "5.3.2" }
grin_api = { path = "./api", version = "5.3.3" }
grin_config = { path = "./config", version = "5.3.3" }
grin_chain = { path = "./chain", version = "5.3.3" }
grin_core = { path = "./core", version = "5.3.3" }
grin_keychain = { path = "./keychain", version = "5.3.3" }
grin_p2p = { path = "./p2p", version = "5.3.3" }
grin_servers = { path = "./servers", version = "5.3.3" }
grin_util = { path = "./util", version = "5.3.3" }

[dependencies.cursive]
version = "0.20"
version = "0.21"
default-features = false
features = ["pancurses-backend"]

[build-dependencies]
built = { version = "0.4", features = ["git2"]}
built = { version = "0.7", features = ["git2"]}

[dev-dependencies]
grin_chain = { path = "./chain", version = "5.3.2" }
grin_store = { path = "./store", version = "5.3.2" }
grin_chain = { path = "./chain", version = "5.3.3" }
grin_store = { path = "./store", version = "5.3.3" }
14 changes: 7 additions & 7 deletions api/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "grin_api"
version = "5.3.2"
version = "5.3.3"
authors = ["Grin Developers <mimblewimble@lists.launchpad.net>"]
description = "APIs for grin, a simple, private and scalable cryptocurrency implementation based on the Mimblewimble chain format."
license = "Apache-2.0"
Expand Down Expand Up @@ -30,9 +30,9 @@ rustls = "0.17"
url = "2.1"
bytes = "0.5"

grin_core = { path = "../core", version = "5.3.2" }
grin_chain = { path = "../chain", version = "5.3.2" }
grin_p2p = { path = "../p2p", version = "5.3.2" }
grin_pool = { path = "../pool", version = "5.3.2" }
grin_store = { path = "../store", version = "5.3.2" }
grin_util = { path = "../util", version = "5.3.2" }
grin_core = { path = "../core", version = "5.3.3" }
grin_chain = { path = "../chain", version = "5.3.3" }
grin_p2p = { path = "../p2p", version = "5.3.3" }
grin_pool = { path = "../pool", version = "5.3.3" }
grin_store = { path = "../store", version = "5.3.3" }
grin_util = { path = "../util", version = "5.3.3" }
1 change: 1 addition & 0 deletions api/src/owner_rpc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ pub trait OwnerRpc: Sync + Send {
"jsonrpc": "2.0",
"result": {
"Ok": {
"chain": "main",
"protocol_version": "2",
"user_agent": "MW/Grin 2.x.x",
"connections": "8",
Expand Down
5 changes: 4 additions & 1 deletion api/src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ use crate::chain;
use crate::core::core::hash::Hashed;
use crate::core::core::merkle_proof::MerkleProof;
use crate::core::core::{FeeFields, KernelFeatures, TxKernel};
use crate::core::{core, ser};
use crate::core::{core, global, ser};
use crate::p2p;
use crate::util::secp::pedersen;
use crate::util::{self, ToHex};
Expand Down Expand Up @@ -68,6 +68,8 @@ impl Tip {
/// Status page containing different server information
#[derive(Serialize, Deserialize, Debug, Clone)]
pub struct Status {
// The chain type
pub chain: String,
// The protocol version
pub protocol_version: u32,
// The user user agent
Expand All @@ -91,6 +93,7 @@ impl Status {
sync_info: Option<serde_json::Value>,
) -> Status {
Status {
chain: global::get_chain_type().shortname(),
protocol_version: ser::ProtocolVersion::local().into(),
user_agent: p2p::msg::USER_AGENT.to_string(),
connections: connections,
Expand Down
10 changes: 5 additions & 5 deletions chain/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "grin_chain"
version = "5.3.2"
version = "5.3.3"
authors = ["Grin Developers <mimblewimble@lists.launchpad.net>"]
description = "Chain implementation for grin, a simple, private and scalable cryptocurrency implementation based on the Mimblewimble chain format."
license = "Apache-2.0"
Expand All @@ -23,10 +23,10 @@ chrono = "0.4.11"
lru-cache = "0.1"
lazy_static = "1"

grin_core = { path = "../core", version = "5.3.2" }
grin_keychain = { path = "../keychain", version = "5.3.2" }
grin_store = { path = "../store", version = "5.3.2" }
grin_util = { path = "../util", version = "5.3.2" }
grin_core = { path = "../core", version = "5.3.3" }
grin_keychain = { path = "../keychain", version = "5.3.3" }
grin_store = { path = "../store", version = "5.3.3" }
grin_util = { path = "../util", version = "5.3.3" }

[dev-dependencies]
env_logger = "0.7"
Expand Down
2 changes: 2 additions & 0 deletions chain/tests/chain_test_helper.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ use grin_keychain as keychain;
use std::fs;
use std::sync::Arc;

#[allow(dead_code)]
#[cfg(test)]
pub fn clean_output_dir(dir_name: &str) {
let _ = fs::remove_dir_all(dir_name);
}
Expand Down
10 changes: 5 additions & 5 deletions config/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "grin_config"
version = "5.3.2"
version = "5.3.3"
authors = ["Grin Developers <mimblewimble@lists.launchpad.net>"]
description = "Configuration for grin, a simple, private and scalable cryptocurrency implementation based on the Mimblewimble chain format."
license = "Apache-2.0"
Expand All @@ -16,10 +16,10 @@ serde_derive = "1"
toml = "0.5"
dirs = "2.0"

grin_core = { path = "../core", version = "5.3.2" }
grin_servers = { path = "../servers", version = "5.3.2" }
grin_p2p = { path = "../p2p", version = "5.3.2" }
grin_util = { path = "../util", version = "5.3.2" }
grin_core = { path = "../core", version = "5.3.3" }
grin_servers = { path = "../servers", version = "5.3.3" }
grin_p2p = { path = "../p2p", version = "5.3.3" }
grin_util = { path = "../util", version = "5.3.3" }

[dev-dependencies]
pretty_assertions = "0.6.1"
6 changes: 3 additions & 3 deletions core/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "grin_core"
version = "5.3.2"
version = "5.3.3"
authors = ["Grin Developers <mimblewimble@lists.launchpad.net>"]
description = "Chain implementation for grin, a simple, private and scalable cryptocurrency implementation based on the Mimblewimble chain format."
license = "Apache-2.0"
Expand Down Expand Up @@ -28,8 +28,8 @@ chrono = { version = "0.4.11", features = ["serde"] }
zeroize = { version = "1.1", features =["zeroize_derive"] }
bytes = "0.5"

keychain = { package = "grin_keychain", path = "../keychain", version = "5.3.2" }
util = { package = "grin_util", path = "../util", version = "5.3.2" }
keychain = { package = "grin_keychain", path = "../keychain", version = "5.3.3" }
util = { package = "grin_util", path = "../util", version = "5.3.3" }

[dev-dependencies]
serde_json = "1"
14 changes: 8 additions & 6 deletions core/src/core/block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ use crate::pow::{verify_size, Difficulty, Proof, ProofOfWork};
use crate::ser::{
self, deserialize_default, serialize_default, PMMRable, Readable, Reader, Writeable, Writer,
};
use chrono::prelude::{DateTime, NaiveDateTime, Utc};
use chrono::prelude::{DateTime, Utc};
use chrono::Duration;
use keychain::{self, BlindingFactor};
use std::convert::TryInto;
Expand Down Expand Up @@ -232,7 +232,7 @@ impl Default for BlockHeader {
version: HeaderVersion(1),
height: 0,
timestamp: DateTime::from_naive_utc_and_offset(
NaiveDateTime::from_timestamp_opt(0, 0).unwrap(),
DateTime::<Utc>::from_timestamp(0, 0).unwrap().naive_utc(),
Utc,
),
prev_hash: ZERO_HASH,
Expand Down Expand Up @@ -295,25 +295,27 @@ fn read_block_header<R: Reader>(reader: &mut R) -> Result<BlockHeader, ser::Erro
> chrono::NaiveDate::MAX
.and_hms_opt(0, 0, 0)
.unwrap()
.and_utc()
.timestamp()
|| timestamp
< chrono::NaiveDate::MIN
.and_hms_opt(0, 0, 0)
.unwrap()
.and_utc()
.timestamp()
{
return Err(ser::Error::CorruptedData);
}

let ts = NaiveDateTime::from_timestamp_opt(timestamp, 0);
let ts = DateTime::<Utc>::from_timestamp(timestamp, 0);
if ts.is_none() {
return Err(ser::Error::CorruptedData);
}

Ok(BlockHeader {
version,
height,
timestamp: DateTime::from_naive_utc_and_offset(ts.unwrap(), Utc),
timestamp: DateTime::from_naive_utc_and_offset(ts.unwrap().naive_utc(), Utc),
prev_hash,
prev_root,
output_root,
Expand Down Expand Up @@ -662,12 +664,12 @@ impl Block {

let now = Utc::now().timestamp();

let ts = NaiveDateTime::from_timestamp_opt(now, 0);
let ts = DateTime::<Utc>::from_timestamp(now, 0);
if ts.is_none() {
return Err(Error::Other("Converting Utc::now() into timestamp".into()));
}

let timestamp = DateTime::from_naive_utc_and_offset(ts.unwrap(), Utc);
let timestamp = DateTime::from_naive_utc_and_offset(ts.unwrap().naive_utc(), Utc);
// Now build the block with all the above information.
// Note: We have not validated the block here.
// Caller must validate the block as necessary.
Expand Down
4 changes: 0 additions & 4 deletions core/src/genesis.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@
// required for genesis replacement
//! #![allow(unused_imports)]

#![cfg_attr(feature = "cargo-clippy", allow(clippy::unreadable_literal))]

use crate::core;
use crate::core::hash::Hash;
use crate::pow::{Difficulty, Proof, ProofOfWork};
Expand All @@ -44,7 +42,6 @@ pub fn genesis_dev() -> core::Block {
}

/// Testnet genesis block
#[allow(clippy::inconsistent_digit_grouping)]
pub fn genesis_test() -> core::Block {
let gen = core::Block::with_header(core::BlockHeader {
height: 0,
Expand Down Expand Up @@ -157,7 +154,6 @@ pub fn genesis_test() -> core::Block {
}

/// Mainnet genesis block
#[allow(clippy::inconsistent_digit_grouping)]
pub fn genesis_main() -> core::Block {
let gen = core::Block::with_header(core::BlockHeader {
height: 0,
Expand Down
4 changes: 2 additions & 2 deletions core/src/pow.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ pub use crate::pow::cuckaroom::{new_cuckaroom_ctx, CuckaroomContext};
pub use crate::pow::cuckarooz::{new_cuckarooz_ctx, CuckaroozContext};
pub use crate::pow::cuckatoo::{new_cuckatoo_ctx, CuckatooContext};
pub use crate::pow::error::Error;
use chrono::prelude::{DateTime, NaiveDateTime, Utc};
use chrono::prelude::{DateTime, Utc};

const MAX_SOLS: u32 = 10;

Expand Down Expand Up @@ -116,7 +116,7 @@ pub fn pow_size(
// well)
if bh.pow.nonce == start_nonce {
bh.timestamp = DateTime::from_naive_utc_and_offset(
NaiveDateTime::from_timestamp_opt(0, 0).unwrap(),
DateTime::<Utc>::from_timestamp(0, 0).unwrap().naive_utc(),
Utc,
);
}
Expand Down
2 changes: 0 additions & 2 deletions core/src/pow/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@ pub fn create_siphash_keys(header: &[u8]) -> Result<[u64; 4], Error> {
/// Utility struct to calculate commonly used Cuckoo parameters calculated
/// from header, nonce, edge_bits, etc.
pub struct CuckooParams {
pub edge_bits: u8,
pub proof_size: usize,
pub num_edges: u64,
pub siphash_keys: [u64; 4],
Expand All @@ -98,7 +97,6 @@ impl CuckooParams {
let num_nodes = 1u64 << node_bits;
let node_mask = num_nodes - 1;
Ok(CuckooParams {
edge_bits,
proof_size,
num_edges,
siphash_keys: [0; 4],
Expand Down
4 changes: 2 additions & 2 deletions core/tests/pmmr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,11 @@ fn bench_peak_map() {
let increments = vec![1_000_000u64, 10_000_000u64, 100_000_000u64];

for v in increments {
let start = Utc::now().timestamp_nanos();
let start = Utc::now().timestamp_nanos_opt().unwrap();
for i in 0..v {
let _ = pmmr::peak_map_height(i);
}
let fin = Utc::now().timestamp_nanos();
let fin = Utc::now().timestamp_nanos_opt().unwrap();
let dur_ms = (fin - start) as f64 * nano_to_millis;
println!("{:9?} peak_map_height() in {:9.3?}ms", v, dur_ms);
}
Expand Down
4 changes: 2 additions & 2 deletions keychain/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "grin_keychain"
version = "5.3.2"
version = "5.3.3"
authors = ["Grin Developers <mimblewimble@lists.launchpad.net>"]
description = "Chain implementation for grin, a simple, private and scalable cryptocurrency implementation based on the Mimblewimble chain format."
license = "Apache-2.0"
Expand All @@ -26,4 +26,4 @@ ripemd160 = "0.9"
sha2 = "0.9"
pbkdf2 = "0.8"

grin_util = { path = "../util", version = "5.3.2" }
grin_util = { path = "../util", version = "5.3.3" }
33 changes: 0 additions & 33 deletions keychain/src/extkey_bip32.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@
//! Modified from above to integrate into grin and allow for different
//! hashing algorithms if desired

#[cfg(feature = "serde")]
use serde;
use std::default::Default;
use std::io::Cursor;
use std::str::FromStr;
Expand Down Expand Up @@ -276,26 +274,6 @@ impl fmt::Display for ChildNumber {
}
}

#[cfg(feature = "serde")]
impl<'de> serde::Deserialize<'de> for ChildNumber {
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
u32::deserialize(deserializer).map(ChildNumber::from)
}
}

#[cfg(feature = "serde")]
impl serde::Serialize for ChildNumber {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
u32::from(*self).serialize(serializer)
}
}

/// A BIP32 error
#[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)]
pub enum Error {
Expand Down Expand Up @@ -875,15 +853,4 @@ mod tests {
"xprv9uPDJpEQgRQfDcW7BkF7eTya6RPxXeJCqCJGHuCJ4GiRVLzkTXBAJMu2qaMWPrS7AANYqdq6vcBcBUdJCVVFceUvJFjaPdGZ2y9WACViL4L",
"xpub68NZiKmJWnxxS6aaHmn81bvJeTESw724CRDs6HbuccFQN9Ku14VQrADWgqbhhTHBaohPX4CjNLf9fq9MYo6oDaPPLPxSb7gwQN3ih19Zm4Y");
}

#[test]
#[cfg(all(feature = "serde", feature = "strason"))]
pub fn encode_decode_childnumber() {
serde_round_trip!(ChildNumber::from_normal_idx(0));
serde_round_trip!(ChildNumber::from_normal_idx(1));
serde_round_trip!(ChildNumber::from_normal_idx((1 << 31) - 1));
serde_round_trip!(ChildNumber::from_hardened_idx(0));
serde_round_trip!(ChildNumber::from_hardened_idx(1));
serde_round_trip!(ChildNumber::from_hardened_idx((1 << 31) - 1));
}
}
Loading
Loading