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

Allow pruning to multiple targets, including without snapshots #186

Merged
merged 20 commits into from
Apr 13, 2023
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
96bbca5
Fix pruning with an arbitrary target root
PlasmaPower Dec 7, 2022
1e3c069
Merge branch 'master' into arbitrary-prune-point
PlasmaPower Dec 14, 2022
e403d14
Support pruning to multiple state roots
PlasmaPower Dec 14, 2022
52ddf7f
Free lastSnaptree early
PlasmaPower Dec 15, 2022
fb81ff4
Fix missing headSnaptree calculation
PlasmaPower Dec 15, 2022
54c3ca9
Re-fix calling Cap on a disk layer snapshot
PlasmaPower Dec 15, 2022
6e60560
Add support for non-snapshot based pruning
PlasmaPower Dec 15, 2022
5fcf71b
Fix missing genesis state case
PlasmaPower Dec 15, 2022
197331f
Address remaining TODOs
PlasmaPower Dec 22, 2022
1e780fd
Improve removeOtherRoots
PlasmaPower Dec 22, 2022
ae27026
Fix waiting for error and improve logging
PlasmaPower Dec 22, 2022
bc1b10b
Only traverse storage trie if storage is non-empty
PlasmaPower Dec 23, 2022
3da051a
Add log message when done removing old state roots
PlasmaPower Dec 24, 2022
43e8c2f
Store bloom filter roots in the file content
PlasmaPower Dec 28, 2022
5521226
Fix reading in a state bloom from file
PlasmaPower Dec 29, 2022
2dfaad1
Merge pull request #189 from OffchainLabs/bloom-file-roots
PlasmaPower Dec 29, 2022
f9db2af
Merge branch 'master' into arbitrary-prune-point
PlasmaPower Jan 11, 2023
080c490
Merge branch 'master' into arbitrary-prune-point
PlasmaPower Jan 26, 2023
2ed3220
Merge branch 'master' into arbitrary-prune-point
PlasmaPower Mar 30, 2023
7ba1099
Merge branch 'master' into arbitrary-prune-point
PlasmaPower Apr 13, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions cmd/geth/snapshot.go
Original file line number Diff line number Diff line change
Expand Up @@ -179,15 +179,16 @@ func pruneState(ctx *cli.Context) error {
log.Error("Too many arguments given")
return errors.New("too many arguments")
}
var targetRoot common.Hash
var targetRoots []common.Hash
if ctx.NArg() == 1 {
targetRoot, err = parseRoot(ctx.Args().First())
root, err := parseRoot(ctx.Args().First())
if err != nil {
log.Error("Failed to resolve state root", "err", err)
return err
}
targetRoots = append(targetRoots, root)
}
if err = pruner.Prune(targetRoot); err != nil {
if err = pruner.Prune(targetRoots); err != nil {
log.Error("Failed to prune state", "err", err)
return err
}
Expand Down
7 changes: 7 additions & 0 deletions core/blockchain.go
Original file line number Diff line number Diff line change
Expand Up @@ -647,6 +647,13 @@ func (bc *BlockChain) setHeadBeyondRoot(head uint64, root common.Hash, repair bo
// if the historical chain pruning is enabled. In that case the logic
// needs to be improved here.
if !bc.HasState(bc.genesisBlock.Root()) {
// Arbitrum: we have a later block with state; use that instead.
if lastFullBlock != 0 {
blockNumber = lastFullBlock
newHeadBlock = bc.GetBlock(lastFullBlockHash, lastFullBlock)
log.Debug("Rewound to block with state but not snapshot", "number", newHeadBlock.NumberU64(), "hash", newHeadBlock.Hash())
break
}
if err := CommitGenesisState(bc.db, bc.genesisBlock.Hash()); err != nil {
log.Crit("Failed to commit genesis state", "err", err)
}
Expand Down
Loading