Skip to content
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
808 changes: 808 additions & 0 deletions boreth-test-cases.md

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion crates/bor-chainspec/src/genesis.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ use reth_chainspec::ChainSpecBuilder;
use reth_ethereum_forks::{ChainHardforks, EthereumHardfork, ForkCondition};

use crate::chainspec::{BorChainSpec, bor_mainnet_chainspec};
use crate::BorHardfork;

/// Berlin and London activated together on Polygon PoS mainnet.
const BERLIN_BLOCK: u64 = 29_231_616;
Expand Down Expand Up @@ -40,6 +39,7 @@ pub fn bor_mainnet_genesis() -> BorChainSpec {
#[cfg(test)]
mod tests {
use super::*;
use crate::BorHardfork;
use reth_chainspec::EthChainSpec;
use reth_ethereum_forks::Hardforks;

Expand Down
2 changes: 1 addition & 1 deletion crates/bor-consensus/src/block_validation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
//! Pre-execution validation checks body constraints, extra data at span starts, and seal.
//! Post-execution validation verifies state root, receipt root, and gas used.

use alloy_primitives::{Address, B256, U256};
use alloy_primitives::{Address, B256};
use crate::extra_data::ExtraData;
use crate::validation::ValidationError;

Expand Down
3 changes: 2 additions & 1 deletion crates/bor-consensus/src/snapshot.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//! Bor consensus snapshot: tracks validator set and recent signers at a block.

use alloy_primitives::{Address, B256};
use bor_primitives::{Validator, ValidatorSet};
use bor_primitives::ValidatorSet;
use std::collections::BTreeMap;

/// Snapshot of the Bor consensus state at a given block.
Expand Down Expand Up @@ -65,6 +65,7 @@ impl BorSnapshot {
mod tests {
use super::*;
use alloy_primitives::address;
use bor_primitives::Validator;

fn test_validator(id: u64, addr: &str) -> Validator {
let a = addr.parse::<Address>().unwrap();
Expand Down
4 changes: 2 additions & 2 deletions crates/bor-consensus/src/validation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
//! - Signer must not have signed recently (anti-double-sign)

use alloy_primitives::{Address, B256, U256};
use crate::difficulty::{calculate_difficulty, is_inturn};
use crate::difficulty::calculate_difficulty;
use crate::extra_data::ExtraData;
use crate::seal::ecrecover_seal;

Expand Down Expand Up @@ -131,7 +131,7 @@ pub fn validate_header(
// 8. Anti-double-sign: signer must not have signed recently
let limit = (authorized_signers.len() / 2 + 1) as u64;
let cutoff = params.number.saturating_sub(limit);
for (&block, &recent_signer) in recent_signers.range(cutoff..params.number) {
for (&_block, &recent_signer) in recent_signers.range(cutoff..params.number) {
if recent_signer == signer {
return Err(ValidationError::RecentlySigned(signer));
}
Expand Down
1 change: 1 addition & 0 deletions crates/bor-evm/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ use bor_chainspec::BorHardfork;
pub const P256_VERIFY_ADDRESS: Address = address!("0000000000000000000000000000000000000100");

/// KZG point evaluation precompile address (never active on Bor).
#[cfg(test)]
const KZG_ADDRESS: Address = address!("000000000000000000000000000000000000000a");

/// BorEvmConfig holds chain spec for fork-aware EVM configuration.
Expand Down
5 changes: 3 additions & 2 deletions crates/bor-node/src/node.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
//! BorNode: wires all components together.

use alloy_primitives::{Address, B256};
use alloy_primitives::B256;
use bor_chainspec::BorChainSpec;
use bor_consensus::BorSnapshot;
use bor_storage::persistence::{InMemorySpanStore, InMemorySnapshotStore, SpanStore, SnapshotStore};
use bor_storage::persistence::{InMemorySpanStore, InMemorySnapshotStore, SnapshotStore};
use crate::config::{BorNodeConfig, BorNetwork};
use std::sync::{Arc, RwLock};

Expand Down Expand Up @@ -67,6 +67,7 @@ impl BorNode {
#[cfg(test)]
mod tests {
use super::*;
use alloy_primitives::Address;
use bor_primitives::{Validator, ValidatorSet};

fn test_validator_set() -> ValidatorSet {
Expand Down
2 changes: 1 addition & 1 deletion crates/bor-payload/src/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
//! sprint/span boundaries, and constructs the complete block payload.

use alloy_primitives::{Address, Bytes, U256};
use bor_evm::{SystemTxPlan, plan_system_txs, execute_system_tx_plan, SystemCallRecord};
use bor_evm::{plan_system_txs, execute_system_tx_plan, SystemCallRecord};

/// Configuration for building a payload.
#[derive(Debug, Clone)]
Expand Down
2 changes: 1 addition & 1 deletion crates/bor-storage/src/receipt_key.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ pub fn bor_receipt_key(block_hash: &B256) -> B256 {

/// Compute the legacy Bor receipt key from block number
pub fn bor_receipt_key_legacy(block_number: u64) -> B256 {
alloy_primitives::keccak256(&block_number.to_be_bytes())
alloy_primitives::keccak256(block_number.to_be_bytes())
}

#[cfg(test)]
Expand Down
2 changes: 1 addition & 1 deletion crates/bor-storage/src/tables.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ pub const BOR_TABLES: &[&str] = &[
/// BorReceipts: B256 (receipt_key) -> Vec<u8> (RLP bytes)
/// BorTxLookup: B256 (tx_hash) -> (u64, u64) (block_number, tx_index)
/// BorMeta: u64 (meta_key) -> u64 (value)

///
/// Meta keys
pub const META_LAST_SPAN_ID: u64 = 0;
pub const META_LAST_SNAPSHOT_BLOCK: u64 = 1;
Expand Down
4 changes: 2 additions & 2 deletions crates/heimdall-client/src/cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ impl SpanCache {
let span_id = span.id;

// If already present, update in place and promote.
if self.spans.contains_key(&span_id) {
self.spans.insert(span_id, span);
if let std::collections::hash_map::Entry::Occupied(mut e) = self.spans.entry(span_id) {
e.insert(span);
self.touch(span_id);
return;
}
Expand Down
Loading