Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
6819283
chore: upgrade reth v0.0.9 → develop-v2 (reth 2.0.0)
Apr 23, 2026
f822ba8
fix: implement NodePrimitives/BlockBody for BSC primitives (reth 2.0.0)
Apr 23, 2026
b5173b0
chore: source reth-core crates from git tag v0.1.1
Apr 23, 2026
71316e8
chore: switch reth-core crates to branch v0.1.1-v2
Apr 24, 2026
643fe47
fix: replace reth_primitives imports with reth 2.0 equivalents
Apr 24, 2026
5183f46
fix: replace revm_context_interface with revm::context_interface
Apr 24, 2026
8d3a1bd
fix: replace EthPayloadBuilderAttributes with EthPayloadAttributes (G…
Apr 24, 2026
dc072e6
fix: upgrade reth-bsc to develop-v2 (reth 2.0.0)
Apr 25, 2026
780f5fb
fix: resolve clippy errors for CI
chee-chyuan Apr 28, 2026
bf78f08
chore: switch reth dependency from develop-v2 to v0.1.1-v2
chee-chyuan Apr 28, 2026
47e400b
chore: revert reth to develop-v2, remove patch section for reth-core
chee-chyuan Apr 28, 2026
2a2d03e
chore: update Cargo.lock
chee-chyuan Apr 28, 2026
abc69f8
fix: restore [patch.crates-io] for reth-core transitive deps
chee-chyuan Apr 28, 2026
66fe79a
chore: remove [patch.crates-io] and update reth to latest develop-v2
chee-chyuan Apr 28, 2026
4f1ce66
chore: merge origin/develop-v2 into upgrade/develop-v2
chee-chyuan Apr 29, 2026
3bc6127
chore: regenerate Cargo.lock after merge conflict resolution
chee-chyuan Apr 29, 2026
b27218a
fix: remove stale EngineApiMessageVersion::V1 arg from fork_choice_up…
chee-chyuan Apr 29, 2026
78a0ec6
fix: replace reth_primitives with reth_primitives_traits in fork_reco…
chee-chyuan Apr 29, 2026
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
2,453 changes: 1,255 additions & 1,198 deletions Cargo.lock

Large diffs are not rendered by default.

142 changes: 74 additions & 68 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,95 +16,100 @@ name = "reth-bsc"
path = "src/main.rs"

[dependencies]
reth = { git = "https://github.com/bnb-chain/reth.git", rev = "ed59a0985b62f4964b389b1666b73b03b39b6928" }
reth-cli = { git = "https://github.com/bnb-chain/reth.git", rev = "ed59a0985b62f4964b389b1666b73b03b39b6928" }
reth-cli-commands = { git = "https://github.com/bnb-chain/reth.git", rev = "ed59a0985b62f4964b389b1666b73b03b39b6928" }
reth-basic-payload-builder = { git = "https://github.com/bnb-chain/reth.git", rev = "ed59a0985b62f4964b389b1666b73b03b39b6928" }
reth-db = { git = "https://github.com/bnb-chain/reth.git", rev = "ed59a0985b62f4964b389b1666b73b03b39b6928" }
reth-engine-local = { git = "https://github.com/bnb-chain/reth.git", rev = "ed59a0985b62f4964b389b1666b73b03b39b6928" }
reth-engine-tree = { git = "https://github.com/bnb-chain/reth.git", rev = "ed59a0985b62f4964b389b1666b73b03b39b6928" }
reth-node-builder = { git = "https://github.com/bnb-chain/reth.git", rev = "ed59a0985b62f4964b389b1666b73b03b39b6928" }
reth-chainspec = { git = "https://github.com/bnb-chain/reth.git", rev = "ed59a0985b62f4964b389b1666b73b03b39b6928" }
reth-cli-util = { git = "https://github.com/bnb-chain/reth.git", rev = "ed59a0985b62f4964b389b1666b73b03b39b6928" }
reth-discv4 = { git = "https://github.com/bnb-chain/reth.git", rev = "ed59a0985b62f4964b389b1666b73b03b39b6928", features = [
reth = { git = "https://github.com/bnb-chain/reth.git", branch = "develop-v2" }
reth-cli = { git = "https://github.com/bnb-chain/reth.git", branch = "develop-v2" }
reth-cli-commands = { git = "https://github.com/bnb-chain/reth.git", branch = "develop-v2" }
reth-basic-payload-builder = { git = "https://github.com/bnb-chain/reth.git", branch = "develop-v2" }
reth-db = { git = "https://github.com/bnb-chain/reth.git", branch = "develop-v2" }
reth-engine-local = { git = "https://github.com/bnb-chain/reth.git", branch = "develop-v2" }
reth-engine-tree = { git = "https://github.com/bnb-chain/reth.git", branch = "develop-v2" }
reth-node-builder = { git = "https://github.com/bnb-chain/reth.git", branch = "develop-v2" }
reth-chainspec = { git = "https://github.com/bnb-chain/reth.git", branch = "develop-v2" }
reth-cli-util = { git = "https://github.com/bnb-chain/reth.git", branch = "develop-v2" }
reth-discv4 = { git = "https://github.com/bnb-chain/reth.git", branch = "develop-v2", features = [
"test-utils",
] }
reth-engine-primitives = { git = "https://github.com/bnb-chain/reth.git", rev = "ed59a0985b62f4964b389b1666b73b03b39b6928" }
reth-ethereum-forks = { git = "https://github.com/bnb-chain/reth.git", rev = "ed59a0985b62f4964b389b1666b73b03b39b6928", features = [
reth-engine-primitives = { git = "https://github.com/bnb-chain/reth.git", branch = "develop-v2" }
reth-ethereum-forks = { git = "https://github.com/bnb-chain/reth.git", branch = "develop-v2", features = [
"serde",
] }
reth-ethereum-payload-builder = { git = "https://github.com/bnb-chain/reth.git", rev = "ed59a0985b62f4964b389b1666b73b03b39b6928" }
reth-payload-builder-primitives = { git = "https://github.com/bnb-chain/reth.git", rev = "ed59a0985b62f4964b389b1666b73b03b39b6928" }
reth-chain-state = { git = "https://github.com/bnb-chain/reth.git", rev = "ed59a0985b62f4964b389b1666b73b03b39b6928" }
reth-ethereum-primitives = { git = "https://github.com/bnb-chain/reth.git", rev = "ed59a0985b62f4964b389b1666b73b03b39b6928" }
reth-eth-wire = { git = "https://github.com/bnb-chain/reth.git", rev = "ed59a0985b62f4964b389b1666b73b03b39b6928" }
reth-eth-wire-types = { git = "https://github.com/bnb-chain/reth.git", rev = "ed59a0985b62f4964b389b1666b73b03b39b6928" }
reth-evm = { git = "https://github.com/bnb-chain/reth.git", rev = "ed59a0985b62f4964b389b1666b73b03b39b6928" }
reth-evm-ethereum = { git = "https://github.com/bnb-chain/reth.git", rev = "ed59a0985b62f4964b389b1666b73b03b39b6928" }
reth-execution-types = { git = "https://github.com/bnb-chain/reth.git", rev = "ed59a0985b62f4964b389b1666b73b03b39b6928" }
reth-ipc = { git = "https://github.com/bnb-chain/reth.git", rev = "ed59a0985b62f4964b389b1666b73b03b39b6928" }
reth-metrics = { git = "https://github.com/bnb-chain/reth.git", rev = "ed59a0985b62f4964b389b1666b73b03b39b6928" }
reth-node-core = { git = "https://github.com/bnb-chain/reth.git", rev = "ed59a0985b62f4964b389b1666b73b03b39b6928" }
reth-revm = { git = "https://github.com/bnb-chain/reth.git", rev = "ed59a0985b62f4964b389b1666b73b03b39b6928" }
reth-network = { git = "https://github.com/bnb-chain/reth.git", rev = "ed59a0985b62f4964b389b1666b73b03b39b6928", features = [
reth-ethereum-payload-builder = { git = "https://github.com/bnb-chain/reth.git", branch = "develop-v2" }
reth-payload-builder-primitives = { git = "https://github.com/bnb-chain/reth.git", branch = "develop-v2" }
reth-chain-state = { git = "https://github.com/bnb-chain/reth.git", branch = "develop-v2" }
reth-ethereum-primitives = { git = "https://github.com/bnb-chain/reth.git", branch = "develop-v2" }
reth-eth-wire = { git = "https://github.com/bnb-chain/reth.git", branch = "develop-v2" }
reth-eth-wire-types = { git = "https://github.com/bnb-chain/reth.git", branch = "develop-v2" }
reth-evm = { git = "https://github.com/bnb-chain/reth.git", branch = "develop-v2" }
reth-evm-ethereum = { git = "https://github.com/bnb-chain/reth.git", branch = "develop-v2" }
reth-execution-types = { git = "https://github.com/bnb-chain/reth.git", branch = "develop-v2" }
reth-ipc = { git = "https://github.com/bnb-chain/reth.git", branch = "develop-v2" }
reth-metrics = { git = "https://github.com/bnb-chain/reth.git", branch = "develop-v2" }
reth-node-core = { git = "https://github.com/bnb-chain/reth.git", branch = "develop-v2" }
reth-revm = { git = "https://github.com/bnb-chain/reth.git", branch = "develop-v2" }
reth-network = { git = "https://github.com/bnb-chain/reth.git", branch = "develop-v2", features = [
"test-utils",
] }
reth-network-p2p = { git = "https://github.com/bnb-chain/reth.git", rev = "ed59a0985b62f4964b389b1666b73b03b39b6928" }
reth-network-api = { git = "https://github.com/bnb-chain/reth.git", rev = "ed59a0985b62f4964b389b1666b73b03b39b6928" }
reth-node-ethereum = { git = "https://github.com/bnb-chain/reth.git", rev = "ed59a0985b62f4964b389b1666b73b03b39b6928", features = [
reth-network-p2p = { git = "https://github.com/bnb-chain/reth.git", branch = "develop-v2" }
reth-network-api = { git = "https://github.com/bnb-chain/reth.git", branch = "develop-v2" }
reth-node-ethereum = { git = "https://github.com/bnb-chain/reth.git", branch = "develop-v2", features = [
"test-utils",
] }
reth-network-peers = { git = "https://github.com/bnb-chain/reth.git", rev = "ed59a0985b62f4964b389b1666b73b03b39b6928" }
reth-payload-primitives = { git = "https://github.com/bnb-chain/reth.git", rev = "ed59a0985b62f4964b389b1666b73b03b39b6928" }
reth-ethereum-engine-primitives = { git = "https://github.com/bnb-chain/reth.git", rev = "ed59a0985b62f4964b389b1666b73b03b39b6928" }
reth-primitives = { git = "https://github.com/bnb-chain/reth.git", rev = "ed59a0985b62f4964b389b1666b73b03b39b6928" }
reth-primitives-traits = { git = "https://github.com/bnb-chain/reth.git", rev = "ed59a0985b62f4964b389b1666b73b03b39b6928" }
reth-provider = { git = "https://github.com/bnb-chain/reth.git", rev = "ed59a0985b62f4964b389b1666b73b03b39b6928", features = [
reth-network-peers = { git = "https://github.com/bnb-chain/reth.git", branch = "develop-v2" }
reth-payload-primitives = { git = "https://github.com/bnb-chain/reth.git", branch = "develop-v2" }
reth-ethereum-engine-primitives = { git = "https://github.com/bnb-chain/reth.git", branch = "develop-v2" }
reth-primitives-traits = { git = "https://github.com/bnb-chain/reth-core.git", branch = "v0.1.1-v2", default-features = false }
reth-codecs = { git = "https://github.com/bnb-chain/reth-core.git", branch = "v0.1.1-v2" }
reth-provider = { git = "https://github.com/bnb-chain/reth.git", branch = "develop-v2", features = [
"test-utils",
] }
reth-rpc-eth-api = { git = "https://github.com/bnb-chain/reth.git", rev = "ed59a0985b62f4964b389b1666b73b03b39b6928" }
reth-rpc-convert = { git = "https://github.com/bnb-chain/reth.git", rev = "ed59a0985b62f4964b389b1666b73b03b39b6928" }
reth-rpc-engine-api = { git = "https://github.com/bnb-chain/reth.git", rev = "ed59a0985b62f4964b389b1666b73b03b39b6928" }
reth-rpc-server-types = { git = "https://github.com/bnb-chain/reth.git", rev = "ed59a0985b62f4964b389b1666b73b03b39b6928" }
reth-trie-common = { git = "https://github.com/bnb-chain/reth.git", rev = "ed59a0985b62f4964b389b1666b73b03b39b6928" }
reth-trie-db = { git = "https://github.com/bnb-chain/reth.git", rev = "ed59a0985b62f4964b389b1666b73b03b39b6928" }
reth-tasks = { git = "https://github.com/bnb-chain/reth.git", rev = "ed59a0985b62f4964b389b1666b73b03b39b6928" }
reth-transaction-pool = { git = "https://github.com/bnb-chain/reth.git", rev = "ed59a0985b62f4964b389b1666b73b03b39b6928" }
reth-rpc-eth-api = { git = "https://github.com/bnb-chain/reth.git", branch = "develop-v2" }
reth-rpc-convert = { git = "https://github.com/bnb-chain/reth.git", branch = "develop-v2" }
reth-rpc-engine-api = { git = "https://github.com/bnb-chain/reth.git", branch = "develop-v2" }
reth-rpc-server-types = { git = "https://github.com/bnb-chain/reth.git", branch = "develop-v2" }
reth-trie-common = { git = "https://github.com/bnb-chain/reth.git", branch = "develop-v2" }
reth-trie-db = { git = "https://github.com/bnb-chain/reth.git", branch = "develop-v2" }
reth-tasks = { git = "https://github.com/bnb-chain/reth.git", branch = "develop-v2" }
reth-transaction-pool = { git = "https://github.com/bnb-chain/reth.git", branch = "develop-v2" }

# triedb dependencies
rust-eth-triedb = { git = "https://github.com/bnb-chain/reth-bsc-triedb.git", tag = "v0.0.2" }
rust-eth-triedb-common = { git = "https://github.com/bnb-chain/reth-bsc-triedb.git", tag = "v0.0.2", package = "rust-eth-triedb-common" }
rust-eth-triedb-pathdb = { git = "https://github.com/bnb-chain/reth-bsc-triedb.git", tag = "v0.0.2", package = "rust-eth-triedb-pathdb" }
rust-eth-triedb-state-trie = { git = "https://github.com/bnb-chain/reth-bsc-triedb.git", tag = "v0.0.2", package = "rust-eth-triedb-state-trie" }

revm = "34.0.0"
revm-context-interface = "14.0.0"
revm-database = "10.0.0"
revm = "36.0.0"
revm-database = "12.0.0"
revm-bytecode = "9.0.0"
revm-state = "10.0.0"
revm-primitives = { version = "22.1.0", default-features = false }
revm-interpreter = "34.0.0"
revm-database-interface = "10.0.0"

# alloy dependencies
alloy-evm = "0.26.3"

alloy-genesis = "1.1.3"
alloy-consensus = "1.1.3"
alloy-eips = "1.1.3"
alloy-network = "1.1.3"
alloy-rpc-types = { version = "1.1.3", features = ["engine"] }
alloy-rpc-types-eth = "1.1.3"
alloy-rpc-types-engine = "1.1.3"
alloy-rpc-types-mev = "1.1.3"
alloy-signer = "1.1.3"

alloy-chains = "0.2.23"
alloy-rlp = { version = "0.3.12", default-features = false, features = [
alloy-evm = "0.30.0"

alloy-genesis = "1.8.2"
alloy-consensus = "1.8.2"
alloy-eips = "1.8.2"
alloy-network = "1.8.2"
alloy-rpc-types = { version = "1.8.2", features = ["eth"] }
alloy-rpc-types-eth = "1.8.2"
alloy-rpc-types-engine = "1.8.2"
alloy-rpc-types-mev = "1.8.2"
alloy-signer = "1.8.2"

alloy-chains = "0.2.33"
alloy-rlp = { version = "0.3.13", default-features = false, features = [
"core-net",
] }

alloy-dyn-abi = "1.4.1"
alloy-json-abi = { version = "1.4.1", default-features = false }
alloy-primitives = { version = "1.4.1", default-features = false, features = [
alloy-dyn-abi = "1.5.6"
alloy-json-abi = { version = "1.5.6", default-features = false }
alloy-primitives = { version = "1.5.6", default-features = false, features = [
"map-foldhash",
] }
alloy-sol-macro = "1.4.1"
alloy-sol-types = { version = "1.4.1", default-features = false }
alloy-sol-macro = "1.5.6"
alloy-sol-types = { version = "1.5.6", default-features = false }

jsonrpsee = { version = "0.26.0", features = ["server", "client", "macros"] }
jsonrpsee-core = { version = "0.26.0", features = ["server"] }
Expand Down Expand Up @@ -182,7 +187,6 @@ dev = ["reth-cli-commands/arbitrary", "reth/dev", "revm/dev"]
asm-keccak = [
"reth/asm-keccak",
"reth-node-core/asm-keccak",
"reth-primitives/asm-keccak",
"reth-node-ethereum/asm-keccak",
]

Expand Down Expand Up @@ -238,4 +242,6 @@ lto = "fat"
codegen-units = 1

[dev-dependencies]
uuid = { version = "1", features = ["v4"] }
uuid = { version = "1", features = ["v4"] }


2 changes: 1 addition & 1 deletion src/chainspec/bsc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use alloy_primitives::BlockHash;
use reth_chainspec::{
make_genesis_header, BaseFeeParams, BaseFeeParamsKind, Chain, ChainSpec, Head, NamedChain,
};
use reth_primitives::SealedHeader;
use reth_primitives_traits::SealedHeader;
use std::str::FromStr;

pub fn bsc_mainnet() -> ChainSpec {
Expand Down
2 changes: 1 addition & 1 deletion src/chainspec/bsc_chapel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use alloy_primitives::{BlockHash, B256, U256};
use reth_chainspec::{
make_genesis_header, BaseFeeParams, BaseFeeParamsKind, Chain, ChainSpec, Head, NamedChain,
};
use reth_primitives::SealedHeader;
use reth_primitives_traits::SealedHeader;
use std::str::FromStr;

pub fn bsc_testnet() -> ChainSpec {
Expand Down
2 changes: 1 addition & 1 deletion src/chainspec/bsc_rialto.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use alloy_primitives::{BlockHash, U256, B256};
use reth_chainspec::{
make_genesis_header, BaseFeeParams, BaseFeeParamsKind, Chain, ChainSpec, Head,
};
use reth_primitives::SealedHeader;
use reth_primitives_traits::SealedHeader;
use std::str::FromStr;

pub const RIALTO_CHAIN_ID: u64 = 714;
Expand Down
2 changes: 1 addition & 1 deletion src/chainspec/local.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use crate::hardforks::bsc::BscHardfork;
use reth_chainspec::{
make_genesis_header, BaseFeeParams, BaseFeeParamsKind, Chain, ChainSpec, Head, NamedChain,
};
use reth_primitives::SealedHeader;
use reth_primitives_traits::SealedHeader;

pub fn bsc_local() -> ChainSpec {
let genesis = serde_json::from_str(include_str!("genesis_local.json"))
Expand Down
7 changes: 3 additions & 4 deletions src/consensus/parlia/snapshot.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ use super::vote::{VoteAddress, VoteAttestation, VoteData};
use crate::metrics::BscVoteMetrics;
use alloy_primitives::{Address, BlockHash, BlockNumber};
use once_cell::sync::Lazy;
use reth_db::table::{Compress, Decompress};
use reth_db::DatabaseError;
use reth_codecs::{Compress, Decompress, DecompressError};
use serde::{Deserialize, Serialize};

/// Number of blocks after which we persist snapshots to DB.
Expand Down Expand Up @@ -498,8 +497,8 @@ impl Compress for Snapshot {
}

impl Decompress for Snapshot {
fn decompress(value: &[u8]) -> Result<Self, DatabaseError> {
serde_cbor::from_slice(value).map_err(|_| DatabaseError::Decode)
fn decompress(value: &[u8]) -> Result<Self, DecompressError> {
serde_cbor::from_slice(value).map_err(DecompressError::new)
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/consensus/parlia/validation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use crate::consensus::eip4844::is_blob_eligible_block;
use super::{Parlia, EMPTY_WITHDRAWALS_HASH};
use alloy_consensus::{Header, Transaction, EMPTY_OMMER_ROOT_HASH};
use alloy_primitives::B256;
use reth_primitives::GotExpected;
use reth_primitives_traits::GotExpected;
use alloy_eips::eip4844::{DATA_GAS_PER_BLOB, MAX_DATA_GAS_PER_BLOCK_DENCUN};
use crate::BscBlock;
use reth_primitives_traits::Block;
Expand Down Expand Up @@ -297,7 +297,7 @@ impl<ChainSpec: EthChainSpec + BscHardforks + std::fmt::Debug + Send + Sync + 's
mod tests {
use super::*;
use alloy_primitives::B256;
use reth_primitives::SealedHeader as RethSealedHeader;
use reth_primitives_traits::SealedHeader as RethSealedHeader;

fn sealed(header: Header) -> SealedHeader {
RethSealedHeader::new(header, B256::ZERO)
Expand Down
2 changes: 1 addition & 1 deletion src/evm/api/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,7 @@ mod tests {
false,
false,
);
mismatched.inner.instruction = EthInstructions::new_mainnet();
mismatched.inner.instruction = EthInstructions::new_mainnet_with_spec(SpecId::default());

let mismatched_result = mismatched
.transact_one(tx)
Expand Down
27 changes: 12 additions & 15 deletions src/evm/handler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ use revm::{
transaction::TransactionType,
Cfg, ContextError, ContextTr, LocalContextTr, Transaction,
},
context_interface::{transaction::eip7702::AuthorizationTr, Block, JournalTr},
context_interface::{result::ResultGas, transaction::eip7702::AuthorizationTr, Block, JournalTr},
handler::{EthFrame, EvmTr, FrameResult, Handler, MainnetHandler},
inspector::{Inspector, InspectorHandler},
interpreter::{interpreter::EthInterpreter, Host, InitialAndFloorGas, SuccessOrHalt},
primitives::hardfork::SpecId,
};
use revm_context_interface::journaled_state::account::JournaledAccountTr;
use revm::context_interface::journaled_state::account::JournaledAccountTr;

use crate::consensus::SYSTEM_ADDRESS;
pub struct BscHandler<DB: revm::Database, INSP> {
Expand Down Expand Up @@ -249,6 +249,7 @@ impl<DB: Database, INSP> Handler for BscHandler<DB, INSP> {
&mut self,
evm: &mut Self::Evm,
result: FrameResult,
mut result_gas: ResultGas,
) -> Result<ExecutionResult<Self::HaltReason>, Self::Error> {
// Ensure we always pop the trace context, even on early returns.
struct PrecompileTracePopGuard;
Expand All @@ -265,15 +266,12 @@ impl<DB: Database, INSP> Handler for BscHandler<DB, INSP> {
Ok(_) => (),
}

// used gas with refund calculated.
let raw_gas_refunded = result.gas().refunded() as u64;
let raw_gas_spent = result.gas().spent();
let is_system_tx = {
let ctx = evm.ctx_ref();
ctx.tx().is_system_transaction
};
let gas_refunded = if is_system_tx { 0 } else { raw_gas_refunded };
let final_gas_used = raw_gas_spent - gas_refunded;
// System transactions never get a gas refund in BSC.
let is_system_tx = evm.ctx_ref().tx().is_system_transaction;
if is_system_tx {
result_gas.set_refunded(0);
}

let output = result.output();
let instruction_result = result.into_interpreter_result();

Expand All @@ -283,16 +281,15 @@ impl<DB: Database, INSP> Handler for BscHandler<DB, INSP> {
let result = match SuccessOrHalt::from(instruction_result.result) {
SuccessOrHalt::Success(reason) => ExecutionResult::Success {
reason,
gas_used: final_gas_used,
gas_refunded,
gas: result_gas,
logs,
output,
},
SuccessOrHalt::Revert => {
ExecutionResult::Revert { gas_used: final_gas_used, output: output.into_data() }
ExecutionResult::Revert { gas: result_gas, logs, output: output.into_data() }
}
SuccessOrHalt::Halt(reason) => {
ExecutionResult::Halt { reason, gas_used: final_gas_used }
ExecutionResult::Halt { reason, gas: result_gas, logs }
}
// Only two internal return flags.
flag @ (SuccessOrHalt::FatalExternalError | SuccessOrHalt::Internal(_)) => {
Expand Down
Loading
Loading