Commit Graph

171 Commits

Author SHA1 Message Date
dependabot[bot] a036953d12
build(deps): bump serde_json from 1.0.67 to 1.0.68 (#2416)
Bumps [serde_json](https://github.com/serde-rs/json) from 1.0.67 to 1.0.68.
- [Release notes](https://github.com/serde-rs/json/releases)
- [Commits](https://github.com/serde-rs/json/compare/v1.0.67...v1.0.68)

---
updated-dependencies:
- dependency-name: serde_json
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

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

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-09-15 11:17:56 +00:00
Han Yang 30406eea40
stake-pool: cli fix remove-vsa bug (#2404)
* fix remove-vsa bug: join instructions

* missed &

* pls squash this merge
2021-09-13 14:39:22 +02:00
Jon Cinque 864b7eff0b
stake-pool-cli: Fix sol deposit for private pool (#2399)
* stake-pool-cli: Fix sol deposit for private pool

* cargo fmt
2021-09-10 01:27:43 +02:00
Jon Cinque 562fd6d97f
stake-pool: Bump versions and update id for deployment (#2384) 2021-09-08 13:00:32 +02:00
Jon Cinque 87a5c79347
stake-pool: Reduce minimum stake per validator to 0.001 SOL (#2373)
* stake-pool: Reduce minimum stake per validator to 0.01 SOL

* Lower the limit to 0.001 SOL
2021-09-08 02:10:31 +02:00
Jon Cinque 87b74cfa4c
stake-pool: Combine create stake and add validator (#2371) 2021-09-03 00:54:51 +02:00
Jon Cinque fc0d6a2db7
stake-pool: Split from stake account during removal (#2367)
If the stake pool gives over the validator stake account to the staker,
they may keep it and make it impossible to re-add that validator in the
future.

Split the whole amount into a new stake account on removal.
2021-09-02 01:38:16 +02:00
dependabot[bot] 3fcfb999d1
build(deps): bump serde from 1.0.129 to 1.0.130 (#2361)
Bumps [serde](https://github.com/serde-rs/serde) from 1.0.129 to 1.0.130.
- [Release notes](https://github.com/serde-rs/serde/releases)
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.129...v1.0.130)

---
updated-dependencies:
- dependency-name: serde
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

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

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-08-31 11:13:17 +00:00
Michael Vines 4406265d4a Upgrade to Solana 1.7.11 2021-08-30 12:41:08 -07:00
dependabot[bot] 7ef3509f51
build(deps): bump serde_json from 1.0.66 to 1.0.67 (#2351)
Bumps [serde_json](https://github.com/serde-rs/json) from 1.0.66 to 1.0.67.
- [Release notes](https://github.com/serde-rs/json/releases)
- [Commits](https://github.com/serde-rs/json/compare/v1.0.66...v1.0.67)

---
updated-dependencies:
- dependency-name: serde_json
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

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

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-08-30 11:32:19 +00:00
dependabot[bot] 1f97833cdd
build(deps): bump serde from 1.0.128 to 1.0.129 (#2322)
Bumps [serde](https://github.com/serde-rs/serde) from 1.0.128 to 1.0.129.
- [Release notes](https://github.com/serde-rs/serde/releases)
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.128...v1.0.129)

---
updated-dependencies:
- dependency-name: serde
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

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

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-08-24 11:17:42 +00:00
dependabot[bot] 4b7898cb2b
build(deps): bump serde from 1.0.127 to 1.0.128 (#2318)
Bumps [serde](https://github.com/serde-rs/serde) from 1.0.127 to 1.0.128.
- [Release notes](https://github.com/serde-rs/serde/releases)
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.127...v1.0.128)

---
updated-dependencies:
- dependency-name: serde
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

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

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-08-23 11:29:51 +00:00
Jon Cinque 7c8e65292a
stake-pool: Add seed for transient stake account (#2304)
* stake-pool: Add seed for transient stake account

* Use new functions in CLI

* Put back transient stake seed prefix
2021-08-20 14:15:02 -04:00
jon-chuang 25cc0cffc5
stake-pool: seed suffix to allow creating & discarding multiple transient stake accs (#2298)
* seed suffix to allow creating & discarding multiple transient stake accs

* "suffix"

* fix tests, memcmp and len, reorder struct fields

* remove proptest
2021-08-20 01:14:42 -04:00
Jon Cinque 9799fa1355
stake-pool-cli: Add `list-all` instruction (#2296)
* stake-pool-cli: Add "list-all" command to see all pools

* Cleanup output for withdraw
2021-08-18 00:59:11 -04:00
jon-chuang 4b0f59e9c6
Use stake pool's declared token ID rather than hard-coded (#2286)
* fix

* tests use hard-coded `&spl_token::id()` - fine since we need a baseline

* use spl_token::id
2021-08-17 16:36:32 -04:00
jon-chuang e168a5db92
stake-pool: skip manager fee if invalid account, check new manager fee owned by `spl_token` (#2277)
* fix

* add check if new manager fee is spl token program

* Convert manager fee info check to fail only inside `Result` box

* update also checks validity of manager fee info

* clippy
2021-08-17 16:32:47 -04:00
jon-chuang 494ef1d54e
stake-pool: `DepositStake` only issues tokens for `delegation.stake` + `min(undelegated_stake_rent, additional_lamports)` (#2270)
* charge fees for `sol_deposit_lamports` in `DepositStake` separately

* do not add extra lamports beyond rent

* change name: `additional_lamports`

* fix: put `meta_exempt_reserve` limit on additional lamports instead

* debugging tools

* saturating_add

* make rent quota conditional

* eagerly update total_stake_lamports

* fix tests to reflect increase in `total_staked_lamports`
2021-08-17 16:27:50 -04:00
Han Yang 85f81ae45c
fix stake-pool: preferred validator can be set to validator not part of the pool (#2272)
* deny set preferred validator if validator is about to be removed, add tests

* fix copy paste error

* only allow Active validators to be set to preferred validator

Co-authored-by: Jon Cinque <jon.cinque@gmail.com>

Co-authored-by: Jon Cinque <jon.cinque@gmail.com>
2021-08-17 16:02:02 -04:00
dependabot[bot] 6900c7815f
build(deps): bump num_enum from 0.5.3 to 0.5.4 (#2293)
Bumps [num_enum](https://github.com/illicitonion/num_enum) from 0.5.3 to 0.5.4.
- [Release notes](https://github.com/illicitonion/num_enum/releases)
- [Commits](https://github.com/illicitonion/num_enum/compare/0.5.3...0.5.4)

---
updated-dependencies:
- dependency-name: num_enum
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

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

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-08-17 11:15:31 +00:00
Jon Cinque b4b9763a00
stake-pool: Cleanup comments and rename functions (#2283) 2021-08-14 01:15:50 -04:00
jon-chuang 05325a511d
fix (#2278) 2021-08-14 00:30:37 -04:00
Han Yang 11a5551446
fix: stake-pool require signature in SetManager (#2273)
* add check for new_manager's signature in SetManager

* cli arg edit
2021-08-14 00:16:43 -04:00
jon-chuang 974541c158
stake-pool: Update fee changes only once per epoch (#2269)
* fix

* test for withdrawal fee

* merge conflict changes
2021-08-14 00:09:33 -04:00
Jon Cinque c0be064278
stake-pool: Address a few points post-liquid staking (#2252) 2021-08-11 01:33:06 -04:00
jon-chuang 87d88bd078
Stake pool/liquid deposits (rebased on new master) (#2141)
* rename staking instructions

* modify DepositStake te to include manager fees and referrer, continue _stake refactor, referral fees WIP

* initialize with fees, fee application, checks

* inline functions

* temporarily substitute u8 for bool until borsh gets it's * straight

* set deposit fee

* apply deposit and referral fee to liquid deposit_sol too

* add set-deposit-fee, unify cli interface

* set-referral-fee

* full feature set for liquid deposits (?)

* add tests/set_referral_fee.rs

* fix missing serialization in process_set_referral_fee

* remove duplicated test case in tests/set_withdrawal_fee.rs

* tests WIP, numbers dont add up after non-zero deposit fee

* fix error, fix tests

* deposit_sol tests. Requires additional changes to work properly

* simplify deposit_sol tests, add referral fee tests for deposit and deposit_sol

* add `sol_deposit_authority`.

* split deposit_sol() & deposit_sol_with_authority(), cli sol_deposit --from, minor cleanup

* cli deposit-sol from argument should take keypair instead

* commands: set-sol-deposit-authority, show

* cli: pretty print stake pool struct

* chore: comments/naming

* fmt, clippy

* add args for `create-pool`

* mistake in the cli

* `system_prog` is `read_only`, require sig from `stake_deposit_auth`

* change deposit-sol-authority arg to optional acount, rename instruction::withdraw->withdraw_stake, remove unnecesary sys_prog arg for withdraw_stake

* resolve simple nits and suggestions

* cli: change default referrer to user's token receiver account instead of pool manager

* cli: remove show command, add fees to list command, rename pool -> epoch

* update tests for removed unnecessary referral fee account owner check and deposit sol

* cli changes: create ephemeral account for deposit_sol

* specify pool token type for account info name

* add check for manager fee acc in deposit_sol

* Apply suggestions from code review

Co-authored-by: Jon Cinque <jon.cinque@gmail.com>

* fix non-rebased bug

* SetDepositStakeAuthority

* refactor + tests + cli

* fmt

* clippy

* remove unnecessary comment

* ASK keyword

* unset deposit auth

* combine set fee instructions

* clippy

* applying suggestions

* apply out-of-date check only for FeeTypes that need it

* add fee + user = new tokens check

* Fix test

* Unify `SetDepositAuthority` instruction

* fmt

Co-authored-by: dhy1996 <dhy1996@live.com.sg>
Co-authored-by: Jesse Y. Cho <f8122dac91@gmail.com>
Co-authored-by: Jon Cinque <jon.cinque@gmail.com>
2021-08-11 00:15:45 -04:00
Jon Cinque 0d8a248786
stake-pool: Fix zero withdraw calculation (#2251) 2021-08-10 15:56:20 -04:00
Jon Cinque f7384c1fb3
stake-pool: Make it impossible to leech value (#2218) 2021-08-05 10:25:37 -04:00
dependabot[bot] 488af86a78
build(deps): bump num_enum from 0.5.2 to 0.5.3 (#2207)
Bumps [num_enum](https://github.com/illicitonion/num_enum) from 0.5.2 to 0.5.3.
- [Release notes](https://github.com/illicitonion/num_enum/releases)
- [Commits](https://github.com/illicitonion/num_enum/compare/0.5.2...0.5.3)

---
updated-dependencies:
- dependency-name: num_enum
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

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

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-08-03 11:16:44 +00:00
dependabot[bot] e6a7c0080b
build(deps): bump serde from 1.0.126 to 1.0.127 (#2200)
Bumps [serde](https://github.com/serde-rs/serde) from 1.0.126 to 1.0.127.
- [Release notes](https://github.com/serde-rs/serde/releases)
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.126...v1.0.127)

---
updated-dependencies:
- dependency-name: serde
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

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

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-08-02 11:15:36 +00:00
dependabot[bot] 4406ffc5b9
build(deps): bump serde_json from 1.0.65 to 1.0.66 (#2187)
Bumps [serde_json](https://github.com/serde-rs/json) from 1.0.65 to 1.0.66.
- [Release notes](https://github.com/serde-rs/json/releases)
- [Commits](https://github.com/serde-rs/json/compare/v1.0.65...v1.0.66)

---
updated-dependencies:
- dependency-name: serde_json
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

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

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-07-30 11:13:27 +00:00
Jon Cinque 2414022606
stake-pool: Don't assess withdrawal fee from fee account (#2180) 2021-07-29 17:56:50 -04:00
Jon Cinque 146b1fa2fe
stake-pool-cli: Fixup help message for decrease-validator-stake (#2179) 2021-07-29 14:40:02 -04:00
dependabot[bot] 6de07fe2c4
build(deps): bump serde_json from 1.0.64 to 1.0.65 (#2160)
Bumps [serde_json](https://github.com/serde-rs/json) from 1.0.64 to 1.0.65.
- [Release notes](https://github.com/serde-rs/json/releases)
- [Commits](https://github.com/serde-rs/json/compare/v1.0.64...v1.0.65)

---
updated-dependencies:
- dependency-name: serde_json
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

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

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-07-29 11:47:23 +00:00
jon-chuang e9e4d36211
Stake pool/withdrawal fee (#2107)
* stake-pool: Add new fee fields for liquid staking and arbitrage

* incorporate withdrawal fee to withdrawal instruction, refactor calculating fees into Fee method

* update withdraw instruction to take manager fee account, revert divide by 0 edge-case removal

* initialize with withdrawal fee, modify integration tests to incorporate withdrawal fee

* extra safety check, prevent divide by 0

* patch Initialize for other tests

* decrease HUGE_POOL_SIZE to fit compute budget

* set_withdrawal_fee, initialize conditions

* Handle current withdrawal fee = 0 case

* add tests for withdrawal fees

* baseline fee increase is explicit constant

* withdrawal_fee for cli for initialize

* fmt, fix cli

* obey clippy

* clean up cli, add increase from 0 tests.

* add cli: set-withdraw-fee

* apply suggestions for code review

* remove 1_000_000 denom limit

* remove denom limit tests, inline, checked muls

* apply suggestions for code review

* referral fee

* tests: use local copy to calculate_withdrawal_fee instead of fetching from chain

Co-authored-by: Jon Cinque <jon.cinque@gmail.com>
Co-authored-by: dhy1996 <dhy1996@live.com.sg>
2021-07-25 20:08:16 -04:00
Tyera Eulberg 30fccebdc6
Bump solana crates (#2139) 2021-07-23 16:47:06 +00:00
dependabot[bot] 2556d163ae
build(deps): bump num_enum from 0.5.1 to 0.5.2 (#2119)
Bumps [num_enum](https://github.com/illicitonion/num_enum) from 0.5.1 to 0.5.2.
- [Release notes](https://github.com/illicitonion/num_enum/releases)
- [Commits](https://github.com/illicitonion/num_enum/compare/0.5.1...0.5.2)

---
updated-dependencies:
- dependency-name: num_enum
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

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

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-07-20 23:02:28 +00:00
Jon Cinque ddc029e14d
token: Bump to 3.2.0 everywhere (#2116) 2021-07-20 23:40:32 +02:00
Jon Cinque 5159608d03
stake-pool: Update pool token supply on update, in case of burns (#2108) 2021-07-20 00:36:08 +02:00
Jon Cinque f9c7932f03
stake-pool-cli: Integrate user feedback (#2100)
* Add ATA for pool fee account and more pool info

* stake-pool-cli: Integrate user feedback

* Add more output for `list` command, `-v` gives more info
* Default to the manager's associated token account when creating a pool
2021-07-17 21:11:53 +02:00
Brian Anderson 8fbb54bf5f
Eliminate doc warnings (#2058)
* Add URL autolinks to docs in spl-math

* Autolink URLs in doc comments

* Surround 'account references' doc items with code spans to avoid warnings
2021-07-15 17:58:37 -05:00
Jack May df480b9795
Breakup stake-pool update test transactions (#2084)
* Breakup stake-pool update test transactions

* nudge
2021-07-14 10:26:31 -07:00
Jon Cinque 02397e9152
stake-pool: Add check for delegation stake in add / remove (#2076) 2021-07-13 20:11:39 +02:00
Jon Cinque 151eef0696
Convert `checked_add` to `saturating_add` to fix downstream build (#2055) 2021-07-12 12:50:28 +02:00
Jon Cinque 054d61c6b2
stake-pool: Increase version for crate release, update program id (#2059) 2021-07-10 00:24:24 +02:00
Jon Cinque f35ca3c48c
stake-pool-cli: Address feedback (#2057)
* Fix signer parameters (staker, manager, depositor, fee-payer, and
  token-owner)
* On deposit / withdraw / add / remove validator, show the validator
  stake account and where the stake is going to
2021-07-09 23:56:41 +02:00
Jon Cinque 99a6e95106
stake-pool: Optimizations for 4k validators (#2041)
* In-place serde

* Add cleanup instruction

* Add BigVec tests, clarify lifetimes
2021-07-08 22:50:28 +02:00
Tyera Eulberg 0acc8c8bad
Bump solana and borsh crates (#2015) 2021-07-02 16:53:41 +00:00
dependabot[bot] b565332024
build(deps): bump serde from 1.0.125 to 1.0.126 (#2008)
Bumps [serde](https://github.com/serde-rs/serde) from 1.0.125 to 1.0.126.
- [Release notes](https://github.com/serde-rs/serde/releases)
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.125...v1.0.126)

---
updated-dependencies:
- dependency-name: serde
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

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

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-07-01 11:57:51 +00:00
dependabot[bot] 2cb2129527
build(deps): bump proptest from 0.10.1 to 1.0.0 (#2007)
Bumps [proptest](https://github.com/altsysrq/proptest) from 0.10.1 to 1.0.0.
- [Release notes](https://github.com/altsysrq/proptest/releases)
- [Changelog](https://github.com/AltSysrq/proptest/blob/master/CHANGELOG.md)
- [Commits](https://github.com/altsysrq/proptest/compare/v0.10.1...1.0.0)

---
updated-dependencies:
- dependency-name: proptest
  dependency-type: direct:production
  update-type: version-update:semver-major
...

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

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-07-01 11:44:21 +00:00