Commit Graph

22 Commits

Author SHA1 Message Date
Connor O'Hara 3ef766d249 Added the required CHECK docs from Anchor 2022-12-22 09:21:35 +01:00
Christian Kamm 8eee11a86a Ensure the behavior of the bump ix arguments is unchanged 2022-05-04 13:50:50 +02:00
Christian Kamm 233e5414f4 Use anchor's new require_*!() macros 2022-05-04 13:50:50 +02:00
Christian Kamm eb46a030d1 Upgrade anchor to 0.24.2 2022-05-04 13:50:50 +02: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 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 decdd1230c Address unaligned references, add padding
- Make Registrar zero-copy. While it was using borsh for serialization,
  the array of voting mint configs couldn't be serialized without
  unaligned references.
- Reorganize all zero_copy fields such that switching to repr(C) would
  not make a difference. (just for safety in case that happens)
- Add static asserts on the sizes of all account structs, so any changes
  are visible very early.
- Add padding to structs that didn't have it yet.
2021-12-09 11:59:14 +01:00
microwavedcola1 317b7168eb Remove instruction name logs since they would be redundant with next anchor release
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2021-12-07 19:12:56 +01:00
Christian Kamm 119bdffcec Add grant instruction 2021-12-05 20:36:01 +01:00
Christian Kamm 4cbe9ad4d6 Make create_voter idempotent 2021-12-05 15:29:14 +01:00
Christian Kamm 05582700cf Make create_voter permissionless 2021-12-05 14:34:03 +01:00
Christian Kamm bae63655cc Update voter weight record in withdraw
This avoids a security issue where three separate transactions in the
same slot may update the voter weight record, withdraw funds and then
vote with the stale voter weight record.
2021-12-05 11:58:56 +01:00
Christian Kamm 78bebfdd98 Common code for token owner record validation 2021-12-03 12:54:51 +01:00
Christian Kamm 0612a3f918 Simplify state:: use 2021-12-03 09:52:48 +01:00
Christian Kamm b91f9ba595 Pass deposit_entry_index to create_deposit_entry()
This allows create_deposit_entry() and deposit() to be in the same
transaction.
2021-12-03 09:48:10 +01:00
Christian Kamm d9fac29b28 Documentation improvements 2021-12-03 09:19:13 +01:00
Christian Kamm 26e1511e3e Add comments 2021-12-02 21:30:15 +01:00
microwavedcola1 9823f282d4 split accounts.rs into state/*
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2021-12-02 20:05:43 +01:00
Christian Kamm 7fa584e77a Remove unused `use` declarations 2021-12-02 19:34:27 +01:00
Christian Kamm 6d15fb8d77 Simplification and doc comments 2021-12-02 19:30:41 +01:00
Christian Kamm f5ea3180d1 Move all instructions to separate files 2021-12-02 16:28:12 +01:00