This repository was archived by the owner on Jan 22, 2025. It is now read-only.
Add replacements for Pubkey::new_rand()/Hash::new_rand()#12987
Merged
Conversation
5a46a4f to
0dff75c
Compare
This was referenced Oct 19, 2020
ce48d71 to
50462d4
Compare
Codecov Report
@@ Coverage Diff @@
## master #12987 +/- ##
=======================================
Coverage 82.1% 82.1%
=======================================
Files 366 366
Lines 86237 86295 +58
=======================================
+ Hits 70878 70932 +54
- Misses 15359 15363 +4 |
1548d7f to
eae525d
Compare
jackcmay
reviewed
Oct 21, 2020
| fn test_parse_account_data() { | ||
| let account_pubkey = Pubkey::new_rand(); | ||
| let other_program = Pubkey::new_rand(); | ||
| let account_pubkey = solana_sdk::pubkey::new_rand(); |
Contributor
There was a problem hiding this comment.
Stating solana_sdk everytime is pretty verbose, we would probably want:
use solana_sdk::pubkey;
...
let account_pubkey = pubkey::new_rand();
Contributor
Author
There was a problem hiding this comment.
that was just an artifact of mass search/replace
Contributor
Author
There was a problem hiding this comment.
I'm going to leave this as is, it can be cleaned up later. It'll be a painful manual edit to over a hundred files
Contributor
|
Looks like except one nit |
mergify Bot
added a commit
that referenced
this pull request
Oct 22, 2020
…13076) * Add pubkey_new_rand(), mark Pubkey::new_rand() deprecated (cherry picked from commit 0e68ed6) * Add hash_new_rand(), mark Hash::new_rand() as deprecated (cherry picked from commit 76f11c7) * Run `codemod --extensions rs Pubkey::new_rand solana_sdk::pubkey::new_rand` (cherry picked from commit 7bc073d) # Conflicts: # programs/bpf/benches/bpf_loader.rs # runtime/benches/accounts.rs # runtime/src/accounts.rs * Run `codemod --extensions rs Hash::new_rand solana_sdk::hash::new_rand` (cherry picked from commit 17c3911) * Remove unused pubkey::Pubkey imports (cherry picked from commit 959880d) # Conflicts: # runtime/src/accounts_index.rs * Resolve conflicts Co-authored-by: Michael Vines <mvines@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Pubkey::new_rand()andHash::new_rand()are problematic. They are unavailable when compilingsolana-sdkwith the "program" feature, but will come back when the "everything" (#12985) feature.Due to how Cargo feature addition works, a program developer could inadvertently add a dependency on
Pubkey::new_rand()due to the "everything" feature getting activated in a[dev-dependency]when building native only to later have their build fail when targetting BPF.When
PubkeyandHashmove into a newsolana-program-sdkcreate (thatsolana-sdkdepends on),Pubkey::new_rand()andHash::new_rand()cannot come along. This will make it impossible to support thenew_rand()functions where they currently live.The migration plan:
PubkeyandHashmove into a newsolana-program-sdksupply a stub forPubkey::new_rand()when !BPF for now.Hash::new_rand()is believed to only be in use internally so remove it entirely in v1.4Pubkey::new_rand()