Commit Graph

2626 Commits

Author SHA1 Message Date
Sebastian Bor 0094255292
Governance: Max voter weight addin (#2815)
* chore: change voter-weight-addin to mock

* chore: fix tests

* chore: add action, target and expiry validation tests

* chore: add full target test checks

* feat: add max community voter weight adding structures

* chore: move payer to last account position

* wip: update max_community_voter_weight_addin

* chore: simplify logic to update realm config

* wip: setup addins when realm is created

* wip: setup voter weights accounts

* chore: make clippy happy

* core: fix merge

* chore: remove old readme

* chore: add SetupMaxVoterWeightRecord to addin mock

* chore: test_create_realm_with_max_voter_weight_addin test

* chore: add SetRealmConfigArgs and refactor tests

* chore: update max voter weight tests

* chore: setup cast_vote_with_max_voter_weight_addin test

* wip: get max voter weight from plugin

* chore: update comments and make clippy happy

* wip: use max voter weight to tip proposals

* chore: rename get_max_voter_weight

* chore: load addins using different ids

* chore: add tests with all addins

* fix: coerce max vote weight when cast votes are higher

* chore: add tests with all adins being used

* chore: add test for expired max voter weight record

* chore: simplify addin mock

* wip: Create addin api crate

* chore: use native build order and dependency

* chore: fix build

* feat: add reserved space to addin records

* chore: bump versions

* fix: use [u8; 8] discriminator for addin account types

* chore: update instruction comments

* chore: use saturating_sub instead of checked_sub

Co-authored-by: Jon Cinque
2022-01-29 02:08:21 +00:00
Jon Cinque 32e77fb390
stake-pool-js: Bump version for release (#2832) 2022-01-29 00:39:28 +01:00
Tyera Eulberg f9e6f66758
Add extension realloc helper (#2821) 2022-01-28 15:41:22 -07:00
Tyera Eulberg eaaed0d3c4
Handle extended token Accounts in ATA program (#2738)
* Use token-2022 in ProgramTest

* Add get_account_len() helper with CPI to spl_token::get_account_data_size()

* Add test for extended mints/accounts using transfer_fee
2022-01-28 15:40:39 -07:00
Tyera Eulberg 9d759b70f9
Revert "Revert ATA to spl-token v3.3 (#2796)" (#2800)
This reverts commit 533f767563.
2022-01-28 12:25:02 -07:00
Kabir R b63d368b79
Add stake-pool browser build commands and documentation (#2804)
* Add browser build commands and documentation

* Improve rollup configuration

* Remove unused external import from rollup configuration

* Move from Babel to Typescript plugin

Co-authored-by: Jon Cinque <jon.cinque@gmail.com>
2022-01-28 19:15:51 +01:00
Tyera Eulberg 8a2d3cc227
token-2022: fix panics due to small buffers (#2824)
* Add panicking test

* Fix panic

* Add another panicking case

* Fix panic

* Add another panicking case

* Fix panics

* Add another panicking case

* Fix

* Add another case

* Move existing fix outside if clause

* Add some helpful comments
2022-01-28 09:47:47 -07:00
Jon Cinque c781067b2b
stake-pool-cli: Use old ATA creation instruction (#2819) 2022-01-27 17:50:22 +01:00
Tyera Eulberg 76b59b6dc1
Fixup use stmts (#2816) 2022-01-26 15:02:07 -07:00
Tyera Eulberg c4de9e35f2
token-2022: remove split_at usages (#2813)
* Add helper and remove split_at usage

* Rework helpers for TransferFee extension ix unpacking

* Refactor pubkey unpacking, remove magic numbers
2022-01-26 14:11:15 -07:00
Tyera Eulberg 2daa6e645f
token-2022: add DefaultAccountState mint extension (#2810)
* Add DefaultAccountState extension

* Check DefaultAccountState in InitializeAccount

* Add rust client functionality

* Add tests

* Simplify ix variants

* Fixup freeze-auth signing state for multisig

* Add InitializeMint check to prevent freeze_authority.is_none() and default AccountState::Frozen

* Use separate freeze_authority in program_test

* Add docs for default-state instruction data

* Rebase on #2807
2022-01-26 13:30:24 -07:00
Jon Cinque e2d56f403d
token-2022: Assess transfer fees (#2807)
* Refactor transfer to use StateWithExtensionsMut

* Add basic transfer tests

* Add transfer fee calculation and use in transfer

* Add specific transfer fee tests

* Add self-transfer test + rename test
2022-01-26 19:25:10 +01:00
Sebastian Bor 5d330d1a74
Governance: Voter weight action & target (#2803)
* feat: add weight action and target to VoterWeightRecord

* chore: update comments

* chore: change voter-weight-addin to mock

* chore: fix tests

* chore: add action, target and expiry validation tests

* chore: add full target test checks

* chore: update comments

* chore: rename addin to addin-mock

* chore: rename voter-weight-addin to addin

* chore: fix tests
2022-01-26 17:00:00 +00:00
Jon Cinque 82d862ebde
token-2022: Enforce maximum transfer fee of 10k bps (#2808) 2022-01-26 14:02:24 +01:00
Tyera Eulberg 8eaaafed54
Refactor TestContext to enable unwrap_err (#2805) 2022-01-25 13:45:53 -07:00
Tyera Eulberg 87fe3793ea
token-2022: implement SetAuthority for TransferFeeConfig and WithheldWithdraw (#2801)
* Make comment more explicit

* Support setting TransferFeeConfig and WithheldWithdraw authorities

* Add tests
2022-01-25 10:23:34 -07:00
Sebastian Bor 27ea2f013d
Governance: Add client SDK link to readme (#2802) 2022-01-25 13:55:58 +00:00
Sebastian Bor 56953b2286
Governance: Transfer freeze and close authorities (#2799)
* fix: transfer mint freeze authority for mint governance

* chore: update transfer_mint_authorities comments

* feat: transfer close_authority when creating token account governance

* chore: update spl-token function names

* chore: remove redundant set_spl_token_mint_authority
2022-01-25 11:02:43 +00:00
Michael Vines 6d62ea6cc7 Drop _program_id 2022-01-24 17:41:47 -08:00
Michael Vines 679e9b1212 spl-token-client no longer hard codes the token program id 2022-01-24 17:41:47 -08:00
Michael Vines 8e559ce69c Add --program-id argument 2022-01-24 17:41:47 -08:00
Michael Vines a46a198404 Document authority restriction 2022-01-24 17:41:47 -08:00
Jon Cinque 8bac649302
token-2022: Implement set transfer fee instruction (#2797)
* token-2022: Implement set transfer fee instruction

* Address feedback
2022-01-25 02:03:12 +01:00
Michael Vines c309e10b84 Restore rent sysvar to create_associated_token_account 2022-01-24 15:05:07 -08:00
Tyera Eulberg 533f767563
Revert ATA to spl-token v3.3 (#2796) 2022-01-24 15:41:14 -07:00
Tyera Eulberg cc8826ac70
token-2022: plumb program_id through instruction builders (#2792)
* Plumb program_id into ix builders

* Don't unwrap extension instructions
2022-01-24 14:14:21 -07:00
Sebastian Bor 3e1dd7cac8
Validate proposal owner for tipped vote (#2793) 2022-01-24 20:50:07 +00:00
Sebastian Bor bc00009d64
Governance: Realm authority validation (#2787)
* feat: Ensure realm authority can be set to realm's governances only

* chore: update comments for governance account check

* chore: update realm authority comments

* chore: update comments

* chore: update comments

Co-authored-by: Jon Cinque <jon.cinque@gmail.com>
2022-01-24 19:41:01 +00:00
Tyera Eulberg a98977f5fd
token-2022: add more tests (#2783)
* Add extended-mint case to test_get_account_data_size()

* Add missing account-type init

* Add basic init-acct ProgramTest tests
2022-01-24 11:39:13 -07:00
Tyera Eulberg c03c1fc7b4
token-2022: make extension instruction builders consistent with vanilla token (#2782)
* Make TransferFee and MintClose ix builders consistent with vanilla token

* Make ConfidentialTransfer ix builders consistent with vanilla token
2022-01-24 11:03:37 -07:00
Tyera Eulberg 28e779d480
Bump thread_local (#2789)
* Revert "Temp. ignore thread_local 1.1.3 security warning (#2788)"

This reverts commit 44b338fa14.

* Bump thread_local
2022-01-24 11:01:43 -07:00
Sebastian Bor 2ae2f5f067
Governance Chat: Voter weight (#2778)
* chore: update governance chat program version to 0.2.0

* feat: support voter weight for chat

* chore: move ensure_voter_weight_addin_is_built to test sdk

* chore: add program version to logs

* fix: workaround for logs

* chore: add test for chat message using voter weight addin

* chore: remove logger overrides

Co-authored-by: Jon Cinque
2022-01-24 17:59:21 +00:00
Sebastian Bor 44b338fa14
Temp. ignore thread_local 1.1.3 security warning (#2788)
* fix: temp ingnore thread_local 1.1.3 security warning

* chore: fix typo
2022-01-24 17:36:22 +00:00
Jordan Sexton 66770345eb alpha version bump 2022-01-22 00:29:56 -06:00
Jordan Sexton 0cfedde82d version bump: 0.2.0-alpha.1 2022-01-22 00:29:56 -06:00
Jordan Sexton 5afaae7a60 add decoded instruction type guard functions 2022-01-22 00:29:56 -06:00
Jordan Sexton 55b1732731 add DecodedInstruction type 2022-01-22 00:29:56 -06:00
Jordan Sexton 65cd045523 update deps 2022-01-22 00:26:44 -06:00
Jordan Sexton b55986b16b update tsconfig 2022-01-22 00:26:44 -06:00
steveluscher f090e55642 Build ESModules with typescript-esm 2022-01-22 00:26:44 -06:00
steveluscher eda6998654 Import indexes, explicitly 2022-01-22 00:26:44 -06:00
Tyera Eulberg 83c3ffad25
Bump solana crates to v1.9.5 (#2780)
* Bump solana crates to v1.9.5

* Update sol_set_return_data type signature and un-ignore test
2022-01-21 22:52:10 -07:00
Jon Cinque 8ee35d74c1
stake-pool-cli / token-lending-cli: Sign after balance check (#2773) 2022-01-22 01:11:58 +01:00
Tyera Eulberg defdca2201
Comment SyscallStubs sol_set_return_data and ignore test for now (#2777) 2022-01-21 16:32:37 -07:00
Tyera Eulberg bf96dd43bf
token-2022: overwrite with init_extension using default state (#2746)
* Overwrite extension data when init is called

* Update comments
2022-01-21 16:28:04 -07:00
Tyera Eulberg fbd3dd4247
Bump solana-zk-token-sdk (#2772) 2022-01-21 15:57:55 -07:00
Tyera Eulberg 821ad120d8
Bump zk-token-sdk and impl Default for confidential-transfer extensions (#2771) 2022-01-21 13:33:41 -07:00
Tyera Eulberg 498d347cdd
token-2022: bump compute limit for close test (#2770) 2022-01-21 11:54:02 -07:00
Jon Cinque 54cb4ad1d8
associated-token-account: Revert to using spl-token-2022 (#2769)
* associated-token-account: Revert to using spl-token-2022

* Clear up no-entrypoint feature for rust client
2022-01-21 19:17:44 +01:00
Jon Cinque 78e7a9538e
associated-token-account: Bump dependent token version to 3.3 (#2766)
* associated-token-account: Bump dependent token version to 3.3

* Fix uses of deprecated instruction
2022-01-21 11:01:06 +01:00