Skip to content
This repository has been archived by the owner on Jun 11, 2024. It is now read-only.

Update state store interface to support new information #4951

Closed
shuse2 opened this issue Mar 10, 2020 · 0 comments · Fixed by #4992
Closed

Update state store interface to support new information #4951

shuse2 opened this issue Mar 10, 2020 · 0 comments · Fixed by #4992

Comments

@shuse2
Copy link
Collaborator

shuse2 commented Mar 10, 2020

Description

  • Update name of chainState to be consensusState, and this should not be exposed to the transaction.
  • Update chainState to have lastBlockHeader when creating state store so that transaction can reference
  • Update 'consensusStateto havelastBlockHeaders` which contains last 309 blocks when creating state store, which DPoS and BFT can reference.
  • Update database name chain_state to consensus_state
  • Update state store interface on lisk-transactions
interface StateStore {
    account: {
        get: (address: string) => Promise<Account>;
        getOrDefault: (address: string) => Promise<Account>;
        set: (address: string, value: Account) => void;
        finalize: (batch: any) => Promise<void>,
    },
    chain: {
        lastBlockHeader: BlockHeader;
        networkIdentifier: string;
    },
    consensus: {
        lastBlockHeaders: ReadonlyArray<BlockHeader>;
        get: <T>(key: string) => Promise<T>;
        set: <T>(key: string, value: T) => void;
        finalize: (batch: any) => Promise<void>,
    },
    finalize: () => Promise<void>, // take diff of all set and delete
}

Motivation

In order to support new type of transactions, state store needs to be updated.

Acceptance Criteria

  • lisk-transactions should not include the interface for consensus state. Only chainState and accountState.
  • Test that state store always includes lastBlockHeader, networkIdentifier and lastBlockHeaders on creation

Related Issues

#4915

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants