-
Notifications
You must be signed in to change notification settings - Fork 20.4k
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
[BUG][Clique] Database has receipts with a legacy format on fresh node, cannot restart node #25498
Comments
Might be related to #24724 |
Can you please re-compile with this patch and see if it still halts on start? @karalabe pointed out an issue in the legacy detection function: if there are no non-empty receipts in the freezer, the detection gives a false positive. Which we think might be your case. Or did you have receipts in the first 30k (or even 60k) blocks? diff --git a/cmd/geth/config.go b/cmd/geth/config.go
index 2562de8ae..519868de8 100644
--- a/cmd/geth/config.go
+++ b/cmd/geth/config.go
@@ -173,12 +173,13 @@ func makeFullNode(ctx *cli.Context) (*node.Node, ethapi.Backend) {
if cfg.Eth.NetworkId == 1 && ghash == params.MainnetGenesisHash {
firstIdx = 46147
}
- isLegacy, _, err := dbHasLegacyReceipts(eth.ChainDb(), firstIdx)
+ isLegacy, firstLegacy, err := dbHasLegacyReceipts(eth.ChainDb(), firstIdx)
if err != nil {
log.Error("Failed to check db for legacy receipts", "err", err)
} else if isLegacy {
stack.Close()
- utils.Fatalf("Database has receipts with a legacy format. Please run `geth db freezer-migrate`.")
+ log.Error("Database has receipts with a legacy format", "firstLegacy", firstLegacy)
+ utils.Fatalf("Aborting. Please run `geth db freezer-migrate`.")
}
}
// Configure GraphQL if requested
diff --git a/cmd/geth/dbcmd.go b/cmd/geth/dbcmd.go
index ab7427712..bb53a632e 100644
--- a/cmd/geth/dbcmd.go
+++ b/cmd/geth/dbcmd.go
@@ -822,11 +822,15 @@ func dbHasLegacyReceipts(db ethdb.Database, firstIdx uint64) (bool, uint64, erro
}
}
}
- // Is first non-empty receipt legacy?
first, err := db.Ancient("receipts", firstIdx)
if err != nil {
return false, 0, err
}
+ // We looped over all receipts and they were all empty
+ if bytes.Equal(first, emptyRLPList) {
+ return false, 0, nil
+ }
+ // Is first non-empty receipt legacy?
legacy, err = types.IsLegacyStoredReceipts(first)
return legacy, firstIdx, err
} |
Sure, I will do this later today. And yes, in first 30k blocks I dont think I have any receipts, I usually spin up private network and let it sit for few days to ensure it's set up correctly and works. |
Sorry for late reply. The patch seems to make node run correctly, I can include logs but there is nothing unusal after the patch. |
@s1na did you ever PR that patch? |
Since @s1na provided working patch, I wouldn't want this issue to get forgotten as fix is already known. Is there any way I could help to push this forward? |
System information
Debian 11 server (CPX21 @ hetzner)
Geth
Version: 1.10.21-stable
Git Commit: 6710942
Git Commit Date: 20220727
Architecture: amd64
Go Version: go1.18.4
Operating System: linux
Node type: Archive
Context
I set up private clique PoA chain, it works until first geth shutdown (I tested this on my archive node, not brave enough to try to shut down my sealer to check if it would die too).
The node the issue apeared on is Archive node.
Expected behaviour
After node clean shut down, the node should be able to stand back up
Actual behaviour
After node clean shutdown, upon restart node complains it's transaction receipts are in legacy format. Running suggested command does not change behaviour.
Steps to reproduce the behaviour
archive
databaseBacktrace
Logs (complete since working node -> broken node -> attempted to use migrate command -> still broken)
`genesis.json`
I can provide
configuration.toml
file that I use to run geth, if requestedEdit: I found out about
--ignore-legacy-receipts
(thank you for having these things in commit names / descriptions, really helpfull!) that works around the issue. Issue is still valid though, these receipts shouldn't be written to the database in the first place (entire chain was bootstrapped with geth 1.10.21)The text was updated successfully, but these errors were encountered: