Skip to content
Open
Show file tree
Hide file tree
Changes from 6 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
65 changes: 60 additions & 5 deletions Cargo.lock

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

15 changes: 9 additions & 6 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ members = [
"modules/ismp/clients/ismp-optimism",
"modules/ismp/clients/polygon",
"modules/ismp/clients/tendermint",
"modules/ismp/clients/beacon-kit",
"modules/pallets/collator-manager",

# cryptography
Expand Down Expand Up @@ -114,6 +115,7 @@ members = [
"tesseract/consensus/relayer",
"tesseract/consensus/polygon",
"tesseract/consensus/tendermint",
"tesseract/consensus/beaconkit",


# Airdrop
Expand Down Expand Up @@ -209,11 +211,11 @@ impl-trait-for-tuples = "0.2.3"
ark-ec = { version = "0.4.2", default-features = false }
bls = { package = "bls_on_arkworks", version = "0.2.2", default-features = false }

# tendermint/cometbft
cometbft = { git = "https://github.com/cometbft/cometbft-rs", rev = "ac3db79c5807cd1d0b8b14a7b8199b8d79d6408d", default-features = false, features = ["secp256k1"]}
cometbft-rpc = { git = "https://github.com/cometbft/cometbft-rs", package = "cometbft-rpc", features = ["http-client", "secp256k1"], rev = "ac3db79c5807cd1d0b8b14a7b8199b8d79d6408d"}
cometbft-proto = { git = "https://github.com/cometbft/cometbft-rs", package = "cometbft-proto", rev = "ac3db79c5807cd1d0b8b14a7b8199b8d79d6408d", default-features = false }
cometbft-light-client-verifier = { git = "https://github.com/cometbft/cometbft-rs", package = "cometbft-light-client-verifier", rev = "ac3db79c5807cd1d0b8b14a7b8199b8d79d6408d", default-features = false }
# tendermint/cometbft (with BLS aggregation support for BeaconKit)
cometbft = { git = "https://github.com/polytope-labs/cometbft-rs", rev = "676cb035eaf14bfb7bd027edac66ad04c71c61b6", default-features = false, features = ["secp256k1"]}
cometbft-rpc = { git = "https://github.com/polytope-labs/cometbft-rs", package = "cometbft-rpc", features = ["http-client", "secp256k1"], rev = "676cb035eaf14bfb7bd027edac66ad04c71c61b6"}
cometbft-proto = { git = "https://github.com/polytope-labs/cometbft-rs", package = "cometbft-proto", rev = "676cb035eaf14bfb7bd027edac66ad04c71c61b6", default-features = false }
cometbft-light-client-verifier = { git = "https://github.com/polytope-labs/cometbft-rs", package = "cometbft-light-client-verifier", rev = "676cb035eaf14bfb7bd027edac66ad04c71c61b6", default-features = false }
ics23 = { version = "0.12.0", default-features = false }
ibc = { version = "0.57.0", default-features = false }
ibc-proto = { version = "0.52.0", default-features = false, package = "ibc-proto"}
Expand Down Expand Up @@ -258,7 +260,6 @@ 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 }

# consensus clients
ismp-bsc = { path = "./modules/ismp/clients/bsc", default-features = false }
ismp-sync-committee = { path = "./modules/ismp/clients/sync-committee", default-features = false }
Expand All @@ -268,6 +269,7 @@ ismp-arbitrum = { path = "modules/ismp/clients/ismp-arbitrum", default-features
ismp-optimism = { path = "modules/ismp/clients/ismp-optimism", default-features = false }
ismp-polygon = { path = "modules/ismp/clients/polygon", default-features = false }
ismp-tendermint = { path = "modules/ismp/clients/tendermint", default-features = false }
ismp-beacon-kit = { path = "modules/ismp/clients/beacon-kit", default-features = false }

# state machine clients
evm-state-machine = { path = "./modules/ismp/state-machines/evm", default-features = false }
Expand Down Expand Up @@ -324,6 +326,7 @@ tesseract-grandpa = { path = "tesseract/consensus/grandpa" }
tesseract-consensus = { path = "tesseract/consensus/relayer" }
tesseract-polygon = { path = "tesseract/consensus/polygon" }
tesseract-tendermint = { path = "tesseract/consensus/tendermint" }
tesseract-beaconkit = { path = "tesseract/consensus/beaconkit" }


[workspace.dependencies.codec]
Expand Down
25 changes: 24 additions & 1 deletion modules/consensus/tendermint/primitives/src/verifier.rs
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,8 @@ pub enum CodecPublicKey {
Ed25519(Vec<u8>),
/// Secp256k1 keys
Secp256k1(Vec<u8>),
/// BLS12-381 keys (for BeaconKit/Berachain)
Bls12_381(Vec<u8>),
}

impl AsRef<CodecConsensusProof> for CodecConsensusProof {
Expand Down Expand Up @@ -563,6 +565,8 @@ impl CodecPublicKey {
CodecPublicKey::Secp256k1(key_bytes) =>
cometbft::public_key::PublicKey::from_raw_secp256k1(key_bytes)
.ok_or_else(|| format!("Invalid Secp256k1 public key")),
CodecPublicKey::Bls12_381(key_bytes) =>
Ok(cometbft::public_key::PublicKey::Bls12_381(key_bytes.clone())),
}
}
}
Expand Down Expand Up @@ -657,6 +661,22 @@ impl From<&crate::CommitSig> for CodecCommitSig {
timestamp: timestamp.to_rfc3339(),
signature: signature.as_ref().map(|sig| sig.as_bytes().to_vec()),
},
// BLS aggregated commit signatures - convert to regular commit for Codec representation
crate::CommitSig::BlockIdFlagAggCommit { validator_address, timestamp, signature } |
crate::CommitSig::BlockIdFlagAggCommitAbsent { validator_address, timestamp, signature } =>
CodecCommitSig::BlockIdFlagCommit {
validator_address: validator_address.as_bytes().to_vec(),
timestamp: timestamp.to_rfc3339(),
signature: signature.as_ref().map(|sig| sig.as_bytes().to_vec()),
},
// BLS aggregated nil signatures - convert to regular nil for Codec representation
crate::CommitSig::BlockIdFlagAggNil { validator_address, timestamp, signature } |
crate::CommitSig::BlockIdFlagAggNilAbsent { validator_address, timestamp, signature } =>
CodecCommitSig::BlockIdFlagNil {
validator_address: validator_address.as_bytes().to_vec(),
timestamp: timestamp.to_rfc3339(),
signature: signature.as_ref().map(|sig| sig.as_bytes().to_vec()),
},
}
}
}
Expand All @@ -681,7 +701,10 @@ impl From<&cometbft::public_key::PublicKey> for CodecPublicKey {
let key_bytes = key.to_encoded_point(false);
CodecPublicKey::Secp256k1(key_bytes.as_bytes().to_vec())
},
_ => CodecPublicKey::Ed25519(pub_key.to_bytes().to_vec()),
cometbft::public_key::PublicKey::Bls12_381(key) =>
CodecPublicKey::Bls12_381(key.clone()),
// Handle any future key types as Ed25519 with raw bytes
_ => CodecPublicKey::Ed25519(pub_key.clone().to_bytes()),
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions modules/consensus/tendermint/verifier/src/sp_io_verifier.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@ pub fn validate_validator_set_hash(
.iter()
.map(|validator| {
let pub_key_bytes = {
if let Some(secp256k1_key) = validator.pub_key.secp256k1() {
if let Some(secp256k1_key) = validator.pub_key.clone().secp256k1() {
secp256k1_key.to_encoded_point(false).as_bytes().to_vec()
} else {
validator.pub_key.to_bytes()
validator.pub_key.clone().to_bytes()
}
};

Expand Down
46 changes: 46 additions & 0 deletions modules/ismp/clients/beacon-kit/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
[package]
name = "ismp-beacon-kit"
version = "0.1.0"
edition = "2021"
description = "ISMP Consensus Client for BeaconKit Consensus Protocol"
authors = ["Polytope Labs <hello@polytope.technology>"]
publish = false

[dependencies]
log = { workspace = true, default-features = false, optional = true }
anyhow = { workspace = true, default-features = false, optional = true }
scale-info = { version = "2.1.1", default-features = false, features = ["derive"] }
primitive-types = { workspace = true, default-features = false }
pallet-ismp-host-executive = { workspace = true, default-features = false }
sp-io = { workspace = true }
ismp = { workspace = true, default-features = false }
tendermint-verifier = { workspace = true, default-features = false }
tendermint-primitives = { workspace = true, default-features = false }
geth-primitives = { workspace = true, default-features = false }
codec = { workspace = true, default-features = false }
evm-state-machine = { workspace = true }
sync-committee-primitives = { workspace = true, default-features = false }
ssz-rs = { git = "https://github.com/polytope-labs/ssz-rs", branch = "main", default-features = false }
sha2 = { version = "0.10", default-features = false }
base64 = { version = "0.22.1", default-features = false }

[features]
default = ["std"]
std = [
"log/std",
"anyhow/std",
"scale-info/std",
"primitive-types/std",
"pallet-ismp-host-executive/std",
"sp-io/std",
"ismp/std",
"tendermint-verifier/std",
"tendermint-primitives/std",
"geth-primitives/std",
"codec/std",
"evm-state-machine/std",
"sync-committee-primitives/std",
"ssz-rs/default",
"ssz-rs/serde",
"base64/std"
]
Loading