Skip to content

Commit

Permalink
Merge pull request #29 from bnb-chain/develop_bak
Browse files Browse the repository at this point in the history
release: prepare for v0.1.0-beta.2
  • Loading branch information
unclezoro authored Jun 7, 2024
2 parents 8df161d + 714f83b commit 5710c1f
Show file tree
Hide file tree
Showing 41 changed files with 234 additions and 132 deletions.
21 changes: 21 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
### Description

add a description of your changes here...

### Rationale

tell us why we need these changes...

### Example

add an example CLI or API response...

### Changes

Notable changes:
* add each change in a bullet point here
* ...

### Potential Impacts
* add potential impacts for other components here
* ...
8 changes: 4 additions & 4 deletions .github/workflows/integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
pull_request:
merge_group:
push:
branches: [main]
branches: [ main ]

env:
CARGO_TERM_COLOR: always
Expand All @@ -19,7 +19,7 @@ concurrency:
jobs:
test:
name: test / ${{ matrix.network }}
runs-on: ubuntu-latest
runs-on: [ bnb-chain-ap-qa-cicd-runners ]
env:
RUST_BACKTRACE: 1
strategy:
Expand Down Expand Up @@ -56,7 +56,7 @@ jobs:
name: sync / 100k blocks
# Only run sync tests in merge groups
if: github.event_name == 'merge_group'
runs-on: ubuntu-latest
runs-on: [ bnb-chain-ap-qa-cicd-runners ]
env:
RUST_LOG: info,sync=error
RUST_BACKTRACE: 1
Expand Down Expand Up @@ -84,7 +84,7 @@ jobs:
name: integration success
runs-on: ubuntu-latest
if: always()
needs: [test]
needs: [ test ]
timeout-minutes: 30
steps:
- name: Decide whether the needed jobs succeeded or failed
Expand Down
14 changes: 7 additions & 7 deletions .github/workflows/unit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
pull_request:
merge_group:
push:
branches: [main]
branches: [ main ]

env:
CARGO_TERM_COLOR: always
Expand All @@ -19,13 +19,13 @@ concurrency:
jobs:
test:
name: test / ${{ matrix.network }} (${{ matrix.partition }}/2)
runs-on: ubuntu-latest
runs-on: [ bnb-chain-ap-qa-cicd-runners ]
env:
RUST_BACKTRACE: 1
strategy:
matrix:
partition: [1, 2]
network: [ethereum, optimism]
partition: [ 1, 2 ]
network: [ ethereum, optimism ]
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
Expand Down Expand Up @@ -53,7 +53,7 @@ jobs:
state:
name: Ethereum state tests
runs-on: ubuntu-latest
runs-on: [ bnb-chain-ap-qa-cicd-runners ]
env:
RUST_LOG: info,sync=error
RUST_BACKTRACE: 1
Expand All @@ -77,7 +77,7 @@ jobs:

doc:
name: doc tests (${{ matrix.network }})
runs-on: ubuntu-latest
runs-on: [ bnb-chain-ap-qa-cicd-runners ]
env:
RUST_BACKTRACE: 1
timeout-minutes: 30
Expand All @@ -101,7 +101,7 @@ jobs:
name: unit success
runs-on: ubuntu-latest
if: always()
needs: [test, state, doc]
needs: [ test, state, doc ]
timeout-minutes: 30
steps:
- name: Decide whether the needed jobs succeeded or failed
Expand Down
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,14 @@
## v0.1.0-beta.1
### FEATURE
* [\#10](https://github.com/bnb-chain/reth/pull/10) feat: support opbnb network

## v0.1.0-beta.2
### FEATURE
* [\#27](https://github.com/bnb-chain/reth/pull/27) feat: introduce Haber fork into opBNB testnet

### BUGFIX
* [\#17](https://github.com/bnb-chain/reth/pull/17) fix: p2p incompatible forks for opbnb testnet and mainnet
* [\#19](https://github.com/bnb-chain/reth/pull/19) chore: fix ci issues
* [\#24](https://github.com/bnb-chain/reth/pull/24) fix: opbnb synchronization failure issue
* [\#25](https://github.com/bnb-chain/reth/pull/25) chore: add pr template
* [\#26](https://github.com/bnb-chain/reth/pull/26) fix: opbnb p2p forkid mismatch issue
30 changes: 26 additions & 4 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ rust.missing_debug_implementations = "warn"
rust.missing_docs = "warn"
rust.unreachable_pub = "warn"
rust.unused_must_use = "deny"
rust.rust_2018_idioms = "deny"
rust.rust_2018_idioms = { level = "deny", priority = -1 }
rustdoc.all = "warn"

[workspace.lints.clippy]
Expand Down Expand Up @@ -401,6 +401,6 @@ similar-asserts = "1.5.0"
test-fuzz = "5"

[patch.crates-io]
revm = { git = "https://github.com/bnb-chain/revm.git", rev = "f5cc71d" }
revm-primitives = { git = "https://github.com/bnb-chain/revm.git", rev = "f5cc71d" }
alloy-chains = { git = "https://github.com/alloy-rs/chains.git", rev = "906d6fb" }
revm = { git = "https://github.com/bnb-chain/revm.git", rev = "2f38e6c" }
revm-primitives = { git = "https://github.com/bnb-chain/revm.git", rev = "2f38e6c" }
alloy-chains = { git = "https://github.com/alloy-rs/chains.git", rev = "906d6fb" }
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -414,9 +414,9 @@ fix-lint-other-targets:
-- -D warnings

fix-lint:
make lint-reth && \
make lint-op-reth && \
make lint-other-targets && \
make fix-lint-reth && \
make fix-lint-op-reth && \
make fix-lint-other-targets && \
make fmt

.PHONY: rustdocs
Expand Down
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,17 @@ Coming soon......

## 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.

### Hardware Requirements

* CPU with 16+ cores
* 128GB RAM
* High-performance NVMe SSD with at least 3TB of free space
* A broadband internet connection with upload/download speeds of 25 MB/s

### 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.

Expand Down Expand Up @@ -105,10 +116,12 @@ The command below is for an archive node. To run a full node, simply add the `--
# for testnet
export network=testnet
export L2_RPC=https://opbnb-testnet-rpc.bnbchain.org
export TRUST_NODES="enode://1a8f2d3160ad6efd6591981c026bd31807b79844422d99107f8ffa0bd966f35dd6b44d3169e05fcb15be492a58c3098c1d5ab04a3b2769f1aa87ab871b3ef49b@54.238.146.8:30303,enode://28a8309f958c58a0f6fd3cee83951033d20f2b7369e25c63f66caf0d2bac1df89df52b82d74d828f35c76152e4b2aa8dae816a2e3ea5a03c40d4ec08005d426c@35.74.91.224:30303"

# for mainnet
# export network=mainnet
# export L2_RPC=https://opbnb-mainnet-rpc.bnbchain.org
# export TRUST_NODES="enode://db109c6cac5c8b6225edd3176fc3764c58e0720950fe94c122c80978e706a9c9e976629b718e48b6306ea0f9126e5394d3424c9716c5703549e2e7eba216353b@52.193.218.151:30303,enode://e74ecea4943c27d7d4d0c40f84fc3426a7e80f8a9035c0b383725b693ebf9a6376b8c9db12690b513a6ac83041d9b6418d51dc079dce1f13ef948b32f63a589d@54.150.37.120:30303"

./target/release/op-reth node \
--datadir=./datadir \
Expand All @@ -126,6 +139,7 @@ export L2_RPC=https://opbnb-testnet-rpc.bnbchain.org
--ws.port=8546 \
--builder.gaslimit=150000000 \
--nat=any \
--trusted-peers=${TRUST_NODES} \
--log.file.directory ./datadir/logs
```

Expand Down
1 change: 1 addition & 0 deletions bin/reth/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ reth-node-api.workspace = true
reth-node-ethereum.workspace = true
reth-node-optimism = { workspace = true, optional = true, features = [
"optimism",
"opbnb",
] }
reth-node-core.workspace = true
reth-node-builder.workspace = true
Expand Down
2 changes: 1 addition & 1 deletion bin/reth/src/commands/db/stats.rs
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,7 @@ impl Command {
let max_widths = table.column_max_content_widths();
let mut separator = Row::new();
for width in max_widths {
separator.add_cell(Cell::new(&"-".repeat(width as usize)));
separator.add_cell(Cell::new("-".repeat(width as usize)));
}
table.add_row(separator);

Expand Down
7 changes: 6 additions & 1 deletion crates/blockchain-tree/src/blockchain_tree.rs
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,12 @@ where
// get parent hashes
let mut parent_block_hashes = self.all_chain_hashes(chain_id);
let first_pending_block_number =
*parent_block_hashes.first_key_value().expect("There is at least one block hash").0;
if let Some(key_value) = parent_block_hashes.first_key_value() {
*key_value.0
} else {
debug!(target: "blockchain_tree", ?chain_id, "No blockhashes stored");
return None
};
let canonical_chain = canonical_chain
.iter()
.filter(|&(key, _)| key < first_pending_block_number)
Expand Down
8 changes: 4 additions & 4 deletions crates/consensus/beacon/src/engine/hooks/prune.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,10 @@ impl<DB: Database + 'static> PruneHook<DB> {

/// This will try to spawn the pruner if it is idle:
/// 1. Check if pruning is needed through [Pruner::is_pruning_needed].
/// 2.
/// 1. If pruning is needed, pass tip block number to the [Pruner::run] and spawn it in a
/// separate task. Set pruner state to [PrunerState::Running].
/// 2. If pruning is not needed, set pruner state back to [PrunerState::Idle].
///
/// 2.1. If pruning is needed, pass tip block number to the [Pruner::run] and spawn it in a
/// separate task. Set pruner state to [PrunerState::Running].
/// 2.2. If pruning is not needed, set pruner state back to [PrunerState::Idle].
///
/// If pruner is already running, do nothing.
fn try_spawn_pruner(&mut self, tip_block_number: BlockNumber) -> Option<EngineHookEvent> {
Expand Down
14 changes: 7 additions & 7 deletions crates/consensus/beacon/src/engine/hooks/static_file.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,13 +71,13 @@ impl<DB: Database + 'static> StaticFileHook<DB> {
/// 1. Check if producing static files is needed through
/// [StaticFileProducer::get_static_file_targets](reth_static_file::StaticFileProducerInner::get_static_file_targets)
/// and then [StaticFileTargets::any](reth_static_file::StaticFileTargets::any).
/// 2.
/// 1. If producing static files is needed, pass static file request to the
/// [StaticFileProducer::run](reth_static_file::StaticFileProducerInner::run) and spawn
/// it in a separate task. Set static file producer state to
/// [StaticFileProducerState::Running].
/// 2. If producing static files is not needed, set static file producer state back to
/// [StaticFileProducerState::Idle].
///
/// 2.1. If producing static files is needed, pass static file request to the
/// [StaticFileProducer::run](reth_static_file::StaticFileProducerInner::run) and
/// spawn it in a separate task. Set static file producer state to
/// [StaticFileProducerState::Running].
/// 2.2. If producing static files is not needed, set static file producer state back to
/// [StaticFileProducerState::Idle].
///
/// If static_file_producer is already running, do nothing.
fn try_spawn_static_file_producer(
Expand Down
10 changes: 5 additions & 5 deletions crates/consensus/beacon/src/engine/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -710,13 +710,13 @@ where
/// If validation fails, the response MUST contain the latest valid hash:
///
/// - The block hash of the ancestor of the invalid payload satisfying the following two
/// conditions:
/// conditions:
/// - It is fully validated and deemed VALID
/// - Any other ancestor of the invalid payload with a higher blockNumber is INVALID
/// - 0x0000000000000000000000000000000000000000000000000000000000000000 if the above
/// conditions are satisfied by a PoW block.
/// conditions are satisfied by a PoW block.
/// - null if client software cannot determine the ancestor of the invalid payload satisfying
/// the above conditions.
/// the above conditions.
fn latest_valid_hash_for_invalid_payload(
&mut self,
parent_hash: B256,
Expand Down Expand Up @@ -1110,8 +1110,8 @@ where
/// - invalid extra data
/// - invalid transactions
/// - incorrect hash
/// - the versioned hashes passed with the payload do not exactly match transaction
/// versioned hashes
/// - the versioned hashes passed with the payload do not exactly match transaction versioned
/// hashes
/// - the block does not contain blob transactions if it is pre-cancun
///
/// This validates the following engine API rule:
Expand Down
4 changes: 4 additions & 0 deletions crates/ethereum-forks/src/forkid.rs
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,10 @@ impl ForkFilter {
forks.remove(&ForkFilterKey::Time(0));
forks.remove(&ForkFilterKey::Block(0));

// Skip Fermat hardfork for opbnb
forks.remove(&ForkFilterKey::Time(1698991506));
forks.remove(&ForkFilterKey::Time(1701151200));

let forks = forks
.into_iter()
// filter out forks that are pre-genesis by timestamp
Expand Down
Loading

0 comments on commit 5710c1f

Please sign in to comment.