Skip to content
This repository has been archived by the owner on Nov 30, 2021. It is now read-only.

fix csdb index error #493

Merged
merged 4 commits into from
Sep 1, 2020
Merged

fix csdb index error #493

merged 4 commits into from
Sep 1, 2020

Conversation

noot
Copy link
Contributor

@noot noot commented Sep 1, 2020

Closes: #491

Description


For contributor use:

  • 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

For admin use:

  • Added appropriate labels to PR (ex. WIP, R4R, docs, etc)
  • Reviewers assigned
  • Squashed all commits, uses message "Merge pull request #XYZ: [title]" (coding standards)

@codecov
Copy link

codecov bot commented Sep 1, 2020

Codecov Report

Merging #493 into evm-params will decrease coverage by 0.17%.
The diff coverage is 73.33%.

Impacted file tree graph

@@              Coverage Diff               @@
##           evm-params     #493      +/-   ##
==============================================
- Coverage       71.33%   71.15%   -0.18%     
==============================================
  Files              40       40              
  Lines            2637     2638       +1     
==============================================
- Hits             1881     1877       -4     
- Misses            621      625       +4     
- Partials          135      136       +1     
Impacted Files Coverage Δ
x/evm/types/statedb.go 88.44% <73.33%> (-1.32%) ⬇️

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 64957ac...7941280. Read the comment docs.

}
}

// Above, we don't copy the actual journal. This means that if the copy is
// copied, the loop above will be a no-op, since the copy's journal is empty.
// Thus, here we iterate over stateObjects, to enable copies of copies.
for addr := range csdb.stateObjectsDirty {
if idx, exist := state.addressToObjectIndex[addr]; !exist {
if idx, exist := state.addressToObjectIndex[addr]; exist {
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this should be !exist?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think so but we are using idx in the line right after, which is bad if it doesn't exist

Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

i see, will update!

state.stateObjectsDirty[dirty.address] = struct{}{}
})
delete(state.stateObjectsDirty, dirty.address)
state.addressToObjectIndex[dirty.address] = len(state.stateObjects) - 1
Copy link
Contributor

Choose a reason for hiding this comment

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

this is the fix, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

unfortunately not, the fix seemed to be idx < len(csdb.stateObjects) inside getStateObject and setStateObject which I don't really like...

@noot noot requested a review from fedekunze September 1, 2020 21:15
@noot noot marked this pull request as ready for review September 1, 2020 21:24
@noot noot self-assigned this Sep 1, 2020
Copy link
Contributor

@fedekunze fedekunze left a comment

Choose a reason for hiding this comment

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

utACK. Will look into the other test failures tomorrow

@fedekunze fedekunze merged commit 8fa07a8 into evm-params Sep 1, 2020
@fedekunze fedekunze deleted the noot/csdb-fix branch September 1, 2020 21:36
fedekunze added a commit that referenced this pull request Sep 2, 2020
* evm: params

* setup

* bump commit

* fixes

* increase gas usage

* tests

* evm denom param

* more config updates

* update genesis

* update ante handler

* csdb param test

* more tests and fixes

* update statedb.Copy

* lint

* additional test

* fix importer tests

* fix AnteHandler test

* minor update

* revert

* undo gas update

* stringer test

* changelog

* fix csdb index error (#493)

* attempt to fix

* cleanup

* add idx check

* update csdb.Copy

* update default hash

* update querier

* update rpc tests

* fix estimate gas test

Co-authored-by: noot <36753753+noot@users.noreply.github.com>
Co-authored-by: noot <elizabethjbinks@gmail.com>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants