crypto-org-chain / cronos

Cronos is the first Ethereum-compatible blockchain network built on Cosmos SDK technology. Cronos aims to massively scale the DeFi, GameFi, and overall Web3 user community by providing builders with the ability to instantly port apps and crypto assets from other chains while benefiting from low transaction fees, high throughput, and fast finality.
Other
295 stars 237 forks source link

Problem: sig verification result is not cached between incarnations #1515

Closed yihuang closed 4 months ago

yihuang commented 4 months ago

Benchmark Results

100 accounts on x86 mac (run by @mmsqe)

ERC20Transfer/memiavl-stm-8-12    1131.9m ± 1%   965.4m ± 1%  -14.72% (p=0.000 n=8)
ERC20Transfer/memiavl-stm-16-12     3.298 ± 5%    3.196 ± 5%   -3.07% (p=0.028 n=8)
ERC20Transfer/memiavl-stm-32-12     6.705 ± 6%    7.118 ± 9%        ~ (p=0.328 n=8)
geomean                             1.331         1.323        -0.63%

1 unique account (Worst Case)

goos: darwin
goarch: arm64
pkg: github.com/crypto-org-chain/cronos/v2/app
                                │ /tmp/before  │             /tmp/after             │
                                │    sec/op    │   sec/op     vs base               │
ERC20Transfer/memdb-16            626.5m ±  2%   609.6m ± 2%   -2.70% (p=0.002 n=6)
ERC20Transfer/leveldb-16          628.2m ±  2%   618.0m ± 2%   -1.63% (p=0.041 n=6)
ERC20Transfer/memiavl-16          635.6m ±  2%   625.1m ± 4%        ~ (p=0.065 n=6)
ERC20Transfer/memiavl-stm-1-16    781.4m ±  1%   777.7m ± 2%        ~ (p=0.485 n=6)
ERC20Transfer/memiavl-stm-8-16    884.2m ±  1%   730.2m ± 1%  -17.41% (p=0.002 n=6)
ERC20Transfer/memiavl-stm-16-16    1.584 ±  9%    1.553 ± 6%        ~ (p=0.394 n=6)
ERC20Transfer/memiavl-stm-32-16    4.729 ± 11%    4.731 ± 4%        ~ (p=0.937 n=6)
geomean                            1.038         997.5m        -3.87%

                                │  /tmp/before  │             /tmp/after              │
                                │     B/op      │     B/op      vs base               │
ERC20Transfer/memdb-16            366.1Mi ±  0%   366.7Mi ± 0%   +0.16% (p=0.002 n=6)
ERC20Transfer/leveldb-16          368.5Mi ±  0%   369.1Mi ± 0%   +0.17% (p=0.002 n=6)
ERC20Transfer/memiavl-16          364.3Mi ±  0%   364.9Mi ± 0%   +0.17% (p=0.002 n=6)
ERC20Transfer/memiavl-stm-1-16    500.4Mi ±  0%   502.7Mi ± 0%   +0.46% (p=0.002 n=6)
ERC20Transfer/memiavl-stm-8-16    1.911Gi ±  0%   2.723Gi ± 1%  +42.49% (p=0.002 n=6)
ERC20Transfer/memiavl-stm-16-16   4.224Gi ± 11%   6.844Gi ± 3%  +62.01% (p=0.002 n=6)
ERC20Transfer/memiavl-stm-32-16   12.45Gi ± 10%   20.14Gi ± 4%  +61.75% (p=0.002 n=6)
geomean                           1.123Gi         1.357Gi       +20.87%

                                │ /tmp/before  │             /tmp/after              │
                                │  allocs/op   │  allocs/op    vs base               │
ERC20Transfer/memdb-16            4.745M ±  0%    4.745M ± 0%        ~ (p=0.310 n=6)
ERC20Transfer/leveldb-16          4.745M ±  0%    4.745M ± 0%        ~ (p=0.240 n=6)
ERC20Transfer/memiavl-16          4.707M ±  0%    4.707M ± 0%        ~ (p=0.240 n=6)
ERC20Transfer/memiavl-stm-1-16    6.226M ±  0%    6.241M ± 0%   +0.24% (p=0.002 n=6)
ERC20Transfer/memiavl-stm-8-16    32.38M ±  0%    47.07M ± 1%  +45.40% (p=0.002 n=6)
ERC20Transfer/memiavl-stm-16-16   74.71M ± 11%   122.43M ± 3%  +63.87% (p=0.002 n=6)
ERC20Transfer/memiavl-stm-32-16   226.2M ± 10%    365.6M ± 4%  +61.67% (p=0.002 n=6)
geomean                           16.69M          20.24M       +21.29%

100 unique accounts

goos: darwin
goarch: arm64
pkg: github.com/crypto-org-chain/cronos/v2/app
                                │ /tmp/before │             /tmp/after             │
                                │   sec/op    │    sec/op     vs base              │
ERC20Transfer/memdb-16            640.0m ± 3%   624.7m ±  1%       ~ (p=0.093 n=6)
ERC20Transfer/leveldb-16          645.4m ± 2%   622.4m ±  1%  -3.57% (p=0.002 n=6)
ERC20Transfer/memiavl-16          650.5m ± 2%   629.4m ±  2%  -3.25% (p=0.002 n=6)
ERC20Transfer/memiavl-stm-1-16    774.0m ± 1%   751.1m ±  1%  -2.95% (p=0.002 n=6)
ERC20Transfer/memiavl-stm-8-16    137.7m ± 1%   136.7m ±  5%       ~ (p=0.485 n=6)
ERC20Transfer/memiavl-stm-16-16   126.4m ± 2%   122.8m ± 10%       ~ (p=0.093 n=6)
ERC20Transfer/memiavl-stm-32-16   167.1m ± 6%   160.8m ±  3%  -3.82% (p=0.041 n=6)
geomean                           346.9m        337.2m        -2.80%

                                │ /tmp/before  │             /tmp/after             │
                                │     B/op     │     B/op      vs base              │
ERC20Transfer/memdb-16            368.5Mi ± 0%   369.1Mi ± 0%  +0.17% (p=0.002 n=6)
ERC20Transfer/leveldb-16          371.0Mi ± 0%   371.7Mi ± 0%  +0.17% (p=0.002 n=6)
ERC20Transfer/memiavl-16          364.8Mi ± 0%   365.4Mi ± 0%  +0.17% (p=0.002 n=6)
ERC20Transfer/memiavl-stm-1-16    457.9Mi ± 0%   460.2Mi ± 0%  +0.50% (p=0.002 n=6)
ERC20Transfer/memiavl-stm-8-16    469.3Mi ± 0%   471.1Mi ± 0%  +0.38% (p=0.002 n=6)
ERC20Transfer/memiavl-stm-16-16   486.3Mi ± 0%   486.4Mi ± 0%       ~ (p=0.699 n=6)
ERC20Transfer/memiavl-stm-32-16   512.4Mi ± 1%   514.7Mi ± 0%  +0.44% (p=0.009 n=6)
geomean                           428.9Mi        430.1Mi       +0.26%

                                │ /tmp/before │            /tmp/after             │
                                │  allocs/op  │  allocs/op   vs base              │
ERC20Transfer/memdb-16            4.773M ± 0%   4.773M ± 0%       ~ (p=1.000 n=6)
ERC20Transfer/leveldb-16          4.771M ± 0%   4.771M ± 0%       ~ (p=0.937 n=6)
ERC20Transfer/memiavl-16          4.709M ± 0%   4.709M ± 0%       ~ (p=0.485 n=6)
ERC20Transfer/memiavl-stm-1-16    5.848M ± 0%   5.863M ± 0%  +0.26% (p=0.002 n=6)
ERC20Transfer/memiavl-stm-8-16    6.007M ± 0%   6.015M ± 0%  +0.13% (p=0.002 n=6)
ERC20Transfer/memiavl-stm-16-16   6.252M ± 0%   6.235M ± 0%       ~ (p=0.093 n=6)
ERC20Transfer/memiavl-stm-32-16   6.727M ± 1%   6.741M ± 0%       ~ (p=0.132 n=6)
geomean                           5.531M        5.534M       +0.05%

10 unique accounts

benchstat /tmp/before /tmp/after                                                                                                                                                                     ~/src/cronos
goos: darwin
goarch: arm64
pkg: github.com/crypto-org-chain/cronos/v2/app
                                │ /tmp/before  │             /tmp/after              │
                                │    sec/op    │    sec/op     vs base               │
