Skip to content
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

Add solana-tokens #10011

Merged
merged 73 commits into from
May 13, 2020
Merged

Add solana-tokens #10011

merged 73 commits into from
May 13, 2020

Conversation

garious
Copy link
Contributor

@garious garious commented May 12, 2020

Problem

I've been developing the CLI tool solana-tokens in a separate repo, which was great for its initial development, but now it's more important that it doesn't bitrot at we change solana APIs.

Summary of Changes

git subtree add -P tokens git@github.com:solana-labs/solana-tokens.git master

danpaul000 and others added 18 commits May 5, 2020 17:36
* Add ThinClient methods to implement --no-wait

* Plumb --no-wait through

No tests yet

* Check transaction status on startup

* Easier to test

* Wait until transaction is finalized before checking if it failed with an error

It's possible that a minority fork thinks it failed.

* Add unit tests

* Remove dead code and rustfmt

* Don't flush database to file if doing a dry-run
If those transactions are dropped, the next run will execute them.
Delete the copy-pasted top-level test.

Fixes solana-labs#19
* Move resolve_distribute_stake_args into its own function

* Add stake args to token args

* Unify option names

* Move Command::DistributeStake into DistributeTokens

* Remove process_distribute_stake

* Only unique signers

* Use sender keypair to fund new fee-payer accounts

* Unify distribute_tokens and distribute_stake
* Send all transactions as quickly as possible, then wait

* Exit when finalized or blockhashes have expired

* Don't need blockhash in the CSV output

* Better types

CSV library was choking on Pubkey as a type. PickleDb doesn't have that problem.

* Resend if blockhash has not expired

* Attempt to fix CI
* Add constructor, tuck away client

* Fix unwrap() caught by CI
* Remove untested --no-wait feature

* Make --transactions-db an option, not an arg

So that in the future, we can make it optional

* Remove more untested features

Too many false positives in that santity check.  Use --dry-run
instead.

* Add dry-run mode to ThinClient

* Cleaner dry-run

* Make key parameters required

Just don't use them in --dry-run

* Add option to write the transaction log

--dry-run doesn't write to the database. Use this option if you
want a copy of the transaction log before the final run.

* Revert --transaction-log addition

Implement solana-labs#27 first

* Fix CI

* Update readme

* Fix CI in copypasta
* Move db functionality into its own module

* Rename tokens module to commands

* Version bump

* Upgrade Solana
git-subtree-dir: tokens
git-subtree-mainline: a9b82cf
git-subtree-split: 282c9f3
@garious garious requested a review from danpaul000 May 12, 2020 23:22
};
use solana_transaction_status::TransactionStatus;

pub trait Client {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After this is merged, first course of action will be looking for ways to get rid of trait.

impl Client for RpcClient {
fn send_transaction1(&self, transaction: Transaction) -> Result<Signature> {
self.send_transaction(&transaction)
.map_err(|e| TransportError::Custom(e.to_string()))
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is super ugly - will make it go away post-merge.

@garious garious requested a review from mvines May 12, 2020 23:29
@codecov
Copy link

codecov bot commented May 13, 2020

Codecov Report

Merging #10011 into master will not change coverage.
The diff coverage is n/a.

@@           Coverage Diff           @@
##           master   #10011   +/-   ##
=======================================
  Coverage    80.4%    80.4%           
=======================================
  Files         292      292           
  Lines       67293    67293           
=======================================
  Hits        54140    54140           
  Misses      13153    13153           

@mvines
Copy link
Member

mvines commented May 13, 2020

Do we want to ship solana-tokens in the releases? Why not? If so, add it to scripts/cargo-install-all.sh

@garious garious merged commit e09f517 into solana-labs:master May 13, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants