Mega Dev Update #106-#115

THORChain Weekly Dev Update for Weeks 106–115, 30 Aug — 7 Nov; MCCN re-enabled, MCCN Updates, Community Updates and Roadmap.

THORChain Author
THORChain
10 min readNov 8, 2021

--

Summary

All security audits have been completed and all chains have been restarted. All chains have been restated and MCCN is now stabilised with a bigger TVL due to several caps raising.

Approx. 67 THORNode and 2 Midgard updates have been deployed to MCCN, Whitelist implemented for ERC Tokens and viewable here, and Asgard approaching sharing, testing TSS party size limits.

Community input has been strong with Runebase and THORNoob providing solid community coverage of updates. A new ecosystem page was created to highlight the community and navigate the wider THORChain community.

Strong community support has allowed MCCN to return greater than ever and lay the path to Mainnet.

Network Halt Refunds

364k RUNE will be returned to network participants that was supposed to be emitted over the course of the halt, calculated using network parameters at the time of the halt. Donations to pools are divided equally among all LPers based on their share.

The only addition to normal block rewards is standby node operators which get 50% the funds of the active nodes.

Payout details at: https://pastebin.com/aXJSUtAj

TSS Signing Issues

After BTC Trading was enabled, TSS signing issues emerged which delayed transactions.

The main points were:

  1. TSS timeout — due to backlog Txs, inflow of UXTOs https://gitlab.com/thorchain/thornode/-/merge_requests/1947
  2. Decreasing the UXTO Consolidation size (aka UTXO Batching) to reduce the load on TSS. https://gitlab.com/thorchain/thornode/-/merge_requests/1949
  3. Round TSS block height (how the leader is selected) to the nearest 20th block, to stop double signing of TSS transactions. https://gitlab.com/thorchain/thornode/-/merge_requests/1951

Adding to the above complexity, TSS experiences a quadratic increase in signing time for every signing party (aka full node) added. At the time, the party size was 38 — two more than allowed in SCCN and two short of the 40 required for Asgard sharding, which splits the signing party in half and allows network scaling.

Once TSS had settled and the queues were cleared, ETH trading was enabled.

THORSec Update

Audits were completed for all chains (BNB, LTC, BTH, BTC, ETH).

- [x] Phase 1 Complete

- [x] Phase 2 Complete

- [x] THORSec Audits Newly Active Code paths for Phase 3

- [x] Nine Realms provides Go/No-Go

- [x] Test deployment in Testnet

- [x] Re-enable Chains in Chosnet

All PRs were reviewed and approved by the THORSec team.

All aspects of THORChain have now been audited, the report will be released soon.

Bug Disclosures

Serious bugs have been found and responsibly disclosed.

Fake voting and double voting within the TSS signing party.

Requires 2 active validators (600000+ RUNE) to attack. $0 funds at risk currently as no churns.

Full disclosure: https://gist.github.com/HildisviniOttar/0f931cc823837b0a239270e95e92bbca

Upset pool accounting (pool prices)

Evil Node operators can slash their own bond past zero to corrupt the pool accounting creating arb opportunities greater than lost bonds. Requires $10M+ upfront and theoretically funds at risk is 3 times bond ~ $7.2M. Attacker would lose their bond (high risk to the attacker) Full Disclosure: https://gist.github.com/HildisviniOttar/d3cf0da2242731f60416c77fc986d79c

Forge Tx Consensus in Tendermint

Forge invalid inbound message that achieves a consensus by all nodes. Requires 300000 RUNE up front and be an active node operator. Funds at risk, $20–30M, attacker’s likely to lose half of bond value post attack.

Full Disclosure: https://gist.github.com/HildisviniOttar/e4529c54b65724ca5bc28c5592ba0757

ETH Chain double Spend Exploit

Requires fake events to be emitted to trick the protocol.1000 ETH+ at risk.

Full disclosure: https://gist.github.com/HildisviniOttar/7198452b312b8b2da9510ad8b7bc75d2

Upgrading cheap synths to RUNE native.

No funds at risk as Synths is not active yet. https://gist.github.com/HildisviniOttar/61a6ffe14b92ab21a9001a34b5bf2512

Bug bounty still active, up to half a million on offer — all chains in scope. Details at: https://immunefi.com/bounty/thorchain/

Update on IBC Integration

IBC is a lightweight transport protocol between two different Cosmos Chains that allows a single relayer to prove something happened on one chain to another. It has no economic design; no incentives to run it, and no penalties for bad behaviour. In summary, it relays truth between chains using cryptographic proofs.

THORChain Bifröst is a 1-way state peg from any data source to THORChain’s state machine, requiring 67% consensus between validators that an external event happened. It is built into THORChain’s economic design that includes incentives to run it and penalties for bad behaviour. It relays truth to THORChain by getting everyone to agree on what the truth is.

Advantages of the Bifröst: chain-agnostic (any chain can be connected), application-specific (cross-chain liquidity), economically secured.

Disadvantage of Bifrost: 1 swap with 100 nodes requires 2 * 100 observation tx’s (200 total), compared with just 2 for IBC. So it is state-intensive.

Counter: THORChain can do batching, 200 per swap is the worst case; 100 swaps in the same block can be batched into 200 observation batches, so back to 2 per swap.

Disadvantage of IBC: Requires a centralised altruistic relayer; if they pull the plug it can halt those bridges, blocking churns and locking up the entire network. One way to make it work is to get each THORNode to run a relayer in round-robin., with a modified IBC client. Additionally, there are no vaults and the IBC chains will be treated differently.

Red Flag: two different bridge designs for THORChain running in parallel, requiring custom clients, with the ONLY advantage being less state intensive in worse case scenario. The only users impacted by heavy-state are Node Ops, but storage is cheap.

Decision: IBC is not suitable for THORChain, which absolutely requires economic assurances for its bridges. Using the existing Bifröst design reduces the complexity of the system.

Note on Treasury

The treasury operates independently from the dev team. The treasury pays the dev team, funds ecosystem projects and processes bills. The treasury conducting activities in the best interest of the project and rune holders doesn’t tie up dev resources or affect the roadmap. Some actions of the treasury do create noise and exposure (good/bad). But the treasury is always listening and acting benevolently.

A single treasury is a point of centralisation, and as part of Planned Obsolescence it will be split up across ecosystem teams who are deemed responsible and can carry on the duties of the project. 5–10 treasuries is better than 1 treasury.

Additionally, by investing and supporting heavily into THORChain ecosystem projects, the process of splitting up the treasury has already begun. By investing $200–500k into THORFi projects then supporting them into the launches allows them to pull in $3m-5m treasuries of their own. This expands the ecosystem’s capital.

The most important priority for the Treasury is to provide support in every way possible to ecosystem teams, at the same time as decentralising. This will not change in the future.

Insurance update

Discussion around insurance continues. At this stage, self-insurance is preferable to an insurance provider. Benefits of self-insurance are:

* automated, no managers, no decision making

* no reliance on third-party protocols

* no centralising forces

* cheaper

MCCN Updates

MIDGARD 2.4.1 Update

Midgard version 2.4.1 push to Chaosnet https://gitlab.com/thorchain/midgard/-/releases/2.4.1

THORNODE UPDATE 0.67.0

1) [BUG] Version isChainHalt func to fix consensus failure. PR: https://gitlab.com/thorchain/thornode/-/merge_requests/1910
2) [BUG] Stop report solvency when the external chain block scanner is falling behind. PR: https://gitlab.com/thorchain/thornode/-/merge_requests/1907
3) [feature] mimir can pause LP actions. PR: https://gitlab.com/thorchain/thornode/-/merge_requests/1906
4) [BUG] Fix Impermanent protection rune amount get override error. PR: https://gitlab.com/thorchain/thornode/-/merge_requests/1903
5) [BUG] Remove unused bond reward and total reserve calculation. PR: https://gitlab.com/thorchain/thornode/-/merge_requests/1902
6) [ADD] Update go build tags. PR: https://gitlab.com/thorchain/thornode/-/merge_requests/1901
7) [ADD] Whitelist arb address for trading. PR: https://gitlab.com/thorchain/thornode/-/merge_requests/1900
8) [BUG] Fix common.GetShare potential divide by zero error. PR: https://gitlab.com/thorchain/thornode/-/merge_requests/1898
9) [BUG] Revert changes to GetSafeShare in yggdrasil manager. PR: https://gitlab.com/thorchain/thornode/-/merge_requests/1897
10) [BUG] Fix consensusTx function. PR: https://gitlab.com/thorchain/thornode/-/merge_requests/1895
11) [security] update go version. PR: https://gitlab.com/thorchain/thornode/-/merge_requests/1892
12) [ADD] Configure ERC20 RUNE testnet contract address. PR: https://gitlab.com/thorchain/thornode/-/merge_requests/1891
13) [BUG] Prevent signing outbound when bifrost has not scanned up to tip. PR: https://gitlab.com/thorchain/thornode/-/merge_requests/1890
14) [BUG] Update handler withdraw to use correct version. PR: https://gitlab.com/thorchain/thornode/-/merge_requests/1889
15) [BUG] Update handler_swap to use correct validate method. PR: https://gitlab.com/thorchain/thornode/-/merge_requests/1888
16) [ADD] Read telemetry.enabled config , and don’t try to publish metrics when it is disabled. PR: https://gitlab.com/thorchain/thornode/-/merge_requests/1887
17) [BUG] Change ragnarok to refund LP in one iteration. PR: https://gitlab.com/thorchain/thornode/-/merge_requests/1883

release: https://gitlab.com/thorchain/thornode/-/tags/v0.65.0

1) [ADD] Update telemetry labels. PR: https://gitlab.com/thorchain/thornode/-/merge_requests/1914
2) [BUG] Support multiple delayed outbounds for a single txn. PR: https://gitlab.com/thorchain/thornode/-/merge_requests/1913
3) [ADD] Emit scheduled value in telemetry metrics. PR: https://gitlab.com/thorchain/thornode/-/merge_requests/1912
4) [Bug] Recover from Divide by 0 panic in subsidizePoolWithSlashBondV46. PR: https://gitlab.com/thorchain/thornode/-/merge_requests/1894

release: https://gitlab.com/thorchain/thornode/-/tags/v0.66.0

1) [BUG] Withdraw cause node account get slashed. PR: https://gitlab.com/thorchain/thornode/-/merge_requests/1918

release: https://gitlab.com/thorchain/thornode/-/tags/v0.67.0

Bitcoin Core Upgrade

A new version of Bitcoin Core was released (v22) which has breaking changes to bifrost. A backward-compatible change is being made to bifrost to support v22 and previous versions. In the meantime, DO NOT upgrade your bitcoin daemon to the latest version. It will cause your bifrost to miss observations and therefore be slashed continuously. A small percentage of the Bitcoin community has adopted this new version, which can be tracked here. https://coin.dance/nodes#nodeVersions There is no rush to adopt this change, so the community can take their time adopting the new version. Stay tuned.

THORNODE UPDATE 0.68.0

1) [BUG] Add liquidity patches. PR: https://gitlab.com/thorchain/thornode/-/merge_requests/1929
2) [ADD] Add logic to extract addresses from ScriptPubKey, support bitcoin core 22.0. PR: https://gitlab.com/thorchain/thornode/-/merge_requests/1925
3) [Refactor] Rename manager files to make diffing easier to read for reviewers. PR: https://gitlab.com/thorchain/thornode/-/merge_requests/1924
4) [Refactor] Changes file structure slightly to make it easier to see the change being made for managers. PR: https://gitlab.com/thorchain/thornode/-/merge_requests/1923
5) [ADD] Ensure Tss Msg integrity. PR: https://gitlab.com/thorchain/thornode/-/merge_requests/1922
6) [HAL-3.12] revert node status on failure to fund node address. PR: https://gitlab.com/thorchain/thornode/-/merge_requests/1921
7) [BUG] Update ETH block scanner logic. PR: https://gitlab.com/thorchain/thornode/-/merge_requests/1920
8) [ADD] Lite Nodes (1/3): Add NodeType and update keeper/helpers. PR: https://gitlab.com/thorchain/thornode/-/merge_requests/1916
9) [BUG] Withdraw LP , not enough to pay for fee cause discrepancy between midgard and thornode. PR: https://gitlab.com/thorchain/thornode/-/merge_requests/1909

release: https://gitlab.com/thorchain/thornode/-/tags/v0.68.0

THORNODE UPDATE 0.69.0

1) [BUG]Fix lint error. PR: https://gitlab.com/thorchain/thornode/-/merge_requests/1940
2) [ADD] Unknown NodeType. PR: https://gitlab.com/thorchain/thornode/-/merge_requests/1935
3) [ADD] support whitelist ERC20 token list. PR: https://gitlab.com/thorchain/thornode/-/merge_requests/1934
4) [BUG] When node get slashed , slashed bond should be credit to correct module. PR: https://gitlab.com/thorchain/thornode/-/merge_requests/1933
5) [BUG]Update bifrost to use ParseMemo to be consistent. PR: https://gitlab.com/thorchain/thornode/-/merge_requests/1932
6) [ADD] When ETH transaction spend more than MaxETHGas , then slash it. PR: https://gitlab.com/thorchain/thornode/-/merge_requests/1930
7) [BUG] Irregular update to fix dropped txns. PR: https://gitlab.com/thorchain/thornode/-/merge_requests/1928
8) [ADD] Track incentive pendulum. PR: https://gitlab.com/thorchain/thornode/-/merge_requests/1915

release: https://gitlab.com/thorchain/thornode/-/tags/v0.69.0

THORNODE UPDATE 0.69.1

1) [BUG] Increase TSS keysign timeout to 90 seconds. PR: https://gitlab.com/thorchain/thornode/-/merge_requests/1947 release: https://gitlab.com/thorchain/thornode/-/tags/v0.69.1-chaosnet

THORNODE UPDATE 0.69.2

1) [ADD] Enable Mimir to control maximum utxo to spend. PR: https://gitlab.com/thorchain/thornode/-/merge_requests/1949 release: https://gitlab.com/thorchain/thornode/-/tags/v0.69.2-chaosnet

THORNODE UPDATE 0.69.3

1) [ADD] Round TSS block height to the nearest 20th. PR: https://gitlab.com/thorchain/thornode/-/merge_requests/1951

A recent change in encryption & decryption cause bifrost to pay a significant performance penalty when trying to sign tx outbound , which cause TSS to choose different TSS leader during keysign. This release revert that change as well, hopefully, it will get TSS back to a stable state release: https://gitlab.com/thorchain/thornode/-/tags/v0.69.3-chaosnet

Update MIDGARD 2.5.4

https://gitlab.com/thorchain/midgard/-/releases/2.5.

THORNODE UPDATE 0.70.0

1) [ADD] Cache THORChain block height for 5s. PR: https://gitlab.com/thorchain/thornode/-/merge_requests/1954
2) [ADD] Cherry pick the changes in 0.69.3 back to develop branch. PR: https://gitlab.com/thorchain/thornode/-/merge_requests/1953
3) [BUG] Reduce the number UTXOs need to consolidate. PR: https://gitlab.com/thorchain/thornode/-/merge_requests/1950
4) [BUG] Set “fail to parse memo” to debug level. PR: https://gitlab.com/thorchain/thornode/-/merge_requests/1948
5) [BUG] Ensure MsgTssKeysignFail & MsgSolvency integrity. PR: https://gitlab.com/thorchain/thornode/-/merge_requests/1946
6) [BUG] Adjust Pool balances. PR: https://gitlab.com/thorchain/thornode/-/merge_requests/1945
7) [BUG] Update the binance seed endpoint that used to query status. PR: https://gitlab.com/thorchain/thornode/-/merge_requests/1943
8) [BUG] Fix USD metrics telemetry. PR: https://gitlab.com/thorchain/thornode/-/merge_requests/1942
9) [BUG] Add TKN token that is used on testnet. PR: https://gitlab.com/thorchain/thornode/-/merge_requests/1941
10) [ADD] Allows the network to stop solvency check per chain. PR: https://gitlab.com/thorchain/thornode/-/merge_requests/1939

release: https://gitlab.com/thorchain/thornode/-/tags/v0.70.0

Update MIDGARD 2.5.6

Fixing pool prices. https://gitlab.com/thorchain/midgard/-/releases/2.5.6

THORNODE UPDATE 0.71.0

1) [ADD] ShapeShift FOX token. PR: https://gitlab.com/thorchain/thornode/-/merge_requests/1969
2) [ADD] Small validation tweak. PR: https://gitlab.com/thorchain/thornode/-/merge_requests/1968
3) [ADD] Update Validation for keygen block. PR: https://gitlab.com/thorchain/thornode/-/merge_requests/1966
4) [ADD] update dependencies. PR: https://gitlab.com/thorchain/thornode/-/merge_requests/1962
5) [BUG] Update BEP2 burned RUNE. PR: https://gitlab.com/thorchain/thornode/-/merge_requests/1961
6) [Add] THORSwap token to token list. PR: https://gitlab.com/thorchain/thornode/-/merge_requests/1960
7) [ADD] Refund the rest binance tx. PR: https://gitlab.com/thorchain/thornode/-/merge_requests/1959
8) [BUG] swap and withdrawal incr telemetry with labels. PR: https://gitlab.com/thorchain/thornode/-/merge_requests/1958
9) [BUG] RBF enabled inbound transaction not been observed. PR: https://gitlab.com/thorchain/thornode/-/merge_requests/1956

release: https://gitlab.com/thorchain/thornode/-/tags/v0.71.0

UPDATE 0.72.0

1) [BUG] Withdrawal of deposit value. PR: https://gitlab.com/thorchain/thornode/-/merge_requests/1977
2) [ADD] keep testnet state. PR: https://gitlab.com/thorchain/thornode/-/merge_requests/1976
3) [BUG] Update GenesisState to only include necessary state to bootstrap next chain. PR: https://gitlab.com/thorchain/thornode/-/merge_requests/1975
4) [BUG] When a tx out item rescheduled, mark it as sent out by setting outbound hash to a blank hash. PR: https://gitlab.com/thorchain/thornode/-/merge_requests/1974
5) [ADD] Disable scheduled outbounds via mimir. PR: https://gitlab.com/thorchain/thornode/-/merge_requests/1970
6) [refactor] Handler Archive. PR: https://gitlab.com/thorchain/thornode/-/merge_requests/1936

release: https://gitlab.com/thorchain/thornode/-/tags/v0.72.0

Community Updates

A vast amount of community updates which have been covered by Runebase and THORNoob.

Ecosystem page launch at https://docs.thorchain.org/ecosystem.

Deployed to MCCN

  • Binance Chain: Deployed to chaosnet
  • Bitcoin: Deployed to chaosnet
  • Ethereum: Deployed to chaosnet
  • BitcoinCash: Deployed to chaosnet
  • Litecoin: Deployed to chaosnet

Bridge status:

Want to see bridges built quicker, get involved!

How to bridge to THORChain? This is a serious undertaking, a dev should be sponsored for 6–12 months:

  1. Read https://gitlab.com/thorchain/thornode/-/blob/develop/docs/newchain.md and https://docs.thorchain.org/chain-clients/overview
  2. Implement the Chain Client https://gitlab.com/thorchain/thornode/-/tree/develop/bifrost/pkg/chainclients
  3. Add to Node Launcher https://gitlab.com/thorchain/devops/node-launcher
  4. Add to XChainJs https://github.com/xchainjs/xchainjs-lib
  5. Launch on Mocknet — demo to the community
  6. Launch on Testnet, stabilise. Must be run successfully for a few weeks with no issues.
  7. Launch on Mainnet, stabilise
  8. Maintain the chain client, be on deck for hard forks, client updates and more.

Next Milestones

  • Churn and Asgard Sharding
  • ETH v3 Router Upgrade
  • Activation of Synths
  • THORNames
  • New Bridges
  • Vault Nodes (formally Lite Nodes)

--

--