mirror of
https://github.com/mimblewimble/grin.git
synced 2025-01-20 19:11:08 +03:00
[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>
This commit is contained in:
parent
7f7d0635ef
commit
bd98d17f75
28 changed files with 690 additions and 577 deletions
1030
Cargo.lock
generated
1030
Cargo.lock
generated
File diff suppressed because it is too large
Load diff
28
Cargo.toml
28
Cargo.toml
|
@ -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"
|
||||
|
@ -24,7 +24,7 @@ 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"
|
||||
|
@ -32,23 +32,23 @@ 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" }
|
||||
|
|
|
@ -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"
|
||||
|
@ -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" }
|
||||
|
|
|
@ -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",
|
||||
|
|
|
@ -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};
|
||||
|
@ -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
|
||||
|
@ -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,
|
||||
|
|
|
@ -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"
|
||||
|
@ -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"
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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"
|
||||
|
@ -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"
|
||||
|
|
|
@ -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"
|
||||
|
@ -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"
|
||||
|
|
|
@ -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;
|
||||
|
@ -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,
|
||||
|
@ -295,17 +295,19 @@ 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);
|
||||
}
|
||||
|
@ -313,7 +315,7 @@ fn read_block_header<R: Reader>(reader: &mut R) -> Result<BlockHeader, ser::Erro
|
|||
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,
|
||||
|
@ -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.
|
||||
|
|
|
@ -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};
|
||||
|
@ -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,
|
||||
|
@ -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,
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
@ -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,
|
||||
);
|
||||
}
|
||||
|
|
|
@ -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],
|
||||
|
@ -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],
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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"
|
||||
|
@ -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" }
|
||||
|
|
|
@ -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;
|
||||
|
@ -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 {
|
||||
|
@ -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));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
[package]
|
||||
name = "grin_p2p"
|
||||
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"
|
||||
|
@ -22,10 +22,10 @@ log = "0.4"
|
|||
chrono = { version = "0.4.11", features = ["serde"] }
|
||||
bytes = "0.5"
|
||||
|
||||
grin_core = { path = "../core", version = "5.3.2" }
|
||||
grin_store = { path = "../store", version = "5.3.2" }
|
||||
grin_util = { path = "../util", version = "5.3.2" }
|
||||
grin_chain = { path = "../chain", version = "5.3.2" }
|
||||
grin_core = { path = "../core", version = "5.3.3" }
|
||||
grin_store = { path = "../store", version = "5.3.3" }
|
||||
grin_util = { path = "../util", version = "5.3.3" }
|
||||
grin_chain = { path = "../chain", version = "5.3.3" }
|
||||
|
||||
[dev-dependencies]
|
||||
grin_pool = { path = "../pool", version = "5.3.2" }
|
||||
grin_pool = { path = "../pool", version = "5.3.3" }
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
[package]
|
||||
name = "grin_pool"
|
||||
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"
|
||||
|
@ -18,9 +18,9 @@ thiserror = "1"
|
|||
log = "0.4"
|
||||
chrono = "0.4.11"
|
||||
|
||||
grin_core = { path = "../core", version = "5.3.2" }
|
||||
grin_keychain = { path = "../keychain", 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_util = { path = "../util", version = "5.3.3" }
|
||||
|
||||
[dev-dependencies]
|
||||
grin_chain = { path = "../chain", version = "5.3.2" }
|
||||
grin_chain = { path = "../chain", version = "5.3.3" }
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
[package]
|
||||
name = "grin_servers"
|
||||
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"
|
||||
|
@ -26,11 +26,11 @@ tokio = {version = "0.2", features = ["full"] }
|
|||
tokio-util = { version = "0.2", features = ["codec"] }
|
||||
walkdir = "2.3.1"
|
||||
|
||||
grin_api = { path = "../api", 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_pool = { path = "../pool", version = "5.3.2" }
|
||||
grin_store = { path = "../store", version = "5.3.2" }
|
||||
grin_util = { path = "../util", version = "5.3.2" }
|
||||
grin_api = { path = "../api", 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_pool = { path = "../pool", version = "5.3.3" }
|
||||
grin_store = { path = "../store", version = "5.3.3" }
|
||||
grin_util = { path = "../util", version = "5.3.3" }
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
//! Build a block to mine: gathers transactions from the pool, assembles
|
||||
//! them into a block and returns it.
|
||||
|
||||
use chrono::prelude::{DateTime, NaiveDateTime, Utc};
|
||||
use chrono::prelude::{DateTime, Utc};
|
||||
use rand::{thread_rng, Rng};
|
||||
use serde_json::{json, Value};
|
||||
use std::sync::Arc;
|
||||
|
@ -168,11 +168,11 @@ fn build_block(
|
|||
|
||||
b.header.pow.nonce = thread_rng().gen();
|
||||
b.header.pow.secondary_scaling = difficulty.secondary_scaling;
|
||||
let ts = NaiveDateTime::from_timestamp_opt(now_sec, 0);
|
||||
let ts = DateTime::<Utc>::from_timestamp(now_sec, 0);
|
||||
if ts.is_none() {
|
||||
return Err(Error::General("Utc::now into timestamp".into()));
|
||||
}
|
||||
b.header.timestamp = DateTime::from_naive_utc_and_offset(ts.unwrap(), Utc);
|
||||
b.header.timestamp = DateTime::from_naive_utc_and_offset(ts.unwrap().naive_utc(), Utc);
|
||||
|
||||
debug!(
|
||||
"Built new block with {} inputs and {} outputs, block difficulty: {}, cumulative difficulty {}",
|
||||
|
|
|
@ -63,7 +63,7 @@ impl HTTPNodeClient {
|
|||
Err(e) => {
|
||||
let report = format!("Error calling {}: {}", method, e);
|
||||
error!("{}", report);
|
||||
Err(Error::RPCError(report))
|
||||
Err(Error::RPCError)
|
||||
}
|
||||
Ok(inner) => match inner.clone().into_result() {
|
||||
Ok(r) => Ok(r),
|
||||
|
@ -71,7 +71,7 @@ impl HTTPNodeClient {
|
|||
error!("{:?}", inner);
|
||||
let report = format!("Unable to parse response for {}: {}", method, e);
|
||||
error!("{}", report);
|
||||
Err(Error::RPCError(report))
|
||||
Err(Error::RPCError)
|
||||
}
|
||||
},
|
||||
}
|
||||
|
@ -92,6 +92,7 @@ impl HTTPNodeClient {
|
|||
t.reset().unwrap();
|
||||
match self.send_json_request::<Status>("get_status", &serde_json::Value::Null) {
|
||||
Ok(status) => {
|
||||
writeln!(e, "Chain type: {}", status.chain).unwrap();
|
||||
writeln!(e, "Protocol version: {:?}", status.protocol_version).unwrap();
|
||||
writeln!(e, "User agent: {}", status.user_agent).unwrap();
|
||||
writeln!(e, "Connections: {}", status.connections).unwrap();
|
||||
|
@ -251,5 +252,5 @@ pub fn client_command(client_args: &ArgMatches<'_>, global_config: GlobalConfig)
|
|||
#[derive(Debug)]
|
||||
enum Error {
|
||||
/// RPC Error
|
||||
RPCError(String),
|
||||
RPCError,
|
||||
}
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
|
||||
use std::cmp::Ordering;
|
||||
|
||||
use chrono::prelude::{DateTime, NaiveDateTime, Utc};
|
||||
use chrono::prelude::{DateTime, Utc};
|
||||
use cursive::direction::Orientation;
|
||||
use cursive::event::Key;
|
||||
use cursive::traits::{Nameable, Resizable};
|
||||
|
@ -64,14 +64,15 @@ impl StratumWorkerColumn {
|
|||
|
||||
impl TableViewItem<StratumWorkerColumn> for WorkerStats {
|
||||
fn to_column(&self, column: StratumWorkerColumn) -> String {
|
||||
let naive_datetime = NaiveDateTime::from_timestamp_opt(
|
||||
let naive_datetime = DateTime::<Utc>::from_timestamp(
|
||||
self.last_seen
|
||||
.duration_since(time::UNIX_EPOCH)
|
||||
.unwrap()
|
||||
.as_secs() as i64,
|
||||
0,
|
||||
)
|
||||
.unwrap_or_default();
|
||||
.unwrap_or_default()
|
||||
.naive_utc();
|
||||
let datetime: DateTime<Utc> = DateTime::from_naive_utc_and_offset(naive_datetime, Utc);
|
||||
|
||||
match column {
|
||||
|
@ -127,8 +128,9 @@ impl DiffColumn {
|
|||
|
||||
impl TableViewItem<DiffColumn> for DiffBlock {
|
||||
fn to_column(&self, column: DiffColumn) -> String {
|
||||
let naive_datetime =
|
||||
NaiveDateTime::from_timestamp_opt(self.time as i64, 0).unwrap_or_default();
|
||||
let naive_datetime = DateTime::<Utc>::from_timestamp(self.time as i64, 0)
|
||||
.unwrap_or_default()
|
||||
.naive_utc();
|
||||
let datetime: DateTime<Utc> = DateTime::from_naive_utc_and_offset(naive_datetime, Utc);
|
||||
|
||||
match column {
|
||||
|
|
|
@ -38,13 +38,10 @@ fn main() {
|
|||
}
|
||||
|
||||
// build and versioning information
|
||||
let mut opts = built::Options::default();
|
||||
opts.set_dependencies(true);
|
||||
let out_dir_path = format!("{}{}", env::var("OUT_DIR").unwrap(), "/built.rs");
|
||||
// don't fail the build if something's missing, may just be cargo release
|
||||
let _ = built::write_built_file_with_opts(
|
||||
&opts,
|
||||
Path::new(env!("CARGO_MANIFEST_DIR")),
|
||||
Some(Path::new(env!("CARGO_MANIFEST_DIR"))),
|
||||
Path::new(&out_dir_path),
|
||||
);
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
[package]
|
||||
name = "grin_store"
|
||||
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"
|
||||
|
@ -21,8 +21,8 @@ serde_derive = "1"
|
|||
thiserror = "1"
|
||||
log = "0.4"
|
||||
|
||||
grin_core = { path = "../core", version = "5.3.2" }
|
||||
grin_util = { path = "../util", version = "5.3.2" }
|
||||
grin_core = { path = "../core", version = "5.3.3" }
|
||||
grin_util = { path = "../util", version = "5.3.3" }
|
||||
|
||||
[dev-dependencies]
|
||||
chrono = "0.4.11"
|
||||
|
|
|
@ -122,11 +122,11 @@ fn bench_fast_or() {
|
|||
|
||||
let mut bitmaps = init_bitmaps();
|
||||
let mut bitmap = Bitmap::new();
|
||||
let start = Utc::now().timestamp_nanos();
|
||||
let start = Utc::now().timestamp_nanos_opt().unwrap();
|
||||
for _ in 0..bitmaps_number {
|
||||
bitmap.or_inplace(&bitmaps.pop().unwrap());
|
||||
}
|
||||
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!(
|
||||
" or_inplace(): {:9.3?}ms. bitmap cardinality: {}",
|
||||
|
@ -135,9 +135,9 @@ fn bench_fast_or() {
|
|||
);
|
||||
|
||||
let bitmaps = init_bitmaps();
|
||||
let start = Utc::now().timestamp_nanos();
|
||||
let start = Utc::now().timestamp_nanos_opt().unwrap();
|
||||
let bitmap = Bitmap::fast_or(&bitmaps.iter().map(|x| x).collect::<Vec<&Bitmap>>());
|
||||
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!(
|
||||
" fast_or(): {:9.3?}ms. bitmap cardinality: {}",
|
||||
|
@ -146,9 +146,9 @@ fn bench_fast_or() {
|
|||
);
|
||||
|
||||
let bitmaps = init_bitmaps();
|
||||
let start = Utc::now().timestamp_nanos();
|
||||
let start = Utc::now().timestamp_nanos_opt().unwrap();
|
||||
let bitmap = Bitmap::fast_or_heap(&bitmaps.iter().map(|x| x).collect::<Vec<&Bitmap>>());
|
||||
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!(
|
||||
"fast_or_heap(): {:9.3?}ms. bitmap cardinality: {}",
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
[package]
|
||||
name = "grin_util"
|
||||
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"
|
||||
|
@ -10,6 +10,7 @@ workspace = ".."
|
|||
edition = "2018"
|
||||
|
||||
[dependencies]
|
||||
anyhow = "1.0"
|
||||
backtrace = "0.3"
|
||||
base64 = "0.12"
|
||||
byteorder = "1"
|
||||
|
@ -17,7 +18,7 @@ lazy_static = "1"
|
|||
rand = "0.6"
|
||||
serde = "1"
|
||||
serde_derive = "1"
|
||||
log4rs = { version = "0.12", features = ["rolling_file_appender", "compound_policy", "size_trigger", "fixed_window_roller"] }
|
||||
log4rs = { version = "1.3", features = ["rolling_file_appender", "compound_policy", "size_trigger", "fixed_window_roller", "gzip"] }
|
||||
log = "0.4"
|
||||
walkdir = "2"
|
||||
zip = { version = "0.5.11", default-features = false }
|
||||
|
|
|
@ -32,7 +32,6 @@ use log4rs::encode::pattern::PatternEncoder;
|
|||
use log4rs::encode::writer::simple::SimpleWriter;
|
||||
use log4rs::encode::Encode;
|
||||
use log4rs::filter::{threshold::ThresholdFilter, Filter, Response};
|
||||
use std::error::Error;
|
||||
use std::sync::mpsc;
|
||||
use std::sync::mpsc::SyncSender;
|
||||
|
||||
|
@ -123,7 +122,7 @@ struct ChannelAppender {
|
|||
}
|
||||
|
||||
impl Append for ChannelAppender {
|
||||
fn append(&self, record: &Record) -> Result<(), Box<dyn Error + Sync + Send>> {
|
||||
fn append(&self, record: &Record) -> Result<(), anyhow::Error> {
|
||||
let mut writer = SimpleWriter(Vec::new());
|
||||
self.encoder.encode(&mut writer, record)?;
|
||||
|
||||
|
|
Loading…
Reference in a new issue