Address Terra audit feedback

TerraSCV audit: https://cdn.discordapp.com/attachments/946274837515603989/951806859021549628/Thorchain_-_Bifrost_Observer_Terraclient_-_Audit_Report.pdf

The following vulnerabilities were not addressed:

  1. gRPC not using TLS & connecting WithInsecure(): bifrost talks to chain clients within a Kubernetes cluster and not over the open internet. Therefore, a TLS connection is not required when instantiating the grpc client.
  2. Txs order might not be the same between API endpoints: we checked millions of blocks on both Terra and THORChain client and confirmed ordering is consistent. Only a hard fork and breaking change in Tendermint could change this behavior. This is an acceptable level of risk, that we will have to keep on top of as Terra/Tendermint evolve. It shouldn't be an issue to stay on top of it, due to the fact that THORChain is also a Cosmos/Tendermint chain and we are monitoring new releases for cases like this when new versions of Tendermint are announced. If it were possible to correlate the Tx body from GetBlock to the Tx result in GetBlockResult, we would create a sanity check. However, there is nothing to correlate between the two responses, so we would have to make an additional RPC call for each transaction within a block in order to implement a sanity check. This is an unacceptable degree of overhead given the risk assessed.
  3. Missing additional test cases on common files: out of scope in adding a new chain client. Should be addressed in a subsequent PR.
  4. Terra native demon might not be fully supported when paying fees: TxIn can be sent with any fee coin. TxOut will always be sent with LUNA, since the design of THORChain is such that gas are always paid in the L1 token of a chain. User experience is not impacted here, you can use UST to swap in to THORChain. This calculation is only required for determining the gas that should be paid for outbound transactions. TxOut fee amount are subtracted from the token (e.g. UST) using LUNA/RUNE price on the backend. Therefore, you can swap in with UST fee, or swap to UST and have gas fee paid in LUNA, and THORChain will subtract the appropriate amount of LUNA in RUNE terms to pay the outbound fee.
  5. Unnecessary code adds complexity to the code base: out of scope in adding a new chain client. Should be addressed in a subsequent PR.
  6. UST denom not defined Thorchain assets: uusd is the symbol on Terra for UST. This mapping creates that linkage. Without it, we could just use the denom without having to override it, but we wanted UST to be stored as TERRA.UST and not TERRA.USD.

Merge request reports

Loading
Loading