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

[R4R] Upgrade to 1.10.3 #152

Merged
merged 935 commits into from
May 10, 2021
Merged

[R4R] Upgrade to 1.10.3 #152

merged 935 commits into from
May 10, 2021

Conversation

yutianwu
Copy link
Contributor

@yutianwu yutianwu commented Apr 16, 2021

Description

Upgrade to go-ethereum 1.10.3.

Changes

Snapshots

Snapshots are an acceleration data structure on top of the Ethereum state, that allows reading accounts and contract storage significantly faster. The snapshot feature reduces the cost of accessing an account from O(logN) to O(1).

Though snapshots have enormous benefits, there are certain costs to them:
A snapshot is a redundant copy of the raw Ethereum state already contained in the leaves of the Merkle Patricia trie so it requires an additional disk overhead.
Since nobody has snapshots constructed in the network yet, nodes will initially need to bear the cost of iterating the state trie and creating the initial snapshot themselves. This might take a day to a week but you only need to do it once in the lifetime of your node.

Snapshot feature is enabled by default, you can disable it via --snapshot=false.

Snap sync

Now you have two different ways to synchronize the BSC network: full sync and fast sync. Full sync operated by downloading the entire chain and executing all transactions; fast sync placed an initial trust in a recent-ish block, and directly downloaded the state associated with it (after which it switched to block execution like full sync).

For fast sync, it needs to download the trie nodes one by one. So it will take time to download all the nodes if there are millions of nodes. And for the serving peers, they need to traverse all the nodes and it also takes time.

Snap sync is designed to solve the fast sync problems. The core idea is instead of downloading the trie node-by-node, snap sync downloads the contiguous chunks of useful state data, and reconstructs the Merkle trie locally.

You can manually enable snap sync via --syncmode=snap. Note: usually it will need one or two weeks until there is enough client upgrade to the version with snap enabled, you may use snap sync after that.

Offline pruning

If you have snapshots enabled and fully generated, Geth can use those as an acceleration structure to relatively quickly determine which trie nodes should be kept and which should be deleted. Pruning trie nodes based on snapshots does have the drawback that the chain may not progress during pruning. This means that you need to stop Geth, prune its database and then restart it.

Execution time wise, pruning takes a few hours (greatly depends on your disk speed and accumulated junk), one third of which is indexing recent trie nodes from snapshots, one third deleting stale trie nodes and the last third compacting the database to reclaim freed up space. At the end of the process, your disk usage should approximately be the same as if you did a fresh sync.

To prune your database, please run geth snapshot prune-state.

Note: You need to upgrade the client and run for a while before prune the data

Transaction unindexing

Geth no longer keeps transaction inclusion info for all transactions, and instead limits the storage of inclusion records to one year. For application developers, this change means that very old transactions can no longer be accessed by hash.
If you would like todisable this behavior and keep inclusion information for all historical transactions, you can re-enable indexing using the --txlookuplimit=0 command-line flag.

Database changes

There is an incompatible database change: adds a prefix for contract code in order to separate the codes and trie nodes.

So if you use the version of geth, you will not be able to rollback to the older version geth.

Geth command changes

  • --rpc -> --http - Enable the HTTP-RPC server
  • --rpcaddr -> --http.addr - HTTP-RPC server listening interface
  • --rpcport -> --http.port - HTTP-RPC server listening port
  • --rpccorsdomain -> --http.corsdomain - Domain from which to accept requests
  • --rpcvhosts -> --http.vhosts - Virtual hostnames from which to accept requests
  • --rpcapi -> --http.api - API’s offered over the HTTP-RPC interface
  • --wsaddr -> --ws.addr - WS-RPC server listening interface
  • --wsport -> --ws.port - WS-RPC server listening port
  • --wsorigins -> --ws.origins - Origins from which to accept websockets requests
  • --wsapi -> --ws.api - API’s offered over the WS-RPC interface
  • --gpoblocks -> --gpo.blocks - Number of blocks to check for gas prices
  • --gpopercentile -> --gpo.percentile - Percentile of recent txs to use as gas suggestion
  • --graphql.addr -> --graphql - Enable GraphQL on the HTTP-RPC server
  • --graphql.port -> --graphql - Enable GraphQL on the HTTP-RPC server
  • --pprofport -> --pprof.port - Profiler HTTP server listening port
  • --pprofaddr -> --pprof.addr - Profiler HTTP server listening interface
  • --memprofilerate -> --pprof.memprofilerate - Turn on memory profiling with the given rate
  • --blockprofilerate -> --pprof.blockprofilerate - Turn on block profiling with the given rate
  • --cpuprofile -> --pprof.cpuprofile - Write CPU profile to the given file

For more details about the command changes, you can refer to: v1.10.0.

Rpc changes

BREAKING CHANGE: Non-EIP155 transactions (i.e. transactions which are not replay-protected) are now rejected by the RPC API. You can disable this restriction using the --rpc.allow-unprotected-txs command-line flag.
Since there are txs signed by old clients, we need to add this flag for all our nodes.

Response changes in eth_estimateGas, eth_call, eth_sendRawTransaction.

The response will now add a message field in addition to the data field if these RPCs cause the EVM to execute a REVERT operation. For example:

{
   "jsonrpc":"2.0",
   "id":1,
   "error":{
      "code":3,
      "message":"execution reverted: num_ is \u003c= 10",
      "data":"0x08c379a00000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000d6e756d5f206973203c3d20313000000000000000000000000000000000000000"
   }
}

Response changes in eth_getTransactionByBlockHashAndIndex, eth_getTransactionByBlockNumberAndIndex, eth_getTransactionByHash.

The response now adds a type field to denote the transaction type. For example:

{
   "jsonrpc":"2.0",
   "id":1,
   "result":{
      "blockHash":"0x812619b0a7eb58de4f4c4fcf0b497567705f9182c2ad102745fa5ed87b3d96b5",
      "blockNumber":"0x95dc",
      "from":"0xef7368f755f5f551a602971b1f792b2737bc6e16",
      "gas":"0x2dc6c0",
      "gasPrice":"0x430e23400",
      "hash":"0xabbed20a397ff811fddf2b3f559e6291c1d14c6456bd1eca5fde82169e283857",
      "input":"0x29e99f07000000000000000000000000000000000000000000000000000000000000000c",
      "nonce":"0x55731a",
      "to":"0x6ac00c8b5514496aaae72cc2e6b8d4c29ee7d4ba",
      "transactionIndex":"0x0",
      "value":"0x0",
      "type":"0x0",
      "v":"0x1b",
      "r":"0x6e8c8af7e3266f0216b9a796eddd736a4f9bcdbfd6a47c49f566c187174d3268",
      "s":"0x5bf210f56d04126e0864643cb06670abe46fbf935446438490c2ff9ce6921adf"
   }
}

GraphQL changes

The GraphQL API is no longer available separately from the JSON-RPC HTTP server. If you want GraphQL, you need to enable it using the --http --graphql flag combination. The --graphql.port and --graphql.addr flags are no longer available.

Config changes

Remove whisper config.

[Shh]
MaxMessageSize = 1048576
RestrictConnectionBetweenLightClients = true

Remove GraphQL config.

GraphQLPort
GraphQLVirtualHosts

Rename DiscoveryURLs to EthDiscoveryURLs.

For more details about config changes, you can refer to go-ethereum v1.9.19, v1.9.21, v1.10.0

Preflight checks

  • build passed (make build)
  • tests passed (make test)
  • manual transaction test passed

holiman and others added 30 commits February 23, 2021 11:27
This PR introduces:

- db.put to put a value into the database
- db.get to read a value from the database
- db.delete to delete a value from the database
- db.stats to check compaction info from the database
- db.compact to trigger a db compaction

It also moves inspectdb to db.inspect.
This PR prevents users from submitting transactions without EIP-155 enabled. This behaviour can be overridden by specifying the flag --rpc.allow-unprotected-txs=true.
* travis, appveyor, build: bump Go to 1.16

* accounts/abi/bind: fix up Go mod files for Go 1.16
cmd/utils: disable caching preimages by default
travis: bump Android NDK version
This removes support for all deprecated flags except --rpc*.
eth/protocols/snap: lower abortion and resumption logs to debug
This PR adds a more CLI flag, so that the les-server can serve light clients even the local node is not synced yet.

