Commit Graph

2567 Commits

Author SHA1 Message Date
Sebastian Bor fa1da606a7
Governance: Update release version to v2.2.2 (#2878)
* chore: Update release version to v2.2.2

* chore: Update chat version
2022-02-07 14:39:46 +00:00
Tyera Eulberg 482a9281f6
token-2022: Add MemoTransfer extension (#2822)
* Style nits

* Initial MemoTransfer extension

* Stub in check for memo

* Add memo-transfer token-client method

* Add MemoTransfer tests

* Add immutable get_extension, and clean up mod

* Update token/program-2022/src/extension/memo_transfer/instruction.rs

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

* Update token/rust/src/token.rs

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

Co-authored-by: Jon Cinque <jon.cinque@gmail.com>
2022-02-04 17:12:01 -07:00
Tyera Eulberg c7ec4427b6
token-2022: Add Reallocate instruction (#2864)
* Pass by ref

* Dedupe ExtensionTypes in length apis

* Depend on deduplication in ExtensionType::get_account_len

* Add Reallocate instruction

* Remove unneeded api

* Add set_account_type helper and remove unneeded StateWithExtensionsMut api
2022-02-04 15:23:16 -07:00
Jon Cinque 129b35609a
token-2022: Support approve / revoke with extensions (#2870) 2022-02-04 23:07:48 +01:00
Jon Cinque d3539c19f9
token-2022: Fail to close account with withheld fees (#2871)
* token-2022: Fail to close account with withheld fees

* Add comment to use `get_extension`
2022-02-04 23:07:22 +01:00
Jon Cinque 93c7ad7618
token-2022: Support extensions in burn (#2869) 2022-02-04 22:25:36 +01:00
Jon Cinque 9b52455213
token-2022: Add delegate self-revoke (#2872)
* token-2022: Add delegate self-revoke

* Address feedback
2022-02-04 22:23:41 +01:00
Jon Cinque 0a0a6d9380
token-2022: Try to fix flaky test (#2874) 2022-02-04 20:11:01 +01:00
Jon Cinque 2d357e85f5
token-2022: Add transfer tests with extension too (#2868) 2022-02-04 19:16:39 +01:00
Michael Vines 43b9a37836 Remove TODO 2022-02-04 09:58:06 -08:00
Michael Vines 0df75ab5e8 Freezing -> Thawing 2022-02-04 09:55:36 -08:00
Sebastian Bor 1573319244
Governance: Fix Realm deserialisation and bump create versions for V2 (#2863)
* fix: realm deserialisation

* chore: update spl-gov version for chat

* chore: update spl-governance-tools version to 0.1.2

* chore: upgrade Anchor to 0.20.1

* chore: update addin-api version

* chore: update spl-governance-test-sdk version
2022-02-04 15:42:30 +00:00
Anurag Gupta 78e29e9238
token-swap: Changed Wrap SwapCurve's calculator field into Arc instead of Box (#2860)
* box changed to arc

* Imported Arc in all files

* warnings removed

* Updated fuzz
2022-02-03 20:22:51 +01:00
Jon Cinque eb048559eb
token-2022: Add withdraw withheld tokens from accounts (#2857)
* token-2022: Add withdraw withheld tokens from accounts

* Add instruction field for number of signers

* Update instruction field

* Rename field and update comment

* Fix test?
2022-02-03 00:08:13 +01:00
Tyera Eulberg 27b0df1159
token-2022: add StateWithExtensionsMut::unpack_after_realloc (#2859)
* Add unpack_after_realloc

* Dedupe with internal fn
2022-02-02 15:20:54 -07:00
Tyera Eulberg 3863914b10
token-2022: fix handling for extensions with no data (#2858)
* Add failing test

* Fix
2022-02-01 20:53:37 -07:00
Tyera Eulberg 448e75f8ec
token-2022: fixup realloc_needed (#2856)
* Add failing test cases and fix buggy method

* Add extension initializations to ensure buffers are long enough

* Add extra checks

* Move multisig check lower

* Add missing test case and fix
2022-02-01 19:31:10 -07:00
Michael Vines 115c3c4703 Add ImmutableOwner extension to block ATA owner authority changes 2022-02-01 12:53:45 -08:00
Sebastian Bor 4c0bc4c968
Governance V2 cleanup (#2855)
* chore: use exhaustive check for governance account type

* fix: realm v1 deserialisation

* chore: use exhaustive check for multiple account types

* chore:  use exhaustive check for seeds

* chore: update comments
2022-02-01 19:56:03 +00:00
Jon Cinque ab05e4e597
token-2022: Fix flaky test (#2851) 2022-02-01 11:57:02 +01:00
Michael Vines 809c1a1a77 GetAccountDataSize instruction now accepts user-provided extension types 2022-01-31 23:03:22 -08:00
Michael Vines 4ddd6c81cc Permit new token accounts to be overallocated 2022-01-31 22:48:16 -08:00
Jon Cinque ccebd8d4c8
token-2022: Add transfer fee withdrawal from mint (#2849) 2022-02-01 01:00:20 +01:00
Jon Cinque 28f1ba9be5
token-2022: Add freeze / thaw through StateWithExtensions (#2848) 2022-02-01 00:24:59 +01:00
Tyera Eulberg 5b0e0c12e6
Single use stmts (#2850) 2022-01-31 15:04:47 -07:00
Jon Cinque 1f77ba09ed
token-2022: DRY out the transfer fee tests (#2845) 2022-01-31 22:08:44 +01:00
Jon Cinque 37ba32f7c8
stake-pool-cli: Fix mismatched output fields (#2846) 2022-01-31 20:15:28 +01:00
Sebastian Bor ebc91e871a
Governance: add v2 account padding (#2842)
* chore: create RealmV2 account type

* feat: add padding to Realm account

* chore: move RealmConfigArgsV1 and GovernanceInstructionV1 to tests

* chore: Add RealmV2 comments

* chore: rename TokenOwnerRecord to V2 and add reserved space

* feat: translate TokenOwnerRecordV1

* chore: rename Governance to GovernanceV2

* feat: add reserved_v2 to Governance

* chore: make clippy happy

* feat: translate GovernanceV1 accounts

* chore: fix chat build

* fix: update seeds logic for governance V1 accounts

* fix: add check for RealmV1 and GovernanceV1

* chore: add padding to ProposalTransaction

* chore: add padding to VoteRecordV2

* chore: add padding to SignatoryRecord V2

* feat: translate SignatoryRecordV1 account
2022-01-31 03:58:28 +00:00
Sebastian Bor 925f8f5711
Governance: Limit proposal options to 10 (#2841)
* fix: limit proposal options to 10

* chore: increase reserved space to 64
2022-01-31 00:01:13 +00:00
Sebastian Bor 0e85d2e3e0
Governance: Rename tokens_to_create to weight_to_create (#2839)
* chore: assert options length when serialising ProposalV1

* chore: rename tokens_to_create to weight_to_create

* fix: use saturating_sub for voting_proposal_count

* chore: update voting_proposal_count comments

* Revert "chore: update voting_proposal_count comments"

This reverts commit 3e2eb9d90afdd4f6001d17b14f9579fb72ebb895.

* Revert "fix: use saturating_sub for voting_proposal_count"

This reverts commit 5d357049b7bbc12d8ec9d46caefe3b740967fae3.
2022-01-30 22:23:11 +00:00
Sebastian Bor c9f8dda737
Governance: Use saturating sub to decrease voting proposal count (#2840)
* fix: use saturating_sub for voting_proposal_count

* chore: update voting_proposal_count comments
2022-01-30 22:10:58 +00:00
Sebastian Bor 2600963545
Governance: Track proposals in Voting state for realms and governances (#2838)
* wip: add voting_proposal_count to Realm

* feat: track voting proposal count when proposal enters voting state

* chore: pass signatory or owner record

* chore: rename assert_can_create_governance to assert_create_authority_can_create_governance

* feat: decrease voting proposal count when proposal is canceled

* chore: remove clock and rent accounts

* chore: remove clock and rent

* chore: remove rent and clock

* chore: remove rent and clock

* chore: remove clock

* chore: remove rent

* chore: remove rent

* chore: remove rent

* fix: decrease voting_proposal_count when proposal is finalised

* fix: update voting_proposal_count when proposal vote is tipped

* wip: add muted checks for ream and governance config change
2022-01-29 23:52:11 +00:00
Sebastian Bor 3a21fcaa94
Governance: future proof v2 Proposal account (#2837)
* wip: add Veto and Abstain votes to Proposal

* chore: rename max_executable_options to max_voter_options

* wip: add start_at to Proposal

* feat: add SignOffProposal to proposal actions

* chore: rename start_at to start_voting_at

* feat: add max_voting_time

* chore: add comments

* chore: update comments

* feat: Add Abstain and Veto vote types
2022-01-29 20:53:52 +00:00
Sebastian Bor 851efed467
Governance: Rename AccountGovernance to Governance (#2836)
* chore: rename AccountGovernance to Governance

* chore: make governed_account optional

* chore: rename account_governance to governance
2022-01-29 18:14:27 +00:00
Christian Kamm 5850973d97
Governance: Add VoteTipping option (#2826)
* spl-governance: Add VoteTipping option

This allows two new tipping styles in addition to the previous "Strict"
mode:
- Early: Where a yes majority above the yes vote threshold will
  complete the vote, even if below 50% of total possible votes.
- Disabled: Where votes never complete early.

* address review nits
2022-01-29 18:13:18 +00:00
Sebastian Bor 2e69f37633
Governance: Proposals signed off by owner (#2835)
* feat: allow proposal owner to sign off proposal directly

* chore: add proposal by owner sign off tests

* chore: add test for owner trying to sign off proposal with signatory
2022-01-29 15:48:05 +00:00
Sebastian Bor aefbebe3ae
Governance: Multiple instructions per proposal transaction (#2833)
* feat: support multiple instructions per proposal instruction

* chore: rename instruction to transaction

* chore: rename ProposalInstruction to ProposalTransaction

* chore: rename instruction to transaction

* chore: rename InstructionExecutionStatus to TransactionExecutionStatus

* chore: rename proposal instruction to proposal transaction

* chore: make clippy happy

* chore: update instruction names to transactions

* chore: fix compilation

* chore: rename instruction to transaction

* chore: rename instruction to transaction

* chore rename instruction to transaction

Co-authored-by: Jon Cinque jon.cinque@gmail.com
2022-01-29 12:43:22 +00:00
Jon Cinque 95f6c4f501
token-2022: Add harvest from accounts to mint (#2820)
* token-2022: Add harvest from accounts to mint

* Address feedback
2022-01-29 12:21:57 +01:00
Sebastian Bor 46d27c7bed
Governance: Add max_executable_options to VoteType (#2831)
* feat: add max_executable_options to MultiChoice vote

* chore: update Governance comments

* chore: update comments
2022-01-29 02:51:50 +00:00
Sebastian Bor 6070eb5f6c
Governance: Allow realm authority create governances (#2828)
* feat: make it possible for realm authority to create governances

* chore: refactor create governance authority check into a single instruction

* chore: add tests to create governance with ream authority signer

* chore: make clippy happy

* chore: update comments

* chore: fix merge conflicts

Co-authored-by: Jon Cinque jon.cinque@gmail.com
2022-01-29 02:50:13 +00:00
Sebastian Bor aee41fcccd
Governance: Make realm authority check optional (#2827)
* feat: support unchecked SetRealmAuthority

* chore: add test for unchecked set realm authority

Co-authored-by: Jon Cinque
2022-01-29 02:08:52 +00:00
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