Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem: eth tx sender recovery is slow #928

Merged
merged 8 commits into from Mar 15, 2023
Merged

Conversation

yihuang
Copy link
Collaborator

@yihuang yihuang commented Mar 14, 2023

Solution:

  • update ethermint dependency, do the recovery once in ante handler and cache the result

Benchmark result improve from 1.3s -> 0.9s, 1k+ erc20 transfer TPS achived in this benchmark ;D

$ go test -run=^$ -bench=BenchmarkERC20Transfer -benchmem ./app -count=3
goos: darwin
goarch: amd64
pkg: github.com/crypto-org-chain/cronos/v2/app
cpu: Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz
BenchmarkERC20Transfer/memdb-12         	       2	 898359140 ns/op	275876728 B/op	 4689863 allocs/op
BenchmarkERC20Transfer/memdb-12         	       2	 918545580 ns/op	275865808 B/op	 4689827 allocs/op
BenchmarkERC20Transfer/memdb-12         	       2	 915937210 ns/op	275905872 B/op	 4690029 allocs/op
BenchmarkERC20Transfer/leveldb-12       	       2	 985876458 ns/op	277770568 B/op	 4688924 allocs/op
BenchmarkERC20Transfer/leveldb-12       	       2	1050278982 ns/op	277757240 B/op	 4688916 allocs/op
BenchmarkERC20Transfer/leveldb-12       	       1	1192915378 ns/op	276416192 B/op	 4679697 allocs/op
PASS
ok  	github.com/crypto-org-chain/cronos/v2/app	28.915s

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

PR Checklist:

  • Have you read the CONTRIBUTING.md?
  • Does your PR follow the C4 patch requirements?
  • Have you rebased your work on top of the latest master?
  • Have you checked your code compiles? (make)
  • Have you included tests for any non-trivial functionality?
  • Have you checked your code passes the unit tests? (make test)
  • Have you checked your code formatting is correct? (go fmt)
  • Have you checked your basic code style is fine? (golangci-lint run)
  • If you added any dependencies, have you checked they do not contain any known vulnerabilities? (go list -json -m all | nancy sleuth)
  • If your changes affect the client infrastructure, have you run the integration test?
  • If your changes affect public APIs, does your PR follow the C4 evolution of public contracts?
  • If your code changes public APIs, have you incremented the crate version numbers and documented your changes in the CHANGELOG.md?
  • If you are contributing for the first time, please read the agreement in CONTRIBUTING.md now and add a comment to this pull request stating that your PR is in accordance with the Developer's Certificate of Origin.

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

Solution:
- update ethermint dependency, do it once in ante handler and cache the result
go.mod Outdated Show resolved Hide resolved
@codecov
Copy link

codecov bot commented Mar 14, 2023

Codecov Report

Merging #928 (876f82c) into main (392eee6) will increase coverage by 15.93%.
The diff coverage is 23.07%.

Impacted file tree graph

@@             Coverage Diff             @@
##             main     #928       +/-   ##
===========================================
+ Coverage   21.56%   37.50%   +15.93%     
===========================================
  Files          48       75       +27     
  Lines        2991     5557     +2566     
===========================================
+ Hits          645     2084     +1439     
- Misses       2285     3251      +966     
- Partials       61      222      +161     
Impacted Files Coverage Δ
app/upgrades.go 22.22% <23.07%> (+0.79%) ⬆️

... and 40 files with indirect coverage changes

@yihuang yihuang marked this pull request as ready for review March 15, 2023 03:52
@yihuang yihuang requested a review from a team as a code owner March 15, 2023 03:52
@yihuang yihuang requested review from JayT106 and thomas-nguy and removed request for a team March 15, 2023 03:52
go.mod Show resolved Hide resolved
@yihuang yihuang requested a review from mmsqe March 15, 2023 08:08
Copy link
Collaborator

@mmsqe mmsqe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wait, upgrade test fails

@yihuang
Copy link
Collaborator Author

yihuang commented Mar 15, 2023

wait, upgrade test fails

I see, also looking at it.

@mmsqe
Copy link
Collaborator

mmsqe commented Mar 15, 2023

wait, upgrade test fails

I see, also looking at it.

not sure why get failed to load latest version: version of store gravity mismatch root store's version; expected 28 got 0

@yihuang
Copy link
Collaborator Author

yihuang commented Mar 15, 2023

wait, upgrade test fails

I see, also looking at it.

not sure why get failed to load latest version: version of store gravity mismatch root store's version; expected 28 got 0

we have something wrong in upgrade handler, and that's the exact mistake that's checked in new sdk version ;D

@yihuang
Copy link
Collaborator Author

yihuang commented Mar 15, 2023

wait, upgrade test fails

I see, also looking at it.

not sure why get failed to load latest version: version of store gravity mismatch root store's version; expected 28 got 0

should be fixed, let's see.

@yihuang yihuang enabled auto-merge (squash) March 15, 2023 09:07
@yihuang yihuang merged commit 672a3e7 into crypto-org-chain:main Mar 15, 2023
28 of 32 checks passed
mmsqe added a commit to mmsqe/cronos that referenced this pull request Mar 16, 2023
* Problem: eth tx sender recovery is slow

Solution:
- update ethermint dependency, do it once in ante handler and cache the result

* fix build

* update upstream

* fix lint

* fix versiondb

* fix memiavl

* fix upgrade integration test

---------

Co-authored-by: mmsqe <mavis@crypto.com>
mmsqe added a commit that referenced this pull request Mar 16, 2023
* Problem: tx delivery performance is not benchmarked (#916)

Solution:
- add the first benchmark for tx delivery

* Problem: go 1.20.2 is not used (#926)

* Problem: go 1.20.2 is not used

Solution:
- update nixpkgs to recent master
- re-enable coverage report for integration tests

* enlarge timeout

---------

Co-authored-by: mmsqe <mavis@crypto.com>

* Problem: eth tx sender recovery is slow (#928)

* Problem: eth tx sender recovery is slow

Solution:
- update ethermint dependency, do it once in ante handler and cache the result

* fix build

* update upstream

* fix lint

* fix versiondb

* fix memiavl

* fix upgrade integration test

---------

Co-authored-by: mmsqe <mavis@crypto.com>

* fix lint

* fix test

* point to rpc fix only

* no report coverage

---------

Co-authored-by: yihuang <huang@crypto.com>
AleksandM pushed a commit to AleksandM/cronos that referenced this pull request Jan 23, 2024
…n#932)

* Problem: tx delivery performance is not benchmarked (crypto-org-chain#916)

Solution:
- add the first benchmark for tx delivery

* Problem: go 1.20.2 is not used (crypto-org-chain#926)

* Problem: go 1.20.2 is not used

Solution:
- update nixpkgs to recent master
- re-enable coverage report for integration tests

* enlarge timeout

---------

Co-authored-by: mmsqe <mavis@crypto.com>

* Problem: eth tx sender recovery is slow (crypto-org-chain#928)

* Problem: eth tx sender recovery is slow

Solution:
- update ethermint dependency, do it once in ante handler and cache
the result

* fix build

* update upstream

* fix lint

* fix versiondb

* fix memiavl

* fix upgrade integration test

---------

Co-authored-by: mmsqe <mavis@crypto.com>

* fix lint

* fix test

* point to rpc fix only

* no report coverage

---------

Co-authored-by: yihuang <huang@crypto.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants