Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Cherry-pick upstream snapshot commits to 1.3.x (#1533)
* core/state/snapshot: fix binary iterator (#20970) * core/state/snapshot: implement storage iterator (#20971) * core/state/snapshot: implement storage iterator * core/state/snapshot, tests: implement helper function * core/state/snapshot: fix storage issue If an account is deleted in the tx_1 but recreated in the tx_2, the it can happen that in this diff layer, both destructedSet and storageData records this account. In this case, the storage iterator should be able to iterate the slots belong to new account but disable further iteration in deeper layers(belong to old account) * core/state/snapshot: address peter and martin's comment * core/state: address comments * core/state/snapshot: fix test * core/state/snapshot: fix journal nil deserialziation * core/state/snapshot: fix trie generator reporter (#21004) # Conflicts: # go.sum * tests: cleanup snapshot generator goroutine leak * core/state/snapshot: release iterator after verification * core/state/snapshot: don't create storage list for non-existing accounts * core/state/snapshot: fix typo (#21037) * cmd/utils: grant snapshot cache to trie if disabled (#21416) * cmd/utils: grant snapshot cache to trie if disabled * eth: fix up default non-mainnet cache distribution Conflicts: eth/config.go * Fix default DatabaseCache value. In the PR #18087 (https://github.com/ethereum/go-ethereum/pull/18087/files), the trie cached was splited between Clean and Dirty. As the cache was suppose to be 1gb, and the Dirty cache was assigned using part of the DatabaseCache, it means that the DatabaseCache should be updated too, to validate that all the sum of the caches are still 1gb. This was missed in an early merge, and fixed here. * core/state/snapshot: reduce disk layer depth during generation * core/state/snapshot: stop generator if it hits missing trie nodes (#21649) * core/state/snapshot: exit Geth if generator hits missing trie nodes * core/state/snapshot: error instead of hard die on generator fault * core/state/snapshot: don't enable logging on the tests * core/state: disable snapshot iteration if it's not fully constructed (#21682) * core/state/snapshot: add diskRoot function * core/state/snapshot: disable iteration if the snapshot is generating * core/state/snapshot: simplify the function * core/state: panic for undefined layer * Fix imports of snapshot/generate_test * Fix tests from core/state/snapshot/generate_test The trie.database.Commit accepts 3 parameters now, but the commit that adds the change, was not cherrypicked * core: improve snapshot journal recovery (#21594) * core/state/snapshot: introduce snapshot journal version * core: update the disk layer in an atomic way * core: persist the disk layer generator periodically * core/state/snapshot: improve logging * core/state/snapshot: forcibly ensure the legacy snapshot is matched * core/state/snapshot: add debug logs * core, tests: fix tests and special recovery case * core: polish * core: add more blockchain tests for snapshot recovery * core/state: fix comment * core: add recovery flag for snapshot * core: add restart after start-after-crash tests * core/rawdb: fix imports * core: fix tests * core: remove log * core/state/snapshot: fix snapshot * core: avoid callbacks in SetHead * core: fix setHead cornercase where the threshold root has state * core: small docs for the test cases Co-authored-by: Péter Szilágyi <[email protected]> Conflicts: core/blockchain.go core/blockchain_repair_test.go core/blockchain_sethead_test.go core/rawdb/accessors_snapshot.go core/state/snapshot/disklayer_test.go core/state/snapshot/snapshot.go * core/state/snapshot: fix journal recovery from generating old journal (#21775) * core/state/snapshot: print warning if failed to resolve journal * core/state/snapshot: fix snapshot recovery When we meet the snapshot journal consisted with: - disk layer generator with new-format - diff layer journal with old-format The base layer should be returned without error. The broken diff layer can be reconstructed later but we definitely don't want to reconstruct the huge diff layer. * core: add tests * core/state/snapshot: update generator marker in sync with flushes * core/state/snapshot: gethring -> gathering typo (#22104) * snapshot, trie: fixed typos, mostly in snapshot pkg (#22133) Conflicts: trie/database.go * core/state/snapshot: add generation logs to storage too * core/state/snapshot: write snapshot generator in batch (#22163) * core/state/snapshot: write snapshot generator in batch * core: refactor the tests * core: update tests * core: update tests Conflicts: core/blockchain_snapshot_test.go * core/state: maintain one more diff layer (#21730) * core/state: maintain one more diff layer * core/state: address comment * snapshot: merge loops for better performance (#22160) * cmd/utils: enable snapshots by default Conflicts: cmd/utils/flags.go * core/state/snapshot: ensure Cap retains a min number of layers Conflicts: core/state/snapshot/snapshot_test.go * core/state: copy the snap when copying the state (#22340) * core/state: copy the snap when copying the state * core/state: deep-copy snap stuff during state Copy Conflicts: core/state/statedb.go * core/state/snapshot: fix panic on missing parent * core/state/snapshot, ethdb: track deletions more accurately (#22582) * core/state/snapshot, ethdb: track deletions more accurately * core/state/snapshot: don't reset the iterator, leveldb's screwy * ethdb: don't mess with the insert batches for now * core/state/snapshot: fix data race in diff layer (#22540) * Fix lint and fix cherrypicked test * Fix NewBlockChain in tests (commit that adds a param, not ch-p) * Fix test * Remove 'brew update' from ios build in CI (#1531) We previously added brew update in #1503, but it's no longer necessary and gives a different error now, so this removes it. * Fix indeterministic test TestReorgSideEvent. This has already been done on master in commit cae0c99. Here we apply part of that commit to fix this test being indeterministic. Co-authored-by: gary rong <[email protected]> Co-authored-by: Péter Szilágyi <[email protected]> Co-authored-by: Melvin Junhee Woo <[email protected]> Co-authored-by: Martin Holst Swende <[email protected]> Co-authored-by: Edgar Aroutiounian <[email protected]> Co-authored-by: Or Neeman <[email protected]>
- Loading branch information