Commit Graph

190 Commits

Author SHA1 Message Date
Christian Kamm 16d22648f7 Rename padding -> reserved and increase its size 2022-02-14 09:06:29 +01:00
Christian Kamm bb9738b12f Update to 0.1.11 2022-02-11 13:53:06 +01:00
Christian Kamm b7782dcd5c LogVoterInfo: Make range configurable
Previously the instruction was hardcoded to return 16 accounts. It
turned out that this number was too big for the current limits on
compute units.
2022-02-11 13:47:47 +01:00
microwavedcola1 357648e4da bump version
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2022-02-10 19:37:56 +01:00
microwavedcola1 69767b2323
add note why clawback is possible when someone is engaged in an active proposal (#39)
* add comment

Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>

* remove unused

Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>

* fix test

Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2022-02-10 19:34:48 +01:00
Sebastian Bor 7ff4ad2e23 chore: update version to 0.1.9 2022-02-09 13:59:52 +00:00
Christian Kamm 929c38f512 Withdraw: Never block withdraws of tokens without voting power
Previously being engaged in a proposal would prohibit these withdraws.
2022-02-09 10:31:06 +01:00
microwavedcola1 77642d7f0c
update solana dep (#36)
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2022-02-05 18:06:50 +01:00
Christian Kamm 5835652650 Bump version to 0.1.8, release 2022-02-04 14:32:20 +01:00
Christian Kamm b77b23d268 Grant: Separate authorities, allow the voter to grant to itself
This is done to allow governance proposals to grant to a voter from
arbitrary token accounts, as long as it's the voter themselves who
executes the proposal once the vote has succeeded.
2022-02-04 14:27:13 +01:00
microwavedcola1 2105e1b173
fix clippy warnings and some other deprecations (#33)
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2022-02-04 09:32:55 +01:00
microwavedcola1 b466f0d002 release
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2022-02-02 18:19:34 +01:00
Christian Kamm be8f033842 Update spl_governance fixture binary 2022-02-02 08:46:16 +01:00
Sebastian Bor ce16b0e4c6 chore: add version comments 2022-02-02 08:43:42 +01:00
Sebastian Bor b6fe798af6 chore: upgrade spl-gov to 2.2.0 2022-02-02 08:43:42 +01:00
Sebastian Bor 6bbae6519c chore: replace obsolete set_bpf_compute_max_units 2022-02-02 08:43:42 +01:00
silas 12432b3340 Registrar: Fix unsafe math op
Wouldn't be an issue in production because time_offset can only be
non-zero in tests.
2022-02-01 12:58:17 +01:00
Christian Kamm 1a577eb7bd
Upgrade spl-governance version (#30)
Upgrade to latest spl-governance

Co-authored-by: microwavedcola1 <microwavedcola@gmail.com>
2022-02-01 10:46:03 +01:00
Christian Kamm dff41754e2 Update to version 0.1.6 2022-01-26 09:44:27 +01:00
Christian Kamm 68da83cfa9 Test: add basic one for internal_transfer_unlocked 2022-01-26 09:01:17 +01:00
Christian Kamm 5b3d07ffb3 Renames for clarity
- withdrawable -> unlocked

  "withdrawable" was a bad name, since these funds - while unlocked -
  are not necessarily withdrawable if the voter is currently engaged in
  a vote.

- only_deposit -> only_unlocked

  Locked funds are technically also deposited. Make it clearer that this
  is talking about the unlocked parts of the funds on the account.
2022-01-26 09:01:17 +01:00
Christian Kamm 7b7ce7d8ce Add internal_transfer_unlocked
Rename internal_transfer -> internal_transfer_locked

The new instruction can move only unlocked funds and is useful to avoid
needing to withdraw funds if they should be re-locked in a different
deposit entry.

Withdrawing can be impossible when a voter is engaged in proposals.
2022-01-26 09:01:17 +01:00
microwavedcola1 e7ffe744e9
close vault and return rent sol (#26)
close vault and recover rent sol via remaining accounts, in close voter ix
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2022-01-25 14:56:15 +01:00
Christian Kamm b30375e0ac Update error comments for easy error code reference 2022-01-25 13:01:11 +01:00
Christian Kamm 819038a9ae Use checked_div() more 2022-01-25 13:00:45 +01:00
Christian Kamm 22b4923ef2 Address all math issues reported by soteria
None of these should have been a real issue.
2022-01-25 13:00:45 +01:00
Christian Kamm 40708e80ef Fix underflow in voting computation
The vote power computation was broken for lockups that start very far
in the future.

- Fix the underflow itself
- Disallow lockups that start more than 100 years in the future
- Error if the lockup-scaled voting power is bigger than the maximum
  lockup voting power
2022-01-25 13:00:45 +01:00
microwavedcola1 f81e308a7d Add tests for discovered lockup voting power issue
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2022-01-25 13:00:45 +01:00
Christian Kamm 23b0cf9747 Bump version to 0.1.5 2022-01-19 09:06:15 +01:00
Christian Kamm 183626ad32 Add LogVoterInfo instruction
It has no effect on any state. It logs information about the voter and
all of its deposits to the program log. This can be used from the UI.
2022-01-19 09:04:39 +01:00
Christian Kamm 5f07ada27b
Improve docs/readability on ConfigureVotingMint (#21) 2022-01-13 15:28:40 +01:00
microwavedcola1 6b59d48df3
Mc/release experiments (#20)
* fix anchor version

Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>

* fix solana version, use the version anchor-lang refers to

Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>

* add comment

Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>

* uncomment

Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>

* rename

Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>

* fix test script

Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>

* rename + make consistent

Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>

* cleanup script and do a proper release

Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>

* not required in ts package

Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>

* fix-comment

Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2022-01-13 11:53:24 +01:00
microwavedcola1 38d7b03735 ts client
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2022-01-10 10:13:08 +01:00
Christian Kamm 18edcd602e Overflow checking in vested vote power computation 2021-12-29 10:01:36 +01:00
Christian Kamm 1574f53a65 Overflow check when accumulating voter weight 2021-12-29 10:01:36 +01:00
microwavedcola1 4c3215c9b0
Merge pull request #17 from blockworks-foundation/ci
github instead of travis for ci tests
2021-12-20 12:01:41 +01:00
microwavedcola1 1477c29a0f linter-fix
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2021-12-20 11:09:51 +01:00
Christian Kamm bb4c3f85ea
Remove separate clawback_authority (#15)
Just use the realm authority instead.
2021-12-20 11:01:23 +01:00
Christian Kamm 0e45b0d8a4 Prefer Pubkey::default() over manual init 2021-12-18 14:24:58 +01:00
microwavedcola1 bfab92e534 fix-comment
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2021-12-18 14:22:22 +01:00
microwavedcola1 332f1f76fc remove unused, was added for ts tests, which we not longer maintain
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2021-12-18 14:09:20 +01:00
microwavedcola1 6ba0788e48 comment
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2021-12-18 14:06:08 +01:00
Christian Kamm afa1e30269 Tests for starting time in deposit/grant
Including a bugfix to the Grant instruction
2021-12-17 10:44:11 +01:00
microwavedcola1 9d72320bdd
make vault per voter+mint instead of global per registrar+mint (#14) 2021-12-17 08:02:14 +01:00
Christian Kamm 9c8dd35ba6 Grant/CreateDeposit: Allow control of start timestamp 2021-12-17 07:51:06 +01:00
Christian Kamm ae7dea95eb Create voter requires authority signature
and can only be called once for each voter_authority.

Now that there's a separate "Grant" instruction, there's no longer a
need for CreateVoter to be idempotent and be callable on foreign
accounts.

Calling create voter manually on a PDA account could have allowed
automation.
2021-12-17 07:51:06 +01:00
Christian Kamm a5659f6666 Use specific size of VoterWeightRecord in initialization 2021-12-17 07:51:06 +01:00
Christian Kamm 5aa1114beb Make VotingMintConfig::in_use based on the mint 2021-12-17 07:51:06 +01:00
Christian Kamm b937452f51 Increase default voting_mints size to 4. 2021-12-17 07:51:06 +01:00
Christian Kamm d877eae443 Upgrade spl-governance dependency to current master 2021-12-14 13:46:38 +01:00