-
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
core/types: remove support for legacy receipt/log storage encoding #22852
core/types: remove support for legacy receipt/log storage encoding #22852
Conversation
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.
LGTM, but let's hear what karalabe thinks too
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.
Safe to delete as we introduced the freezer at the same time as the new format and the freezer moved everything reencoding, so nobody should have any old format stuff any more.
Note that this comment is intended only to help guide others who have the same problem, we are not expecting a fix. For anyone who sees the following in their geth console logs with v1.10.4 or later:
Or sees the following error when they attempt to export their chaindata:
What probably happened is that at some point in the past, your geth database (chaindata) got silently corrupted and failed to automatically upgrade to the modern receipt/log storage encoding. With this change (#22852) go-ethereum removes the capability to read these legacy logs. Possible solutions include: |
The encoding of Log and LogForStorage is exactly the same now. After tracking it down it seems like #17106 changed the storage schema of logs to be the same as the consensus encoding. Support for the legacy format was dropped in #22852 and if I'm not wrong there's no reason anymore to have these two equivalent types. Since the RLP encoding simply contains the first three fields of Log, we can also avoid creating a temporary struct for encoding/decoding, and use the rlp:"-" tag in Log instead. Note: this is an API change in core/types. We decided it's OK to make this change because LogForStorage is an implementation detail of go-ethereum and the type has zero uses outside of package core/types. Co-authored-by: Felix Lange <[email protected]>
The encoding of Log and LogForStorage is exactly the same now. After tracking it down it seems like ethereum#17106 changed the storage schema of logs to be the same as the consensus encoding. Support for the legacy format was dropped in ethereum#22852 and if I'm not wrong there's no reason anymore to have these two equivalent types. Since the RLP encoding simply contains the first three fields of Log, we can also avoid creating a temporary struct for encoding/decoding, and use the rlp:"-" tag in Log instead. Note: this is an API change in core/types. We decided it's OK to make this change because LogForStorage is an implementation detail of go-ethereum and the type has zero uses outside of package core/types. Co-authored-by: Felix Lange <[email protected]>
@shoenseiwaso not sure you are still around. Are you willing to recompile the geth with these diffs? I am curious why it's failed. Since we have the freezer to re-encode the legacy receipts. No legacy format receipts should be left. diff --git a/core/rawdb/accessors_chain.go b/core/rawdb/accessors_chain.go
index 76132bf37..871ab0b64 100644
--- a/core/rawdb/accessors_chain.go
+++ b/core/rawdb/accessors_chain.go
@@ -572,7 +572,7 @@ func ReadRawReceipts(db ethdb.Reader, hash common.Hash, number uint64) types.Rec
// Convert the receipts from their storage form to their internal representation
storageReceipts := []*types.ReceiptForStorage{}
if err := rlp.DecodeBytes(data, &storageReceipts); err != nil {
- log.Error("Invalid receipt array RLP", "hash", hash, "err", err)
+ log.Error("Invalid receipt array RLP", "number", number, "hash", hash.Hex(), "err", err)
return nil
}
receipts := make(types.Receipts, len(storageReceipts)) |
Let's discuss at #23245 |
…oding (ethereum#22852)" This reverts commit 643fd0e.
* Revert "core/types: go generate (ethereum#23177)" This reverts commit 00b922f. * Revert "core/types: remove LogForStorage type (ethereum#23173)" This reverts commit 7522642. * Revert "core/types: remove support for legacy receipt/log storage encoding (ethereum#22852)" This reverts commit 643fd0e.
…thereum#22852) * core/types: remove support for legacy receipt storage encoding * core/types: remove support for legacy log storage encoding
The encoding of Log and LogForStorage is exactly the same now. After tracking it down it seems like ethereum#17106 changed the storage schema of logs to be the same as the consensus encoding. Support for the legacy format was dropped in ethereum#22852 and if I'm not wrong there's no reason anymore to have these two equivalent types. Since the RLP encoding simply contains the first three fields of Log, we can also avoid creating a temporary struct for encoding/decoding, and use the rlp:"-" tag in Log instead. Note: this is an API change in core/types. We decided it's OK to make this change because LogForStorage is an implementation detail of go-ethereum and the type has zero uses outside of package core/types. Co-authored-by: Felix Lange <[email protected]>
* Revert "core/types: go generate (ethereum#23177)" This reverts commit 00b922f. * Revert "core/types: remove LogForStorage type (ethereum#23173)" This reverts commit 7522642. * Revert "core/types: remove support for legacy receipt/log storage encoding (ethereum#22852)" This reverts commit 643fd0e.
This PR drops the legacy receipt types, the freezer-migrate command and the startup check. The previous attempt #22852 at this failed because there were users who still had legacy receipts in their db, so it had to be reverted #23247. Since then we added a command to migrate legacy dbs #24028. As of the last hardforks all users either must have done the migration, or used the --ignore-legacy-receipts flag which will stop working now.
This PR drops the legacy receipt types, the freezer-migrate command and the startup check. The previous attempt ethereum#22852 at this failed because there were users who still had legacy receipts in their db, so it had to be reverted ethereum#23247. Since then we added a command to migrate legacy dbs ethereum#24028. As of the last hardforks all users either must have done the migration, or used the --ignore-legacy-receipts flag which will stop working now.
This removes the database upgrade path for receipts and logs stored before April 2019.