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

go/oasis-node: Add the debug dumpdb command #2921

Merged
merged 4 commits into from
May 21, 2020
Merged

Conversation

Yawning
Copy link
Contributor

@Yawning Yawning commented May 19, 2020

Fixes #2359

  • Add support for making storage backends read-only.
  • Refactor timekeeping so that state queries can happen without an ApplicationState.
  • Write the tool.
  • Write test cases.

@codecov
Copy link

codecov bot commented May 19, 2020

Codecov Report

Merging #2921 into master will increase coverage by 0.02%.
The diff coverage is 63.63%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2921      +/-   ##
==========================================
+ Coverage   68.46%   68.49%   +0.02%     
==========================================
  Files         360      360              
  Lines       34947    34994      +47     
==========================================
+ Hits        23926    23968      +42     
+ Misses       7941     7938       -3     
- Partials     3080     3088       +8     
Impacted Files Coverage Δ
go/consensus/tendermint/abci/mux.go 71.13% <ø> (-0.24%) ⬇️
go/storage/mkvs/db/api/api.go 60.46% <ø> (ø)
go/storage/database/database.go 73.94% <11.11%> (-1.51%) ⬇️
go/storage/mkvs/db/badger/badger.go 70.24% <25.00%> (-0.81%) ⬇️
go/consensus/tendermint/abci/state.go 69.45% <44.82%> (+0.22%) ⬆️
.../consensus/tendermint/apps/epochtime_mock/query.go 81.81% <50.00%> (-18.19%) ⬇️
go/consensus/tendermint/abci/state/state.go 69.23% <100.00%> (+19.23%) ⬆️
go/consensus/tendermint/api/state.go 51.85% <100.00%> (ø)
go/consensus/tendermint/apps/beacon/query.go 81.81% <100.00%> (+4.04%) ⬆️
go/consensus/tendermint/apps/beacon/state/state.go 61.11% <100.00%> (ø)
... and 38 more

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 3d5e7dc...00c0ed3. Read the comment docs.

@Yawning Yawning force-pushed the yawning/feature/2359 branch 8 times, most recently from 86a0fa6 to 3d0a0ce Compare May 20, 2020 15:46
It is safer if tooling can access on-disk state of an offline node in a
way that ensures that writes will be rejected.  This adds support for
doing so by rejecting writes at the API level and by configuring the
backing database to open the DB for read-only access.
The dump tool was duplicating a considerable amount of this, so refactor
it out into a helper to minimize code duplication.
The timekeeping part of this (needed for the registry) will be somewhat
annoying to implement, and it's unfortunate that the ApplicationState is
now split into two interfaces, but I can't think of a better way to do
it, and this shouldn't be that bad even if we add more things.
@Yawning Yawning force-pushed the yawning/feature/2359 branch 4 times, most recently from a3dd9d1 to a550fcc Compare May 21, 2020 12:59
This command will attempt to extract the ABCI state from a combination
of a shutdown node's on-disk database and the genesis document currently
being used by the network, and will write the output as a JSON formatted
genesis document.

Some caveats:

- It is not guaranteed that the dumped output will be usable as an
  actual genesis document without manual intervention.

- Only the state that would be exported via a normal dump from a running
  node will be present in the dump.

- The epochtime base will be that of the original genesis document, and
  not the most recent epoch (different from a genesis dump).
@Yawning Yawning marked this pull request as ready for review May 21, 2020 14:04
@Yawning Yawning merged commit a28a9cd into master May 21, 2020
@Yawning Yawning deleted the yawning/feature/2359 branch May 21, 2020 15:07
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.

oasis-node: Write a tool to extract a state dump from the state db
2 participants