FIX: automatically HALTTHORCHAIN + ADD: TC Agg Halt Mimirs - #check-lint-warning

Replaced by !395 (closed)

Closes #60 (closed)

• #check-lint-warning because of new func ExinfoHandler.validateV1 (x/mayachain/handler_exinfo.go) • this MR replaces / extends MR !226 (closed)

The overall functionality of Exinfo is similar 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.

The specific implementation of Exinfo in the THORChain client is HaltExinfo. It monitors Mimir settings related to halting chains on THORChain and sends information about changes in these Mimirs to Mayachain, where the values of Maya Mimirs (HALTTHORCHAIN and HALT<chain>CHAINAGG) are then set accordingly.

• The THORChain client observes the following Mimir values: • HaltChainGlobal, HaltTrading, HaltTHORChain, NodePauseChainGlobal -> influence the setting of the HALTTHORCHAIN Mimir on Maya • Halt<chain>Chain, Halt<chain>Trading, SolvencyHalt<chain>Chain -> influence the setting of the HALT<chain>CHAINAGG Mimir on Maya

• After detecting changes in these TC Mimir values, the ExinfoReporter sends an Exinfo message to the Observer/globalChainInfoQueue receiver

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

• The Exinfo message has two parameters: InfoId (int64) and Data (string). InfoId identifies the specific exinfo - currently using HaltChainExinfo (==1) to indicate that Data contains information about the THORChain halt (HaltExinfo). Data field contains JSON-encoded information about the chain and whether it should be halted or unhalted (according to Mimir settings on the THORChain server). The Data field can be used to send any information/message for other exinfo messages in the future

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

• After the msgExinfo is sent to Mayachain, it is processed by its new handler, ExinfoHandler (the flow is similar to msgSolvency). After reaching consensus, the value HALTTHORCHAIN or HALT<chain>CHAINAGG on the Maya node Mimir is set according to the msgExinfo content

Edited by ZlyDevMaya

Merge request reports

Loading
Loading