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

core: store NEP5 balances separately from account #748

Merged
merged 8 commits into from
Mar 12, 2020

Conversation

fyrchik
Copy link
Contributor

@fyrchik fyrchik commented Mar 12, 2020

Track NEP5-related things separately from account.

@codecov
Copy link

codecov bot commented Mar 12, 2020

Codecov Report

Merging #748 into master will decrease coverage by 0.04%.
The diff coverage is 55.17%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #748      +/-   ##
==========================================
- Coverage   65.86%   65.82%   -0.05%     
==========================================
  Files         138      138              
  Lines       12461    12543      +82     
==========================================
+ Hits         8208     8256      +48     
- Misses       3854     3887      +33     
- Partials      399      400       +1
Impacted Files Coverage Δ
pkg/core/storage/store.go 37.5% <ø> (ø) ⬆️
pkg/core/state/account.go 65.67% <ø> (+6.92%) ⬆️
pkg/core/blockchain.go 44.49% <25.8%> (-0.41%) ⬇️
pkg/core/dao.go 68.69% <72%> (ø) ⬆️
pkg/rpc/server/server.go 85.01% <75.86%> (+0.29%) ⬆️
pkg/core/cacheddao.go 83.13% <78.94%> (-3.83%) ⬇️
pkg/core/state/nep5.go 55.55% <9.09%> (-24.94%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 1b5dd53...ac47594. Read the comment docs.

Use existing functions to invoke smartcontract's
method instead of constructing ad-hoc script.
There is no need to take and unmarshal an account structure only
to get it's NEP5 balances.
Copy link
Member

@roman-khimov roman-khimov left a comment

Choose a reason for hiding this comment

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

One thing I think still is missing here is NEP5Balances and NEP5Transfers caching in the cachedDao. Just take a look at typical blocks like these:
https://neoscan.io/block/233db5a99fd0bb893fd9bb4abee4806ade8a99c64cb8ee3aad9ca2338f8a6e4d
https://neoscan.io/block/5216166
https://neoscan.io/block/4997999
https://neoscan.io/block/4717987

I see at lot of cache hits there.

pkg/core/dao.go Outdated Show resolved Hide resolved
pkg/core/state/nep5.go Outdated Show resolved Hide resolved
This is an append-only log which is read only during some RPCs.
It is rather slow to get it from base every time we need to append to
it. This commit stores all NEP5Transfers in batches, so that
only a last batch needs to be unmarshaled during block processing.
pkg/core/cacheddao.go Outdated Show resolved Hide resolved
@roman-khimov roman-khimov added this to the v0.74.0 milestone Mar 12, 2020
pkg/core/cacheddao.go Outdated Show resolved Hide resolved
@roman-khimov roman-khimov merged commit d9a8337 into master Mar 12, 2020
@roman-khimov roman-khimov deleted the feature/splitnep5 branch March 12, 2020 15:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature Completely new functionality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants