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

feat: signature verification cache (#41) #143

Merged
merged 1 commit into from
Apr 26, 2021

Conversation

jinsan-line
Copy link
Contributor

Epic: line/lbm#1258

Cherry-pick: #41

Description

  • During checking a tx, if it succeed to verify the signatures, keep it in txHashCache as [account_number:sequence]: tx_hash
  • When delivering or rechecking a tx, we could look up txHashCache to check whether it's already verified.
  • When delivering a tx, if txHashCache doesn't have a entry or the txHash is not same, we'll verify it again w/ VerifyBytes()
  • When rechecking a tx, SigVerificationDecorator is executed as well for https://github.com/line/link/issues/1136

Motivation and context

Signature verification is cpu intensive task. It could be executed repeatedly for the same transaction so, if we keep the verified the transactions, it could save cpu time and improve the performance.


Before we can merge this PR, please make sure that all the following items have been
checked off. If any of the checklist items are not applicable, please leave them but
write a little note why.

  • Targeted PR against correct branch (see CONTRIBUTING.md)
  • Linked to Github issue with discussion and accepted design OR link to spec that describes this work.
  • Code follows the module structure standards.
  • Wrote unit and integration tests
  • Updated relevant documentation (docs/) or specification (x/<module>/spec/)
  • Added relevant godoc comments.
  • Added a relevant changelog entry to the Unreleased section in CHANGELOG.md
  • Re-reviewed Files changed in the Github PR explorer
  • Review Codecov Report in the comment section below once CI passes

@jinsan-line jinsan-line added this to the Initail ebony milestone Apr 23, 2021
@jinsan-line jinsan-line self-assigned this Apr 23, 2021
@codecov
Copy link

codecov bot commented Apr 26, 2021

Codecov Report

Merging #143 (3f71b8a) into v2/develop (1f739c5) will increase coverage by 1.52%.
The diff coverage is 72.94%.

❗ Current head 3f71b8a differs from pull request most recent head 38044c2. Consider uploading reports for the commit 38044c2 to get more accurate results
Impacted file tree graph

@@              Coverage Diff               @@
##           v2/develop     #143      +/-   ##
==============================================
+ Coverage       54.99%   56.52%   +1.52%     
==============================================
  Files             812      805       -7     
  Lines           51487    49530    -1957     
==============================================
- Hits            28317    27995     -322     
+ Misses          20211    18594    -1617     
+ Partials         2959     2941      -18     
Impacted Files Coverage Δ
client/grpc/tmservice/query.pb.gw.go 30.06% <ø> (ø)
simapp/test_helpers.go 0.49% <0.00%> (-0.01%) ⬇️
testutil/network/network.go 86.26% <0.00%> (ø)
types/address.go 65.71% <ø> (ø)
types/config.go 84.61% <ø> (ø)
x/auth/client/rest/broadcast.go 40.90% <0.00%> (ø)
x/auth/types/query.pb.gw.go 0.89% <ø> (ø)
x/bank/types/query.pb.gw.go 0.00% <ø> (ø)
x/distribution/types/query.pb.gw.go 0.00% <ø> (ø)
x/evidence/types/query.pb.gw.go 0.00% <ø> (ø)
... and 58 more

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.

4 participants