Weekly Dev Update #41

THORChain Weekly Dev Update for Week 30–04 Apr 2020

Weekly Dev Update #41

Summary

Ecosystem work

There are now multiple teams working on the THORChain ecosystem:

This is how a project reaches self-sustainment in community work and THORChain is getting closer to this point every week.

Event Handler

THORChain emits an event everytime something happens with funds (swap, stake, withdrawal etc) and this is consumed by Midgard in order to make it easy for third-party services to display data.

The first implementation of an Event Handler was a custom implementation and works fine, however the team have since decided to refactor in the official CosmosSDK event module since it has better developer tooling. In the long term it means less code, less attack surface and better feature support. In the short term it means 1–2 weeks of refactoring the current code and how Midgard is streamed event data.

Performance Improvements

After completing initial benchmarking, the team have finished refactoring how the Key-Value Store is utilised, ensuring optimal “setting and getting” of keys that are updated when logic happens. The general principle is the more granular a key can be referred to, the less times it will be updated in changes.

Additionally, a lot of unused code and old CLI methods have been cleaned out.

Heimdal Update

Previously the state machine did not give out block rewards every block, instead waiting for a swap to be processed. This was done to make it simpler to test in Heimdall (test infrastructure), but the team have bit the bullet and implemented block rewards every block, and the necessary changes in Heimdall. This was significantly complex, because there is now a time-dependent process (blocks) being tested alongside an event-dependent process (swaps). The solution was to refactor Heimdall to absorb blocks as events and make them both event-dependent.

Bitcoin Re-org Protection

The team implemented the necessary infrastructure to respond to Bitcoin block (PoW) re-organisation events. If anything changes in a re-org, then the nodes can submit Errata Transactions to return the system to solvency.

THORNode Merge Requests

Midgard

Work on Midgard to mature out the service, fix bugs and update to new event structures from THORChain.

In addition to this, the team released a simple Midgard explorer to help visualise the data available:

http://midgard-explorer.herokuapp.com (note the HTTP url)

Clients

Work has begun on the ASGARDEX electron app that will be the primary interface to the chain. ASGARDEX implements the Byzantine module which ensures verified and trustless queries from the THORChain network.

The repo is here:

thorchain/asgardex-electron
Repo to set up Asgardex Electron App. Contribute to thorchain/asgardex-electron development by creating an account on…

The interface borrows most of the existing BEPSwap client code:

View pools
View Assets

ASGARDEX will support multi-chain addresses, all derived from a single BIP32 root key:

  • Bitcoin (BECH32)
  • Ethereum
  • Binance Chain
  • THORChain

The user only needs one asset type to begin interacting with THORChain. This is one example flow:

  • Load wallet, connect BTC Ledger
  • Swap BTC into RUNE
  • Stake BTC & RUNE

Audit

Code Review: Complete

Economic Review: Completed most of THORChain's economic architecture

TSS Audit: begun work

Next Milestones

The updated testnet is in the final stages of testing. Chaosnet is expected once testnet has been fully-validated in several environments. There currently isn’t any known blockers to Chaosnet release.


Community

To keep up to date, please monitor community channels, particularly Telegram and Twitter: