CosmWasm / CosmWasm/wasmd

bug: Genesis imports degradation

Open
#2,350 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
416
Forks
538
PR merge metrics
No merged PRs in 30d

Description

During testing and improving of genesis imports/exports I have identified a bottleneck in how genesis imports of contract state is happening specially when there is half million contract instances being imported

Specifically the import of historicalEntries creating unnecessary amount of iterators creating a lot of cpu usage and contention
https://github.com/CosmWasm/wasmd/blob/b2294ae9cb8c89a2a48e82d2c46fae7d419ed7fa/x/wasm/keeper/keeper.go#L803-L807

the `appendToContractHistory` can avoid entirely the creation of unnecessary iterators if we assume the entire history has been passed for insertion (there is no pre-existing position as it is the case for a genesis import)

I've ran a patched version https://github.com/jhernandezb/wasmd/commit/0c31fbccd9fa8fb1270f66b1e3c089e7a844564d

Let me know if it is ok to submit similar patch

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.