Skip to content

Conversation

@CryptoMaxPlanck
Copy link

Creating a new suite for accounting tests as well as new test cases for minting and redeeming and checking accounting of mangoDepository and controller after txns.

@CryptoMaxPlanck
Copy link
Author

WIP!! if someone is able to, could they try to run "anchor test" with these tests I've added? I seem to be getting some errors about mint and redeem txns (even without my tests)

acamill
acamill previously approved these changes Feb 24, 2022
Copy link
Member

@acamill acamill left a comment

Choose a reason for hiding this comment

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

LGTM, would add this to the BTC/SOL/ETH CI.

also might do the rebalancing one in another PR some day

@CryptoMaxPlanck
Copy link
Author

Gotcha! Will merge momentarily and will make separate PR for CI

@CryptoMaxPlanck CryptoMaxPlanck requested a review from cnek February 24, 2022 03:45
Copy link
Member

@acamill acamill left a comment

Choose a reason for hiding this comment

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

@acamill
Copy link
Member

acamill commented Feb 24, 2022

Merging so you don't get surprises with rebase and stuff 👍

@acamill acamill merged commit f4cc0b1 into v3.1.0 Feb 24, 2022
@acamill acamill deleted the feature/accounting_test_suite branch February 24, 2022 04:56
acamill pushed a commit that referenced this pull request Feb 24, 2022
* feat: accounting suite for accounting tests

* added more checks

* working

* changed back to test_development
@acamill acamill mentioned this pull request Feb 24, 2022
4 tasks
acamill added a commit that referenced this pull request Jun 30, 2022
* Acammm/anchor 0.22.0 (#126)

* - ProgramResult -> Result<()>

* Use error!

* use error from anchor

* Add Check for Unchecked accountsInfo

* WIP trying to make it work but seems that devnet is having issues.
Pausing for now

* feat: accounting suite for accounting tests (#125)

* feat: accounting suite for accounting tests

* added more checks

* working

* changed back to test_development

* Edit rebase error

* Update latest uxd-client

* Yarn lock

* resynchronise a random dev key to enable the replace script

* bump version

* Acammm/ppov2 (place_perp_order_v2) (#131)

* Use new anchor-comp package for mango CPI

* remove old CPI helpers

* Safe changes (w/o mint/redeem/rebalance)

* Use place_perp_order_v2 and simplify code

* Working

* Update tests (most logic been offloaded to Mango)

* Remove uneeded accounts + explicit ATA checks

* allow 100% slippage

* Improve computing for tests

* Slippage tweaks
- Slippage u32 -> u16
- 0 slippage accepted again (was disabled due to previous code but that's been refactored)

* Fix comments + mango 3.4.1

* Acam/enforce limit price (#132)

* Update mango 3.4.1

* fix comment

* Enforce limit price through providing it from front end

* Cleanup

* Ken comments

* idl

* json idl

* Update latest client (was locally linked)

* Add 2.3.1 to changelog

* Cleanup post merge

* Update yarn lock

* Acam/enhancement wo 01  (#144)

* Add zo-abi

WIP zo

Stash pop

stash pop

WIP Cpi almost there.

More updates

Currently doesn't work with yarn so kinda annoying, let's wait for them to fix this as discussed in the TG

Toward cpi support..

Toward cpi support.. almost there

Update reserved padding

Update IDL and client version (still using yarn link)

Fixes

Working Init zo deposiroty + tests

Init Control account in the program for simplicity

Mint WIP

Cargo audit fix

Working register with OO account creationg

Mint issue with CPI

Update client

* wip ZO - issue with constraint. Will add anchor latest for more info to debug

* Deposit mint

* Redeem and mint - Computing issue. Breakpoiint will transit to 0copy

* Redeem withdraw and controller as zero_copy

Require!

* Update PR feedback

* Use latest client (private)
Use accountLoader for mango depository

* Fixing test slowly...

* More test updates and fixes

* Update latest 01 version

* Fixed tests

* ZO Cleanup
(Make a branc without any ZO change for clarity)

* Updated idl

* add the mistakenly erased bank keypair

* Fix memory layout of accounts

* Use the oss version of the client and ditch the private one

* simplified assertion (#147)

* Chore/fix tests (#149)

* Use udx-protocol on NPM instead of private gh version

* Misc

* Fixed mint

* Working integration tests

* Offering to Clippy gods + fmt

* New program ID  + resident program for CI

* Update CI

* npm ci

Co-authored-by: Bamboozelino <memail>

* Usdc minting/redeeming of the PnL (#148)

* first

* instructions (#139)

* instructions

* comments

* api

* rename

* math

* start on tests

* wip tests

* require

* fixes with accounts and merge

* quote_redeem (#140)

* quote_redeem

* comments

* fixed comments and mango check

* a

* poggers

* latest

* save

* nothing

* save

* math fixes

* save

* Invalid Blockhash

* for remote version

* Feature/positive minting and more (#151)

* quote_redeem

* comments

* fixed comments and mango check

* a

* poggers

* latest

* save

* nothing

* save

* math fixes

* save

* Fix memory layout of accounts

* Use the oss version of the client and ditch the private one

* Invalid Blockhash

* for remote version

* simplified assertion (#147)

* save changes

* save

* Chore/fix tests (#149)

* Use udx-protocol on NPM instead of private gh version

* Misc

* Fixed mint

* Working integration tests

* Offering to Clippy gods + fmt

* New program ID  + resident program for CI

* Update CI

* npm ci

Co-authored-by: Bamboozelino <memail>

* committed

* save

* progress

Co-authored-by: Acammm <alexcamill@gmail.com>
Co-authored-by: Ken C <ctk2012ac@gmail.com>
Co-authored-by: acammm <40299747+acamill@users.noreply.github.com>

* Work with max

* misc
- added test to ensure user has UXD
- formatting
- account mutability for mango

* Added test quote test to CI

* - fix quoteMintAndRedeemSuite switch cases
- fix quote mint and redeem test asserts
- changed equals to close_to

* testing improvements
- adding accounting tests for quoteMint and quoteRedeem
- incorporate accounting tests into test suite

* - small test fix

* Test working

Co-authored-by: Max Planck <maxplanck.crypto@gmail.com>
Co-authored-by: Max Planck <99688618+CryptoMaxPlanck@users.noreply.github.com>
Co-authored-by: Ken C <ctk2012ac@gmail.com>
Co-authored-by: Bamboozelino <memail>

* Upgrade CI

* Cleanup + test fixes

* Update package.json and lock

* Update client version to beta next

* fix import

* Update CI

* Update CI

* Mango explorer replacement

* Update CI

* Update Readme

* Update CI

* Use older solana version for more successful deployments

* Update CI

* added ix to disable minting (#152)

* added new ix

* minor

* updated idl

* updated naming

* updated idl

* added ix to disable minting - integration test (#153)

* added integration test

* updated naming

* Update CI

* fmt + ci

* Update uxd-client to beta3

* Update CI

* Disable MM in CI must be ran from the side now
update CI

* Add back the program ID to the IDL

* Cleanup

* Swap program ID in the constants

* CI fix  + readme

* Add missing user ata

* fix ci

* Fix ci transfers

* Fix quote mint redeem

* Fixes

* Add log for rebalancing lite amount

* Fix rebalancing CI

* Fix quote mint/redeem

* Logs

* Fix CI

* Audit 2 Fixes (#160)

* updated cargo.toml (#158)

* fix the accounting for the redeem_from_mango_depository ix (#157)

* Update the conditions for quote (mint and redeem)  (#162)

* Update the conditions for quote (mint and redeem) after talking with Soteria
todo: add tests to try minting/redeeming beyond the adjusted_unreliazed_pnl (SHOULD FAIL)
todo: update tests to verify that the opration should pass or not before running the test (if there isn't enough unrealized PnL to do an operation the test should fail properly)

* added test coverage

* fixes
- add require for minting_disabled in quote_mint
- change update_onchain for quote_mint to add redeemable_minted_amount

* Update @lamine feedback - Don't double dip on the quote mint amount

* Add support + tests for quote_mint_redeem_soft_cap

* fix tests

Co-authored-by: Max Planck <maxplanck.crypto@gmail.com>

* audit 2 fixed: info6 (naming and minor fix) (#163)

* fixed comment about bps

* fixed naming

* Update mango_depository.rs

Eng

Co-authored-by: acammm <40299747+acamill@users.noreply.github.com>

* Fee rounding issue, floor when negative to keep the same behaviour (#164)

* Fee rounding issue, floor when negative to keep the same behavior

* Update order_delta.rs

* Coherent operations for accounting (#166)

* Fix/info 5 checks quotemint (#167)

* Add check for the quote

* Update IDL + tests

* updated test naming (#165)

Co-authored-by: Ken C <ctk2012ac@gmail.com>
Co-authored-by: Max Planck <99688618+CryptoMaxPlanck@users.noreply.github.com>
Co-authored-by: Max Planck <maxplanck.crypto@gmail.com>

* Update mango version to use  v3.4.6 + use latest anchor-comp (0.2.3)

* fixed test (#171)

* fix e2e tests

* dev state for cargo.toml

* FMT

Co-authored-by: Max Planck <99688618+CryptoMaxPlanck@users.noreply.github.com>
Co-authored-by: Ken C <ctk2012ac@gmail.com>
Co-authored-by: Max Planck <maxplanck.crypto@gmail.com>
Co-authored-by: Bamboozelino <memail>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants