Skip to content

Commit

Permalink
feat: add support for bsc parlia consensus
Browse files Browse the repository at this point in the history
  • Loading branch information
pythonberg1997 committed May 11, 2024
1 parent aadf535 commit 72e843a
Show file tree
Hide file tree
Showing 43 changed files with 10,465 additions and 33 deletions.
96 changes: 87 additions & 9 deletions Cargo.lock

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

12 changes: 12 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
members = [
"bin/reth/",
"crates/blockchain-tree/",
"crates/bsc/consensus",
"crates/bsc/node/",
"crates/bsc/evm/",
"crates/cli/runner/",
"crates/config/",
"crates/consensus/auto-seal/",
Expand Down Expand Up @@ -208,6 +211,7 @@ reth = { path = "bin/reth" }
reth-auto-seal-consensus = { path = "crates/consensus/auto-seal" }
reth-basic-payload-builder = { path = "crates/payload/basic" }
reth-beacon-consensus = { path = "crates/consensus/beacon" }
reth-bsc-consensus = { path = "crates/bsc/consensus" }
reth-ethereum-consensus = { path = "crates/ethereum/consensus" }
reth-blockchain-tree = { path = "crates/blockchain-tree" }
reth-cli-runner = { path = "crates/cli/runner" }
Expand All @@ -223,8 +227,10 @@ reth-e2e-test-utils = { path = "crates/e2e-test-utils" }
reth-engine-primitives = { path = "crates/engine-primitives" }
reth-ethereum-engine-primitives = { path = "crates/ethereum/engine-primitives" }
reth-node-builder = { path = "crates/node/builder" }
reth-node-bsc= { path = "crates/bsc/node" }
reth-node-ethereum = { path = "crates/ethereum/node" }
reth-node-optimism = { path = "crates/optimism/node" }
reth-evm-bsc = { path = "crates/bsc/evm" }
reth-evm-optimism = { path = "crates/optimism/evm" }
reth-node-core = { path = "crates/node-core" }
reth-node-api = { path = "crates/node/api" }
Expand Down Expand Up @@ -286,6 +292,7 @@ revm-inspectors = { git = "https://github.com/paradigmxyz/evm-inspectors", rev =
alloy-chains = "0.1.15"
alloy-primitives = "0.7.2"
alloy-dyn-abi = "0.7.2"
alloy-json-abi = "0.7.2"
alloy-sol-types = "0.7.2"
alloy-rlp = "0.3.4"
alloy-trie = "0.3.1"
Expand Down Expand Up @@ -399,3 +406,8 @@ proptest-derive = "0.4"
serial_test = "3"
similar-asserts = "1.5.0"
test-fuzz = "5"

[patch.crates-io]
# TODO: update to official version
revm = { git = "https://github.com/bnb-chain/revm", rev = "dee51654d63f2a8c0197ae804e3efe985ec39557" }
revm-primitives = { git = "https://github.com/bnb-chain/revm", rev = "dee51654d63f2a8c0197ae804e3efe985ec39557" }
11 changes: 7 additions & 4 deletions bin/reth/src/commands/db/diff.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ use reth_db::{
cursor::DbCursorRO, database::Database, open_db_read_only, table::Table, transaction::DbTx,
AccountChangeSets, AccountsHistory, AccountsTrie, BlockBodyIndices, BlockOmmers,
BlockWithdrawals, Bytecodes, CanonicalHeaders, DatabaseEnv, HashedAccounts, HashedStorages,
HeaderNumbers, HeaderTerminalDifficulties, Headers, PlainAccountState, PlainStorageState,
PruneCheckpoints, Receipts, StageCheckpointProgresses, StageCheckpoints, StorageChangeSets,
StoragesHistory, StoragesTrie, Tables, TransactionBlocks, TransactionHashNumbers,
TransactionSenders, Transactions, VersionHistory,
HeaderNumbers, HeaderTerminalDifficulties, Headers, ParliaSnapshot, PlainAccountState,
PlainStorageState, PruneCheckpoints, Receipts, StageCheckpointProgresses, StageCheckpoints,
StorageChangeSets, StoragesHistory, StoragesTrie, Tables, TransactionBlocks,
TransactionHashNumbers, TransactionSenders, Transactions, VersionHistory,
};
use std::{
collections::HashMap,
Expand Down Expand Up @@ -154,6 +154,9 @@ impl Command {
Tables::VersionHistory => {
find_diffs::<VersionHistory>(primary_tx, secondary_tx, output_dir)?
}
Tables::ParliaSnapshot => {
find_diffs::<ParliaSnapshot>(primary_tx, secondary_tx, output_dir)?
}
};
}

Expand Down
3 changes: 2 additions & 1 deletion bin/reth/src/commands/db/stats.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use reth_db::{
database::Database, mdbx, static_file::iter_static_files, AccountChangeSets, AccountsHistory,
AccountsTrie, BlockBodyIndices, BlockOmmers, BlockWithdrawals, Bytecodes, CanonicalHeaders,
DatabaseEnv, HashedAccounts, HashedStorages, HeaderNumbers, HeaderTerminalDifficulties,
Headers, PlainAccountState, PlainStorageState, PruneCheckpoints, Receipts,
Headers, ParliaSnapshot, PlainAccountState, PlainStorageState, PruneCheckpoints, Receipts,
StageCheckpointProgresses, StageCheckpoints, StorageChangeSets, StoragesHistory, StoragesTrie,
Tables, TransactionBlocks, TransactionHashNumbers, TransactionSenders, Transactions,
VersionHistory,
Expand Down Expand Up @@ -359,6 +359,7 @@ impl Command {
Tables::TransactionSenders => viewer.get_checksum::<TransactionSenders>().unwrap(),
Tables::Transactions => viewer.get_checksum::<Transactions>().unwrap(),
Tables::VersionHistory => viewer.get_checksum::<VersionHistory>().unwrap(),
Tables::ParliaSnapshot => viewer.get_checksum::<ParliaSnapshot>().unwrap(),
};

// increment duration for final report
Expand Down
47 changes: 47 additions & 0 deletions crates/bsc/consensus/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
[package]
name = "reth-bsc-consensus"
version.workspace = true
edition.workspace = true
rust-version.workspace = true
license.workspace = true
homepage.workspace = true
repository.workspace = true

[lints]
workspace = true

[dependencies]
# reth
reth-consensus-common.workspace = true
reth-consensus.workspace = true
reth-primitives.workspace = true
reth-provider.workspace = true
reth-rpc-types.workspace = true
reth-db.workspace = true

# eth
alloy-rlp.workspace = true
alloy-dyn-abi.workspace = true
alloy-json-abi.workspace = true

# crypto
secp256k1.workspace = true
sha3 = "0.10.8"
blst = "0.3.11"

# misc
serde_json.workspace = true
parking_lot.workspace = true
tracing.workspace = true
lazy_static = "1.4.0"
lru = "0.12"
bitset = "0.1.2"
thiserror = "1.0.59"

[dev-dependencies]
reth-interfaces = { workspace = true, features = ["test-utils"] }
reth-provider = { workspace = true, features = ["test-utils"] }
mockall = "0.12"

[features]
bsc = []
Loading

0 comments on commit 72e843a

Please sign in to comment.