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

release: prepare for v1.0.0 #88

Merged
merged 7 commits into from
Jul 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
19 changes: 19 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,24 @@
# Changelog

## v1.0.0
The Reth is entering production-ready v1.0.0. Thanks to the Paradigm team for their continuous iterations on Reth,
providing the community with a highly scalable, modular, high-performance, and feature-rich client.
We stand on the shoulders of giants, enabling us to swiftly launch the Reth supporting BSC and opBNB network versions.

### BUGFIX
* [\#75](https://github.com/bnb-chain/reth/pull/75) ci: fix release job
* [\#76](https://github.com/bnb-chain/reth/pull/76) chore: update max db size
* [\#74](https://github.com/bnb-chain/reth/pull/74) fix: add sidecars to db when doing insert_block
* [\#79](https://github.com/bnb-chain/reth/pull/79) fix: read sidecars from table in get_take_block_range
* [\#81](https://github.com/bnb-chain/reth/pull/81) fix: check parent hash of disconnected headers
* [\#83](https://github.com/bnb-chain/reth/pull/83) fix: parlia live sync issue
* [\#89](https://github.com/bnb-chain/reth/pull/89) fix: fork block handling in parlia engine and rewinding blocks to the block before the finalized block issue

### Docs
* [\#87](https://github.com/bnb-chain/reth/pull/87) chore: refine readme file
* [\#90](https://github.com/bnb-chain/reth/pull/90) doc: fix op-reth running tutorial


## v1.0.0-rc.2

This release is a release candidate for the v1.0.0 release. It includes a number of new features and bug fixes.
Expand Down
119 changes: 56 additions & 63 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,26 +53,29 @@ make install-op

## Run Reth for BSC

### Hardware Requirements

* CPU with 16+ cores
* 128GB RAM
* High-performance NVMe SSD with at least 4TB of free space for full node and 8TB of free space for archive node
* A broadband internet connection with upload/download speeds of 25 MB/s

### Steps to Run bsc-reth

The command below is for an archive node. To run a full node, simply add the `--full` tag.

```shell
# for testnet
export network=bsc-testnet

# for mainnet
# export network=bsc
export network=bsc

# for testnet
# export network=bsc-testnet

./target/release/bsc-reth node \
--datadir=./datadir \
--chain=${network} \
--http \
--http.addr=0.0.0.0 \
--http.port=8545 \
--http.api="eth, net, txpool, web3, rpc" \
--ws \
--ws.addr=0.0.0.0 \
--ws.port=8546 \
--nat=any \
--log.file.directory ./datadir/logs
```

Expand All @@ -81,36 +84,37 @@ You can run `bsc-reth --help` for command explanations.
For running bsc-reth with docker, please use the following command:

```shell
# for testnet
export network=bsc-testnet

# for mainnet
# export network=bsc
export network=bsc

# for testnet
# export network=bsc-testnet

# check this for version of the docker image, https://github.com/bnb-chain/reth/pkgs/container/bsc-reth
export version=latest

# the directory where reth data will be stored
export data_dir=/xxx/xxx

docker run -d -p 8545:8545 -p 8546:8546 -p 30303:30303 -p 30303:30303/udp -v ${data_dir}:/data \
docker run -d -p 8545:8545 -p 30303:30303 -p 30303:30303/udp -v ${data_dir}:/data \
--name bsc-reth ghcr.io/bnb-chain/bsc-reth:${version} node \
--datadir=/data \
--chain=${network} \
--http \
--http.addr=0.0.0.0 \
--http.port=8545 \
--http.api="eth, net, txpool, web3, rpc" \
--ws \
--ws.addr=0.0.0.0 \
--ws.port=8546 \
--nat=any \
--log.file.directory /data/logs
```

### Snapshots

There are snapshots available from the community, you can use a snapshot to reduce the sync time for catching up.

* [fuzzland snapshot](https://github.com/fuzzland/snapshots)

## Run Reth for opBNB

The op-reth can function as both a full node and an archive node. Due to its unique storage advantages, it is primarily utilized for running archive nodes.
The op-reth can function as both a full node and an archive node. Due to its unique storage advantages, it is primarily
utilized for running archive nodes.

### Hardware Requirements

Expand All @@ -122,8 +126,7 @@ The op-reth can function as both a full node and an archive node. Due to its uni
### Steps to Run op-reth

The op-reth is an [execution client](https://ethereum.org/en/developers/docs/nodes-and-clients/#execution-clients) for
opBNB.
You need to run op-node along with op-reth to synchronize with the opBNB network.
opBNB. You need to run op-node along with op-reth to synchronize with the opBNB network.

Here is the quick command for running the op-node. For more details, refer to
the [opbnb repository](https://github.com/bnb-chain/opbnb).
Expand All @@ -133,16 +136,16 @@ git clone https://github.com/bnb-chain/opbnb
cd opbnb
make op-node

# for mainnet
export network=mainnet
export L1_RPC=https://bsc-dataseed.bnbchain.org
export P2P_BOOTNODES="enr:-J24QA9sgVxbZ0KoJ7-1gx_szfc7Oexzz7xL2iHS7VMHGj2QQaLc_IQZmFthywENgJWXbApj7tw7BiouKDOZD4noWEWGAYppffmvgmlkgnY0gmlwhDbjSM6Hb3BzdGFja4PMAQCJc2VjcDI1NmsxoQKetGQX7sXd4u8hZr6uayTZgHRDvGm36YaryqZkgnidS4N0Y3CCIyuDdWRwgiMs,enr:-J24QPSZMaGw3NhO6Ll25cawknKcOFLPjUnpy72HCkwqaHBKaaR9ylr-ejx20INZ69BLLj334aEqjNHKJeWhiAdVcn-GAYv28FmZgmlkgnY0gmlwhDTDWQOHb3BzdGFja4PMAQCJc2VjcDI1NmsxoQJ-_5GZKjs7jaB4TILdgC8EwnwyL3Qip89wmjnyjvDDwoN0Y3CCIyuDdWRwgiMs"

# for testnet
# it's better to replace the L1_RPC with your own BSC Testnet RPC Endpoint for stability
export network=testnet
export L1_RPC=https://bsc-testnet.bnbchain.org
export P2P_BOOTNODES="enr:-J24QGQBeMsXOaCCaLWtNFSfb2Gv50DjGOKToH2HUTAIn9yXImowlRoMDNuPNhSBZNQGCCE8eAl5O3dsONuuQp5Qix2GAYjB7KHSgmlkgnY0gmlwhDREiqaHb3BzdGFja4PrKwCJc2VjcDI1NmsxoQL4I9wpEVDcUb8bLWu6V8iPoN5w8E8q-GrS5WUCygYUQ4N0Y3CCIyuDdWRwgiMr,enr:-J24QJKXHEkIhy0tmIk2EscMZ2aRrivNsZf_YhgIU51g4ZKHWY0BxW6VedRJ1jxmneW9v7JjldPOPpLkaNSo6cXGFxqGAYpK96oCgmlkgnY0gmlwhANzx96Hb3BzdGFja4PrKwCJc2VjcDI1NmsxoQMOCzUFffz04eyDrmkbaSCrMEvLvn5O4RZaZ5k1GV4wa4N0Y3CCIyuDdWRwgiMr"

# for mainnet
# export network=mainnet
# export L1_RPC=https://bsc-dataseed.bnbchain.org
# export P2P_BOOTNODES="enr:-J24QA9sgVxbZ0KoJ7-1gx_szfc7Oexzz7xL2iHS7VMHGj2QQaLc_IQZmFthywENgJWXbApj7tw7BiouKDOZD4noWEWGAYppffmvgmlkgnY0gmlwhDbjSM6Hb3BzdGFja4PMAQCJc2VjcDI1NmsxoQKetGQX7sXd4u8hZr6uayTZgHRDvGm36YaryqZkgnidS4N0Y3CCIyuDdWRwgiMs,enr:-J24QPSZMaGw3NhO6Ll25cawknKcOFLPjUnpy72HCkwqaHBKaaR9ylr-ejx20INZ69BLLj334aEqjNHKJeWhiAdVcn-GAYv28FmZgmlkgnY0gmlwhDTDWQOHb3BzdGFja4PMAQCJc2VjcDI1NmsxoQJ-_5GZKjs7jaB4TILdgC8EwnwyL3Qip89wmjnyjvDDwoN0Y3CCIyuDdWRwgiMs"
# export network=testnet
# export L1_RPC=https://bsc-testnet.bnbchain.org
# export P2P_BOOTNODES="enr:-J24QGQBeMsXOaCCaLWtNFSfb2Gv50DjGOKToH2HUTAIn9yXImowlRoMDNuPNhSBZNQGCCE8eAl5O3dsONuuQp5Qix2GAYjB7KHSgmlkgnY0gmlwhDREiqaHb3BzdGFja4PrKwCJc2VjcDI1NmsxoQL4I9wpEVDcUb8bLWu6V8iPoN5w8E8q-GrS5WUCygYUQ4N0Y3CCIyuDdWRwgiMr,enr:-J24QJKXHEkIhy0tmIk2EscMZ2aRrivNsZf_YhgIU51g4ZKHWY0BxW6VedRJ1jxmneW9v7JjldPOPpLkaNSo6cXGFxqGAYpK96oCgmlkgnY0gmlwhANzx96Hb3BzdGFja4PrKwCJc2VjcDI1NmsxoQMOCzUFffz04eyDrmkbaSCrMEvLvn5O4RZaZ5k1GV4wa4N0Y3CCIyuDdWRwgiMr"

./op-node/bin/op-node \
--l1.trustrpc \
Expand All @@ -167,21 +170,25 @@ export P2P_BOOTNODES="enr:-J24QGQBeMsXOaCCaLWtNFSfb2Gv50DjGOKToH2HUTAIn9yXImowlR
--rpc.enable-admin \
--l1=${L1_RPC} \
--l2=http://localhost:8551 \
--l2.jwt-secret=./jwt.txt
--l2.jwt-secret=./jwt.txt \
--syncmode=execution-layer
```

Copy the JWT file generated when running the op-node to the current workspace. Here is a quick command for running
op-reth.
The command below is for an archive node. To run a full node, simply add the `--full` tag.
**It's important to mention that op-node and op-reth both need the same jwt.txt file.**
To do this, switch to the op-reth workdir and paste the jwt.txt file created during op-node execution into the current
workspace.

```shell
# for testnet
export network=testnet
export L2_RPC=https://opbnb-testnet-rpc.bnbchain.org
Here is a quick command for running op-reth. The command below is for an archive node, to run a full node, simply add
the `--full` tag.

```shell
# for mainnet
# export network=mainnet
# export L2_RPC=https://opbnb-mainnet-rpc.bnbchain.org
export network=mainnet
export L2_RPC=https://opbnb-mainnet-rpc.bnbchain.org

# for testnet
# export network=testnet
# export L2_RPC=https://opbnb-testnet-rpc.bnbchain.org

./target/release/op-reth node \
--datadir=./datadir \
Expand All @@ -191,14 +198,7 @@ export L2_RPC=https://opbnb-testnet-rpc.bnbchain.org
--authrpc.port=8551 \
--authrpc.jwtsecret=./jwt.txt \
--http \
--http.addr=0.0.0.0 \
--http.port=8545 \
--http.api="eth, net, txpool, web3, rpc" \
--ws \
--ws.addr=0.0.0.0 \
--ws.port=8546 \
--builder.gaslimit=150000000 \
--nat=any \
--log.file.directory ./datadir/logs
```

Expand All @@ -208,13 +208,13 @@ found [here](https://docs.bnbchain.org/opbnb-docs/docs/tutorials/running-a-local
For running op-reth with docker, please use the following command:

```shell
# for testnet
export network=testnet
export L2_RPC=https://opbnb-testnet-rpc.bnbchain.org

# for mainnet
# export network=mainnet
# export L2_RPC=https://opbnb-mainnet-rpc.bnbchain.org
export network=mainnet
export L2_RPC=https://opbnb-mainnet-rpc.bnbchain.org

# for testnet
# export network=testnet
# export L2_RPC=https://opbnb-testnet-rpc.bnbchain.org

# check this for version of the docker image, https://github.com/bnb-chain/reth/pkgs/container/op-reth
export version=latest
Expand All @@ -225,7 +225,7 @@ export data_dir=/xxx/xxx
# the directory where the jwt.txt file is stored
export jwt_dir=/xxx/xxx

docker run -d -p 8545:8545 -p 8546:8546 -p 30303:30303 -p 30303:30303/udp -v ${data_dir}:/data -v ${jwt_dir}:/jwt \
docker run -d -p 8545:8545 -p 30303:30303 -p 30303:30303/udp -v ${data_dir}:/data -v ${jwt_dir}:/jwt \
--name op-reth ghcr.io/bnb-chain/op-reth:${version} node \
--datadir=/data \
--chain=opbnb-${network} \
Expand All @@ -234,14 +234,7 @@ docker run -d -p 8545:8545 -p 8546:8546 -p 30303:30303 -p 30303:30303/udp -v ${d
--authrpc.port=8551 \
--authrpc.jwtsecret=/jwt/jwt.txt \
--http \
--http.addr=0.0.0.0 \
--http.port=8545 \
--http.api="eth, net, txpool, web3, rpc" \
--ws \
--ws.addr=0.0.0.0 \
--ws.port=8546 \
--builder.gaslimit=150000000 \
--nat=any \
--log.file.directory /data/logs
```

Expand Down
25 changes: 20 additions & 5 deletions crates/bsc/engine/src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,13 @@ pub struct ParliaClient {
/// cached header and body
storage: Storage,
fetch_client: FetchClient,
peer_id: PeerId,
}

impl ParliaClient {
pub(crate) const fn new(storage: Storage, fetch_client: FetchClient) -> Self {
Self { storage, fetch_client }
pub(crate) fn new(storage: Storage, fetch_client: FetchClient) -> Self {
let peer_id = PeerId::random();
Self { storage, fetch_client, peer_id }
}

async fn fetch_headers(&self, request: HeadersRequest) -> InnerFetchHeaderResult {
Expand Down Expand Up @@ -87,6 +89,11 @@ impl ParliaClient {

Ok(bodies)
}

async fn clean_cache(&self) {
let mut storage = self.storage.write().await;
storage.clean_caches()
}
}

impl HeadersClient for ParliaClient {
Expand All @@ -98,10 +105,11 @@ impl HeadersClient for ParliaClient {
priority: Priority,
) -> Self::Output {
let this = self.clone();
let peer_id = self.peer_id;
Box::pin(async move {
let result = this.fetch_headers(request.clone()).await;
if let Ok(headers) = result {
return Ok(WithPeerId::new(PeerId::random(), headers));
return Ok(WithPeerId::new(peer_id, headers));
}
this.fetch_client.get_headers_with_priority(request.clone(), priority).await
})
Expand All @@ -117,10 +125,11 @@ impl BodiesClient for ParliaClient {
priority: Priority,
) -> Self::Output {
let this = self.clone();
let peer_id = self.peer_id;
Box::pin(async move {
let result = this.fetch_bodies(hashes.clone()).await;
if let Ok(blocks) = result {
return Ok(WithPeerId::new(PeerId::random(), blocks));
return Ok(WithPeerId::new(peer_id, blocks));
}
this.fetch_client.get_block_bodies_with_priority(hashes.clone(), priority).await
})
Expand All @@ -130,7 +139,13 @@ impl BodiesClient for ParliaClient {
impl DownloadClient for ParliaClient {
fn report_bad_message(&self, peer_id: PeerId) {
let this = self.clone();
this.fetch_client.report_bad_message(peer_id)
if peer_id == self.peer_id {
tokio::spawn(async move {
this.clean_cache().await;
});
} else {
this.fetch_client.report_bad_message(peer_id)
}
}

fn num_connected_peers(&self) -> usize {
Expand Down
Loading