-
Notifications
You must be signed in to change notification settings - Fork 7
CLI helper: CreateMint #33
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
Conversation
76229ef
to
bbfc939
Compare
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.
Really small stuff from me. Looks great!
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.
Looks great overall! Mostly small things
bbfc939
to
8371aab
Compare
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.
Lgtm, just a CI failure to address!
Since swapping from ProgramClient to RpcClient in the tests I am hitting flakiness with a ~30% success rate on the cli test. I think it may be because the ProgramClient perhaps waits for confirmation and the other doesn't. Not sure, investigating. |
let starting_accounts = vec![(payer.pubkey(), payer_account), unwrapped_mint.clone()]; | ||
|
||
// Start the test validator with necessary programs | ||
let validator = start_validator(starting_accounts).await; |
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.
Nice! 😊
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.
When using rpc_client.send_transaction
, it only sends.
So rather than setting all of the data at startup to "fix" the race condition, the preference should be to use rpc_client.send_and_confirm_transaction
to wait for a transaction to land before sending the next one, if the two transactions depend on each other.
You don't need to change setting the accounts into the validator, but can you at least use send_and_confirm_transaction
in the tests? That also lets us find out if the transaction was successful or not.
Also, it's done now, but the workspace deps changes should have been done in a separate PR.
f03cd19
to
11cbc09
Compare
When digging into the ProgramClient, I did manage to find
Though it's still not clear to me what strategy is preferred for CLI tests. Is it better to A) load all accounts within the validator on startup and make the single command you are testing or B) have a fresh startup state and make the sequential transactions to build the state the command your testing needs. If A, there shouldn't be additional changes needed. If B, I can revert back and make use of |
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.
I typically lean towards building things up in tests with transactions rather than setting up the accounts by hand, since it's possible for the setup to be incorrect, as we've already seen in some of the program tests earlier, but there's no need to revert the work here.
And right, sorry, I thought there was still some usage of send_transaction
somewhere. This is all good to me then!
Helpful, in the next PR will probably re-establish the multiple-tx pattern again. |
The first of a number of CLI/JS helpers for users of the program. First up is the
CreateMint
instruction.Takes large inspiration from the CLI helpers and tests in spl-single-pool.
Walkthrough for testing locally:
spl-token create-token # Example will have G85DDQCoHchhDFWtUFT2MDkfUPYQt8BvViFyjGv167xb for this spl-token create-account G85DDQCoHchhDFWtUFT2MDkfUPYQt8BvViFyjGv167xb spl-token mint G85DDQCoHchhDFWtUFT2MDkfUPYQt8BvViFyjGv167xb 100000
token-wrap
command