LiskArchive / lisk-sdk

🔩 Lisk software development kit

Home Page:https://lisk.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Create StateRecoveryDB and MessageRecoveryDB classes

ishantiw opened this issue · comments

Description

  • Propose and define types for each data type, define getDBInstance to create DB instance. Below is one proposal,
// Data to be stored for state recovery
interface InclusionProof {
	height: number;
	stateRoot: Buffer;
	inclusionProof: OutboxRootWitness & { key: Buffer; value: Buffer };
	storeValue: Buffer;
	storeKey: Buffer;
}

interface ProofByHeight {
  Proof: Proof;
  Height: number
}

// Data to be stored for message recovery
interface CCMAndInclusionProofByHeight {
  ccms: CCM[];
  Proof: Proof;
  Height: number;
}
  • Define DB classes for state and message recovery without implementation
class StateRecoveryDB {
	// Save proof by height
	public setInclusionProof(chainID, queryKey, proofByHeight) {}
	public getInclusionProof(chainID, queryKey) {}
      public getInclusionProofByHeight(height: number) {}
      public deleteInclusionProofsUntilHeight(height: number) {}
}

class MessageRecoveryDB {
	// Save CCMs and proof by height
	public setCCMs(chainID, CCMAndInclusionProofByHeight[]) {}
	public getCCMs(chainID) {}
}

Acceptance Criteria

  • Should have all the files, interfaces and tests should be present

Additional Information

  • Relevant implementation #8903