This functionality is needed in some testing environments(e.g. hive). After launching the les server, no more blocks will be imported so the node is always marked as "non-synced".
Transaction unindexing will be enabled by default as of 1.10, which causes tx status retrieval will be broken without this PR. 

This PR introduces a retry mechanism in TxStatus retrieval.
This adds support for EIP-2718 typed transactions as well as EIP-2930
access list transactions (tx type 1). These EIPs are scheduled for the
Berlin fork.

There very few changes to existing APIs in core/types, and several new APIs
to deal with access list transactions. In particular, there are two new
constructor functions for transactions: types.NewTx and types.SignNewTx.
Since the canonical encoding of typed transactions is not RLP-compatible,
Transaction now has new methods for encoding and decoding: MarshalBinary
and UnmarshalBinary.

The existing EIP-155 signer does not support the new transaction types.
All code dealing with transaction signatures should be updated to use the
newer EIP-2930 signer. To make this easier for future updates, we have
added new constructor functions for types.Signer: types.LatestSigner and
types.LatestSignerForChainID. 

This change also adds support for the YoloV3 testnet.

Co-authored-by: Martin Holst Swende <martin@swende.se>
Co-authored-by: Felix Lange <fjl@twurst.com>
Co-authored-by: Ryan Schneider <ryanleeschneider@gmail.com>
Co-authored-by: Martin Holst Swende <martin@swende.se>
* les: move serverPool to les/vflux/client

* les: add metrics

* les: moved ValueTracker inside ServerPool

* les: protect against node registration before server pool is started

* les/vflux/client: fixed tests

* les: make peer registration safe
This makes the WebSocket message size limit independent of the
limit used for HTTP requests. The new limit for WebSocket messages 
is 15MB.
all: define and enable the Berlin hard fork on all networks
This replaces the github.com/pborman/uuid dependency with
github.com/google/uuid because the former is only a wrapper for
the latter (since v1.0.0).

Co-authored-by: Felix Lange <fjl@twurst.com>
This PR implements the first one of the "lespay" UDP queries which
is already useful in itself: the capacity query. The server pool is making
use of this query by doing a cheap UDP query to determine whether it is
worth starting the more expensive TCP connection process.
README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
README.md Show resolved Hide resolved
SECURITY.md Outdated Show resolved Hide resolved
SECURITY.md Outdated Show resolved Hide resolved
@unclezoro
Copy link
Collaborator

Please refine the description of the PR, and also change the version to v1.8.0

@spec42
Copy link

spec42 commented May 9, 2021

Hi, my database is 560G beacause of the bug fixexd in 1.0.7-hf1. Will the prune command be able to shrink this too? Or should i sync from scratch?

@unclezoro unclezoro changed the title [WIP] Upgrade to 1.10.3 [R4R] Upgrade to 1.10.3 May 10, 2021
@unclezoro unclezoro merged commit 032970b into master May 10, 2021
@gituser
Copy link

gituser commented May 11, 2021

Hi, my database is 560G beacause of the bug fixexd in 1.0.7-hf1. Will the prune command be able to shrink this too? Or should i sync from scratch?

will be faster to sync from scratch

@jmouvill
Copy link

Hi, how/when do we know when validators will use this release ? I suppose it will be made as a requirement at some point to be elected ? thanks

@unclezoro unclezoro deleted the upgrade_1.10.2 branch July 29, 2021 11:18
@nilampatel-engineer
Copy link

Hi, running bsc full node with --gcmode = archive, syncmode=full, chain has stopped syncing with running out of space on device, if I add geth snapshot prune-state. it will prune database means will I loose complete historical data? means will not b able to see any chain history? what storage size is recommended? I have given 1TB and I ran out of space

@gituser
Copy link

gituser commented Dec 9, 2021

@nilampatel-engineer for archive node --gcmode=archive you will need 15TB+ or maybe more.

You don't need archive node in order to get historical data unless you need to know exact balance at certain block.

@Pjrich1313 Pjrich1313 mentioned this pull request Mar 27, 2024
3 tasks
galaio pushed a commit to galaio/bsc that referenced this pull request Jul 31, 2024
…ipt-hash

post-Canyon receipt-root deposit tx hashing fix
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.