-
Notifications
You must be signed in to change notification settings - Fork 134
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
implement TestPublicKey
util and refactor examples
#1574
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is great!
Re naming, "account" for a public key (with attached private key) feels not optimal, there is the distinct concept of an account. So it should stay at "public key" or "address"
Co-authored-by: Gregor Mitscha-Baude <[email protected]>
Can you please add your thoughts in #1578 and I'll fix all occurrences in a follow-up PR? |
TestAccount
util and refactor examplesTestPublicKey
util and refactor examples
src/lib/mina/local-blockchain.ts
Outdated
|
||
for (let i = 0; i < 10; ++i) { | ||
for (let i = 0; i < 100; ++i) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@harrysolovay I just realized that this takes 2ms per public key (it does an elliptic curve scaling), so 200ms for 100 accounts feels a bit excessive to do every time we instantiate local blockchain.
Maybe we can create these test accounts lazily and still preserve the same API with some trickery. If not, I'd prefer to create only 20 or so.
All of this can be a separate PR
Closes #1516
In addition to solving the false positive / unchecked indexing error of the local blockchain's
testAccounts
, this PR introducesTestPublicKey
, a subclass ofPublicKey
off of whichkey
(the correspondingPrivateKey
) can be accessed. This leads to a reduction in test code boilerplate, as one doesn't need to define the corresponding private key under its own name.For cases in which a non-pre-funded account is needed (for instance, to be used as a contract account), one can use
TestPublicKey.random
.Note to reviewers re. naming convention: I addressed some (but not all) of the test naming inconsistencies (#1578).