Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

simplify light client contract: create genesis state struct and remove states mapping #1938

Closed
alysiahuggins opened this issue Aug 28, 2024 · 0 comments · Fixed by #1939
Closed
Assignees

Comments

@alysiahuggins
Copy link
Contributor

alysiahuggins commented Aug 28, 2024

subtask of #1912

  1. remove unnecessary variables from the LightClientState
struct LightClientState {
        uint64 viewNum;
        uint64 blockHeight;
        BN254.ScalarField blockCommRoot;
}
  1. introduce a new struct for genesis state
struct GenesisState {
        uint256 threshold;
        uint256 stakeTableBlsKeyComm;
        uint256 stakeTableSchnorrKeyComm;
        uint256 stakeTableAmountComm;
        uint256 blockCommRoot;
 }

To ensure simplicity for the updateStateHistory(uint64 blockNumber, uint64 blockTimestamp, LightClientState memory state) function, there may be need for the genesisState to be separated into two separate variables e.g.

struct LightClientState {
        uint64 viewNum;
        uint64 blockHeight;
        BN254.ScalarField blockCommRoot;
}

struct StakeState {
        uint256 threshold;
        BN254.ScalarField stakeTableBlsKeyComm;
        BN254.ScalarField stakeTableSchnorrKeyComm;
        BN254.ScalarField stakeTableAmountComm;
}
   
StakeStake genesisStake;
LightClientState genesisState;
LightClientState lightClientState;
  1. remove the states mapping and add a genesisState variable and add a finalizedState variable
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant