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

refactor StateManger/StateReader #1886

Merged
merged 2 commits into from
Feb 13, 2020

Conversation

koseoyoung
Copy link
Contributor

works on #1882

@koseoyoung koseoyoung requested a review from a team as a code owner February 13, 2020 01:41
@codecov
Copy link

codecov bot commented Feb 13, 2020

Codecov Report

Merging #1886 into master will decrease coverage by 0.06%.
The diff coverage is 57.89%.

Impacted file tree graph

@@            Coverage Diff            @@
##           master   #1886      +/-   ##
=========================================
- Coverage   61.37%   61.3%   -0.07%     
=========================================
  Files         161     161              
  Lines       13300   13321      +21     
=========================================
+ Hits         8163    8167       +4     
- Misses       4099    4113      +14     
- Partials     1038    1041       +3
Impacted Files Coverage Δ
action/protocol/execution/evm/evmstatedbadapter.go 52.09% <0%> (ø) ⬆️
action/protocol/managers.go 0% <0%> (ø) ⬆️
action/protocol/poll/util.go 74.77% <100%> (+0.46%) ⬆️
action/protocol/account/protocol.go 47.56% <50%> (ø) ⬆️
state/factory/workingset.go 62.58% <60%> (-1.25%) ⬇️
state/factory/statetx.go 60.76% <62.5%> (ø) ⬆️
action/protocol/rewarding/protocol.go 67.1% <66.66%> (-0.01%) ⬇️
state/factory/statedb.go 59.81% <83.33%> (ø) ⬆️
state/factory/factory.go 63.85% <88.88%> (ø) ⬆️
db/trie/extensionnode.go 57.62% <0%> (-1.7%) ⬇️

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 4279c62...13f1ab1. Read the comment docs.

Comment on lines +41 to +48
_, err = sm.State(&account, protocol.LegacyKeyOption(addrHash))
if err == nil {
return &account, nil
}
if errors.Cause(err) == state.ErrStateNotExist {
account.Balance = big.NewInt(0)
account.VotingWeight = big.NewInt(0)
if err := sm.PutState(addrHash, account); err != nil {
if _, err := sm.PutState(account, protocol.LegacyKeyOption(addrHash)); err != nil {
Copy link
Collaborator

Choose a reason for hiding this comment

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

this is the perfect place for us to check the versions (heights)

@@ -126,9 +125,9 @@ func TestActQueuePendingActs(t *testing.T) {
require := require.New(t)
cfg := config.Default
sf := mock_factory.NewMockFactory(ctrl)
sf.EXPECT().State(gomock.Any(), gomock.Any()).Do(func(_ hash.Hash160, accountState *state.Account) {
sf.EXPECT().State(gomock.Any(), gomock.Any()).Do(func(accountState *state.Account, _ protocol.StateOption) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

is it
sf.EXPECT().State(gomock.Any(), gomock.Any()).Do(func(accountState *state.Account, _ ...protocol.StateOption) {

@@ -601,6 +601,7 @@ func (bc *blockchain) commitBlock(ctx context.Context, blk *block.Block) error {
sfTimer.End()
// detach working set so it can be freed by GC
if err != nil {
//
Copy link
Collaborator

Choose a reason for hiding this comment

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

revert?

@CoderZhi CoderZhi merged commit 411cde2 into iotexproject:master Feb 13, 2020
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.

2 participants