* 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
* 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
* 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
* 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
* 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
* 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
* feat: Implement CreateNativeTreasury instruction
* chore: fix fmt
* chore: make clippy happy
* chore: remove account check
* feat: sign with treasury account seeds
* chore: comment out unused code
* feat: Use system as the treasury account owner
* feat: Assert valid governance account
* chore: Make clippy happy
* fix: Use explicit system program id
* feat: add treasury seeds only when required by the instruction
* chore: review celanup
* chore: make clippy happy
* chore: rename create_and_serialize_account_signed2
Co-authored-by: Jon Cinque <jon.cinque@gmail.com>
* chore: update create_and_serialize_account_signed2 name
* fix: remove NativeTreasury from account enums
* chore: update treasury seeds prefix
Co-authored-by: Jon Cinque <jon.cinque@gmail.com>
* feat: implement UpdateProgramMetadata instruction
* feat: put metadata info into the logs
* feat: use CARGO PKG version
* feat: add updated_at for program metadata
* chore: Update instruction comments
* chore: replace .unwrap() with ?
* fix: Change max size to support XXX.YYY.ZZZ version format
* feat: do not allow withdrawing votes before proposal is finalised
* feat: do not allow proposal cancellation before proposal is finalised
* chore: update comments and add test
Co-authored-by: Jon Cinque <jon.cinque@gmail.com>
* chore: Ensure voter-weight-addin is built for tests
fix: build addin during test run
fix: build voter weight addin for tests using the addin only
chore: use mutex to build addin only once
chore: move build guard to separate file
chore: update governance version for chat
* chore: create tools crate for common utility functions in governance ecosystem
* chore: add test-sdk and tools readme
* chore: rename reserved addins to specific names
* chore: remove todo comment
* chore: remove unnecessary var drop
* chore: move all account tools to shared crate
* chore: fix chat compilation
* chore: move program_id to first position
* feat: add amount to Deposit instruction
* feat: use try_from_slice_unchecked to support forward compatibility
* chore: make clippy happy
* chore: update comments
* feat: setup and configure voter weight addin
feat: add use_voter_weight_add_in flag to realm config
chore: use spl-governance 1.1.1 version
chore: make clippy happy
chore: add test to deserialise v1 CreateRealm instruction from v2
feat: add voter-weight-addin skeleton project
chore: build voter-weight-addin before governance
fix: temp workaround to make spl_governance_voter_weight_addin available in CI
chore: add tests with voter-weight-addin
feat: implement deposit instruction for voter weight addin
feat: add voter_weight_expiry
fix: set voter_weight_expiry
chore: restore positive execute tests
chore: restore ignored tests
wip: pass voter weight accounts to create_account_governance2
wip: read voter weight account
chore: make clippy happy
wip: add realm and validation to voter_weight deposit
fix: update addin
chore: make clippy happy
chore: fix voter_weight_record names
feat: use voter weight provided by addin when governance created
chore: update addin
chore: remove governance stake pool program
feat: remove time offset from revise
chore: fix build
feat: create RealmAddins account when realm with addin is created
chore: make clippy happy
feat: set voter weight addin using SetRealmConfig instruction
chore: make clippy happy
chore: update comments
chore: reorder SetrealmConfig accounts
chore: infer use_community_voter_weight_addin
chore: infer use_community_voter_weight_addin
chore: update voter weight addin comments
feat: use voter weight addin id from RealmAddins account
* feat: use voter weight addin to create proposal
* feat: use voter weight addin to cast vote
* chore: make clippy happy
* feat: use voter weight addin to create token governance
* feat: use voter weight addin to create mint governance
* feat: use voter weight adding to create program governance
* chore: create assert_can_withdraw_governing_tokens() helper function
* chore: fix compilation
* fix: ensure governance authority signed transaction to create governance
* feat: implement CreateTokenOwnerRecord instruction
* chore: fix chat tests
* chore: update comments
* chore: rename RealmAddins account to RealmConfig account
* chore: add more reserved space to GovernanceConfig account
* chore: update instruction comments
* chore: update comments
* chore: fix compilation
* chore: remove ignore directive for tests
* feat: panic when depositing tokens into a realm with voter weight addin
* chore: rename community_voter_weight to community_voter_weight_addin
* feat: make payer account optional for SetRealmConfig
* feat: add min_community_tokens_to_create_governance to config
* feat: add token owner record and governing mint to CreateAccountGovernance
* feat: add token owner record and governing mint to CreateMinGovernance
* feat: add token owner record and governing mint to CreateProgramGovernance
* feat: add token owner record and governing mint to CreateTokenGovernance
* feat: remove custodian
* fix: remove mint and update comments
* chore: make clippy happy
* chore: make clippy happy
* feat: change mint fraction precision to 10^10
* chore: move optional fields towards the end of RealmConfig
* chore: fix comment
* feat: create realm using config args
* chore: update comments
* chore: make clippy happy
* chore: fix test name
* fix: remove realm authority from config_args and make it mandatory
* feat: implement SetRealmConfig instruction
* chore: move custodian above council in accounts list
* chore: add tests for setting realm config
* chore: bump version
* chore: make clippy happy
* chore: validate and pass realm to
* feat: validate realm config args
* feat: calculate max vote weight
* chore: make clippy happy and update comments
* fix: adjust max vote weight for vote overflow
* feat: create RealmConfig and move council to it
* feat: add realm custodian to config
* feat: add community_mint_max_vote_weight_source tp realm config
* chore: fix data types
* feat: implement SetRealmAuthority
* chore: add test_sign_off_proposal_with_signatory_must_sign_error
* chore: fix test name
* chore: pass option as value
Co-authored-by: Jon Cinque <jon.cinque@gmail.com>
* chore: move config towards account end to allow potential future grow
* feat: add realm authority to the account
* feat: add governing_token_mint_supply to proposal account
* feat: save realm authority when realm is created
* feat: capture governing mint supply when voting starts
* chore: update comments
* feat: capture governing_token_mint_supply when voting is decided
* Revert "feat: capture governing mint supply when voting starts"
This reverts commit c8d786d322f6c2907fa58b650100021bada9486e.
* chore: update comments on governing_token_mint_vote_supply
Co-authored-by: Jon Cinque <jon.cinque@gmail.com>
* feat: use separate thresholds for council and community tokens to crate proposals
* chore: add tests for proposal creation
* chore: cleanup code and bump version
* chore: fix test name
Co-authored-by: Jon Cinque <jon.cinque@gmail.com>
* feat: implement FlagInstructionError
* fix: ensure instruction can still be executed after being flagged with error
* chore: review cleanup
* chore: bump version
* chore: code review updates
Co-authored-by: Jon Cinque <jon.cinque@gmail.com>
Co-authored-by: Jon Cinque <jon.cinque@gmail.com>
* chore: move realm from config to governance account direct field
* chore: move governed_account from config to governance account direct field
* chore: update comments
* chore: make clippy happy
Co-authored-by: Jon Cinque <jon.cinque@gmail.com>
* chore: upgrade instruction serialisation
* chore: add assert for base64 encoded instruction
* chore: move fields with dynamic size to account end
* chore: Add VoteThresholdPercentageType to support quorum votes in future versions
* chore: Add VoteWeightSource to support account snapshots as voter weights in future versions
* chore: Add InstructionExecutionStatus to support failing proposal instructions in future versions
* fix: update voting_at_slot when proposal enters voting state
* fix: change min_tokens_to_create_proposal to u64 to support large mints
* chore: add InstructionExecutionFlags to support ordered and transactional instruction in future versions
* chore: add withdraw tests with relinquished and unrelinquished votes
* chore: add placeholder for proposal_cool_off_time
* chore: add padding to permanent accounts to use in future versions
* chore: add ProposalCoolOffTimeNotSupported error
* chore: start governance errors from 500
* chore: update versions
* chore: update comments
* chore: use slice for reserved account space
* chore: use VoteThresholdPercentage enum to store percentage value
* chore: use enum None value instead of Option for execution_status
* chore: use enum None instead of Option for execution_flags
* chore: make clippy happy
Co-authored-by: Jon Cinque <jon.cinque@gmail.com>
* feat: implement CreateMintGovernance instruction
* fix: ensure mint is initialised in assert_is_valid_spl_token_mint
* fix: ensure token account is initialised in assert_is_valid_spl_token_account
* chore: move account type and instruction to the end to avoid breaking changes
* chore: make clippy happy
Co-authored-by: Jon Cinque <jon.cinque@gmail.com>