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

draft release v1.3.1 #1928

Merged
merged 25 commits into from
Nov 9, 2023
Merged

draft release v1.3.1 #1928

merged 25 commits into from
Nov 9, 2023

Conversation

brilliant-lx
Copy link
Collaborator

@brilliant-lx brilliant-lx commented Oct 18, 2023

Description

Release v1.3.1 is another maintenance release, it mainly has these changes:

  • 1.Support PBSS
  • 2.Performance Improvement, it reduced the validation cost dramatically.
  • 3.Dependency upgrade, especially upgrade Golang from v1.19 to v1.20 and several other dependencies.

About PBSS

PBSS stands for: Path-Based-Storage-Scheme, which is used to optimize the MPT trie tree access, to improve its efficiency and also brings the inline state prune. You could refer this post on how it works: Geth Path-Based Storage Model and Newly Inline State Prune

Currently, PBSS is disabled by default, use this new flag to enable it: --state.scheme path
Important
Before use PBSS, you need to make sure your MPT storage in levelDB are already in PBSS format. There are 2 options to get the PBSS storage:

  • 1.Full sync from genesis with the flag: --state.scheme path. // Not recommend, could take 3 months to catch up the latest block.
  • 2.Use the converting tool, refer: cmd/geth: add hbss to pbss convert tool #1882. // Recommend, could take ~3 days to complete the MPT convert from HashBased to PBSS.

Another thing worth to note is that in the high-pressure situation of the BSC validator scenario, the nodebuffer disk writing of PBSS will become a performance bottleneck. We have optimized this and made the disk writing operation become asynchronous in the background by using asynnodebuffer.

Change Log

FEATURE

  • #1881 feat: active pbss
  • #1882 cmd/geth: add hbss to pbss convert tool
  • #1916 feat: cherry-pick pbss patch commits from eth repo in v1.13.2
  • #1939 dependency: go version to 1.20 and some dependencies in go.mod
  • #1955 eth, trie/triedb/pathdb: pbss patches
  • #1962 cherry pick pbss patches from go-ethereum

BUGFIX

  • #1923 consensus/parlia: fix nextForkHash in Extra filed of block header
  • #1950 fix: 2 APIs of get receipt related
  • #1951 txpool: fix a potential crash issue in shutdown;
  • #1963 fix: revert trie commited flag after delete statedb mpt cache

IMPROVEMENT

  • #1948 performance: commitTire concurrently
  • #1949 code: remove accountTrieCache and storageTrieCache
  • #1954 trie: keep trie prefetch during validation phase

Example

NA

Compatibility

PBSS will have a new MPT storage scheme, although it is still based the Key/Value database, like LevelDB. HashBased storage could not use PBSS and vice versa.

brilliant-lx and others added 12 commits October 13, 2023 10:01
branch: merge v1.3.0 fix ups from master to develop
This changes implements faster post-selfdestruct iteration of storage slots for deletion, by using snapshot-storage+stacktrie to recover the trienodes to be deleted. This mechanism is only implemented for path-based schema.

For hash-based schema, the entire post-selfdestruct storage iteration is skipped, with this change, since hash-based does not actually perform deletion anyway.

---------

Co-authored-by: Martin Holst Swende <martin@swende.se>
Avoid truncating files, if ancients are opened in readonly mode. With this change, we return error instead of trying (and failing)  to repair
…(#28163)

* trie: remove internal nodes between shortNode and child in path mode

* trie: address comments

* core/rawdb, trie: address comments

* core/rawdb: delete unused func

* trie: change comments

* trie: add missing tests

* trie: fix lint
@brilliant-lx brilliant-lx changed the title Develop WIP: draft release v1.3.1 Oct 18, 2023
@brilliant-lx brilliant-lx marked this pull request as draft October 18, 2023 02:30
@brilliant-lx brilliant-lx changed the title WIP: draft release v1.3.1 draft release v1.3.1 Oct 18, 2023
@brilliant-lx brilliant-lx marked this pull request as ready for review October 18, 2023 03:32
* go.mod: upgrade prysm and the indrect dependency
prysm from v4.0.2 to v4.0.8, and run go mod tidy

* ci: upgrade go version from 1.19 to 1.20
* go-version: upgrade from v1.19 to v1.20
there is some dependency on go v1.20, such as go-libp2p v0.27.8
and also run go mod tidy

* dependency: upgrade docker version for security
it is not a big issue, since docker is only used for test purpose.

* rand: update the usage of math/rand after golang v1.20

2 APIs of math/rand module were deprecated since golang v1.20.
that is: rand.Seed() and rand.Read(), refer: ettps://pkg.go.dev/math/rand

"rand.Seed(seed int64)" has been replaced by: "r := rand.New(rand.NewSource(seed int64))",
need to initialize it with an instance before use

"rand.Read()" has been replaced by "crypto/rand.Read()"

* readme: need golang v1.20+ to build bsc
@brilliant-lx brilliant-lx marked this pull request as draft October 25, 2023 01:59
@brilliant-lx
Copy link
Collaborator Author

replaced by: #1941

brilliant-lx and others added 9 commits October 27, 2023 08:55
accountTrieCache and storageTrieCache were introduced in this PR:
#257, which is to improve performance.
Actually the performance gain is quite limited, as there is already dirty
and clean cache for trie node.
And after big merge, these 2 cache can not be used when PBSS is enabled.
So remove these code to simplify the logic.
* fix: GetTransactionReceiptsByBlockNumber &  GetTransactionDataAndReceipt
trie/triedb/pathdb: add tests

trie/triedb/pathdb: address comment
cherry pick pbss patches from go-ethereum
* fix: use the top root hash for rewinding under path schema

* feat: add async flush nodebuffer in path schema

* chore: add prun-block param suffix check

* fix: code review comments
@brilliant-lx brilliant-lx reopened this Nov 7, 2023
@brilliant-lx brilliant-lx marked this pull request as ready for review November 9, 2023 05:44
@joeylichang
Copy link
Contributor

It is necessary to add a description of PBSS optimization. In the high-pressure situation of the BSC validator scenario, the nodebuffer disk writing of PBSS will become a performance bottleneck. We have optimized this and made the disk writing operation become asynchronous in the background by using asynnodebuffer.

Copy link

@RenRick RenRick left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@brilliant-lx brilliant-lx merged commit 1dca486 into master Nov 9, 2023
9 of 10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.