Commit Graph

61 Commits

Author SHA1 Message Date
Jon Cinque d336b8b714
stake-pool: Use checked_ceil_div for withdraw calc (#1482)
* stake-pool: Use checked_ceil_div for withdraw calc

When a stake account is totally removed from a stake pool by the
manager, there's a chance that the operation would not take enough of
the manager's pool tokens by 1 due to truncation.

Do a ceiling division instead, and refactor ceiling division into the
math library.

* Use new function name on CLI

* Cargo fmt
2021-03-23 00:33:51 +01:00
Yuriy Savchenko d0bf7157cf
Set staking authority instruction removed (#1469)
* Set staking authority instruction removed

* Fixed fmt errors
2021-03-18 12:21:01 +01:00
Michael Vines 662f38f939 Bump Solana version to 1.6.1 2021-03-18 04:07:16 +00:00
Michael Vines af5fdb3146 Bump Rust version to 1.50.0 2021-03-16 22:22:59 -07:00
Michael Vines 686444088b Bump Solana version to 1.5.15 2021-03-16 18:33:37 -07:00
Michael Vines 1bc52c30fd Remove yelling 2021-03-16 18:33:37 -07:00
Michael Vines 995d4a029f Remove tokio dev-dependency 2021-03-16 18:33:37 -07:00
Michael Vines c63d854ac7 Switch to Instruction::new_with_bincode 2021-03-16 18:33:37 -07:00
Jon Cinque 78f7f7f5de
stake-pool-cli: Fix withdraw calc for CLI / program consistency (#1422)
* stake-pool-cli: Fix withdraw calc for CLI / program consistency

* Run cargo fmt

* Integrate review feedback
2021-03-10 13:45:42 +01:00
Jon Cinque 2217950da1
stake-pool-cli: Rename burn -> withdraw (#1423) 2021-03-10 10:38:44 +01:00
Jon Cinque 9c12b50703
Update solana-program to 1.5.11 (#1362)
* Update solana-program to 1.5.11

* Update all programs
2021-03-02 19:19:50 +01:00
Jon Cinque d536460d3f
stake-pool: Fix stake split and withdraw token calculation (#1352)
* Fix stake split and withdraw token calculation

* Cargo fmt
2021-03-01 21:39:21 +00:00
Jon Cinque 833ea9324d
stake-pool-cli: Fix update command, add verbosity (#1345)
* stake-pool-cli: Fix update command, add verbosity

The update command in the stake pool CLI was passing the validator vote
account instead of the associated stake account from the pool, causing
it to fail.  Additionally, add more verbose logging, and a dry-run mode
to get simulate transaction information, useful for debugging CLI
failures.

* Run cargo fmt
2021-02-27 00:57:38 +01:00
Jon Cinque d74b8c8f0a
stake-pool-cli: Update RPC client per TODO (#1304)
* Update deployed stake pool program id

* Add validator account takes 1 SOL instead of 1 lamport

* Fix "update" command for empty validator list

* Update dependencies

* Revert consequential changes

* Run cargo fmt

* Revert sdk

* Revert Cargo.lock
2021-02-23 00:28:06 +01:00
Jon Cinque d75fc5875c
stake-pool-cli: Fix update command for empty list (#1306) 2021-02-22 23:50:17 +01:00
Jon Cinque d31cd78a54
stake-pool: Validator stake account initialized with 1 SOL (#1305)
* stake-pool: Validator stake account initialized with 1 SOL

A validator stake account only has 1 lamport, which means that it will
gain very few rewards per epoch.  Its credits_observed is not
be reset each epoch, which makes it practically impossible to merge
into.  Get around this by instantiating them with more stake.

* Cargo fmt + fix tests
2021-02-22 23:50:05 +01:00
dependabot[bot] 1e5b376df6
build(deps): bump serde_json from 1.0.61 to 1.0.62 (#1265)
Bumps [serde_json](https://github.com/serde-rs/json) from 1.0.61 to 1.0.62.
- [Release notes](https://github.com/serde-rs/json/releases)
- [Commits](https://github.com/serde-rs/json/compare/v1.0.61...v1.0.62)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-02-18 02:07:29 +00:00
dependabot[bot] 5b4c62ce49
build(deps): bump solana-program from 1.5.6 to 1.5.8 (#1261)
Bumps [solana-program](https://github.com/solana-labs/solana) from 1.5.6 to 1.5.8.
- [Release notes](https://github.com/solana-labs/solana/releases)
- [Changelog](https://github.com/solana-labs/solana/blob/master/RELEASE.md)
- [Commits](https://github.com/solana-labs/solana/compare/v1.5.6...v1.5.8)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-02-17 23:56:18 +00:00
dependabot[bot] b476c962ce
build(deps): bump solana-cli-config from 1.5.6 to 1.5.8 (#1260)
Bumps [solana-cli-config](https://github.com/solana-labs/solana) from 1.5.6 to 1.5.8.
- [Release notes](https://github.com/solana-labs/solana/releases)
- [Changelog](https://github.com/solana-labs/solana/blob/master/RELEASE.md)
- [Commits](https://github.com/solana-labs/solana/compare/v1.5.6...v1.5.8)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-02-17 23:23:27 +00:00
dependabot[bot] 0caba7d549
build(deps): bump serde from 1.0.120 to 1.0.121 (#1258)
Bumps [serde](https://github.com/serde-rs/serde) from 1.0.120 to 1.0.121.
- [Release notes](https://github.com/serde-rs/serde/releases)
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.120...v1.0.121)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-02-17 22:17:04 +00:00
Trent Nelson 188c03e9a1 chore: bump solana crates to 1.5.6 2021-02-11 16:30:03 -07:00
Atticlab LLC 11df4aa5ec
Various postponed fixes and changes to the stake pool program (#1200)
* Various postponed fixes and changes to the stake pool program

* Fixed PR comments

* Fixed no-signature validator stake account add test

Co-authored-by: Yuriy Savchenko <yuriy.savchenko@gmail.com>
2021-02-10 17:42:28 +01:00
Yuriy Savchenko 13826294ef
Stake pool: test coverage for most of the program errors (#1134)
* Stake pool: test coverage for most of the program errors

* Fixes to stake pool tests PR comments
2021-01-27 23:35:25 +01:00
Jon Cinque 14daf0d370
Stake pool: adding pool balance confirmation (Redo of #960) (#1116)
* Added validator stake account list storage, deprecated old tests

* Added join and leave stake pool instructions, error messages refactoring

* Stake pool tests refactoring, tests for join and leave pool added

* Added validator stake account creation instruction, join/leave pool instructions renamed, version field added

* Formatting fixes

* Added update list/pool instructions (no tests yet), updated deposit instruction logic, claim instruction removed, refactoring

* Updated deposit logic and tests, updated withdraw logic and added tests, refactoring

* Stake pool CLI updated to work with new deposit/withdraw instructions, claim usage removed

* Added validator stake account management and balance update commands to the stake pool CLI, updated dependency versions, updated devnet program address

* Merge conflicts fixed

* Removed deprecated tests

* Fixes for review comments

* Additional program id checks across the code

* Formatting errors fixed

* Changed minimum stake balance in CLI, removed deprecated tests, removed check for stake history id

* Added TODO for stake account warmup status check

* Cargo.lock conflict fix

* Formatting fixed

* Update Cargo lock file for CI

* Pin themis version of subtle

Co-authored-by: Yuriy Savchenko <yuriy.savchenko@gmail.com>
2021-01-21 14:48:46 +01:00
dependabot[bot] c1d49de8b2
build(deps): bump solana-logger from 1.5.1 to 1.5.3 (#1066)
Bumps [solana-logger](https://github.com/solana-labs/solana) from 1.5.1 to 1.5.3.
- [Release notes](https://github.com/solana-labs/solana/releases)
- [Changelog](https://github.com/solana-labs/solana/blob/master/RELEASE.md)
- [Commits](https://github.com/solana-labs/solana/compare/v1.5.1...v1.5.3)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-01-14 12:36:43 +00:00
dependabot[bot] 7e8c36ef78
build(deps): bump solana-cli-config from 1.5.1 to 1.5.2 (#1051)
Bumps [solana-cli-config](https://github.com/solana-labs/solana) from 1.5.1 to 1.5.2.
- [Release notes](https://github.com/solana-labs/solana/releases)
- [Changelog](https://github.com/solana-labs/solana/blob/master/RELEASE.md)
- [Commits](https://github.com/solana-labs/solana/compare/v1.5.1...v1.5.2)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-01-11 01:32:56 +00:00
dependabot[bot] 86af1b771a
Bump serde from 1.0.117 to 1.0.118 (#1004)
Bumps [serde](https://github.com/serde-rs/serde) from 1.0.117 to 1.0.118.
- [Release notes](https://github.com/serde-rs/serde/releases)
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.117...v1.0.118)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-01-11 08:55:02 +08:00
dependabot[bot] 7b81c0d3c0
build(deps): bump solana-program from 1.5.0 to 1.5.1 (#1025)
Bumps [solana-program](https://github.com/solana-labs/solana) from 1.5.0 to 1.5.1.
- [Release notes](https://github.com/solana-labs/solana/releases)
- [Changelog](https://github.com/solana-labs/solana/blob/master/RELEASE.md)
- [Commits](https://github.com/solana-labs/solana/compare/v1.5.0...v1.5.1)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-01-04 13:51:29 +00:00
dependabot[bot] b08ed21332
build(deps): bump solana-cli-config from 1.5.0 to 1.5.1 (#1023)
Bumps [solana-cli-config](https://github.com/solana-labs/solana) from 1.5.0 to 1.5.1.
- [Release notes](https://github.com/solana-labs/solana/releases)
- [Changelog](https://github.com/solana-labs/solana/blob/master/RELEASE.md)
- [Commits](https://github.com/solana-labs/solana/compare/v1.5.0...v1.5.1)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-01-04 12:39:08 +00:00
dependabot[bot] c64d43180a
Bump serde_json from 1.0.59 to 1.0.61 (#983)
Bumps [serde_json](https://github.com/serde-rs/json) from 1.0.59 to 1.0.61.
- [Release notes](https://github.com/serde-rs/json/releases)
- [Commits](https://github.com/serde-rs/json/compare/v1.0.59...v1.0.61)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-01-04 01:33:47 +00:00
Michael Vines 8ae34d2137 Update to Solana 1.5.0 2020-12-17 21:24:30 -08:00
Yuriy Savchenko c03f45ec30
Multi-account withdraw added the stake-pool CLI (#895)
* Multi-account withdraw added the stake-pool CLI

* Multi-account withdraw refactoring in stake-pool cli, added merge of multiple claim accounts

* Fixed formatting

* Added tests to stake pool CLI withdraw accounts selection

* Formatting fixed

* Clippy warnings fixed
2020-12-03 11:11:56 +01:00
Michael Vines 158fa1dea6 Upgrade to Solana v1.4.14 2020-12-03 05:39:55 +00:00
Michael Vines a477895f02 program-test now adds SPL Token automatically 2020-12-03 05:39:55 +00:00
dependabot[bot] 6aa1d8cce1
Bump solana-program from 1.4.9 to 1.4.13 (#916)
Bumps [solana-program](https://github.com/solana-labs/solana) from 1.4.9 to 1.4.13.
- [Release notes](https://github.com/solana-labs/solana/releases)
- [Changelog](https://github.com/solana-labs/solana/blob/master/RELEASE.md)
- [Commits](https://github.com/solana-labs/solana/compare/v1.4.9...v1.4.13)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2020-12-02 12:54:42 +00:00
Yuriy Savchenko 90698e4be9
Added negative tests for stake pool (#857)
* Added negative tests for stake pool

* Claim refactoring, error codes fixed

* Linter errors fixed
2020-11-18 22:47:42 +01:00
Michael Vines c6a4ac9a82 Bump solana version to v1.4.9 2020-11-17 20:02:17 -08:00
dependabot[bot] 83096bc02a Bump bs58 from 0.3.1 to 0.4.0
Bumps [bs58](https://github.com/mycorrhiza/bs58-rs) from 0.3.1 to 0.4.0.
- [Release notes](https://github.com/mycorrhiza/bs58-rs/releases)
- [Commits](https://github.com/mycorrhiza/bs58-rs/compare/0.3.1...0.4.0)

Signed-off-by: dependabot[bot] <support@github.com>
2020-11-13 21:04:26 -08:00
Michael Vines f4af9054a2 Update to Solana 1.4.8 2020-11-14 02:35:20 +00:00
Jon Cinque b9fed1116b
stake-pool: Add end-to-end testing using ProgramTest (#828)
* WIP: stake-pool: Add end-to-end testing using ProgramTest

* Run cargo fmt

* Add deposit test and extra requirements

* Update Cargo.lock after rebuild

* Bring token program sdk version back to 1.4.7
2020-11-13 13:11:39 +01:00
Michael Vines 5030a87021 Upgrade to Solana 1.4.7 2020-11-12 11:05:20 -08:00
Yuriy Savchenko b9c2bbc275
Added set-staking-auth and set-owner commands to stake pool CLI (#827)
* Added set-staking-auth and set-owner commands to stake pool CLI

* Error handling refactored, fixed new fee owner setting, fixed set owner arg group settings

* Added check for fee account mint to stake pool initialization and set owner methods
2020-11-12 16:44:08 +01:00
dependabot[bot] b71456a8f1
Bump solana-program from 1.4.5 to 1.4.6 (#826)
Bumps [solana-program](https://github.com/solana-labs/solana) from 1.4.5 to 1.4.6.
- [Release notes](https://github.com/solana-labs/solana/releases)
- [Changelog](https://github.com/solana-labs/solana/blob/master/RELEASE.md)
- [Commits](https://github.com/solana-labs/solana/compare/v1.4.5...v1.4.6)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2020-11-11 12:39:52 +00:00
Yuriy Savchenko fec7794c22
Stake pool CLI added (#806)
* Implemented stake-pool CLI with create-pool, deposit, list and withdraw commands, fixed several bugs in underlying smart contract

* Several typos fixed, some error text clarifications.

* Fee parameter in stake pool creation changed into two: numarator and demoninator

* Refactoring to resolve pool request comments

* Added merge to stake_receiver account when claiming whole stake account

* Removed unused import

* Withdraw bump seed calculation fixed
2020-11-10 15:36:05 +01:00
Michael Vines 238eabc1d0 Bump solana version to v1.4.5 2020-11-06 21:29:04 -08:00
Justin Starry 1f810787d0
Fix broken stake-pool docs link and make readme's consistent (#805) 2020-11-06 09:15:27 +08:00
Yuriy Savchenko 87129a93ac
Added positive tests in stake pool and fixed several bugs in instructions (#788)
* Added positive tests for withdraw, claim, set owner, set authority, several bugs fixed

* Fixed PR comments

* Fixed constant with leading zero

* Deposit tests refactoring
2020-11-04 13:34:25 +01:00
Michael Vines 341149d0e9 Back to no-entrypoint feature name 2020-11-03 10:34:43 -08:00
Yuriy Savchenko 480f6604b7
Added missing accounts to the interface to call stake account program (#763)
* Interface accounts added as read-only, fixed mint authority on deposit, fixed stake pool stake deserializing

* Unit test refactoring, added success tests for deposit, updated stake account program id

* Warnings fixed

* Removed random key generation, used Pubkey::new_unique instead

* Imports optimization

* Unit test architecture updated to remove separate invoke_signed declarations

* Added missing accounts (sysvar clock and stake account program id) to calls to stake account program

* Fixed formatting

* Fixed stake pool deposit unit test

* Temporarily removed stake-pool cli from main workspace

* Fixed warning in token program

* Fixed warning in token program v3

* Fixed warnings in token swap program

* Fixed warning in token cli

* Sysvar and program id params reordered
2020-11-02 22:03:54 +01:00
Michael Vines 2b5e9d1286 Drop lifetimes 2020-11-01 20:48:15 -08:00