Weekly Dev Update #47
THORChain Weekly Dev Update for Week 09–15 June 202
The team spent the week bug-fixing and stress-testing the Testnet. Testnet 3 is being prepared for imminent deployment, contingent on some Binance Chain node reliability issues being rectified.
Node Account Jail
If a node goes offline then the protocol suffers reliability because it requires availability. To improve this, the concept of Jail was added, which temporarily marks a node as unavailable if they fail a key-gen or key-sign and it will not be selected for subsequent key-generation or key-signing. This in addition to the presecribed penalities — which should discourage bad behaviour in the first place.
The mechanism is:
- Jailed nodes can not be selected to be a key signer. When a node gets blamed for failing to do a keysign, they get 20 blocks in “jail”, which means they won’t be selected in a keysign for that time. So if 1/3 of the nodes are bad, every 20 blocks, the good nodes will blame the bad nodes, giving them slash points, and then giving the network 20 blocks of freedom to send transactions without the bad nodes inhibiting them (ie more resilient).
- Jailed nodes will not be selected to be churned into the network. When a node fails a keygen, they go to jail for 6 hours (in addition to slashing their bond). This gives other nodes a chance to churn in during this time (retries every hour).
- Jailed nodes can not withdraw funds via a
leavememo. This means they have an additional opportunity cost during the time they are jailed. This will reduce the likelihood of intentional malicous beahviour.
Bugfixes from testnets, as well as some quality and feature inclusions from testing.
Testnet Bug Fixes
- [bugfix] Ignore non stdtx
- [bugfix] mark outbound as done more accurately
- [bugfix] fix bifrost pubkey manager
- [bugfix] pubkey mgr refreshes signer pks
- [bugfix] re-enable outbound memos
- [bugfix] panic when tss is frozen
- [bugfix] smarter thorchain block height querying
- [bugfix] clear markers on outbound
- [bugfix] bifrost add tss timeout
- [bugfix] don’t kill transaction if we don’t update last chain height
- [bugfix] txout outhash marks all tx outs
- update go tss
- remove a few lines of dead code
- 509-issue set the observe tx to done
- 500-issue add retry field , so we won’t slash node account for reporting duplicate tx id
- [feature] node account preflight endpoint
- [refactor] ragnarok in 20 rounds
- 503-issue prevent standby node from sending network fee msg
- 512-issue automatically enable gas asset pool
- [feature] add API endpoint to count number of pending outbound transactions
- [feature] node account jail
Bugfixes and feature requests as required for the clients.
- Resolve “FEATURE: Support multiple transaction type query in tx endpoint”
- WIP: Resolve “FEATURE: Double swap event type in txs endpoint”
- Resolve “BUG: Invalid coins for double swap events in txs endpoint”
- Resolve “FEATURE: Double swap event type in txs endpoint”
- Merge double swap events into one
- Resolve “FIX: doubleSwap type is not available in txs type enum”
- Resolve “Change value of `poolActivationCountdown` to number of blocks”
- Resolve “FIX: [TRANSACTION] type reported incorrectly as doubleswap”
- Resolve “FEATURE: Fast sync”
- Resolve “FEATURE: add resume to blockscanner”
- Resolve “Move logic of GetPriceInRune to usecase”
- Resolve “FIX: add transaction status”
The team have commissioned work to build out a GG20 TSS Proof-of-Concept that could improve reliability, scalability and solve for node-account blame.
Numerous changes, as well as a new library
asgardex-crypto which allows an ASGARDEX-Keystore file to be encrypted and decrypted.
The BIP44 path will use
931 as the coin-type.
// Crypto Constants for ASGARDEX
const AsgardexBIP39Phrase = 'asgardex'
const BIP44Path = "m/44'/931'/0'/0/0"
const cipher = 'aes-128-ctr'
const kdf = 'pbkdf2'
const prf = 'hmac-sha256'
const dklen = 32
const c = 262144
const hashFunction = 'sha256'
const meta = 'asgardex-keystore'
The design is slightly different to other keystore libraries, since it encrypts the phrase, instead of the seed:
Typically keystore files encrypt a
seedto a file, however this is not appropriate or UX friendly, since the phrase cannot be recovered after the fact.
[entropy] -> [phrase] -> [seed] -> [privateKey] -> [publicKey] -> [address]
Instead, ASGARDEX-CRYPTO stores the phrase in a keystore file, then decrypts and passes this phrase to other clients:
[keystore] -> ASGARDEX-CRYPTO -> [phrase] -> ChainClient
The ChainClients can then convert this into their respective key-pairs and addresses. Users can also export their phrases after the fact, ensuring they have saved it securely. This could enhance UX onboarding since users aren’t forced to write their phrases down immediately for empty or test wallets, and makes the wallet chain-agnostic.
The community are building out:
- THORNode telegram bot: https://github.com/block42-blockchain-company/thornode-telegram-bot
- THORChain community explorer: thorchain.community
- THORChain arbitrage bots: https://gitlab.com/thorchain/trade-bots
In addition, the team are also talking with a mobile wallet provider as well as potentially a team to build a blockchain exporter
The team have received the first draft of the Kudelski audit, with no major issues found.
Gauntlet are preparing their final THORChain report.
The testnet is being re-deployed and will be made public soon. Chaosnet is expected once testnet has been fully-validated in several environments.
To keep up to date, please monitor community channels, particularly Telegram and Twitter: