Skip to content

Commit bd98d17

Browse files
yeastplumeaglkm
andauthored
[current/v5.3.x] 5.3.x Version of Rust 1.80 updates (#3797)
* Update grin_secp to 0.7.14 (#3788) * Update versioning on master to 5.4.0-alpha.0 * Update versioning on master to 5.4.0-alpha.0 (#3789) * Remove Merkle Proof Generation from Foreign API `get_outputs` (#3792) * Update versioning on master to 5.4.0-alpha.0 * Remove merkle proof generation from foreign API * Rust 1.80+ fixes & accumulated warning cleanup (#3796) * Update versioning on master to 5.4.0-alpha.0 * updates for 1.80 and other accumulated warnings * further warning cleanups * move dead code tag to function defn rather than module * Chain type field (#3790) * Adding chain type field into get_status rpc * formatting * update version for next build --------- Co-authored-by: aglkm <39521015+aglkm@users.noreply.github.com>
1 parent 7f7d063 commit bd98d17

File tree

28 files changed

+682
-569
lines changed

28 files changed

+682
-569
lines changed
File renamed without changes.

Cargo.lock

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

Cargo.toml

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "grin"
3-
version = "5.3.2"
3+
version = "5.3.3"
44
authors = ["Grin Developers <mimblewimble@lists.launchpad.net>"]
55
description = "Simple, private and scalable cryptocurrency implementation based on the Mimblewimble chain format."
66
license = "Apache-2.0"
@@ -24,31 +24,31 @@ blake2-rfc = "0.2"
2424
chrono = "0.4.11"
2525
clap = { version = "2.33", features = ["yaml"] }
2626
ctrlc = { version = "3.1", features = ["termination"] }
27-
cursive_table_view = "0.14.0"
27+
cursive_table_view = "0.15.0"
2828
humansize = "1.1.0"
2929
serde = "1"
3030
futures = "0.3.19"
3131
serde_json = "1"
3232
log = "0.4"
3333
term = "0.6"
3434

35-
grin_api = { path = "./api", version = "5.3.2" }
36-
grin_config = { path = "./config", version = "5.3.2" }
37-
grin_chain = { path = "./chain", version = "5.3.2" }
38-
grin_core = { path = "./core", version = "5.3.2" }
39-
grin_keychain = { path = "./keychain", version = "5.3.2" }
40-
grin_p2p = { path = "./p2p", version = "5.3.2" }
41-
grin_servers = { path = "./servers", version = "5.3.2" }
42-
grin_util = { path = "./util", version = "5.3.2" }
35+
grin_api = { path = "./api", version = "5.3.3" }
36+
grin_config = { path = "./config", version = "5.3.3" }
37+
grin_chain = { path = "./chain", version = "5.3.3" }
38+
grin_core = { path = "./core", version = "5.3.3" }
39+
grin_keychain = { path = "./keychain", version = "5.3.3" }
40+
grin_p2p = { path = "./p2p", version = "5.3.3" }
41+
grin_servers = { path = "./servers", version = "5.3.3" }
42+
grin_util = { path = "./util", version = "5.3.3" }
4343

4444
[dependencies.cursive]
45-
version = "0.20"
45+
version = "0.21"
4646
default-features = false
4747
features = ["pancurses-backend"]
4848

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

5252
[dev-dependencies]
53-
grin_chain = { path = "./chain", version = "5.3.2" }
54-
grin_store = { path = "./store", version = "5.3.2" }
53+
grin_chain = { path = "./chain", version = "5.3.3" }
54+
grin_store = { path = "./store", version = "5.3.3" }

api/Cargo.toml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "grin_api"
3-
version = "5.3.2"
3+
version = "5.3.3"
44
authors = ["Grin Developers <mimblewimble@lists.launchpad.net>"]
55
description = "APIs for grin, a simple, private and scalable cryptocurrency implementation based on the Mimblewimble chain format."
66
license = "Apache-2.0"
@@ -30,9 +30,9 @@ rustls = "0.17"
3030
url = "2.1"
3131
bytes = "0.5"
3232

33-
grin_core = { path = "../core", version = "5.3.2" }
34-
grin_chain = { path = "../chain", version = "5.3.2" }
35-
grin_p2p = { path = "../p2p", version = "5.3.2" }
36-
grin_pool = { path = "../pool", version = "5.3.2" }
37-
grin_store = { path = "../store", version = "5.3.2" }
38-
grin_util = { path = "../util", version = "5.3.2" }
33+
grin_core = { path = "../core", version = "5.3.3" }
34+
grin_chain = { path = "../chain", version = "5.3.3" }
35+
grin_p2p = { path = "../p2p", version = "5.3.3" }
36+
grin_pool = { path = "../pool", version = "5.3.3" }
37+
grin_store = { path = "../store", version = "5.3.3" }
38+
grin_util = { path = "../util", version = "5.3.3" }

api/src/owner_rpc.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ pub trait OwnerRpc: Sync + Send {
4949
"jsonrpc": "2.0",
5050
"result": {
5151
"Ok": {
52+
"chain": "main",
5253
"protocol_version": "2",
5354
"user_agent": "MW/Grin 2.x.x",
5455
"connections": "8",

api/src/types.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ use crate::chain;
1616
use crate::core::core::hash::Hashed;
1717
use crate::core::core::merkle_proof::MerkleProof;
1818
use crate::core::core::{FeeFields, KernelFeatures, TxKernel};
19-
use crate::core::{core, ser};
19+
use crate::core::{core, global, ser};
2020
use crate::p2p;
2121
use crate::util::secp::pedersen;
2222
use crate::util::{self, ToHex};
@@ -68,6 +68,8 @@ impl Tip {
6868
/// Status page containing different server information
6969
#[derive(Serialize, Deserialize, Debug, Clone)]
7070
pub struct Status {
71+
// The chain type
72+
pub chain: String,
7173
// The protocol version
7274
pub protocol_version: u32,
7375
// The user user agent
@@ -91,6 +93,7 @@ impl Status {
9193
sync_info: Option<serde_json::Value>,
9294
) -> Status {
9395
Status {
96+
chain: global::get_chain_type().shortname(),
9497
protocol_version: ser::ProtocolVersion::local().into(),
9598
user_agent: p2p::msg::USER_AGENT.to_string(),
9699
connections: connections,

chain/Cargo.toml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "grin_chain"
3-
version = "5.3.2"
3+
version = "5.3.3"
44
authors = ["Grin Developers <mimblewimble@lists.launchpad.net>"]
55
description = "Chain implementation for grin, a simple, private and scalable cryptocurrency implementation based on the Mimblewimble chain format."
66
license = "Apache-2.0"
@@ -23,10 +23,10 @@ chrono = "0.4.11"
2323
lru-cache = "0.1"
2424
lazy_static = "1"
2525

26-
grin_core = { path = "../core", version = "5.3.2" }
27-
grin_keychain = { path = "../keychain", version = "5.3.2" }
28-
grin_store = { path = "../store", version = "5.3.2" }
29-
grin_util = { path = "../util", version = "5.3.2" }
26+
grin_core = { path = "../core", version = "5.3.3" }
27+
grin_keychain = { path = "../keychain", version = "5.3.3" }
28+
grin_store = { path = "../store", version = "5.3.3" }
29+
grin_util = { path = "../util", version = "5.3.3" }
3030

3131
[dev-dependencies]
3232
env_logger = "0.7"

chain/tests/chain_test_helper.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ use grin_keychain as keychain;
2929
use std::fs;
3030
use std::sync::Arc;
3131

32+
#[allow(dead_code)]
33+
#[cfg(test)]
3234
pub fn clean_output_dir(dir_name: &str) {
3335
let _ = fs::remove_dir_all(dir_name);
3436
}

config/Cargo.toml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "grin_config"
3-
version = "5.3.2"
3+
version = "5.3.3"
44
authors = ["Grin Developers <mimblewimble@lists.launchpad.net>"]
55
description = "Configuration for grin, a simple, private and scalable cryptocurrency implementation based on the Mimblewimble chain format."
66
license = "Apache-2.0"
@@ -16,10 +16,10 @@ serde_derive = "1"
1616
toml = "0.5"
1717
dirs = "2.0"
1818

19-
grin_core = { path = "../core", version = "5.3.2" }
20-
grin_servers = { path = "../servers", version = "5.3.2" }
21-
grin_p2p = { path = "../p2p", version = "5.3.2" }
22-
grin_util = { path = "../util", version = "5.3.2" }
19+
grin_core = { path = "../core", version = "5.3.3" }
20+
grin_servers = { path = "../servers", version = "5.3.3" }
21+
grin_p2p = { path = "../p2p", version = "5.3.3" }
22+
grin_util = { path = "../util", version = "5.3.3" }
2323

2424
[dev-dependencies]
2525
pretty_assertions = "0.6.1"

core/Cargo.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "grin_core"
3-
version = "5.3.2"
3+
version = "5.3.3"
44
authors = ["Grin Developers <mimblewimble@lists.launchpad.net>"]
55
description = "Chain implementation for grin, a simple, private and scalable cryptocurrency implementation based on the Mimblewimble chain format."
66
license = "Apache-2.0"
@@ -28,8 +28,8 @@ chrono = { version = "0.4.11", features = ["serde"] }
2828
zeroize = { version = "1.1", features =["zeroize_derive"] }
2929
bytes = "0.5"
3030

31-
keychain = { package = "grin_keychain", path = "../keychain", version = "5.3.2" }
32-
util = { package = "grin_util", path = "../util", version = "5.3.2" }
31+
keychain = { package = "grin_keychain", path = "../keychain", version = "5.3.3" }
32+
util = { package = "grin_util", path = "../util", version = "5.3.3" }
3333

3434
[dev-dependencies]
3535
serde_json = "1"

core/src/core/block.rs

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ use crate::pow::{verify_size, Difficulty, Proof, ProofOfWork};
2727
use crate::ser::{
2828
self, deserialize_default, serialize_default, PMMRable, Readable, Reader, Writeable, Writer,
2929
};
30-
use chrono::prelude::{DateTime, NaiveDateTime, Utc};
30+
use chrono::prelude::{DateTime, Utc};
3131
use chrono::Duration;
3232
use keychain::{self, BlindingFactor};
3333
use std::convert::TryInto;
@@ -232,7 +232,7 @@ impl Default for BlockHeader {
232232
version: HeaderVersion(1),
233233
height: 0,
234234
timestamp: DateTime::from_naive_utc_and_offset(
235-
NaiveDateTime::from_timestamp_opt(0, 0).unwrap(),
235+
DateTime::<Utc>::from_timestamp(0, 0).unwrap().naive_utc(),
236236
Utc,
237237
),
238238
prev_hash: ZERO_HASH,
@@ -295,25 +295,27 @@ fn read_block_header<R: Reader>(reader: &mut R) -> Result<BlockHeader, ser::Erro
295295
> chrono::NaiveDate::MAX
296296
.and_hms_opt(0, 0, 0)
297297
.unwrap()
298+
.and_utc()
298299
.timestamp()
299300
|| timestamp
300301
< chrono::NaiveDate::MIN
301302
.and_hms_opt(0, 0, 0)
302303
.unwrap()
304+
.and_utc()
303305
.timestamp()
304306
{
305307
return Err(ser::Error::CorruptedData);
306308
}
307309

308-
let ts = NaiveDateTime::from_timestamp_opt(timestamp, 0);
310+
let ts = DateTime::<Utc>::from_timestamp(timestamp, 0);
309311
if ts.is_none() {
310312
return Err(ser::Error::CorruptedData);
311313
}
312314

313315
Ok(BlockHeader {
314316
version,
315317
height,
316-
timestamp: DateTime::from_naive_utc_and_offset(ts.unwrap(), Utc),
318+
timestamp: DateTime::from_naive_utc_and_offset(ts.unwrap().naive_utc(), Utc),
317319
prev_hash,
318320
prev_root,
319321
output_root,
@@ -662,12 +664,12 @@ impl Block {
662664

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

665-
let ts = NaiveDateTime::from_timestamp_opt(now, 0);
667+
let ts = DateTime::<Utc>::from_timestamp(now, 0);
666668
if ts.is_none() {
667669
return Err(Error::Other("Converting Utc::now() into timestamp".into()));
668670
}
669671

670-
let timestamp = DateTime::from_naive_utc_and_offset(ts.unwrap(), Utc);
672+
let timestamp = DateTime::from_naive_utc_and_offset(ts.unwrap().naive_utc(), Utc);
671673
// Now build the block with all the above information.
672674
// Note: We have not validated the block here.
673675
// Caller must validate the block as necessary.

core/src/genesis.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@
1717
// required for genesis replacement
1818
//! #![allow(unused_imports)]
1919
20-
#![cfg_attr(feature = "cargo-clippy", allow(clippy::unreadable_literal))]
21-
2220
use crate::core;
2321
use crate::core::hash::Hash;
2422
use crate::pow::{Difficulty, Proof, ProofOfWork};
@@ -44,7 +42,6 @@ pub fn genesis_dev() -> core::Block {
4442
}
4543

4644
/// Testnet genesis block
47-
#[allow(clippy::inconsistent_digit_grouping)]
4845
pub fn genesis_test() -> core::Block {
4946
let gen = core::Block::with_header(core::BlockHeader {
5047
height: 0,
@@ -157,7 +154,6 @@ pub fn genesis_test() -> core::Block {
157154
}
158155

159156
/// Mainnet genesis block
160-
#[allow(clippy::inconsistent_digit_grouping)]
161157
pub fn genesis_main() -> core::Block {
162158
let gen = core::Block::with_header(core::BlockHeader {
163159
height: 0,

core/src/pow.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ pub use crate::pow::cuckaroom::{new_cuckaroom_ctx, CuckaroomContext};
5353
pub use crate::pow::cuckarooz::{new_cuckarooz_ctx, CuckaroozContext};
5454
pub use crate::pow::cuckatoo::{new_cuckatoo_ctx, CuckatooContext};
5555
pub use crate::pow::error::Error;
56-
use chrono::prelude::{DateTime, NaiveDateTime, Utc};
56+
use chrono::prelude::{DateTime, Utc};
5757

5858
const MAX_SOLS: u32 = 10;
5959

@@ -116,7 +116,7 @@ pub fn pow_size(
116116
// well)
117117
if bh.pow.nonce == start_nonce {
118118
bh.timestamp = DateTime::from_naive_utc_and_offset(
119-
NaiveDateTime::from_timestamp_opt(0, 0).unwrap(),
119+
DateTime::<Utc>::from_timestamp(0, 0).unwrap().naive_utc(),
120120
Utc,
121121
);
122122
}

core/src/pow/common.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,6 @@ pub fn create_siphash_keys(header: &[u8]) -> Result<[u64; 4], Error> {
8282
/// Utility struct to calculate commonly used Cuckoo parameters calculated
8383
/// from header, nonce, edge_bits, etc.
8484
pub struct CuckooParams {
85-
pub edge_bits: u8,
8685
pub proof_size: usize,
8786
pub num_edges: u64,
8887
pub siphash_keys: [u64; 4],
@@ -98,7 +97,6 @@ impl CuckooParams {
9897
let num_nodes = 1u64 << node_bits;
9998
let node_mask = num_nodes - 1;
10099
Ok(CuckooParams {
101-
edge_bits,
102100
proof_size,
103101
num_edges,
104102
siphash_keys: [0; 4],

core/tests/pmmr.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,11 @@ fn bench_peak_map() {
4343
let increments = vec![1_000_000u64, 10_000_000u64, 100_000_000u64];
4444

4545
for v in increments {
46-
let start = Utc::now().timestamp_nanos();
46+
let start = Utc::now().timestamp_nanos_opt().unwrap();
4747
for i in 0..v {
4848
let _ = pmmr::peak_map_height(i);
4949
}
50-
let fin = Utc::now().timestamp_nanos();
50+
let fin = Utc::now().timestamp_nanos_opt().unwrap();
5151
let dur_ms = (fin - start) as f64 * nano_to_millis;
5252
println!("{:9?} peak_map_height() in {:9.3?}ms", v, dur_ms);
5353
}

keychain/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "grin_keychain"
3-
version = "5.3.2"
3+
version = "5.3.3"
44
authors = ["Grin Developers <mimblewimble@lists.launchpad.net>"]
55
description = "Chain implementation for grin, a simple, private and scalable cryptocurrency implementation based on the Mimblewimble chain format."
66
license = "Apache-2.0"
@@ -26,4 +26,4 @@ ripemd160 = "0.9"
2626
sha2 = "0.9"
2727
pbkdf2 = "0.8"
2828

29-
grin_util = { path = "../util", version = "5.3.2" }
29+
grin_util = { path = "../util", version = "5.3.3" }

keychain/src/extkey_bip32.rs

Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,6 @@
3030
//! Modified from above to integrate into grin and allow for different
3131
//! hashing algorithms if desired
3232
33-
#[cfg(feature = "serde")]
34-
use serde;
3533
use std::default::Default;
3634
use std::io::Cursor;
3735
use std::str::FromStr;
@@ -276,26 +274,6 @@ impl fmt::Display for ChildNumber {
276274
}
277275
}
278276

279-
#[cfg(feature = "serde")]
280-
impl<'de> serde::Deserialize<'de> for ChildNumber {
281-
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
282-
where
283-
D: serde::Deserializer<'de>,
284-
{
285-
u32::deserialize(deserializer).map(ChildNumber::from)
286-
}
287-
}
288-
289-
#[cfg(feature = "serde")]
290-
impl serde::Serialize for ChildNumber {
291-
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
292-
where
293-
S: serde::Serializer,
294-
{
295-
u32::from(*self).serialize(serializer)
296-
}
297-
}
298-
299277
/// A BIP32 error
300278
#[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)]
301279
pub enum Error {
@@ -875,15 +853,4 @@ mod tests {
875853
"xprv9uPDJpEQgRQfDcW7BkF7eTya6RPxXeJCqCJGHuCJ4GiRVLzkTXBAJMu2qaMWPrS7AANYqdq6vcBcBUdJCVVFceUvJFjaPdGZ2y9WACViL4L",
876854
"xpub68NZiKmJWnxxS6aaHmn81bvJeTESw724CRDs6HbuccFQN9Ku14VQrADWgqbhhTHBaohPX4CjNLf9fq9MYo6oDaPPLPxSb7gwQN3ih19Zm4Y");
877855
}
878-
879-
#[test]
880-
#[cfg(all(feature = "serde", feature = "strason"))]
881-
pub fn encode_decode_childnumber() {
882-
serde_round_trip!(ChildNumber::from_normal_idx(0));
883-
serde_round_trip!(ChildNumber::from_normal_idx(1));
884-
serde_round_trip!(ChildNumber::from_normal_idx((1 << 31) - 1));
885-
serde_round_trip!(ChildNumber::from_hardened_idx(0));
886-
serde_round_trip!(ChildNumber::from_hardened_idx(1));
887-
serde_round_trip!(ChildNumber::from_hardened_idx((1 << 31) - 1));
888-
}
889856
}

0 commit comments

Comments
 (0)