mirror of
https://github.com/Cuprate/cuprate.git
synced 2024-11-16 15:58:17 +00:00
remove primitive-types for crypto-bigint
we already have crypto-bigint in our tree
This commit is contained in:
parent
b9334b6a90
commit
b20b6fdee1
5 changed files with 19 additions and 44 deletions
51
Cargo.lock
generated
51
Cargo.lock
generated
|
@ -655,15 +655,6 @@ version = "0.2.5"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "27573eac26f4dd11e2b1916c3fe1baa56407c83c71a773a8ba17ec0bca03b6b7"
|
||||
|
||||
[[package]]
|
||||
name = "fixed-hash"
|
||||
version = "0.8.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "835c052cb0c08c1acf6ffd71c022172e18723949c8282f2b9f27efbc51e64534"
|
||||
dependencies = [
|
||||
"static_assertions",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "flexible-transcript"
|
||||
version = "0.3.2"
|
||||
|
@ -725,6 +716,17 @@ version = "0.3.30"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a44623e20b9681a318efdd71c299b6b222ed6f231972bfe2f224ebad6311f0c1"
|
||||
|
||||
[[package]]
|
||||
name = "futures-macro"
|
||||
version = "0.3.30"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.48",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "futures-sink"
|
||||
version = "0.3.30"
|
||||
|
@ -746,6 +748,7 @@ dependencies = [
|
|||
"futures-channel",
|
||||
"futures-core",
|
||||
"futures-io",
|
||||
"futures-macro",
|
||||
"futures-sink",
|
||||
"futures-task",
|
||||
"memchr",
|
||||
|
@ -1112,6 +1115,7 @@ dependencies = [
|
|||
name = "monero-consensus"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"crypto-bigint",
|
||||
"cryptonight-cuprate",
|
||||
"cuprate-common",
|
||||
"curve25519-dalek",
|
||||
|
@ -1120,7 +1124,6 @@ dependencies = [
|
|||
"hex-literal",
|
||||
"monero-serai",
|
||||
"multiexp",
|
||||
"primitive-types",
|
||||
"proptest",
|
||||
"proptest-derive",
|
||||
"rand",
|
||||
|
@ -1377,16 +1380,6 @@ version = "0.2.17"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de"
|
||||
|
||||
[[package]]
|
||||
name = "primitive-types"
|
||||
version = "0.12.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0b34d9fd68ae0b74a41b21c03c2f62847aa0ffea044eee893b4c140b37e244e2"
|
||||
dependencies = [
|
||||
"fixed-hash",
|
||||
"uint",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "proc-macro-crate"
|
||||
version = "3.1.0"
|
||||
|
@ -1852,12 +1845,6 @@ version = "0.9.8"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6980e8d7511241f8acf4aebddbb1ff938df5eebe98691418c4468d0b72a96a67"
|
||||
|
||||
[[package]]
|
||||
name = "static_assertions"
|
||||
version = "1.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f"
|
||||
|
||||
[[package]]
|
||||
name = "std-shims"
|
||||
version = "0.1.1"
|
||||
|
@ -2152,18 +2139,6 @@ version = "1.17.0"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825"
|
||||
|
||||
[[package]]
|
||||
name = "uint"
|
||||
version = "0.9.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "76f64bba2c53b04fcab63c01a7d7427eadc821e3bc48c34dc9ba29c501164b52"
|
||||
dependencies = [
|
||||
"byteorder",
|
||||
"crunchy",
|
||||
"hex",
|
||||
"static_assertions",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "unarray"
|
||||
version = "0.1.4"
|
||||
|
|
|
@ -40,7 +40,7 @@ borsh = { version = "1.2.1", default-features = false }
|
|||
bytes = { version = "1.5.0", default-features = false }
|
||||
clap = { version = "4.4.7", default-features = false }
|
||||
chrono = { version = "0.4.31", default-features = false }
|
||||
primitive-types = { version = "0.12.2", default-features = false }
|
||||
crypto-bigint = { version = "0.5.5", default-features = false }
|
||||
curve25519-dalek = { version = "4.1.1", default-features = false }
|
||||
dalek-ff-group = { git = "https://github.com/Cuprate/serai.git", rev = "a59966b", default-features = false }
|
||||
dirs = { version = "5.0.1", default-features = false }
|
||||
|
|
|
@ -21,7 +21,7 @@ rand = { workspace = true, features = ["std"] }
|
|||
|
||||
hex = { workspace = true, features = ["std"] }
|
||||
hex-literal = { workspace = true }
|
||||
primitive-types = { workspace = true } # enabiling std pulls in 9 extra crates!
|
||||
crypto-bigint = { workspace = true }
|
||||
|
||||
tracing = { workspace = true, features = ["std"] }
|
||||
thiserror = { workspace = true }
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
use crypto_bigint::{CheckedMul, U256};
|
||||
use monero_serai::block::Block;
|
||||
use primitive_types::U256;
|
||||
|
||||
use cryptonight_cuprate::*;
|
||||
|
||||
|
@ -100,11 +100,11 @@ pub fn calculate_pow_hash<R: RandomX>(
|
|||
///
|
||||
/// ref: https://monero-book.cuprate.org/consensus_rules/blocks.html#checking-pow-hash
|
||||
pub fn check_block_pow(hash: &[u8; 32], difficulty: u128) -> Result<(), BlockError> {
|
||||
let int_hash = U256::from_little_endian(hash);
|
||||
let int_hash = U256::from_le_slice(hash);
|
||||
|
||||
let difficulty = U256::from(difficulty);
|
||||
|
||||
if int_hash.checked_mul(difficulty).is_none() {
|
||||
if int_hash.checked_mul(&difficulty).is_none().unwrap_u8() == 1 {
|
||||
tracing::debug!(
|
||||
"Invalid POW: {}, difficulty: {}",
|
||||
hex::encode(hash),
|
||||
|
|
|
@ -16,7 +16,7 @@ cuprate-common = {path = "../../common", features = ["borsh"]}
|
|||
tokio = { workspace = true, features = ["net", "sync", "macros"]}
|
||||
tokio-util = { workspace = true, features = ["codec"] }
|
||||
tokio-stream = { workspace = true, features = ["sync"]}
|
||||
futures = { workspace = true, features = ["std"] }
|
||||
futures = { workspace = true, features = ["std", "async-await"] }
|
||||
async-trait = { workspace = true }
|
||||
tower = { workspace = true, features = ["util"] }
|
||||
|
||||
|
|
Loading…
Reference in a new issue