Skip to content

Commit 84dc6d6

Browse files
committed
build(deps): update getrandom to v0.3
1 parent e90c591 commit 84dc6d6

File tree

10 files changed

+82
-35
lines changed

10 files changed

+82
-35
lines changed

Cargo.lock

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

packages/dapi-grpc/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ tonic = { version = "0.13.0", features = [
5454
"codegen",
5555
"prost",
5656
], default-features = false }
57-
getrandom = { version = "0.2", features = ["js"] }
57+
getrandom = { version = "0.3", features = ["wasm_js"] }
5858

5959
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
6060
tonic = { version = "0.13.0", features = [

packages/rs-dapi-client/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ backon = { version = "1.3", default-features = false, features = [
3030
gloo-timers = { version = "0.3.0", features = ["futures"] }
3131
tonic-web-wasm-client = { version = "0.7.0" }
3232
wasm-bindgen-futures = { version = "0.4.49" }
33-
getrandom = { version = "0.2", features = ["js"] }
33+
getrandom = { version = "0.3", features = ["wasm_js"] }
3434
tower-service = { version = "0.3" }
3535
http-body-util = { version = "0.1" }
3636

packages/rs-dpp/Cargo.toml

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ dashcore = { git = "https://github.com/dashpay/rust-dashcore", features = [
3131
"serde",
3232
], default-features = false, tag = "v0.39.6" }
3333
env_logger = { version = "0.11" }
34-
getrandom = { version = "0.2", features = ["js"] }
3534
hex = { version = "0.4" }
3635
integer-encoding = { version = "4.0.0" }
3736
itertools = { version = "0.13" }
@@ -63,12 +62,20 @@ indexmap = { version = "2.7.0", features = ["serde"] }
6362
strum = { version = "0.26", features = ["derive"] }
6463
json-schema-compatibility-validator = { path = '../rs-json-schema-compatibility-validator', optional = true }
6564
once_cell = "1.19.0"
65+
getrandom = { version = "0.3" }
66+
67+
[target.'cfg(target_arch = "wasm32")'.dependencies]
68+
getrandom = { version = "0.3", features = ["wasm_js"] }
69+
6670

6771
[dev-dependencies]
6872
test-case = { version = "3.3" }
6973
tokio = { version = "1.40", features = ["full"] }
7074
pretty_assertions = { version = "1.4.1" }
71-
dpp = { path = ".", default-features = false, features = ["all_features_without_client", "token-reward-explanations"] }
75+
dpp = { path = ".", default-features = false, features = [
76+
"all_features_without_client",
77+
"token-reward-explanations",
78+
] }
7279
assert_matches = "1.5.0"
7380
once_cell = "1.7"
7481
env_logger = { version = "0.11.8" }
@@ -122,7 +129,7 @@ all_features = [
122129
"fee-distribution",
123130
"client",
124131
"vote-serialization",
125-
"token-reward-explanations"
132+
"token-reward-explanations",
126133
]
127134

128135
dash-sdk-features = [
@@ -272,13 +279,26 @@ core-types-serde-conversion = ["core-types"]
272279
state-transitions = []
273280
system_contracts = ["data-contracts", "factories", "platform-value-json"]
274281
# All system data contracts
275-
all-system_contracts = ["system_contracts", "data-contracts/all-contracts", "dpns-contract", "dashpay-contract", "withdrawals-contract", "masternode-rewards-contract", "wallet-utils-contract", "token-history-contract", "keywords-contract"]
282+
all-system_contracts = [
283+
"system_contracts",
284+
"data-contracts/all-contracts",
285+
"dpns-contract",
286+
"dashpay-contract",
287+
"withdrawals-contract",
288+
"masternode-rewards-contract",
289+
"wallet-utils-contract",
290+
"token-history-contract",
291+
"keywords-contract",
292+
]
276293

277294
# Individual data contract features
278295
dpns-contract = ["data-contracts", "data-contracts/dpns"]
279296
dashpay-contract = ["data-contracts", "data-contracts/dashpay"]
280297
withdrawals-contract = ["data-contracts", "data-contracts/withdrawals"]
281-
masternode-rewards-contract = ["data-contracts", "data-contracts/masternode-rewards"]
298+
masternode-rewards-contract = [
299+
"data-contracts",
300+
"data-contracts/masternode-rewards",
301+
]
282302
wallet-utils-contract = ["data-contracts", "data-contracts/wallet-utils"]
283303
token-history-contract = ["data-contracts", "data-contracts/token-history"]
284304
keywords-contract = ["data-contracts", "data-contracts/keyword-search"]
Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
1-
use getrandom::getrandom;
2-
31
use crate::prelude::Identifier;
42

53
fn generate_random_identifier_struct() -> Identifier {
64
let mut buffer = [0u8; 32];
7-
let _ = getrandom(&mut buffer);
5+
let _ = getrandom::fill(&mut buffer);
86
Identifier::from_bytes(&buffer).unwrap()
97
}

packages/rs-dpp/src/tests/fixtures/get_documents_fixture.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,6 @@ pub fn get_withdrawal_document_fixture(
220220

221221
fn get_random_10_bytes() -> Vec<u8> {
222222
let mut buffer = [0u8; 10];
223-
let _ = getrandom::getrandom(&mut buffer);
223+
let _ = getrandom::fill(&mut buffer);
224224
buffer.to_vec()
225225
}

packages/rs-dpp/src/tests/fixtures/get_dpns_document_fixture.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
use std::collections::BTreeMap;
22

3-
use getrandom::getrandom;
43
use platform_value::{Identifier, Value};
54

65
use crate::document::document_factory::DocumentFactory;
@@ -42,7 +41,7 @@ pub fn get_dpns_parent_document_fixture(
4241
let document_factory =
4342
DocumentFactory::new(protocol_version).expect("expected to get document factory");
4443
let mut pre_order_salt = [0u8; 32];
45-
let _ = getrandom(&mut pre_order_salt);
44+
let _ = getrandom::fill(&mut pre_order_salt);
4645

4746
let normalized_label = convert_to_homograph_safe_chars(options.label.as_str());
4847

@@ -94,7 +93,7 @@ pub fn get_dpns_parent_extended_document_fixture(
9493
let document_factory =
9594
DocumentFactory::new(protocol_version).expect("expected to get document factory");
9695
let mut pre_order_salt = [0u8; 32];
97-
let _ = getrandom(&mut pre_order_salt);
96+
let _ = getrandom::fill(&mut pre_order_salt);
9897

9998
let normalized_label = convert_to_homograph_safe_chars(options.label.as_str());
10099

packages/rs-dpp/src/tests/utils/mod.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ use anyhow::Result;
22
use dashcore::block::Version;
33
use dashcore::hashes::Hash;
44
use dashcore::{Block, BlockHash, CompactTarget, Header, TxMerkleNode};
5-
use getrandom::getrandom;
65
use platform_value::Value;
76
#[cfg(test)]
87
use serde_json::Value as JsonValue;
@@ -60,7 +59,7 @@ where
6059

6160
pub fn generate_random_identifier_struct() -> Identifier {
6261
let mut buffer = [0u8; 32];
63-
let _ = getrandom(&mut buffer);
62+
getrandom::fill(&mut buffer).unwrap();
6463
Identifier::from_bytes(&buffer).unwrap()
6564
}
6665

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
use anyhow::Context;
2-
use getrandom::getrandom;
3-
41
/// A way to provide external entropy generator.
52
pub trait EntropyGenerator {
63
fn generate(&self) -> anyhow::Result<[u8; 32]>;
@@ -11,7 +8,8 @@ pub struct DefaultEntropyGenerator;
118
impl EntropyGenerator for DefaultEntropyGenerator {
129
fn generate(&self) -> anyhow::Result<[u8; 32]> {
1310
let mut buffer = [0u8; 32];
14-
getrandom(&mut buffer).context("generating entropy failed")?;
11+
getrandom::fill(&mut buffer)
12+
.map_err(|e| anyhow::anyhow!(format!("generating entropy failed: {}", e)))?;
1513
Ok(buffer)
1614
}
1715
}

packages/wasm-sdk/Cargo.toml

Lines changed: 43 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,30 +6,62 @@ publish = false
66
crate-type = ["cdylib"]
77

88
[features]
9-
default = ["dpns-contract", "dashpay-contract", "wallet-utils-contract", "token-history-contract", "keywords-contract"]
9+
default = [
10+
"dpns-contract",
11+
"dashpay-contract",
12+
"wallet-utils-contract",
13+
"token-history-contract",
14+
"keywords-contract",
15+
]
1016

1117
mocks = ["dash-sdk/mocks"]
1218

1319
# All system contracts
14-
all-system-contracts = ["dash-sdk/all-system-contracts", "rs-sdk-trusted-context-provider/all-system-contracts"]
20+
all-system-contracts = [
21+
"dash-sdk/all-system-contracts",
22+
"rs-sdk-trusted-context-provider/all-system-contracts",
23+
]
1524

1625
# Individual contract features
17-
withdrawals-contract = ["dash-sdk/withdrawals-contract", "rs-sdk-trusted-context-provider/withdrawals-contract"]
18-
dpns-contract = ["dash-sdk/dpns-contract", "rs-sdk-trusted-context-provider/dpns-contract"]
19-
dashpay-contract = ["dash-sdk/dashpay-contract", "rs-sdk-trusted-context-provider/dashpay-contract"]
20-
wallet-utils-contract = ["dash-sdk/wallet-utils-contract", "rs-sdk-trusted-context-provider/wallet-utils-contract"]
21-
token-history-contract = ["dash-sdk/token-history-contract", "rs-sdk-trusted-context-provider/token-history-contract"]
22-
keywords-contract = ["dash-sdk/keywords-contract", "rs-sdk-trusted-context-provider/keywords-contract"]
26+
withdrawals-contract = [
27+
"dash-sdk/withdrawals-contract",
28+
"rs-sdk-trusted-context-provider/withdrawals-contract",
29+
]
30+
dpns-contract = [
31+
"dash-sdk/dpns-contract",
32+
"rs-sdk-trusted-context-provider/dpns-contract",
33+
]
34+
dashpay-contract = [
35+
"dash-sdk/dashpay-contract",
36+
"rs-sdk-trusted-context-provider/dashpay-contract",
37+
]
38+
wallet-utils-contract = [
39+
"dash-sdk/wallet-utils-contract",
40+
"rs-sdk-trusted-context-provider/wallet-utils-contract",
41+
]
42+
token-history-contract = [
43+
"dash-sdk/token-history-contract",
44+
"rs-sdk-trusted-context-provider/token-history-contract",
45+
]
46+
keywords-contract = [
47+
"dash-sdk/keywords-contract",
48+
"rs-sdk-trusted-context-provider/keywords-contract",
49+
]
2350

2451
token_reward_explanations = ["dash-sdk/token_reward_explanations"]
2552

2653
[dependencies]
2754
dash-sdk = { path = "../rs-sdk", default-features = false }
2855
simple-signer = { path = "../simple-signer" }
29-
drive = { path = "../rs-drive", default-features = false, features = ["verify"] }
56+
drive = { path = "../rs-drive", default-features = false, features = [
57+
"verify",
58+
] }
3059
console_error_panic_hook = { version = "0.1.6" }
3160
thiserror = { version = "2.0.12" }
32-
dashcore = { git = "https://github.com/dashpay/rust-dashcore", branch = "v0.40-dev", features = ["std", "secp-recovery"] }
61+
dashcore = { git = "https://github.com/dashpay/rust-dashcore", branch = "v0.40-dev", features = [
62+
"std",
63+
"secp-recovery",
64+
] }
3365
web-sys = { version = "0.3.4", features = [
3466
'console',
3567
'Document',
@@ -52,7 +84,7 @@ serde_json = "1.0"
5284
hex = "0.4"
5385
base64 = "0.22"
5486
bs58 = "0.5"
55-
getrandom = { version = "0.2", features = ["js"] }
87+
getrandom = { version = "0.3", features = ["wasm_js"] }
5688
bip39 = { version = "2.0", features = ["rand", "all-languages"] }
5789
rand = { version = "0.8", features = ["std"] }
5890
rs-sdk-trusted-context-provider = { path = "../rs-sdk-trusted-context-provider" }
@@ -71,4 +103,3 @@ lto = "fat"
71103

72104
[package.metadata.wasm-pack]
73105
wasm-opt = false
74-

0 commit comments

Comments
 (0)