-
Notifications
You must be signed in to change notification settings - Fork 20.3k
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
Legacy receipt converter tool #23454
Closed
Closed
Changes from 29 commits
Commits
Show all changes
32 commits
Select commit
Hold shift + click to select a range
9351cac
core/types: add legacy receipt encoding, conversion test
s1na 6bae0aa
core/types: add convertLegacyStoredReceipt method
s1na 3a3ca13
core/types: encode list of legacy receipts
s1na b250783
core/types: add method checking if receipt is legacy
s1na 45b73a3
cmd/geth: add boilerplate for freezer-migrate cmd
s1na 7474ef0
core/types: add method for converting list of legacy receipts
s1na 39e5aee
cmd/geth: write converted receipts to tmp freezer file
s1na b1c67fd
cmd,core,ethdb: drop receipts table after copying over new receipts
s1na 82f36c9
cmd,core,ethdb: move logic to transform table fn
s1na 05dade6
core/rawdb: remove getFileBounds
s1na dce1336
core/rawdb: copy over rest of index bits
s1na 16c55dc
core/rawdb: drop table append
s1na 710b7d9
core/rawdb: use new freezer funcs
s1na 16286fa
core/rawdb: forgot batch commit
s1na 05812de
core/rawdb: comment, minor fixes
s1na 99c1a32
core/rawdb: handle clean switch-over boundary
s1na 66b5285
core/rawdb: fix off-by-one err
s1na 8092cdd
core/rawdb: add tableFilePath method
s1na 26ec367
cmd,core: rename files after switchover
s1na fd000bc
core/rawdb: fix file juggling
s1na e4028b6
core/rawdb: remove DropTable method
s1na e3b1daa
ethdb: minor
s1na 0d22403
core/rawdb: improve readability
s1na 8466887
core/rawdb: fix initial legacy check
s1na eb306b6
Add start param to migrateTable
s1na 76426e3
check batch append err
s1na 1279bb3
drop start param from migrateTable
s1na 7338e21
add license to legacy file
s1na 63fb341
rm helper funcs and their tests
s1na fa28df5
freezer: rm unneeded line
s1na 6bef481
core, ethdb: add comments
s1na 2b5b633
Merge remote-tracking branch 's1na/legacy-receipt-converter' into leg…
s1na File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -101,6 +101,10 @@ func (t *table) Sync() error { | |
return t.db.Sync() | ||
} | ||
|
||
func (t *table) MigrateTable(kind string, fn TransformerFn) error { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Docstring |
||
return t.db.MigrateTable(kind, fn) | ||
} | ||
|
||
// Put inserts the given value into the database at a prefixed version of the | ||
// provided key. | ||
func (t *table) Put(key []byte, value []byte) error { | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Afaict, this is the last time you make any use of
firstIdx
: the rest of the code starts over from0
and feeds it into thetransformer
. And the transformer will (?) returnstop=true
for the first empty receipt list, so I don't see how this can work?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had to double-check to see why its working :) so an empty receipt list is both legacy and non-legacy and transformer will ask is this legacy? it is so
stop=false
.stop
will be true only for the first non-empty non-legacy receipt listThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So I was planning to pass
firstIdx
toMigrateTable
so we could start from there but we also need to copy over the first empty receipts so I decided to keepMigrateTable
as is and only usefirstIdx
to determine whether the db is in the old format.