Skip to content

test: siftest verify#3304

Merged
timlind merged 32 commits intomasterfrom
test/integration-test
Nov 9, 2022
Merged

test: siftest verify#3304
timlind merged 32 commits intomasterfrom
test/integration-test

Conversation

@timlind
Copy link
Contributor

@timlind timlind commented Oct 5, 2022

No description provided.

@timlind timlind force-pushed the test/integration-test branch from 04387de to 6a0e390 Compare October 5, 2022 19:43
@timlind timlind changed the title test: integration test for add liquidity test: siftest verify Oct 10, 2022
@timlind timlind enabled auto-merge October 25, 2022 12:25
Comment on lines +166 to +175
func VerifyOpenLong(clientCtx client.Context,
from string,
height int64,
collateralAmount sdk.Uint,
collateralAsset,
borrowAsset string,
leverage sdk.Dec) error {

return nil
}
Copy link
Contributor

Choose a reason for hiding this comment

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

is it actually needed if it returns nil ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

keeping this here as WIP

Wallet native balance after 499999807448702459100223367291740
Wallet external balance after 499999999999999999999022148656694

Wallet native diff 900027225498984213 (expected: 1000032419169645384 unexpected: -100005193670661171)
Copy link
Contributor

Choose a reason for hiding this comment

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

do we want to show in the examples a failure case (think this is what unexpected states)?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This unexpected value is the fee.

Comment on lines +125 to +129
Pool health after 0.999999999999999000
Pool native custody after 0
Pool external custody after 0
Pool native liabilities after 0
Pool external liabilities after 0
Copy link
Contributor

Choose a reason for hiding this comment

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

What if there are multiple MTPs and we're only closing one of them? How are we verifying the values then?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added expected values.

Comment on lines +134 to +135
Wallet collateral balance after: 488999999999999994008999412 (diff: 494008999412)
Wallet custody balance after: 499999211271873732838129967124882 (diff: -99999999999999996)
Copy link
Contributor

Choose a reason for hiding this comment

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

are those diffs expected or not? Would be great to have that info

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added collateral and custody assets so it's easier to see which are fees, as well as expected diff for collateral balance (return amount).

Comment on lines +37 to +41
//txf = txf.WithAccountNumber(accountNumber).WithSequence(seq)
//err = TestAddLiquidity(clientCtx, txf, key)
//if err != nil {
// panic(err)
//}
Copy link
Contributor

Choose a reason for hiding this comment

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

shall we get rid of this code?

return nil
}

func TestOpenPosition(clientCtx client.Context, txf tx.Factory, key keyring.Info) error {
Copy link
Contributor

Choose a reason for hiding this comment

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

Naming convention question: why some functions are prefixed Test and some GetVerify ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The Test functions execute transactions, they aren't in use yet.

Copy link
Contributor

Choose a reason for hiding this comment

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

Would be great to execute transactions and verify them ina single go. Are you actively working on it or what is the plan?

Comment on lines +174 to +181
//fmt.Printf("External deduction %s \n", externalDiff.String())
//fmt.Printf("External expected %s \n\n", externalAmount.String())
//
//fmt.Printf("Native diff %s \n", nativeDiff.String())
//fmt.Printf("Native expected %s \n", sdk.NewIntFromBigInt(nativeAmount.BigInt()).Neg().String())
//fmt.Printf("Native diff - expected %s \n\n", nativeDiff.Sub(sdk.NewIntFromBigInt(nativeAmount.BigInt()).Neg()).String())

//fmt.Printf("LP units expected diff %s \n", lpUnits.String())
Copy link
Contributor

Choose a reason for hiding this comment

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

Shall we remove this code?

Copy link
Contributor

@canercandan canercandan left a comment

Choose a reason for hiding this comment

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

LGTM

@timlind timlind merged commit 0e448ff into master Nov 9, 2022
@timlind timlind deleted the test/integration-test branch November 9, 2022 21:00
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