Resolve "FIX: automatically HALTTHORCHAIN on Mayanode upon observation of NODEPAUSECHAINGLOBAL or HALTCHAINGLOBAL on Thornode" #unsafe

Closes #60 (closed)

#unsafe because of new func ExinfoHandler.validateV1 (x/mayachain/handler_exinfo.go)

The overall functionality of Exinfo is almost identical to SolvencyReporter.

• The difference is that while solvency is reported from each blockchain scanner, exinfo is currently sent only from the Thorchain block scanner

• If needed, Exinfo can be sent from other block scanners simply by adding the OnBlockProcessed function to the respective chain client

• To make the implementation more universal, I changed the original callback of the SolvencyReporter to a callback interface BlockScanCallback, which is implemented on each chain client. It has just a single function OnBlockProcessed that then calls the original SolvencyReporter, and now in the Thorchain client, it also calls the new ExinfoReporter.

• For universality and code simplification, I merged two channels (the original globalChainInfoQueue + the new "ExinfoQueue") into one globalChainInfoQueue. This channel now receives both the original solvency messages and the new exinfo messages. This channel can be used in the future to send other signals from block scanners for global processing.

• After detecting NODEPAUSECHAINGLOBAL or HALTCHAINGLOBAL changes, the ExinfoReporter sends Exinfo message to the Observer / globalChainInfoQueue receiver.

• The Observer then constructs a ExinfoMsg and broadcasts it to Mayachain

• Exinfo message has two parameters: InfoId (int64) and Data (string). InfoId identifies the specific exinfo - currently using 1 that indicates that Data contains info about Thorchain halt (HaltExinfo). I use Data to send json encoded info about wether we should halt or unhalt Thorchain (according to Mimir settings on the Thorchain server). Data can be used to send any information / message for other exinfo messages in the future

• There is also a runner scanning the Mimir values on Thorchain in case the Thorchain block scanner is paused due to the set Mimir HaltTHORChain on Maya chain. If HaltTHORChain was set automatically, it resets when the Thorchain server has reset values NODEPAUSECHAINGLOBAL and HALTCHAINGLOBAL

• After msgExinfo after being sent to Mayachain it is processed by its new handler ExinfoHandler (the flow is similar to msgSolvency). After reaching consensus, the value HaltThorChain on Maya node Mimir is set or unset based on the information from msgExinfo

Edited by ZlyDevMaya

Merge request reports

Loading
Loading