ERC20Transfer/memdb-16            635.6m ±  3%   643.2m ±  1%        ~ (p=0.132 n=6)
ERC20Transfer/leveldb-16          634.1m ±  1%   639.0m ±  1%   +0.77% (p=0.015 n=6)
ERC20Transfer/memiavl-16          637.5m ±  1%   641.8m ±  1%   +0.67% (p=0.041 n=6)
ERC20Transfer/memiavl-stm-1-16    772.6m ±  1%   775.4m ±  1%        ~ (p=0.240 n=6)
ERC20Transfer/memiavl-stm-8-16    176.2m ±  0%   160.3m ±  1%   -9.04% (p=0.002 n=6)
ERC20Transfer/memiavl-stm-16-16   201.4m ± 16%   173.7m ± 16%  -13.79% (p=0.009 n=6)
ERC20Transfer/memiavl-stm-32-16   382.3m ± 11%   375.5m ±  9%        ~ (p=0.589 n=6)
geomean                           429.4m         415.5m         -3.25%

                                │ /tmp/before  │             /tmp/after              │
                                │     B/op     │     B/op      vs base               │
ERC20Transfer/memdb-16            366.3Mi ± 0%   366.9Mi ± 0%   +0.17% (p=0.002 n=6)
ERC20Transfer/leveldb-16          368.7Mi ± 0%   369.3Mi ± 0%   +0.16% (p=0.002 n=6)
ERC20Transfer/memiavl-16          364.3Mi ± 0%   364.9Mi ± 0%   +0.17% (p=0.002 n=6)
ERC20Transfer/memiavl-stm-1-16    478.2Mi ± 0%   480.5Mi ± 0%   +0.48% (p=0.002 n=6)
ERC20Transfer/memiavl-stm-8-16    554.5Mi ± 0%   553.6Mi ± 0%   -0.16% (p=0.041 n=6)
ERC20Transfer/memiavl-stm-16-16   697.4Mi ± 1%   711.8Mi ± 3%   +2.07% (p=0.004 n=6)
ERC20Transfer/memiavl-stm-32-16   1.063Gi ± 3%   1.333Gi ± 8%  +25.37% (p=0.002 n=6)
geomean                           517.2Mi        536.4Mi        +3.71%

                                │ /tmp/before │             /tmp/after              │
                                │  allocs/op  │  allocs/op    vs base               │
ERC20Transfer/memdb-16            4.747M ± 0%    4.747M ± 0%        ~ (p=0.937 n=6)
ERC20Transfer/leveldb-16          4.747M ± 0%    4.747M ± 0%        ~ (p=0.589 n=6)
ERC20Transfer/memiavl-16          4.706M ± 0%    4.706M ± 0%        ~ (p=0.818 n=6)
ERC20Transfer/memiavl-stm-1-16    6.016M ± 0%    6.031M ± 0%   +0.25% (p=0.002 n=6)
ERC20Transfer/memiavl-stm-8-16    7.288M ± 0%    7.211M ± 1%   -1.06% (p=0.002 n=6)
ERC20Transfer/memiavl-stm-16-16   9.827M ± 2%   10.037M ± 4%   +2.14% (p=0.009 n=6)
ERC20Transfer/memiavl-stm-32-16   16.84M ± 4%    21.74M ± 9%  +29.10% (p=0.002 n=6)
geomean                           6.932M         7.203M        +3.91%

👮🏻👮🏻👮🏻 !!!! REFERENCE THE PROBLEM YOUR ARE SOLVING IN THE PR TITLE AND DESCRIBE YOUR SOLUTION HERE !!!! DO NOT FORGET !!!! 👮🏻👮🏻👮🏻

PR Checklist:

Thank you for your code, it's appreciated! :)

Summary by CodeRabbit

coderabbitai[bot] commented 4 months ago

Walkthrough

The recent changes focus on enhancing the performance of the application by caching signature verification results between transaction incarnations. Additionally, several dependencies in the project have been updated to their latest versions, reflecting improvements and fixes from their respective upstream projects. These updates involve changes to go.mod and gomod2nix.toml files, which now reference the new versions of github.com/cosmos/cosmos-sdk and github.com/evmos/ethermint.

