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

Enable ancient block pruning #1216

Merged
merged 60 commits into from
May 9, 2024
Merged
Changes from 1 commit
Commits
Show all changes
60 commits
Select commit Hold shift + click to select a range
c9ef24f
core/state: typo
jsvisa Feb 10, 2023
a4b592c
core/rawdb: backport from https://github.com/bnb-chain/bsc/pull/543
jsvisa Feb 17, 2023
8c35ece
eth,ethdb,node,core/state: backport from https://github.com/bnb-chain…
jsvisa Feb 17, 2023
2b8ca73
eth,core: backport from https://github.com/bnb-chain/bsc/pull/543
jsvisa Feb 17, 2023
4b96e5c
cmd: open db with freeze disabled
jsvisa Feb 17, 2023
4e25407
cli: snapshot prune-block
jsvisa Feb 17, 2023
8bd357f
fix typo
jsvisa Feb 20, 2023
b34d1a5
cli/snapshot: fix the issue of dup open db error
jsvisa Feb 20, 2023
b5f9741
cli/snapshot: resolve datadir and ancient before backup
jsvisa Feb 20, 2023
b4ad6c0
core: more prune-block log
jsvisa Feb 20, 2023
cf25261
core: truncatetail missing f.offset
jsvisa Feb 20, 2023
7397e5a
core/rawdb: indextx adjust offset of pruned block
jsvisa Feb 20, 2023
f7833b7
core/rawdb: freezer batch should implement the offset commit, ref htt…
jsvisa Feb 21, 2023
786c95c
core: check of ancientdb, backport https://github.com/bnb-chain/bsc/p…
jsvisa Feb 21, 2023
ec275a9
core/state: read raw borReceipt to backup
jsvisa Feb 23, 2023
afdeeec
core/rawdb: bor receipt maybe in []Receipt or Receipt RLP format
jsvisa Mar 1, 2023
f91030b
core/state: typo and error msg
jsvisa Mar 1, 2023
727656c
core/rawdb: offSet -> offset
jsvisa Mar 1, 2023
13292b0
cli/snapshot: comment
jsvisa Mar 1, 2023
59e6752
cli/snapshot: add prune-block doc
jsvisa Mar 1, 2023
1b0abf0
docs: add prune-block document
jsvisa Mar 1, 2023
f9ae714
core/rawdb: print wrong bor-receipt length
jsvisa Mar 1, 2023
a3ed4ea
internal/cli: add snapshot prune block tests (referenced from bsc's PR)
manav2401 May 13, 2023
c314ed8
improve errors
manav2401 May 15, 2023
383508a
Merge branch 'develop' into block-pruner
manav2401 May 15, 2023
98c020c
cmd, core, eth, internal: fix lint
manav2401 May 15, 2023
3d71ce5
internal/cli: refactor snapshot prune block test
manav2401 May 16, 2023
f195feb
fix linters in tests
manav2401 May 16, 2023
7104f95
internal/cli: add inspect-ancient-db command, update docs
manav2401 May 17, 2023
54d5a5e
pruner: use a generic function for simplification
manav2401 May 19, 2023
98149be
internal/cli: fixes for inspect-db command
manav2401 May 19, 2023
7c0baba
internal/cli: improve pruning tests
manav2401 May 19, 2023
6276de6
core/rawdb: update end block calculation logic in inspect command
manav2401 May 21, 2023
e21c500
core/rawdb: improve checks db initialisation
manav2401 May 21, 2023
35a95b2
core/rawdb: remove offset check
manav2401 May 21, 2023
495e5cc
update mocks for span, ethdb and add command in makefile
manav2401 May 22, 2023
eda6bac
Merge branch 'develop' into block-pruner
manav2401 May 23, 2023
25a775b
docs/cli: update docs with inspect command
manav2401 May 23, 2023
8cc56a4
Merge branch 'develop' into block-pruner
manav2401 Jun 8, 2023
e813a95
Merge branch 'develop' into block-pruner
manav2401 Jun 20, 2023
7082cb9
Merge remote-tracking branch 'origin/develop' into HEAD
manav2401 Apr 10, 2024
b39c7ba
go mod tidy
manav2401 Apr 11, 2024
afc10b6
refactor and resolve conflicts
manav2401 Apr 11, 2024
b35fea7
resolve more conflicts
manav2401 Apr 14, 2024
968a348
refactor
manav2401 Apr 14, 2024
8dbde87
explicitly read node for hash scheme
manav2401 Apr 14, 2024
ac681be
add check for hash scheme, fix tests
manav2401 Apr 14, 2024
34933fb
Merge branch 'develop' into manav/ancient-pruner-test-1
manav2401 Apr 14, 2024
99f684f
fix typo
manav2401 Apr 14, 2024
a6aa79a
update docs and add warning
manav2401 Apr 15, 2024
0f1b9e2
raise error if pbss is enabled
manav2401 Apr 16, 2024
aba6091
revert read raw bor receipt change
manav2401 Apr 16, 2024
15c806e
consensus/bor: handle nil header case in get root hash
manav2401 Apr 22, 2024
0c49dfc
address comments
manav2401 Apr 22, 2024
3c38710
core/rawdb: check chain continuity by matching parent hash
manav2401 Apr 23, 2024
8e4b0bd
core/rawdb: account for pruned ancient blocks
manav2401 Apr 23, 2024
fbc283c
Merge branch 'develop' into manav/ancient-pruner-test-1
manav2401 May 8, 2024
dbe3449
go mod tidy
manav2401 May 8, 2024
55b5357
fix tests
manav2401 May 8, 2024
d098c59
fix tests
manav2401 May 8, 2024
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
Prev Previous commit
Next Next commit
explicitly read node for hash scheme
manav2401 committed Apr 14, 2024

Unverified

This user has not yet uploaded their public signing key.
commit 8dbde87d6dc9774abeaa69d4deb2084197ebe6d0
6 changes: 3 additions & 3 deletions internal/cli/snapshot.go
Original file line number Diff line number Diff line change
@@ -389,7 +389,7 @@ func (c *PruneBlockCommand) accessDb(stack *node.Node, dbHandles int) error {
// Ensure the root is really present. The weak assumption
// is the presence of root can indicate the presence of the
// entire trie.
if blob := rawdb.ReadTrieNode(chaindb, targetRoot); len(blob) == 0 {
if blob := rawdb.ReadTrieNode(chaindb, common.Hash{}, nil, targetRoot, rawdb.HashScheme); len(blob) == 0 {
// The special case is for clique based networks(rinkeby, goerli
// and some other private networks), it's possible that two
// consecutive blocks will have same root. In this case snapshot
@@ -402,14 +402,14 @@ func (c *PruneBlockCommand) accessDb(stack *node.Node, dbHandles int) error {
// state available, but we don't want to use the topmost state
// as the pruning target.
for i := len(layers) - 2; i >= 1; i-- {
if blob := rawdb.ReadTrieNode(chaindb, layers[i].Root()); len(blob) != 0 {
if blob := rawdb.ReadTrieNode(chaindb, common.Hash{}, nil, layers[i].Root(), rawdb.HashScheme); len(blob) != 0 {
targetRoot = layers[i].Root()
log.Info("Selecting middle-layer as the pruning target", "root", targetRoot, "depth", i)
return nil
}
}

if blob := rawdb.ReadTrieNode(chaindb, snaptree.DiskRoot()); len(blob) != 0 {
if blob := rawdb.ReadTrieNode(chaindb, common.Hash{}, nil, snaptree.DiskRoot(), rawdb.HashScheme); len(blob) != 0 {
targetRoot = snaptree.DiskRoot()
log.Info("Selecting disk-layer as the pruning target", "root", targetRoot)
return nil