Skip to content
This repository was archived by the owner on Apr 11, 2021. It is now read-only.

StateDiff over Sqlite3#128

Merged
tynes merged 10 commits intofraudproof-apifrom
sqlite3
Dec 3, 2020
Merged

StateDiff over Sqlite3#128
tynes merged 10 commits intofraudproof-apifrom
sqlite3

Conversation

@gakonst
Copy link
Copy Markdown
Contributor

@gakonst gakonst commented Dec 1, 2020

Replaces the in-memory map from #118 with Sqlite3. The db is stored under chaindata/diffdb. It stored data in memory and writes to the db / flushes memory every N calls, set by a CLI param which defaults to 256.

@gakonst gakonst marked this pull request as ready for review December 1, 2020 13:55
@gakonst gakonst changed the base branch from fraudproof-api to master December 1, 2020 13:56
@gakonst gakonst changed the base branch from master to fraudproof-api December 1, 2020 14:00
@gakonst gakonst changed the base branch from fraudproof-api to master December 1, 2020 15:04
@gakonst gakonst changed the base branch from master to fraudproof-api December 1, 2020 18:53
@gakonst gakonst requested review from K-Ho and tynes and removed request for tynes December 1, 2020 18:53
Comment thread cmd/utils/flags.go
Comment thread core/vm/ovm_state_manager_test.go Outdated
Comment thread diffdb/db_test.go Outdated
Copy link
Copy Markdown
Collaborator

@tynes tynes left a comment

Choose a reason for hiding this comment

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

Looks good to me, merging into fraudproof-api

@tynes tynes merged commit d5f40e1 into fraudproof-api Dec 3, 2020
@gakonst gakonst deleted the sqlite3 branch December 3, 2020 20:02
gakonst added a commit that referenced this pull request Dec 10, 2020
* feat(diffdb): switch to sqlite3

* perf(diffdb): use db txs to write less often

* test(ovm-state-manager): cleanup diff db each time

* fix(core): intiialize diff db with 256 item cache

* ci: fix import order

* fix(blockchain): close the diff db handler

* feat(cmd): add CLI params for db cache size

* feat(backend): use chaindata dir

* test(ovm-state-manager): remove globals

* chore: use `defer` in tests for tmp files
gakonst added a commit that referenced this pull request Dec 10, 2020
* feat(diffdb): switch to sqlite3

* perf(diffdb): use db txs to write less often

* test(ovm-state-manager): cleanup diff db each time

* fix(core): intiialize diff db with 256 item cache

* ci: fix import order

* fix(blockchain): close the diff db handler

* feat(cmd): add CLI params for db cache size

* feat(backend): use chaindata dir

* test(ovm-state-manager): remove globals

* chore: use `defer` in tests for tmp files
gakonst added a commit that referenced this pull request Dec 10, 2020
* feat(diffdb): switch to sqlite3

* perf(diffdb): use db txs to write less often

* test(ovm-state-manager): cleanup diff db each time

* fix(core): intiialize diff db with 256 item cache

* ci: fix import order

* fix(blockchain): close the diff db handler

* feat(cmd): add CLI params for db cache size

* feat(backend): use chaindata dir

* test(ovm-state-manager): remove globals

* chore: use `defer` in tests for tmp files
gakonst added a commit that referenced this pull request Dec 11, 2020
* feat(diffdb): switch to sqlite3

* perf(diffdb): use db txs to write less often

* test(ovm-state-manager): cleanup diff db each time

* fix(core): intiialize diff db with 256 item cache

* ci: fix import order

* fix(blockchain): close the diff db handler

* feat(cmd): add CLI params for db cache size

* feat(backend): use chaindata dir

* test(ovm-state-manager): remove globals

* chore: use `defer` in tests for tmp files
tynes pushed a commit that referenced this pull request Dec 14, 2020
* fix: update gomod and gofmt

* feat: initial scaffold for getting data

* feat: hook state manager to diff db

* feat: mvp diffdb with in-memory map

* feat: hook diffdb on NewBlockchain

* fix: use eth.diffdb in the API instead of re-instantiating it

* test(ovm-state-manager): ensure that diffdb is called properly

* test(ovm-state-manager): only update diffdb for non eth_call calls

* fix: handle error if no state diff found

* fix(blockchain): directly call diffdb.GetDiff

* fix(ethapi): export StatediffProof json data

* feat(diffdb): save if a key was mutated or not

* feat(ovm-state-manager): save if a key was mutated

* feat(ethapi): expose if a storage key was mutated or not in the diff

* misc: fmt / lint / fix tests

* fix(ovm-state-manager): use proper log.Error format

* StateDiff over Sqlite3 (#128)

* feat(diffdb): switch to sqlite3

* perf(diffdb): use db txs to write less often

* test(ovm-state-manager): cleanup diff db each time

* fix(core): intiialize diff db with 256 item cache

* ci: fix import order

* fix(blockchain): close the diff db handler

* feat(cmd): add CLI params for db cache size

* feat(backend): use chaindata dir

* test(ovm-state-manager): remove globals

* chore: use `defer` in tests for tmp files

* fix(ovm): set diff keys on rest of state mutating calls

* feat(diffdb): set account diffs at special key

* test: sorted diff equality

Co-authored-by: Karl Floersch <karl@karlfloersch.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