Changes

File Change Summary
CHANGELOG.md Improved performance by caching signature verification results between transaction incarnations.
go.mod Removed github.com/libp2p/go-buffer-pool and updated github.com/cosmos/cosmos-sdk and github.com/evmos/ethermint versions.
gomod2nix.toml Updated versions and hashes for dependencies including github.com/cosmos/cosmos-sdk and github.com/evmos/ethermint.

Poem

In code we weave a tale so grand,
Caching signatures across the land.
Dependencies rise to a newer crest,
Our project now performs the best.
Let’s celebrate with hops and cheer,
For better code is finally here!
🐇✨


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share - [X](https://twitter.com/intent/tweet?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A&url=https%3A//coderabbit.ai) - [Mastodon](https://mastodon.social/share?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A%20https%3A%2F%2Fcoderabbit.ai) - [Reddit](https://www.reddit.com/submit?title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&text=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code.%20Check%20it%20out%3A%20https%3A//coderabbit.ai) - [LinkedIn](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fcoderabbit.ai&mini=true&title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&summary=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code)
Tips ### Chat There are 3 ways to chat with [CodeRabbit](https://coderabbit.ai): - Review comments: Directly reply to a review comment made by CodeRabbit. Example: - `I pushed a fix in commit .` - `Generate unit testing code for this file.` - `Open a follow-up GitHub issue for this discussion.` - Files and specific lines of code (under the "Files changed" tab): Tag `@coderabbitai` in a new review comment at the desired location with your query. Examples: - `@coderabbitai generate unit testing code for this file.` - `@coderabbitai modularize this function.` - PR comments: Tag `@coderabbitai` in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples: - `@coderabbitai generate interesting stats about this repository and render them as a table.` - `@coderabbitai show all the console.log statements in this repository.` - `@coderabbitai read src/utils.ts and generate unit testing code.` - `@coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.` - `@coderabbitai help me debug CodeRabbit configuration file.` Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. ### CodeRabbit Commands (invoked as PR comments) - `@coderabbitai pause` to pause the reviews on a PR. - `@coderabbitai resume` to resume the paused reviews. - `@coderabbitai review` to trigger an incremental review. This is useful when automatic reviews are disabled for the repository. - `@coderabbitai full review` to do a full review from scratch and review all the files again. - `@coderabbitai summary` to regenerate the summary of the PR. - `@coderabbitai resolve` resolve all the CodeRabbit review comments. - `@coderabbitai configuration` to show the current CodeRabbit configuration for the repository. - `@coderabbitai help` to get help. Additionally, you can add `@coderabbitai ignore` anywhere in the PR description to prevent this PR from being reviewed. ### CodeRabbit Configration File (`.coderabbit.yaml`) - You can programmatically configure CodeRabbit by adding a `.coderabbit.yaml` file to the root of your repository. - Please see the [configuration documentation](https://docs.coderabbit.ai/guides/configure-coderabbit) for more information. - If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: `# yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json` ### Documentation and Community - Visit our [Documentation](https://coderabbit.ai/docs) for detailed information on how to use CodeRabbit. - Join our [Discord Community](https://discord.com/invite/GsXnASn26c) to get help, request features, and share feedback. - Follow us on [X/Twitter](https://twitter.com/coderabbitai) for updates and announcements.
codecov[bot] commented 4 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 35.87%. Comparing base (1e6484a) to head (6255b87).

Additional details and impacted files [![Impacted file tree graph](https://app.codecov.io/gh/crypto-org-chain/cronos/pull/1515/graphs/tree.svg?width=650&height=150&src=pr&token=92w0Dz1Coj&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=crypto-org-chain)](https://app.codecov.io/gh/crypto-org-chain/cronos/pull/1515?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=crypto-org-chain) ```diff @@ Coverage Diff @@ ## main #1515 +/- ## =========================================== + Coverage 17.54% 35.87% +18.33% =========================================== Files 87 136 +49 Lines 5273 9809 +4536 =========================================== + Hits 925 3519 +2594 - Misses 4238 5894 +1656 - Partials 110 396 +286 ``` [see 72 files with indirect coverage changes](https://app.codecov.io/gh/crypto-org-chain/cronos/pull/1515/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=crypto-org-chain)