Sunday, December 8, 2019

Weekly Dev Update #20

THORChain Weekly Dev Update for Week 03–09 Dec 2019

![](https://miro.medium.com/max/3168/1*jxzqLL5vlWDAd6H5pQ-1eA.png)

Overview

The team believe the current bottleneck to THORChain’s decentralisation is the number of nodes that can participate in a single TSS signing ceremony. As the number of participants grows, the complexity becomes exponential. This is in part because THORChain uses a TSS scheme that has no trusted dealer, which is a non-negotiable aspect. The team scoped out two features this week to address this.

Multi-realm Asgard

Instead of a single Asgard with 66 of 99 participating, Asgard can be broken up into different realms, each with a smaller participation number, such as three 22 of 33 realms. This also means that each realm can be rolled at different times, increasing the availability of the network. THORChain has no opinion on where funds are located, they just have to exist and be accounted for in the network. A Multi-realm Asgard does not change any security characteristics of the network, rather it works to shard the funds and increase the scalability. With Multi-realm Asgard, TSS scalability is no longer a concern, instead the upper limit of nodes now becomes a Tendermint scalability issue. Cosmos Hub is working hard to solve this, recently increasing their node count to 125, and with 300 as their long-term target.

TSS Timeout

The trigger to shard Asgard into smaller realms will no longer be a hard-coded number, instead it will be triggered when the key-gen process in a new vault times out after 10 minutes. This means that if the TSS key-generation process for the increased participation number takes too long, it should be sharded. This prevents the network ever generating a committee size with too many members. 10 minutes was chosen as the cutoff due to diminishing returns above that, and a pre-existing shelling point existing on that particular time-point, thanks to Bitcoin.

Trailing Gas Fee

A 1 Rune Fee was hard-coded into THORChain a week ago as the simple solution to a hard problem. The community had a lot of feedback about this, mainly concerns about ease of updating this in future, and they were correct. THORChain must take the governance-minimal approach to all things, and as a result a programmatic solution has been scoped out. The Network Fee will now be twice the 7-day trailing average of gas fees. This will ensure that it always exceeds the expected gas, and drives long-term income into the system. Currently it is global, but it could easily become chain-specific.

Incentive Pendulum

The system is theoretically unsafe when staked assets exceed bonded assets, whether a cartel exists or not. The reason is that a single node could craft an outgoing transaction that spends asset equally to other defecting nodes, and assuming profit-seeking entities, the assumptions around mutually assured destruction no longer hold. While incredibly unlikely to happen, since defecting nodes would need a modified binary to facilitate this transaction and be able to communicate, the system should protect around this edge case. The solution is to disencentivise staking as the system approaches the edge, so that staking rates reduce and the system becomes safe again. The only tool at the system’s disposal is incentives, and the approach is reduce pool rewards and increase bond rewards. This is known as the “Incentive Pendulum”, designed to keep the system at its happy centre; 67% bonded and 33% staked. The Incentive Pendulum also works in the other direction, increasing incentives to stake at high bond rates. The equation is: poolRewards = (y + x) / (y — x), where x = totalStaked, y = totalBonded. * At exactly 50% bonded and 50% staked, pool rewards will be 0%, incentivising bonding. * At 67% bonded and 33% staked, pool rewards will be 33%, the intended amount. * At 100% bonded and 0% staked, pool rewards will be 100%, incentivising staking.

Removal of Hard-coded Constants

The team intend to remove as many constants as possible from the constants.go file, and replace them with programmatic logic. TSS Timeout, Trailing Gas Fees and Churn Heights help solve this. The team will continue the effort.

THORChain

Cosmos was upgraded to the latest version, allowing the team to begin removing uint64 casting and replacing it with BigInt casting which is better when handling large numbers. The team are also in the process of removing float64 from the codebase, which is unsafe when computed on different machines. * [Upgrade] upgrade to cosmos v0.37.4 * [Bug] fix code coverage counter * stabilize smoke test runs * 224-issue fix validator meta keeper * panic on genesis * Add SafeDivision and removes Float * Resolve: Remove Stake Validation * Resolve “Add min bond requirement” * Resolve “ADD: Incentive Pendulum” * 264-issue fix the way how we broadcast tx to binance RPC host * [Add] Slash bond on bond refund * [Bug] Track gas in yggdrasil vaults * 233-issue add stake handler * add 30 sec timeout to wait for binance txs * Work continues to refactor the codebase to be more modular, testable and easier to grok. * [Refactor] Add unit tests to node account keeper * Resolve “[Refactor] Yggdrasil keeper” * Resolve “[Refactor] Vault Data keeper” * [Refactor] pool addresses keeper * 220-issue refactor Reserve Contributor * [Refactor] observer keeper * Resolve “[Refactor] Pool Staker keeper” * [Refactor] Pool keeper * [Refactor] Staker pool keeper * [Refactor] tx in keeper * [Refactor] reserve contributor handler * [Refactor] Rewrite tx in handler, msg, etc * Resolve “[Refactor] handleMsgBond” * Resolve “[Refactor] handleMsgAck” * [Refactor] add mock txout store * [Refactor] create pool address manager interface * [Refactor] create mock validator manager * Resolve “[Refactor] handleMsgLeave” * Resolve “[Refactor] handleMsgAdd” * [Refactor] version handler * refactor-stake unit tests * [Refactor] TxOutStore * 236-issue handler unstake * [Refactor] Breakout TxIn into two handlers * Resolve “[Refactor] handleMsgConfirmNextPoolAddress”

Bifröst Module

Work begins on the feature/bifrostv2 branch, which is a chain-agnostic Bifröst Module that will be verified to work on Binance Chain, Bitcoin, Ethereum prior to mainnet. Monero has also been scoped out, but testing it may not happen prior to mainnet. https://gitlab.com/thorchain/thornode/tree/feature/bifrostv2

Timelines

The team will soon move away from signalling dates for releases, instead will work to signal around completion status of milestones. Whilst ChaosNet seems to be on time for 03 January, much is left to be done: * [ChaosNet] Artificial Ragnarok * [ChaosNet] 1 Day rotations * Add bond reward events * Create pubkeys endpoint * [ChaosNet] Cap staked rune at 600k * Versionize the constants * Emit Validator Events * THORNode Telegram Bot

Community

To keep up to date, please monitor community channels, particularly Telegram and Twitter: Twitter: https://twitter.com/thorchain_org Telegram Community: https://t.me/thorchain_org Telegram Announcements: https://t.me/thorchain Reddit: https://reddit.com/r/thorchain Github: https://github.com/thorchain Medium: https://medium.com/thorchain


No comments:

Post a Comment