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

LP API bouncer test #3806

Merged
merged 25 commits into from
Sep 20, 2023
Merged

LP API bouncer test #3806

merged 25 commits into from
Sep 20, 2023

Conversation

j4m1ef0rd
Copy link
Contributor

@j4m1ef0rd j4m1ef0rd commented Aug 8, 2023

Pull Request

Closes: PRO-696

Checklist

Please conduct a thorough self-review before opening the PR.

  • I am confident that the code works.
  • I have updated documentation where appropriate.

Summary

  • Using the inbuilt Fetch API to send the RPC's to the LP API server
  • Runs all of the LP API commands and checks the returned values are as expected.
  • Sends eth to the LP account for the test.
    • Added the ability to wait for finalization when observing an event.
  • Had problems when it was in all_concurrent_tests, so i made it just run on its own.

Notes

  • Could not properly test the lp_registerAccount command because the LP API Server account is already registered.
  • The Fetch API has a warning:
    (node:36458) ExperimentalWarning: The Fetch API is an experimental feature. This feature could change at any time

Sorry, something went wrong.

@j4m1ef0rd j4m1ef0rd self-assigned this Aug 8, 2023
@linear
Copy link

linear bot commented Aug 8, 2023

@codecov
Copy link

codecov bot commented Aug 8, 2023

Codecov Report

Merging #3806 (a5d8c16) into main (5c37f77) will decrease coverage by 0%.
Report is 1 commits behind head on main.
The diff coverage is n/a.

@@          Coverage Diff          @@
##            main   #3806   +/-   ##
=====================================
- Coverage     72%     72%   -0%     
=====================================
  Files        366     366           
  Lines      57289   57340   +51     
  Branches   57289   57340   +51     
=====================================
+ Hits       41357   41384   +27     
- Misses     13844   13855   +11     
- Partials    2088    2101   +13     
Files Changed Coverage Δ
state-chain/pallets/cf-lp/src/lib.rs 74% <ø> (ø)
state-chain/pallets/cf-pools/src/lib.rs 51% <ø> (ø)

... and 13 files with indirect coverage changes

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@j4m1ef0rd j4m1ef0rd force-pushed the tests/lp-api-bouncer-tests branch from 0622c67 to 75377ab Compare August 8, 2023 06:17
bouncer/shared/lp_api_test.ts Outdated Show resolved Hide resolved
bouncer/shared/lp_api_test.ts Outdated Show resolved Hide resolved
bouncer/shared/lp_api_test.ts Outdated Show resolved Hide resolved
@j4m1ef0rd j4m1ef0rd marked this pull request as ready for review August 10, 2023 07:07
bouncer/shared/lp_api_test.ts Outdated Show resolved Hide resolved
bouncer/shared/json_rpc.ts Outdated Show resolved Hide resolved
bouncer/shared/json_rpc.ts Outdated Show resolved Hide resolved
bouncer/shared/lp_api_test.ts Outdated Show resolved Hide resolved
bouncer/shared/lp_api_test.ts Outdated Show resolved Hide resolved
bouncer/shared/lp_api_test.ts Outdated Show resolved Hide resolved
bouncer/shared/lp_api_test.ts Outdated Show resolved Hide resolved
bouncer/shared/lp_api_test.ts Outdated Show resolved Hide resolved
bouncer/shared/lp_api_test.ts Outdated Show resolved Hide resolved
bouncer/shared/utils.ts Outdated Show resolved Hide resolved
bouncer/shared/lp_api_test.ts Outdated Show resolved Hide resolved
bouncer/shared/lp_api_test.ts Outdated Show resolved Hide resolved
bouncer/shared/utils.ts Outdated Show resolved Hide resolved
@j4m1ef0rd j4m1ef0rd marked this pull request as draft August 28, 2023 01:04
@j4m1ef0rd
Copy link
Contributor Author

Going to delay this PR until it can be updated with the new LP API changes from #3886

@j4m1ef0rd j4m1ef0rd marked this pull request as ready for review September 11, 2023 06:24
@j4m1ef0rd j4m1ef0rd requested a review from msgmaxim September 11, 2023 06:24
bouncer/setup_for_test.sh Outdated Show resolved Hide resolved
bouncer/shared/lp_api_test.ts Outdated Show resolved Hide resolved
bouncer/shared/lp_api_test.ts Outdated Show resolved Hide resolved
if (!isValidHexHash(await registerEwa)) {
throw new Error(`Unexpected lp_registerLiquidityRefundAddress result`);
}
await observeRegisterEwaEvent;
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 also want to read LiquidityRefundAddress from SC to ensure it has been set?

bouncer/shared/lp_api_test.ts Outdated Show resolved Hide resolved
bouncer/shared/lp_api_test.ts Show resolved Hide resolved
bouncer/shared/lp_api_test.ts Outdated Show resolved Hide resolved
bouncer/shared/lp_api_test.ts Show resolved Hide resolved
bouncer/shared/lp_api_test.ts Outdated Show resolved Hide resolved
bouncer/shared/lp_api_test.ts Show resolved Hide resolved
@j4m1ef0rd j4m1ef0rd merged commit b310667 into main Sep 20, 2023
@j4m1ef0rd j4m1ef0rd deleted the tests/lp-api-bouncer-tests branch September 20, 2023 06:40
dandanlen pushed a commit that referenced this pull request Sep 21, 2023
* tests: lp api bouncer test

* refactor: split into smaller tests

* chore: show balances in error

* refactor: use asset instead of liquidity
- cleanup other expected values

* fix: provide eth and wait for finalization

* refactor: address PR comments

* refactor: trying to fix test running on CI

* fix: check address type when depositing liquidity

* fix: null channelMetadata

* refactor: address PR comments

* chore: don't run test concurrently

* chore: run lp api test after others

* refactor: update range and limit order commands

* chore: rename Reg EWA -> Reg LRA

* test: added get open swap channel test

* refactor: address PR comments

* refactor: run test in all concurrent
dandanlen pushed a commit that referenced this pull request Sep 28, 2023
* tests: lp api bouncer test

* refactor: split into smaller tests

* chore: show balances in error

* refactor: use asset instead of liquidity
- cleanup other expected values

* fix: provide eth and wait for finalization

* refactor: address PR comments

* refactor: trying to fix test running on CI

* fix: check address type when depositing liquidity

* fix: null channelMetadata

* refactor: address PR comments

* chore: don't run test concurrently

* chore: run lp api test after others

* refactor: update range and limit order commands

* chore: rename Reg EWA -> Reg LRA

* test: added get open swap channel test

* refactor: address PR comments

* refactor: run test in all concurrent
dandanlen pushed a commit that referenced this pull request Oct 9, 2023
* tests: lp api bouncer test

* refactor: split into smaller tests

* chore: show balances in error

* refactor: use asset instead of liquidity
- cleanup other expected values

* fix: provide eth and wait for finalization

* refactor: address PR comments

* refactor: trying to fix test running on CI

* fix: check address type when depositing liquidity

* fix: null channelMetadata

* refactor: address PR comments

* chore: don't run test concurrently

* chore: run lp api test after others

* refactor: update range and limit order commands

* chore: rename Reg EWA -> Reg LRA

* test: added get open swap channel test

* refactor: address PR comments

* refactor: run test in all concurrent
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants