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

Add validation logic for blocks and transaction root #7504

Closed
Tracked by #7136
ishantiw opened this issue Sep 7, 2022 · 0 comments · Fixed by #7530
Closed
Tracked by #7136

Add validation logic for blocks and transaction root #7504

ishantiw opened this issue Sep 7, 2022 · 0 comments · Fixed by #7530
Assignees
Milestone

Comments

@ishantiw
Copy link
Contributor

ishantiw commented Sep 7, 2022

Description

Add static validation logic for incoming blocks as described in LIP0063

This function is called from sync function and it can be a util function like below,

validateBlock(receivedBlock: Buffer, deserializedNextBlock)

Validation:

  • To calculate blockID of the incoming block and check its blockID with previousBlockID of the block at height h + 1
    • Calculate the block ID from the received blockBytes and compare with previousBlockID
  • Should pass schema check as given for that range of blocks
  • Deserialize the block
  • Payload should be checked against transactionRoot by calculating transactionRoot from the payload using MerkleTree

Acceptance Criteria

  • Should have unit tests covering the validation steps
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.

3 participants