Skip to content

Commit 97c968c

Browse files
committed
substitute ::generate with ::from_bytes
1 parent d186115 commit 97c968c

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

stacks-common/src/util/vrf.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ impl Default for VRFPrivateKey {
108108
impl VRFPrivateKey {
109109
#[cfg(any(test, feature = "testing"))]
110110
pub fn new() -> VRFPrivateKey {
111-
use rand::RngCore;
111+
use rand::RngCore as _;
112112
let mut rng = rand::thread_rng();
113113
let mut sk_bytes = [0u8; 32];
114114
rng.fill_bytes(&mut sk_bytes);

stackslib/src/burnchains/tests/burnchain.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
// along with this program. If not, see <http://www.gnu.org/licenses/>.
1616

1717
use rand::rngs::ThreadRng;
18-
use rand::thread_rng;
18+
use rand::{thread_rng, RngCore as _};
1919
use stacks_common::address::AddressHashMode;
2020
use stacks_common::types::chainstate::{
2121
BlockHeaderHash, BurnchainHeaderHash, PoxId, SortitionId, TrieHash, VRFSeed,
@@ -690,7 +690,9 @@ fn test_burn_snapshot_sequence() {
690690

691691
for i in 0..32 {
692692
let mut csprng: ThreadRng = thread_rng();
693-
let vrf_privkey = VRFPrivateKey(ed25519_dalek::SigningKey::generate(&mut csprng));
693+
let mut sk_bytes = [0u8; 32];
694+
csprng.fill_bytes(&mut sk_bytes);
695+
let vrf_privkey = VRFPrivateKey(ed25519_dalek::SigningKey::from_bytes(&sk_bytes));
694696
let vrf_pubkey = VRFPublicKey::from_private(&vrf_privkey);
695697

696698
let pubkey_hex = vrf_pubkey.to_hex();

0 commit comments

Comments
 (0)