Commit Graph

93 Commits

Author SHA1 Message Date
behzad nouri 4ec5ea6f7b
replaces assert!(matches!(...)) with assert_matches!(...) (#33068)
assert_matches!(...) provides more informative error message when it
fails and it is part of nightly rust:
https://doc.rust-lang.org/std/assert_matches/macro.assert_matches.html
2023-08-30 13:48:27 -04:00
Trent Nelson 2ea88b41fb
cli: skip delegate-stake current voter check for unstaked voters (#32787)
* cli: use `getVoteAccounts` for delegate-stake current voter check

* cli: skip delegate-stake current voter check for unstaked voters

* cli: refactor delegate-stake current voter check
2023-08-11 13:24:14 -06:00
Jon Cinque c73a56faf8
stake: Rename `StakeStateWithFlags` -> `StakeStateV2` (#32795) 2023-08-11 01:07:21 +02:00
Jon Cinque 8e4a9a94ed
sdk: Add new version of `StakeState` to avoid breaking downstream users (#32736)
* sdk: Rename `StakeState` -> `StakeStateWithFlags`

* Add back `StakeFlags` with a deprecation warning
2023-08-09 00:05:40 +02:00
HaoranYi 17af3ab10a
Add stake_flags to stake state (#32524)
add stake_flags to stake state

Co-authored-by: HaoranYi <haoran.yi@solana.com>
2023-07-24 09:09:40 -05:00
HaoranYi 2e9aeff8dd
Enable partitioned epoch reward by feature id (#32174)
enable partitioned epoch reward feature by feature id
update stake rewards tests with partitioned epoch rewards feature enable

Co-authored-by: HaoranYi <haoran.yi@solana.com>
2023-06-20 12:12:50 -05:00
Jeff Washington (jwash) 03b260a29f
allow stake tests to wait for rewards payout (#31821) 2023-05-30 08:56:02 -05:00
Tyera 0cdb315b5b
Make redelegate signer more optional (#30734) 2023-03-15 22:59:56 -06:00
Tyera Eulberg b8b3d723da
Use new client crates (#27360)
* Update ancillary cli crates

* Update cli

* Update command-line tools

* Update rpc, etc

* Update client-test

* Update core, validator

* Update local-cluster
2022-08-24 10:47:02 -06:00
Tao Zhu 6892970c19
Cli support compute_unit_price (#26464)
* add compute-unit-price trait to insert compute_budget instruction to set priorization fee

* add clap arg for compute-unit-price

* add compute-unit-price arg to commands that send transactions

* add and update tests
2022-08-02 22:23:05 -05:00
Michael Vines b660ac511d cli: Add stake redelegation support 2022-07-27 20:24:25 -06:00
Brooks Prumo 8105b761ed
Add CLI to get stake minimum delegation (#26645) 2022-07-21 07:23:18 -05:00
behzad nouri 5ee157f43d separates durable nonce and blockhash domains
AdvanceNonceAccount instruction updates nonce to blockhash. This makes it
possible that a durable transaction is executed twice both as a normal
transaction and a nonce transaction if it uses blockhash (as opposed to nonce)
for its recent_blockhash field.

The commit prevents this double execution by separating nonce and blockhash
domains; when advancing nonce account, blockhash is hashed with a fixed string.
As a result a blockhash cannot be a valid nonce value; and if transaction was
once executed as a normal transaction it cannot be re-executed as a durable
transaction again and vice-versa.
2022-06-04 12:39:31 +00:00
Brooks Prumo cb501807ca
cli stake tests: Increase stake amounts to handle raising minimum delegation (#24835) 2022-04-29 16:37:18 -05:00
Justin Starry 2ad1baa753
Add const fn StakeState::size_of and static assertion (#24416) 2022-04-20 01:04:12 +08:00
Michael Vines 57ff7371b4 Add StakeInstruction::DeactivateDelinquent 2022-04-14 01:49:22 -04:00
Jack May 3d9874b95a
Add fees to tx-wide caps (#22081) 2022-02-11 16:23:16 -08:00
Jack May 1632ee03da
nit: Traceable balance checks (#22462) 2022-01-13 09:09:22 -08:00
Tyera Eulberg 637e366b18
Prevent rent-paying account creation (#22292)
* Fixup typo

* Add new feature

* Add new TransactionError

* Add framework for checking account state before and after transaction processing

* Fail transactions that leave new rent-paying accounts

* Only check rent-state of writable tx accounts

* Review comments: combine process_result success behavior; log and metrics before feature activation

* Fix tests that assume rent-exempt accounts are okay

* Remove test no longer relevant

* Remove native/sysvar special case

* Move metrics submission to report legacy->legacy rent paying transitions as well
2022-01-11 11:32:25 -07:00
Tyera Eulberg 873fe81bc0
Add offline and fee-payer utilities to CLI vote module (#21579)
* create-vote-account: add offline, nonce, fee_payer capabilities

* vote-authorize: add offline, nonce, fee-payer

* vote-update-things: add offline, nonce, fee-payer

* withdraw-vote: add offline, nonce, fee-payer

* close-vote-acct: add fee-payer

* Allow WithdrawVoteAccount to empty account, since offline operations cannot perform account state queries as in CloseVoteAccount

* Fix lint

* Update offline-signing docs

* Add some parse unit tests

* Add offline integration test
2021-12-06 15:54:50 -07:00
Michael Vines b8837c04ec Reformat imports to a consistent style for imports
rustfmt.toml configuration:
  imports_granularity = "One"
  group_imports = "One"
2021-12-03 09:19:13 -08:00
sakridge a8d78e89d3
Move test-validator to own module to reduce core dependencies (#20658)
* Move test-validator to own module to reduce core dependencies

* Fix a few TestValidator paths

* Use solana_test_validator crate for solana_test_validator bin

* Move client int tests to separate crate

Co-authored-by: Tyera Eulberg <tyera@solana.com>
2021-10-29 01:27:07 +00:00
Michael Vines 7027d56064 Resolve nightly-2021-10-05 clippy complaints 2021-10-06 10:37:58 -07:00
Bryan Ischo e288459cf2 Removed the --authorized-withdrawer argument from create-vote-account
The parameter is now a required third argument.  This is because authorized
withdrawer should never be the same as vote account keypair or validator
identity keypair for security reasons.

Added a --allow-unsafe-authorized-withdrawer to override this restriction if
necessary.
2021-09-03 16:45:06 -07:00
Jack May 0b50bb2b20
Deprecate FeeCalculator returning APIs (#19120) 2021-08-13 09:08:20 -07:00
behzad nouri d2d5f36a3c
adds validator flag to allow private ip addresses (#18850) 2021-07-23 15:25:03 +00:00
Tyera Eulberg aeb30fa873
Cli: Support checked stake and vote operations (#18449)
* Refactor VoteAuthorize to use SignerIndex and support vote-authorize-*-checked

* Add checked bool const and use in command parsing

* Add create-stake-account-checked handling

* Add stake-set-lockup-checked handling

* Remove unnecessary mut

* Add stake-authorized-checked handling
2021-07-15 16:45:03 -06:00
Jon Cinque 1b1d34da59
Refactor stake program into solana_program (#17906)
* Move stake state / instructions into solana_program

* Update account-decoder

* Update cli and runtime

* Update all other parts

* Commit Cargo.lock changes in programs/bpf

* Update cli stake instruction import

* Allow integer arithmetic

* Update ABI digest

* Bump rust mem instruction count

* Remove useless structs

* Move stake::id() -> stake::program::id()

* Re-export from solana_sdk and mark deprecated

* Address feedback

* Run cargo fmt
2021-06-15 18:04:00 +02:00
Michael Vines 96cde36784 SetLockup now requires the authorized withdrawer when the lockup is not in force 2021-05-21 11:49:01 -07:00
Greg Fitzgerald 3805874c86
Add --no-wait option to CLI's stake-authorize command (#17244) 2021-05-17 16:54:33 +00:00
Michael Vines cf779c63c5 Add ALL support to withdraw-stake subcommand 2021-04-26 11:03:37 -07:00
Michael Vines ba9a502e7e Add --seed support to delegate-stake and withdraw-stake commands 2021-04-21 20:25:01 +00:00
Tyera Eulberg 7dfb51c0b4
Cli: move airdrop to rpc requests (#16557)
* Add recent_blockhash to requestAirdrop

* Move tx confirmation to separate method

* Add RpcClient airdrop methods

* Request cli airdrop via RpcClient

* Pass optional faucet_addr into TestValidator and fix tests

* Update client/src/rpc_client.rs

Co-authored-by: Michael Vines <mvines@gmail.com>

Co-authored-by: Michael Vines <mvines@gmail.com>
2021-04-15 06:25:23 +00:00
Tyera Eulberg 03d3ae1cb9
Faucet: repurpose cap and slice args to apply to single IPs (#16381)
* Single use stmt

* Log request IP

* Switch cap and slice to apply per IP

* Use SOL in logs, error msgs

* Use thiserror instead of overloading io::Error

* Return memo transaction for requests that exceed per-request-cap

* Handle faucet memos in cli

* Add some docs, esp about memo transaction

* Use SOL symbol & standardize memo

Co-authored-by: Michael Vines <mvines@gmail.com>

* Differentiate faucet tx-length errors

* Populate signature in cli airdrop memo case

Co-authored-by: Michael Vines <mvines@gmail.com>
2021-04-06 07:01:05 +00:00
bji 364af3a3e0
issue #10831: added --with-memo option to all cli commands that submit (#16291)
* issue #10831: added --with-memo option to all cli commands that submit
transactions.  Also, improve the block command to show UTF-8 string instead
of integer values for memo program data.

* Fixed tests and changed some syntax according to feedback.

* Use spl_memo id (all versions where applicable) instead of hardcoding id.

* Update Cargo.toml in programs/bpf.

* Update formatting via cargo fmt.

* Update to use spl_memo version 3.0.1, which simplifies package imports
2021-04-05 20:53:50 +00:00
Trent Nelson 672e9c640f CLI: Support dumping the TX message in sign-only mode 2021-03-16 19:20:54 -06:00
HowJMay 9c7b3dc1b5 style: Fix the typos 2021-02-13 12:34:21 -07:00
Michael Vines 8993ac0c74 Surface faucet start failures to the user of solana-test-validator 2021-01-28 22:35:58 +00:00
Michael Vines 119e2c75dd cli now supports a custodian for stake authorize operations 2021-01-26 11:48:28 -08:00
Tyera Eulberg ffa5c7dcc8
Deprecate commitment variants (#14797)
* Deprecate commitment variants

* Add new CommitmentConfig builders

* Add helpers to avoid allowing deprecated variants

* Remove deprecated transaction-status code

* Include new commitment variants in runtime commitment; allow deprecated as long as old variants persist

* Remove deprecated banks code

* Remove deprecated variants in core; allow deprecated in rpc/rpc-subscriptions for now

* Heavier hand with rpc/rpc-subscription commitment

* Remove deprecated variants from local-cluster

* Remove deprecated variants from various tools

* Remove deprecated variants from validator

* Update docs

* Remove deprecated client code

* Add new variants to cli; remove deprecated variants as possible

* Don't send new commitment variants to old clusters

* Retain deprecated method in test_validator_saves_tower

* Fix clippy matches! suggestion for BPF solana-sdk legacy compile test

* Refactor node version check to handle commitment variants and transaction encoding

* Hide deprecated variants from cli help

* Add cli App comments
2021-01-26 19:23:07 +00:00
Tyera Eulberg 4964b0fe61
Cli: default to single gossip (#14673)
* Init cli RpcClient with chosen commitment; default to single_gossip

* Fill in missing client methods

* Cli tests: make RpcClient commitment specific

* Simply rpc_client calls, using configured commitment

* Check validator vote account with single-gossip commitment
2021-01-19 15:33:03 -07:00
Michael Vines 7143aaa89b Clippy 2020-12-14 08:03:29 -08:00
Michael Vines bbad3fe501 TestValidator now implements Drop, no need to close() it 2020-12-11 04:17:38 +00:00
Michael Vines 0a9ff1dc9d Initial solana-test-validator command-line program 2020-12-11 04:17:38 +00:00
Michael Vines 43b82b31e5 More TestValidator cleanup 2020-11-26 08:56:25 +00:00
Michael Vines b5f7e39be8 TestValidator public interface cleanup 2020-11-25 17:04:37 -08:00
Tyera Eulberg ef99689592
Improve TestValidator instantiation (#13627)
* Add TestValidator::new_with_fees constructor, and warning for low bootstrap_validator_lamports

* Add logging to solana-tokens integration test to help catch low bootstrap_validator_lamports in the future

* Reasonable TestValidator mint_lamports
2020-11-16 23:27:36 -07:00
Trent Nelson 7cab638297 Factor the rest of CLI offline module out to clap-utils and cli-output crates 2020-09-23 15:58:44 -06:00
Trent Nelson 325a7e9f86 Move CLI cli_output module to its own crate 2020-09-23 15:58:44 -06:00
Trent Nelson ba353c2b1d Move CLI blockhash_query module into client crate 2020-09-23 15:58:44 -06:00