pendulum-chain / vortex

https://app.vortexfinance.co/
1 stars 1 forks source link

Implement initial checks of various services required for a successful off ramp flow #120

Closed prayagd closed 3 weeks ago

prayagd commented 2 months ago

Context

There are several known reason due to which the offramping transaction using teh Vortex prototype, could fail. Therefore, it makes sense to implement a set of checks when a user lands on the app, such that if any of them fail, the user is unable to initiate the off ramping transaction.

Requirements

  1. Implement the following checks before the UI loads
  1. Implement the following message / screen for the user in case any of the checks fail.

If any of these checks where to fail, we know that the offramp will also fail, so it might be better to disable it until everything is ready. This check can be done upon loading the application and disabling the offramp button.

vadaynujra commented 2 months ago

@prayagd do we need to include the below too?

prayagd commented 2 months ago

Moonbeam chain working - to ensure funds can be sent from Moonbeam to Pendulum Pendulum chain running + Spacewalk vaults up and running on Pendulum - to ensure the redemption is executed on the Pendulum side Stellar validators up and running - to ensure the redemption happens on the Stellar side

@pendulum-chain/devs is it also possible to check the status of these before starting the offramp request?

gianfra-t commented 2 months ago

I think the one that makes more sense is adding a Spacewalk check, we already have a testing service that periodically does this, assuming it is checking this token we should be able to connect the result to this.

Apart from that, I think checking Moonbeam or XCM would not be so interesting since at least in my opinion it is expected that these will be working with high availability. What is more, we don't directly interact with Moonbeam so it is not even possible to check an RPC health. Axelar takes care of this.

ebma commented 2 months ago

we already have a testing service that periodically does this, assuming it is checking this token we should be able to connect the result to this.

I think we would need to touch the testing service and make it offer an additional endpoint then. Because right now, the status page shows which vaults are tested and if pending tests are running but it doesn't tell you anything about the last test results. We can add a new endpoint and expose some info that is easy to consume in our prototype.

TorstenStueber commented 2 months ago

I think we should only go by probability here: systems that are very unlikely to fail do not need to be tested. Systems that, out of experience, fail at least once or twice a month on average, would justify some health check.

So checking Moonbeam, Pendulum and XCM health is not necessary.

Would the vaults checks already fall into this or isn't that also less likely?

ebma commented 2 months ago

Would the vaults checks already fall into this or isn't that also less likely?

Since this is about Pendulum vaults, we would always try to make sure that they are running. And if there is a severe issue, our Slack notifications should notify us about it so we can resolve the issue soon enough. So in this regard, I also think that failing vaults (at least on Pendulum) should be less likely.

vadaynujra commented 1 month ago

I updated the ticket description, added more to the context and updated the requirements. The ticket is still in draft till we don't have the message / screen to show the user when the checks fail.

So checking Moonbeam, Pendulum and XCM health is not necessary.

Given this understanding, is there still anything else that we should check?

ebma commented 1 month ago

We might want to have a check for the available amount to redeem on the Spacewalk EURC vault. It might happen that the user wants to offramp e.g. 1k EUR but the vault doesn't allow redeeming that much EURC. We have two EURC vaults, one DOT/EURC vaults and one vDOT/EURC vault. So even if on Pendulum, we have a total issuance of >1000 EURC.s, it might happen that they are split between the vaults and e.g. the DOT/EURC vault can redeem 500 EURC.s and the vDOT/EURC vault can redeem another 600 EURC.s or similar.

On that note, we probably want to implement a smarter logic for choosing the EURC vault. IIRC, we currently hardcode the prototype so that it always considers the DOT/EURC vault only.

TorstenStueber commented 1 month ago

I added to the description the we would need to check the Moonbeam executor account and that we would need to check three different assets for the Pendulum funding account.

@ebma I would think that this hard-coded logic is good enough for the prototype.

ebma commented 1 month ago

Sure, we can also hardcode it to point to the vDOT/EURC vault, no problem. But shouldn't we still check the redeemable amount available on that vault before we initiate the offramping process?

TorstenStueber commented 1 month ago

Yes, sure, it makes sense to also check that amount.

vadaynujra commented 1 month ago

@ebma given it's harded coded and we wouldn't be able to cater for the scenario of splitting the off ramping amount into 2 redeem requests on Spacewalk, I added 'with a single vault' to the check. Does that makes sense? @TorstenStueber I separated the Moonbeam executor into a different point.

gianfra-t commented 1 month ago

I will start looking at this already, let me know if there is consensus on the description regarding the checks.

gianfra-t commented 1 month ago

@pendulum-chain/product regarding this one:

AMM pool status: Confirms if the AMM / DEX has enough liquidity for the swap transaction to be successful.

This already happens, since when the amount is too large, an error appears on the You receive field explaining about the liquidity. Is that what this one is referred to? Perhaps this error was added after we fixed the description.

image
TorstenStueber commented 1 month ago

let me know if there is consensus on the description regarding the checks.

@gianfra-t We didn't specify everything in full detail, e.g., what it means that there are "sufficient funds". Shall we just define the following to have some extra buffer?

For the AMM pool status: correct, the Nabla quoting mechanism already does the check. We could add some extra buffer to the check, e.g., requesting another quote with a 20% higher amount and check whether Nabla returns an error. @pendulum-chain/product what do you think?

For the Spacewalk check we could add a similar buffer instead of using the precise amount.

TorstenStueber commented 1 month ago

Furthermore @pendulum-chain/product, this ticket still requires some kind of definition for the UI (does not need to be a proper design, wireframe could be enough for the time being).

gianfra-t commented 1 month ago

@TorstenStueber Regrading the AMM check (and also the Spacewalk and route check) I have a WIP where it those checks are performed upon click of confirm, and avoid check unkown tokens and amounts at the start of the application.

In that case I was not thinking on adding a 20% higher on the AMM check, I was just relying on the error returned. But we can add that modification on the hook.

I can do the same with the Spacewalk redeemable and add a buffer to query. But the important part is that this will only fail immediately after the user clicks confirm, not when the app is launched. Let me know what you think, also @pendulum-chain/product.

TorstenStueber commented 1 month ago

It could be good enough to check for the actual amount instead of additionally adding a buffer. After all this is just a prototype. What does @pendulum-chain/product say?

prayagd commented 11 hours ago

Implement the following message / screen for the user in case any of the checks fail.

@pendulum-chain/devs What is the message we show here is the checks fail or should i create a ticket to implement that

ebma commented 8 hours ago

It shows

Application initialization failed. Please reload, or try again later if the problem persists.

image