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

Implement genesis block validation function in lisk-genesis #5386

Closed
nazarhussain opened this issue Jun 3, 2020 · 1 comment · Fixed by #5421
Closed

Implement genesis block validation function in lisk-genesis #5386

nazarhussain opened this issue Jun 3, 2020 · 1 comment · Fixed by #5421
Assignees
Milestone

Comments

@nazarhussain
Copy link
Contributor

nazarhussain commented Jun 3, 2020

Description

  • Create validateGenesisBlock = (params: genesisBlock) => boolean for schema validation

This function should follow the rules for any genesis block b;

  • The value b.header.version is 0, which is the block version used for this block.
  • The value b.header.timestamp is a Unix time in seconds and can be any value in the uint32 range.
  • The value b.header.height can be any value in the uint32 range.
  • The valueb.header.previousBlockID can be any 32-byte value.
  • The value of b.header.transactionRoot is computed and verified as specified in LIP 0032, as for any other block.
  • The value of b.header.generatorPublicKey must be empty bytes.
  • The value of b.header.reward must be 0.
  • The value of b.header.asset.accounts must be an array of serialized accounts according
  • The value of the property b.header.asset.initDelegates must be an array of distinct 20-byte values
  • The value of b.header.asset.initRounds must be at least 3.
  • The value of b.header.signature must be empty bytes.

More details can be found on

https://github.com/LiskHQ/lips/blob/master/proposals/lip-0034.md#block-validity

Motivation

This function is required to validate genesis block with new schema.

Acceptance Criteria

  • Unit tests are added to validate genesis block with default values and custom values.
  • It must have unit test for all given rules of valid blocks

Additional Information

Related issues: #5234

@nazarhussain
Copy link
Contributor Author

As this issue is partially been covered in creation PR, so assigning it to myself.

@nazarhussain nazarhussain self-assigned this Jun 9, 2020
shuse2 added a commit that referenced this issue Jun 17, 2020
Implement genesis block creation and validation function in lisk-genesis - Closes #5277, #5386
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
2 participants