Skip to content

x/slashing performance #4977

Closed
Closed
@alexanderbez

Description

Summary

After performing some benchmarks with and without #4748 on the Cosmos Hub mainnet for blocks 50k-100k using a modified version of v0.34.7, certain execution paths offer glaringly obvious room for performance improvement.

Taking a look at the benchmark, we can see inter-block caching provides significant improvement during BeginBlock. However, we can see the following areas take a significant amount of computation time:

  • handleValidatorSignature
  • AllocateTokensToValidator

handleValidatorSignature

Computation time could improve if we modify how GetValidatorMissedBlockBitArray works. The overhead of storing the key at varying heights is probably high. We instead can store the arrays at fixed lengths (e.g. 100), where they would be kept in cache except every 100 blocks (credit @cwgoes).

AllocateTokensToValidator

I don't think there's too much we can tweak here as a bulk of the time is spent in amino and mutexes.

/cc @jackzampolin @tnachen


For Admin Use

  • Not duplicate issue
  • Appropriate labels applied
  • Appropriate contributors tagged
  • Contributor assigned/self-assigned

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions