You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jun 11, 2024. It is now read-only.
Create BaseRecoveryManager class and declare functions
abstractclassBaseRecoveryManager{private_stateRecoveryDB: Database;private_apiClient: APIClient;privateconfig: Config;private_queryKeys: Map<chainID,queryKey[]>;private_mainchainClient: APIClient;public_sidechainClientMap: Map<chainID,SidechainClient>constructor({ config, chainID, stateRecoveryDB }){this._stateRecoveryDB=stateRecoveryDB;this.config=config;this._sidechainClientMap=newMap();}publicload(){}publicunload(){}// Add a clientpublicaddSideChainClient(chainID,connectionURL){constsidechainClient=newSidechainClient((chainID,connectionURL);this._sidechainClientMap.set(chainID,sidechainClient);}// add key for state recovery based on the chain and add it to client.addQueryKeyForInclusionProofpublicaddKeyForStateRecovery(chainID,queryKey){}// this is common to both mainchain and sidechain; gets information from DB stored by clientspublictriggerStateRecovery(chainID,queryKey){// calls private method `computeStateRecoveryParams ` which computes all the params stored in the messageRecoveryDB}// This method will be called once a recovery was done successfully and we need to update all the inclusionProofspublicupdateInclusionProofs(chainID,queryKey){}// Clean mechanism will include checking last certificate height of the sidechain on mainchainpubliccleanup()}classMainchainRecoveryManagerextendsBaseRecoveryManager{private_messageRecoveryDB: Database;constructor({ config, chainID, stateRecoveryDB, messageRecoveryDB, sidechainChainID }){super({ config, chainID, stateRecoveryDB });this._messageRecoveryDB=messageRecoveryDB;}// saves CCMs and inclusion proof on the mainchain on every new blockpublicenableMessageRecovery(){}// creates txpublictriggerMessageRecovery(chainID){// calls private method `computeMessageRecoveryParams ` which computes all the params stored in the messageRecoveryDB}// creates txpublictriggerInitMessageRecovery(chainID){// calls private method `computeInitMessageRecoveryParams ` which computes all the params stored in the messageRecoveryDB}publiccleanup()}classSidechainRecoveryManagerextendsBaseRecoveryManager{private_mainchainClient: APIClient;constructor({ config, chainID, stateRecoveryDB, mainchainClient }){super({ config, chainID, stateRecoveryDB });this._mainchainClient=mainchainClient;}// Only init state recovery is extra command as compared to BaseRecoveryManager// we can call mainchainClient to build the paramspublictriggerInitStateRecovery(chainID,queryKey){// calls private method `computeInitStateRecoveryParams ` which computes all the params stored in the StateRecoveryDB}publiccleanup()}
Implement logic for addSideChainClient and addKeyForStateRecovery
Acceptance Criteria
Should have all the interfaces present
Should have all the unit tests present for addSideChainClient and addKeyForStateRecovery
The text was updated successfully, but these errors were encountered:
ishantiw
changed the title
Create BaseRecoveryManager class and declare functions
Create Mainchain, Sidechain and BaseRecoveryManager class and declare functions
Dec 7, 2023
Description
Create
BaseRecoveryManager
class and declare functionsaddSideChainClient
andaddKeyForStateRecovery
Acceptance Criteria
addSideChainClient
andaddKeyForStateRecovery
The text was updated successfully, but these errors were encountered: