Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
61710ae
pharos verifier
dharjeezy Jan 13, 2026
38fdd03
ismp pharos
dharjeezy Jan 13, 2026
63b3f7c
update state proof verification for pharos staking contract
dharjeezy Jan 14, 2026
883ae04
address more concerns
dharjeezy Jan 15, 2026
c62bbf1
get validator set from proof
dharjeezy Jan 15, 2026
17b7d06
no need to proof the current epoch slot
dharjeezy Jan 15, 2026
d94a728
use a BTreeSet to store validators,
dharjeezy Jan 18, 2026
d81e9b4
prover implementation
dharjeezy Jan 19, 2026
0751817
test for non epoch boundary consensus verification
dharjeezy Jan 21, 2026
fd7ced2
tesseract pharos
dharjeezy Jan 22, 2026
ff08841
pharos spv implementation
dharjeezy Feb 13, 2026
5c648d5
use sp_io for hashing
dharjeezy Feb 13, 2026
5eb6c40
non epoch boundary validator proof checks passes now
dharjeezy Feb 15, 2026
73f7b45
tesseract integration test
dharjeezy Feb 16, 2026
25dfb2d
Merge branch 'main' of github.com:polytope-labs/hyperbridge into dami…
dharjeezy Feb 16, 2026
1052faf
integration test completed
dharjeezy Feb 16, 2026
990b84f
skip pharos on lib
dharjeezy Feb 16, 2026
80e4df3
trigger
dharjeezy Feb 16, 2026
b218d5f
address concerns,
dharjeezy Feb 17, 2026
8fde1f6
dynamic BLS data slots
dharjeezy Feb 17, 2026
75237e9
direct use of state root
dharjeezy Feb 18, 2026
87c7f76
anyhow error variant
dharjeezy Feb 18, 2026
5b50852
address error related concerns
dharjeezy Feb 18, 2026
ddcce64
fix wasm error
dharjeezy Feb 18, 2026
535ec6e
switch to v2 staking contract, add support for non membership proofs
dharjeezy Apr 1, 2026
e2528df
merge main into dami/pharos-network
dharjeezy Apr 2, 2026
371a98e
nits
dharjeezy Apr 2, 2026
c8a7852
get epoch length from the staking contract slot
dharjeezy Apr 2, 2026
c374d23
pharos evm client for state proof fetch
dharjeezy Apr 2, 2026
bbe6edc
address all findings
dharjeezy Apr 2, 2026
bf07643
account proof, CI test, deduplication
dharjeezy Apr 2, 2026
0636c42
run ci on this branch
dharjeezy Apr 2, 2026
e8f3693
change workflow
dharjeezy Apr 2, 2026
2ee6a58
some fixes to proof verification
Wizdave97 Apr 3, 2026
067319d
hack for rate limiting
dharjeezy Apr 3, 2026
c235554
some nits
Wizdave97 Apr 3, 2026
8758b2d
Merge branch 'dami/pharos-network' of github.com:polytope-labs/hyperb…
Wizdave97 Apr 3, 2026
83c3caf
always use key path to verify existence proofs
Wizdave97 Apr 4, 2026
cbbe522
some deduplication
Wizdave97 Apr 4, 2026
6e0668a
some fixes
seunlanlege Apr 4, 2026
93e289e
fix hash_internal_node
seunlanlege Apr 4, 2026
38ac08a
fix pharos tests
seunlanlege Apr 4, 2026
b1cee85
pull_request_target
seunlanlege Apr 4, 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
44 changes: 44 additions & 0 deletions Cargo.lock

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

4 changes: 4 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ members = [
"modules/consensus/tendermint/prover",
"modules/consensus/tendermint/primitives",
"modules/consensus/tendermint/ics23-primitives",
"modules/consensus/pharos/primitives",
"modules/consensus/pharos/verifier",
"modules/trees/ethereum",
"modules/pallets/mmr",
"modules/pallets/mmr/primitives",
Expand Down Expand Up @@ -260,6 +262,8 @@ tendermint-verifier = { path = "./modules/consensus/tendermint/verifier", defaul
tendermint-primitives = { path = "./modules/consensus/tendermint/primitives", default-features = false }
tendermint-prover = { path = "./modules/consensus/tendermint/prover", default-features = false }
tendermint-ics23-primitives = { path = "./modules/consensus/tendermint/ics23-primitives", default-features = false }
pharos-primitives = { path = "./modules/consensus/pharos/primitives", default-features = false }
pharos-verifier = { path = "./modules/consensus/pharos/verifier", default-features = false }

# consensus clients
ismp-bsc = { path = "./modules/ismp/clients/bsc", default-features = false }
Expand Down
34 changes: 34 additions & 0 deletions modules/consensus/pharos/primitives/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
[package]
name = "pharos-primitives"
version = "0.1.0"
edition = "2021"
description = "Primitive types for Pharos consensus verifier"
authors = ["Polytope Labs <hello@polytope.technology>"]
publish = false

[dependencies]
codec = { workspace = true, features = ["derive"] }
alloy-primitives = { workspace = true }
alloy-rlp = { workspace = true }
alloy-rlp-derive = { workspace = true }
sync-committee-primitives = { workspace = true, default-features = false }
primitive-types = { workspace = true, features = ["serde_no_std", "impl-codec"] }
hex-literal = { workspace = true }
serde = { workspace = true, optional = true, features = ["derive"] }
anyhow = { workspace = true, default-features = false }
geth-primitives = { workspace = true, default-features = false }
ismp = { workspace = true, default-features = false }

[features]
default = ["std"]
std = [
"codec/std",
"alloy-primitives/std",
"alloy-rlp/std",
"sync-committee-primitives/std",
"primitive-types/std",
"anyhow/std",
"serde",
"geth-primitives/std",
"ismp/std",
]
109 changes: 109 additions & 0 deletions modules/consensus/pharos/primitives/src/constants.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
// Copyright (C) Polytope Labs Ltd.
// SPDX-License-Identifier: Apache-2.0

// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

//! Constants and configuration for Pharos consensus.

use alloy_primitives::Address;

/// Re-export BLS types from sync-committee-primitives
pub use sync_committee_primitives::constants::{
BlsPublicKey, BlsSignature, BLS_PUBLIC_KEY_BYTES_LEN, BLS_SIGNATURE_BYTES_LEN,
};

/// The staking contract address where validator set is stored.
/// Address: 0x4100000000000000000000000000000000000000
pub const STAKING_CONTRACT_ADDRESS: Address =
Address::new([0x41, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]);

/// Consensus ID for Pharos network
pub const PHAROS_CONSENSUS_ID: [u8; 4] = *b"PHAR";

/// Mainnet epoch length in seconds (4 hours)
pub const MAINNET_EPOCH_LENGTH_SECS: u64 = 4 * 60 * 60; // 14400 seconds

/// Testnet (Atlantic) epoch length in seconds (0.5 hours)
pub const TESTNET_EPOCH_LENGTH_SECS: u64 = 30 * 60; // 1800 seconds

/// Configuration trait for Pharos network parameters.
pub trait Config: Clone + Send + Sync {
/// The epoch length in seconds
const EPOCH_LENGTH_SECS: u64;

/// The epoch length in blocks (derived from epoch length and block time)
const EPOCH_LENGTH_BLOCKS: u64;

/// The chain ID for this network
const CHAIN_ID: u64;

/// Network identifier
const ID: [u8; 4];

/// Calculate the epoch number for a given block number
fn compute_epoch(block_number: u64) -> u64 {
block_number / Self::EPOCH_LENGTH_BLOCKS
}

/// Check if a block is an epoch boundary block (last block of an epoch).
///
/// The epoch boundary is defined as the last block of an epoch, i.e.,
/// `(block_number + 1) % epoch_length == 0`.
///
/// At epoch boundaries, the validator set for the next epoch is finalized
fn is_epoch_boundary(block_number: u64) -> bool {
(block_number + 1) % Self::EPOCH_LENGTH_BLOCKS == 0
}

/// Get the first block number of the next epoch
fn next_epoch_start(current_block: u64) -> u64 {
let current_epoch = Self::compute_epoch(current_block);
(current_epoch + 1) * Self::EPOCH_LENGTH_BLOCKS
}
}

/// Pharos Mainnet configuration
#[derive(Clone, Default, Debug)]
pub struct Mainnet;

impl Config for Mainnet {
/// 4 hours epoch length
const EPOCH_LENGTH_SECS: u64 = MAINNET_EPOCH_LENGTH_SECS;

/// With ~1 second finality (sub-second), assuming 1 block per second
/// 4 hours = 14400 blocks
const EPOCH_LENGTH_BLOCKS: u64 = 14400;

/// Mainnet chain ID - TBD
/// Placeholder based on testnet pattern
const CHAIN_ID: u64 = 688600;

const ID: [u8; 4] = PHAROS_CONSENSUS_ID;
}

/// Pharos Testnet configuration
#[derive(Clone, Default, Debug)]
pub struct Testnet;

impl Config for Testnet {
/// 0.5 hours epoch length
const EPOCH_LENGTH_SECS: u64 = TESTNET_EPOCH_LENGTH_SECS;

/// With ~1 second finality, 0.5 hours = 1800 blocks
const EPOCH_LENGTH_BLOCKS: u64 = 1800;

/// Pharos Testnet chain ID
const CHAIN_ID: u64 = 688689;

const ID: [u8; 4] = PHAROS_CONSENSUS_ID;
}
23 changes: 23 additions & 0 deletions modules/consensus/pharos/primitives/src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
// Copyright (C) Polytope Labs Ltd.
// SPDX-License-Identifier: Apache-2.0

// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#![cfg_attr(not(feature = "std"), no_std)]

extern crate alloc;

pub mod constants;
pub mod types;

pub use constants::*;
pub use types::*;
Loading