mrgnlabs / marginfi-v2

Apache License 2.0
147 stars 61 forks source link

feat: Add transfer account authority ix #163

Closed exdx closed 6 months ago

exdx commented 6 months ago

This PR adds the ability to transfer account authority to another account via a feature flag. This provides the ability to migrate accounts on the platform.

jkbpvsc commented 6 months ago

If you can also add a few integration tests that cover theses cases:

jkbpvsc commented 6 months ago

Also seems tests have failed

exdx commented 6 months ago

Implemented the new functionality and it looks really good now. Running into some CI issues though:

error[E0080]: evaluation of constant value failed
  --> programs/marginfi/src/state/marginfi_account.rs:26:1
   |
26 | assert_struct_size!(MarginfiAccount, 2304);
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ attempt to compute `0_usize - 1_usize`, which would overflow
   |
   = note: this error originates in the macro `const_assert` which comes from the expansion of the macro `assert_struct_size` (in Nightly builds, run with -Z macro-backtrace for more info)

I get this error when building on an M1 mac but they went away on an x86 box. I don't think any struct sizes have changed? Trying to see if I changed something

exdx commented 6 months ago

The issue is that the MarginfiAccountSetAccountAuthority accounts type is too large for the stack? It's an anchor issue. Looking into how to slim down the size of the struct by boxing accounts.

Note: the error is coming from the switchboard_v2::aggregator::AggregatorAccountData type specifically.

exdx commented 6 months ago

Seems like the CI problems here are across open PRs and not related to this PR's functionality.

exdx commented 6 months ago

The fuzz test is broken across CI currently -- not related to the changes made in this PR.