Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v2.1.0 - Hotfix/mango-taker-fee-changes #112

Merged
merged 4 commits into from
Feb 14, 2022
Merged

Conversation

acamill
Copy link
Member

@acamill acamill commented Feb 14, 2022

Tested with program Hto7hH47haUP3Vrinym98BHkVdC3jtYWLXUhmfBSBT5N on Devnet cluster.
Informations related to the testing process in this document.

Testable with our front end here on staging - Related mangoAccount with deposited MNGO

E2E tests passing ✅ (Must run locally and call solana-keygen new -o ./target/deploy/uxd-keypair.json --force --no-bip39-passphrase before hand. The CI on this branch is still the non working old one, w/o the reset_program_id.sh)

Associated proposal on the governance


To check the proposal is legit :

anchor build -- --no-default-features --features production -v
then
anchor verify FSWdY47v91HymJR54fNWaY2DXrkoh9pBVepz31ozfi64

- update to mango v3.3.5
- update solana to 1.9.1 (to do as mango, they use 1.9.1)
- update anchor-lang to 0.20.1 (required by mango)
- update anchor-spl to 0.20.1 (required by mango)
Remove the additional owner passed twice.

This was done to support multisig in a previous version of their code IIRC

It's not deprecated and breaking since their last update as they have a new optional account that takes the first spot.
@acamill acamill added the bug Something isn't working label Feb 14, 2022
@acamill acamill self-assigned this Feb 14, 2022
accounts.push(AccountMeta::new_readonly(*mango_group_pubkey, false));
accounts.push(AccountMeta::new(*mango_account_pubkey, false));
accounts.push(AccountMeta::new_readonly(
Copy link
Member Author

@acamill acamill Feb 14, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We pushed the owner key when it was not needed. This was a bug with no ill effect.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess this reduces a little bit the size of the itx right?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 byte only cause this was a duplicate

*owner_pubkey,
signer_pubkeys.is_empty(),
));
accounts.push(AccountMeta::new_readonly(*owner_pubkey, true));
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the owner must always be the signer.

@@ -32,19 +32,15 @@ fn initialize_mango_account_instruction(
mango_account_pubkey: &Pubkey,
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To test these use a new pubkey before running the E2E tests

@sjillen sjillen self-requested a review February 14, 2022 03:50
sjillen
sjillen previously approved these changes Feb 14, 2022
Copy link

@sjillen sjillen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lgtm as far as I can tell

Copy link

@LexBrill LexBrill left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ran E2E tests locally and all worked. All looks good

programs/uxd/src/mango_program/deposit.rs Show resolved Hide resolved
solana-program = "1.8.11"
anchor-lang = "0.20.1"
anchor-spl = "0.20.1"
solana-program = "=1.9.1"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"1.9.1" = "^1.9.1"
🤷‍♂️

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same but more explicit right?
Cause mango uses ^1.8.1 but then end up with 1.9.1 at build time and it's not very deterministic
This ensure we run the same version as mango did at compile time.
But 1.9.6 works too

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, I mean it quite confuses that u need to put the "=" to hv a fixed version

@0xCryptoSheik
Copy link

read the diff

@0xCryptoSheik
Copy link

LGTM w/ audio commentary kek

Copy link
Contributor

@Orelsanpls Orelsanpls left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@acamill acamill closed this Feb 14, 2022
@acamill acamill reopened this Feb 14, 2022
@0xCryptoSheik 0xCryptoSheik self-requested a review February 14, 2022 10:57
@acamill acamill merged commit c6b6f70 into main Feb 14, 2022
acamill added a commit that referenced this pull request Feb 14, 2022
* Dependencies update to match mango
- update to mango v3.3.5
- update solana to 1.9.1 (to do as mango, they use 1.9.1)
- update anchor-lang to 0.20.1 (required by mango)
- update anchor-spl to 0.20.1 (required by mango)

* Owner now passed as signer always.
Remove the additional owner passed twice.

This was done to support multisig in a previous version of their code IIRC

It's not deprecated and breaking since their last update as they have a new optional account that takes the first spot.

* Upgrade version to 2.1.0

* Add changelog
acamill added a commit that referenced this pull request Feb 15, 2022
* Dependencies update to match mango
- update to mango v3.3.5
- update solana to 1.9.1 (to do as mango, they use 1.9.1)
- update anchor-lang to 0.20.1 (required by mango)
- update anchor-spl to 0.20.1 (required by mango)

* Owner now passed as signer always.
Remove the additional owner passed twice.

This was done to support multisig in a previous version of their code IIRC

It's not deprecated and breaking since their last update as they have a new optional account that takes the first spot.

* Upgrade version to 2.1.0

* Add changelog
@acamill acamill mentioned this pull request Feb 15, 2022
11 tasks
acamill added a commit that referenced this pull request Feb 20, 2022
* feat: moved function validation from lib.rs to each instruction file (#91)

* feat: moved function validation from lib.rs to each instruction file

* Integration Tests and CI improvements (#92)

* Several small improvments

* Test now use container wallet without any ties to other executions. The previous wallet  now became the bank.

* Update devnet id

* feat: moved function validation from lib.rs to each instruction file (#91)

* feat: moved function validation from lib.rs to each instruction file

* cleanup

* Update CI

* Fix sol transfer

* Remove fees from the moved amount

* Fix CI

* Update CI

* CI

* CI

* CI

* ci

* trigger build

* Update CI

* CI

* Remove small values in test that are offsetted by the rent and fee until we implement payer/signer in the mint/redeem

* Fees

* Actually wait for TX to be confirmed before going further to prevent unreliable results

* Move await to the API

* Increase fee offset toprevent issues
Increase crank interval for devnet
Cleanup

* - Upgrade to latest UXD Client
- fix collapsed group
- fix display in insurance tests

* - fix authority typo

* Test close

* fix lamports

* Fix Cleanup

* Sol not lamports in CI transfer

* Remove small amount tests

* remove unneeded provider

Co-authored-by: Lexington Brill <[email protected]>

* Use a fresh provider each time for test

* 2.0.1 - Improve computing + IDL update for typo (#95)

* + Cleanup
+ remove msg!
+ improve computing used mango anchor wrapper

* Update version due to IDL change

* Fix typo "roty"

* Update client to 4.16

* Update UXD-client to 4.17.0

* fixed version uxd-client

* commented emit

* - Remove warning with unused import
- Comment about commenting out the events emits

* Add missing error (It was using the other slippage error, which is not the correct one!)

Co-authored-by: cnek <[email protected]>

* Multi Collateral Testing (#99)

* Not all tests passing, need to improve the ones with the redeemable_soft cap cause it's different for SOL, BTC and ETH

* Update client

* Update mangoDepositoryIntegrationSuite.ts

* Fixing tests

* Added more test cases

* Add BTC and ETH to CI market making

* Update uxd-client

* Update tests

* unit test + prop test (#98)

* prop test trial

* test limit_price from mango_utils (#88)

* test limit_price

* minor

* limit price test 2 (#94)

* wip

* wip

* i80f48 cal test

* rm

* updated workflow file

Co-authored-by: Acammm <[email protected]>

* Have the SOL tests back

* Fix missing insurance parameter in tests

* Feature/add payer to mint and redeem (#100)

* Add a payer to mint and redeem

* Working

* Add changelog + update version

* Trigger CI

* Trigger CI

* Update UXD-Client

* Update UXD-Client

* ETH integration tests. (#102)

* Eth testing

* Missing return for ETH

* Fix CI with multiple MM accounts (#105)

* Update solana version to latest cluster-version

* New accounts on mango

* enhancement/soteria_ci (#108)

* try 2. copy pasted from drift

* no cd

* working

* Rebalancing-lite (#107)

* WIP No tests - no settlement of PNL (maybe todo)

* FIx stack blowup + 3.0.0 idl

* Controller not mutable in the migrate IX

* Update IDL

* Remove uneeded mut of controller in some instances (harmeless but useless)
+ update IDL

* Add sec checks to depository account in migrate

* Add depository version check for the rebalance call + upgrade idl

* Migrate + tests OK

* Fix migrate test

* Use BOX to prevent stackoverflow

* Working tests pre rebalance testing

* wip rebalancing

* Mocha awsome
+ reog tests.. (not the place but I was having some issues. Too much work, easier to pack)

Rebalancing tests WIP

* Provider -> Connection
Readme

* Payer .publicKey

* More refactoring. Almost there

* Fix readme

* Working tests for rebalancing

* Updates devnets and Readme

* Working

* Upgrade tests

* Improve tests

* Remove print

* Update changelog

* Tag version as beta. Add tests

* Fix tests

* Unlock regular tests

* Upgrade anchor version

* Fix slippage display

* Fix tests

* Update Mango + fix tests

* Use functions

* v2.1.0 - Hotfix/mango-taker-fee-changes (#112)

* Dependencies update to match mango
- update to mango v3.3.5
- update solana to 1.9.1 (to do as mango, they use 1.9.1)
- update anchor-lang to 0.20.1 (required by mango)
- update anchor-spl to 0.20.1 (required by mango)

* Owner now passed as signer always.
Remove the additional owner passed twice.

This was done to support multisig in a previous version of their code IIRC

It's not deprecated and breaking since their last update as they have a new optional account that takes the first spot.

* Upgrade version to 2.1.0

* Add changelog

* Update cargo lock and dependencies after rebasing

* Improve integration tests
- better redeem and mint maths
- rebalancing improved

* Remove only tests

* Fix the redeem min amount test (#114)

* reversed sub/add

* naming

* acammm/move-unit-tests-to-another-ci (#115)

* Separate workflows + tweaks

* Update unit tests CI

* Split test and test-bpf
+ simplications

* Cleanup + add lint and audit

* Add color on audit + fix cluster

* Update funding for e2e tests

* Remove anchor test from CI too costy and failish

* Fix errors from cargo fmt -- --check

* Disable clippy

* Add flag for fixing clippy

* trigger anchor test

* Trigger ci anchor test

* Test fund.sh

* Test fund.sh

* Fix env variable capitalization

* Test fund.sh

* Test fund.sh

* Trigger ci

* reduce funding amount

* update uxd-client to 5.0.0-beta3
send extras to bank instead of faucet

* Add suites in describe for easy skip (#116)

* Fix and rework the ci so that it's faster and more reliable (#117)

* Update CI to use 2 wallets for MM and deployments

* Fix env variable name

* Trigger ci

* Use current cluster version

* Solana version change

* Update wrap up code in ci

* Workspace lint lingo

* Improved performances for CI

* Fix CI

* Fix CI

* Fix CI

* fix ci

* Solana install fix

* Fix ci

* Fix ci

* Fix CI

* Fix ci

* dev do something

* hehe

* Fix CI

* Add some clippy stuff

* ci trigger

* Without the trigger of audit and all

* Please clippy

* Please clippy

* CI

* clippy

* more ci

* ci fix

* Updated

* Fix ci

* Mega CI

* CI

* ibakkk

* Fix ci

* Fix rebalancing

* Update CI

* Upgrade readme

* Ok

* CI

* Ci

* ci

* Ci

* Update ci

* build up

* CI

* Optim for solana cache in tests

* ww

* qq

* bpf

* Rebalancing print issues hwen negative

* Fix bpf

* ci

* Fix Tests

* trigger ci

* CI

* ci

* CI

* CI fix

* Anchor

* Skip BTC Test in the BTC CI

* Acammm/unit tests -- Add more unit tests feat @cnek (#118)

* cleanup regression tests

* Add prop tests

* misc

* Order unit test

* Cleanup

* fix warning

* Add more tests

* Remive todos

* Add tests for order_delta

* Update number format for readability

* Refactor tests names

* restructure

* fixed fmt

* minor udates on  assertion

* run rustup updates

* fixed up

* fixed up

Co-authored-by: cnek <[email protected]>

* Acammm/upgrade anchor 0.21.0 (cherry picking @cnek work) (#120)

* Updgrade anchor version

* updated anchor

* Updated Anchor + use new ci program due to layout change between last rebalancing implementation

* And use a new program ID

* Please Clippy and fmt

* Add back some prints + cleanup old ones

* Fix cargo.toml

* Update IDL and uxd-client

* fmt

Co-authored-by: cnek <[email protected]>

* Update doc and client

* Changelog

* Fix CI triggers

* Upgrade CI resident program

* Add sleep to keep alive the MM job in CI

* - Fix the mint redeem amount
- add badge for ci on mangomarkets
- remove size from  Order as it's unused
- tests tweaks

* Remove the sleep on MM bots in CI

* Fix cargo tests

* Moves bots to other jobs

* Update tests names

* Trigger CI

* Disable Anchor Events in mint and redeem for computing savings

* Fix clippy + update rust toolchain version in CI

* Reduce sol used by e2e tests

* - new default test
- add logs to mint and redeem

* - get_best_order_for_quote_lot_amount and get_best_order_for_base_lot_quantity now return the correct error when order not found
- get_best_order_for_base_lot_quantity not return the order with the proper side (was unused)
- Tests E2E tweaks
- More explicit names for order books related operations

* Added comments for each input accounts (#122)

* acammm/lighter-minting (#123)

* - take 0 slippage as invalid for simplification for now. Front end dont take 0 as input.
- the minting now just do an euclidian division to remove the oddlots and place that order with the worst price.
- It does check afterward for slippage
- updated unit tests

* Cleanups

* Fix tests + some comments

* Fix Comment type @cnek

* Add comments for accounts #

* - fix rebalancing sides
- simplify PerpInfo

* Typos

* Add PnL settlement

* Save computing for redeem

* Trigger CI

* Trigger CI

* Latest mocha for dependabot alerts

* Fix polarity issue and overflow of i128 + fix tests for rebalancing

* Upgrade resident program ID (CI), and add a script to do so

* acammm/proper-support-mango-ref-fees (#124)

* - fix rebalancing positive PnL tests
- remove euclidian division (seems to have a very tiny leftover sometimes not sure why
- support for new ref fees

* Add a payer in the wrapped sol call to not mess with the tests
- add logs in mint since a lot of computing left (and no CPI possible due to size)

* Remove janky calculus with micro leftovers

* Fix tests + rebalancing

* Use right test in anchor.toml

* User https://api.devnet.solana.com

* Update CI

* Save computing for rebalancing

* fmt

* Mint/redeem a bit amove min size to not fail CI on price changes

* Remove useless I80F48 conversion

* Add missing initialisation for the total amount rebalanced + test improvments

* Add badges

* Add badges

Co-authored-by: Lexington Brill <[email protected]>
Co-authored-by: cnek <[email protected]>
@acamill acamill deleted the hotfix/mango-taker-fee-changes branch February 20, 2022 11:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants