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

Teleporter multiple asset support: Add recover mechanism for missing mapping #965

Closed
wsdt opened this issue Jun 19, 2023 · 1 comment
Closed
Assignees

Comments

@wsdt
Copy link
Contributor

wsdt commented Jun 19, 2023

related to #959

Issue Type

[ ] bug report
[ x] feature request

Current Behavior

Teleporter service just logs when a tokenAddress is not supported.
Refer to service.ts (Teleporter):

   try {
            const receivingChainTokenAddr = this._getSupportedAssetBySymbol(
              sourceChainTokenAddr,
              sourceChainId.toNumber(),
              chainId,
              this.state.supportedChains
            )

            const [isTokenSupported, , , , ,] =
              await this.state.Teleportation.supportedTokens(
                sourceChainTokenAddr
              )
            if (!isTokenSupported) {
              throw new Error(
                `Token '${sourceChainTokenAddr}' not supported originating from chain '${sourceChainId}' with amount '${amount}'!`
              )
            } else {
              disbursement = [
                ...disbursement,
                {
                  token: receivingChainTokenAddr, // token mapping for correct routing as addresses different on every network
                  amount: amount.toString(),
                  addr: emitter,
                  depositId: depositId.toNumber(),
                  sourceChainId: sourceChainId.toString(),
                },
              ]
              this.logger.info(
                `Found a new deposit - sourceChainId: ${sourceChainId.toString()} - depositId: ${depositId.toNumber()} - amount: ${amount.toString()} - emitter: ${emitter} - token/native: ${sourceChainTokenAddr}`
              )
            }
          } catch (e) {
            this.logger.error(e.message)
            // TODO: Add recovery mechanism
            // TODO: Save somewhere to recover(!) or generally fail (do once db teleporter is merged)
            // TODO: for both when getSupportedAssetBySymbol fails or when onchain support is missing
          }

Desired Behavior

Assets are explictly supported or not supported in the Teleporter contract. The Teleporter service owns the routes between networks and maps token addresses to each other for every network - we may want to save failed disbursements for this kind of configuration mistake and possibly add a recovery mechanism. Same applies to missing on-chain token support to not loose the information and have an inconsistent state for already disbursed assets / to not block other disbursements.

@wsdt wsdt self-assigned this Jun 19, 2023
@wsdt
Copy link
Contributor Author

wsdt commented Jun 22, 2023

fixed through #959

Went for a much more simpler approach instead of implementing a full blown recovery mechanism to keep complexity as low as possible.

@wsdt wsdt closed this as completed Jun 22, 2023
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

No branches or pull requests

1 participant