Skip to content

Block in place while updating witness map #28

@sug0

Description

@sug0

Updating the witness map is a fairly expensive operation, since we must append new nodes to a tree. This operation is linear to the amount of notes that haven't been spent yet, and each insertion is logarithmic. In total, we spendO(N log N) time, which is less than ideal, since that code is run from an async context.

https://github.com/anoma/namada-masp-indexer/blob/6cc34cd451cf4f6ab60c8e4838c486d831534aaa/chain/src/main.rs#L218-L239

Since this blocks tokio from yielding the current worker thread, we should resort to tokio::task::block_in_place around this for loop.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions