Skip to content

perf: Blocksync is double calling types.Block.ValidateBasic at costs to sync speed #1964

@ValarDragon

Description

@ValarDragon

Feature Request

Block sync is double-calling types.Block.ValidateBasic, which re-hashes every transaction in a block. In a 100 block CPU profile sync on Osmosis, over a period with especially large blocks, we found that this was the cause of some notable overhead. (18 seconds out of 185 seconds over all processes, at least 70s of which were in non-blocking operations) Under normal block sizes, this time is lower but still high/worth speeding up. (4.1 seconds for 100 blocks)

image

We should not be double verifying this.

Summary

We are double verifying block hashes in block sync by calling this in two different spots:
ValidateMsg here, which calls types.BlockFromProto which calls validate basic, and types.BlockFromProto right here

Problem Definition

Speed up block sync

Proposal

Do some mild API or order of operations changes to reuse the types.BlockFromProto result and only compute it once.

Metadata

Metadata

Assignees

Type

No type

Projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions