mirror of
https://github.com/logos-blockchain/logos-blockchain-pocs.git
synced 2026-05-02 15:43:11 +00:00
Update some nomos references to logos-blockchain
This commit is contained in:
parent
e938605511
commit
249b81b354
@ -1,10 +1,10 @@
|
||||
# Zone Executor to Nomos DA Communication
|
||||
# Zone Executor to Logos Blockchain DA Communication
|
||||
|
||||
Protocol for communication between the Zone Executor and Nomos DA using Protocol Buffers (protobuf).
|
||||
Protocol for communication between the Zone Executor and Logos Blockchain DA using Protocol Buffers (protobuf).
|
||||
|
||||
## Overview
|
||||
|
||||
The protocol defines messages used to request and respond to data dispersal, sampling operations, and session control within the Nomos DA system. The communication involves the exchange of blobs (binary large objects) and error handling for various operations.
|
||||
The protocol defines messages used to request and respond to data dispersal, sampling operations, and session control within the Logos Blockchain DA system. The communication involves the exchange of blobs (binary large objects) and error handling for various operations.
|
||||
|
||||
## Messages
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
|
||||
## Contents
|
||||
This folder contains code as implementation for a Proof-Of-Concept (PoC) for the subnets designed
|
||||
to address dispersal and sampling in Data Availability (DA) in Nomos.
|
||||
to address dispersal and sampling in Data Availability (DA) in Logos Blockchain.
|
||||
|
||||
Refer to the [Specification](https://www.notion.so/Runnable-DA-PoC-Specification-50f204f2ff0a41d09de4926962bbb4ef?d=9e9677e5536a46d49fe95f366b7c3320#308624c50f1a42769b6c142976999483)
|
||||
for the details of the design of this PoC.
|
||||
@ -53,7 +53,7 @@ After nodes are assigned to subnets, the network connections (via direct libp2p
|
||||
Each node in a subnet connects with every other node in that subnet.
|
||||
|
||||
Next, the executor is started. It is just a simulator. It creates random data for each subnet of `DATA_SIZE` length,
|
||||
simulating the columns generated by the NomosDA protocol.
|
||||
simulating the columns generated by the LogosBlockchainDA protocol.
|
||||
|
||||
It then establishes one connection per subnet and sends one packet of `DATA_SIZE` length on each of these connections.
|
||||
The executor also stores a hash of each packet per subnet.
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
# Large number of direct UDP connections test
|
||||
|
||||
In Nomos DA, the Executor has to maintain persistent connections to 4096 (or more for redundancy) DA Nodes for dispersing the encoded blobs. To see if such number of connections is feasable, a test mimicking high speed dispersal was conducted.
|
||||
In Logos Blockchain DA, the Executor has to maintain persistent connections to 4096 (or more for redundancy) DA Nodes for dispersing the encoded blobs. To see if such number of connections is feasable, a test mimicking high speed dispersal was conducted.
|
||||
|
||||
## Test setup
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@ edition = "2021"
|
||||
[dependencies]
|
||||
cl = { path = "../cl" }
|
||||
ledger_proof_statements = { path = "../ledger_proof_statements" }
|
||||
nomos_cl_risc0_proofs = { path = "../risc0_proofs" }
|
||||
cl_risc0_proofs = { path = "../risc0_proofs" }
|
||||
risc0-zkvm = { version = "1.0", features = ["prove", "metal"] }
|
||||
risc0-groth16 = { version = "1.0" }
|
||||
rand = "0.8.5"
|
||||
|
||||
@ -32,7 +32,7 @@ impl ProvedBundle {
|
||||
|
||||
let opts = risc0_zkvm::ProverOpts::succinct();
|
||||
let prove_info = prover
|
||||
.prove_with_opts(env, nomos_cl_risc0_proofs::BUNDLE_ELF, &opts)
|
||||
.prove_with_opts(env, cl_risc0_proofs::BUNDLE_ELF, &opts)
|
||||
.map_err(|_| Error::Risc0ProofFailed)?;
|
||||
|
||||
println!(
|
||||
@ -61,7 +61,7 @@ impl ProvedBundle {
|
||||
Vec::from_iter(self.bundle.partials.iter().map(|ptx| ptx.balance)) == bundle_public.balances
|
||||
&& self
|
||||
.risc0_receipt
|
||||
.verify(nomos_cl_risc0_proofs::BUNDLE_ID)
|
||||
.verify(cl_risc0_proofs::BUNDLE_ID)
|
||||
.is_ok()
|
||||
}
|
||||
}
|
||||
|
||||
@ -50,7 +50,7 @@ impl ConstraintProof {
|
||||
}
|
||||
|
||||
pub fn nop_constraint() -> Constraint {
|
||||
risc0_constraint(nomos_cl_risc0_proofs::CONSTRAINT_NOP_ID)
|
||||
risc0_constraint(cl_risc0_proofs::CONSTRAINT_NOP_ID)
|
||||
}
|
||||
|
||||
pub fn prove_nop(nf: cl::Nullifier, ptx_root: cl::PtxRoot) -> Self {
|
||||
@ -70,7 +70,7 @@ impl ConstraintProof {
|
||||
// This struct contains the receipt along with statistics about execution of the guest
|
||||
let opts = risc0_zkvm::ProverOpts::succinct();
|
||||
let prove_info = prover
|
||||
.prove_with_opts(env, nomos_cl_risc0_proofs::CONSTRAINT_NOP_ELF, &opts)
|
||||
.prove_with_opts(env, cl_risc0_proofs::CONSTRAINT_NOP_ELF, &opts)
|
||||
.unwrap();
|
||||
|
||||
println!(
|
||||
@ -82,6 +82,6 @@ impl ConstraintProof {
|
||||
// extract the receipt.
|
||||
let receipt = prove_info.receipt;
|
||||
|
||||
Self::from_risc0(nomos_cl_risc0_proofs::CONSTRAINT_NOP_ID, receipt)
|
||||
Self::from_risc0(cl_risc0_proofs::CONSTRAINT_NOP_ID, receipt)
|
||||
}
|
||||
}
|
||||
|
||||
@ -59,7 +59,7 @@ impl ProvedPartialTx {
|
||||
// This struct contains the receipt along with statistics about execution of the guest
|
||||
let opts = risc0_zkvm::ProverOpts::succinct();
|
||||
let prove_info = prover
|
||||
.prove_with_opts(env, nomos_cl_risc0_proofs::PTX_ELF, &opts)
|
||||
.prove_with_opts(env, cl_risc0_proofs::PTX_ELF, &opts)
|
||||
.map_err(|_| Error::Risc0ProofFailed)?;
|
||||
|
||||
println!(
|
||||
@ -109,9 +109,7 @@ impl ProvedPartialTx {
|
||||
}
|
||||
}
|
||||
|
||||
self.risc0_receipt
|
||||
.verify(nomos_cl_risc0_proofs::PTX_ID)
|
||||
.is_ok()
|
||||
self.risc0_receipt.verify(cl_risc0_proofs::PTX_ID).is_ok()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
[package]
|
||||
name = "nomos_cl_risc0_proofs"
|
||||
name = "cl_risc0_proofs"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
@ -8,4 +8,3 @@ risc0-build = { version = "1.0" }
|
||||
|
||||
[package.metadata.risc0]
|
||||
methods = ["bundle", "constraint_nop", "ptx"]
|
||||
|
||||
|
||||
@ -1,15 +1,19 @@
|
||||
[package]
|
||||
name = "nomos_pol_prover"
|
||||
name = "pol_prover"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
[dependencies]
|
||||
cl = { path = "../../../goas/cl/cl" }
|
||||
proof_statements = { path = "../proof_statements" }
|
||||
nomos_pol_risc0_proofs = { path = "../risc0_proofs" }
|
||||
pol_risc0_proofs = { path = "../risc0_proofs" }
|
||||
risc0-zkvm = { version = "1.0", features = ["prove", "metal"] }
|
||||
risc0-groth16 = { version = "1.0" }
|
||||
rand = "0.8.5"
|
||||
rand_core = "0.6.0"
|
||||
thiserror = "1.0.62"
|
||||
curve25519-dalek = {version = "4.1", features = ["serde", "digest", "rand_core"]}
|
||||
curve25519-dalek = { version = "4.1", features = [
|
||||
"serde",
|
||||
"digest",
|
||||
"rand_core",
|
||||
] }
|
||||
|
||||
@ -6,38 +6,42 @@ use proof_statements::proof_of_leadership::{LeaderPrivate, LeaderPublic};
|
||||
|
||||
const MAX_NOTE_COMMS: usize = 2usize.pow(8);
|
||||
|
||||
|
||||
pub struct ProvedLeader {
|
||||
pub leader: LeaderPublic,
|
||||
pub risc0_receipt: risc0_zkvm::Receipt,
|
||||
}
|
||||
|
||||
|
||||
impl ProvedLeader {
|
||||
pub fn prove(input: &cl::InputWitness, epoch_nonce: [u8;32], slot: u64, active_slot_coefficient: f64, total_stake: u64, note_commitments: &[cl::NoteCommitment]) -> Self {
|
||||
pub fn prove(
|
||||
input: &cl::InputWitness,
|
||||
epoch_nonce: [u8; 32],
|
||||
slot: u64,
|
||||
active_slot_coefficient: f64,
|
||||
total_stake: u64,
|
||||
note_commitments: &[cl::NoteCommitment],
|
||||
) -> Self {
|
||||
let note_cm = input.note_commitment();
|
||||
let cm_leaves = note_commitment_leaves(note_commitments);
|
||||
let cm_idx = note_commitments
|
||||
.iter()
|
||||
.position(|c| c == ¬e_cm)
|
||||
.unwrap();
|
||||
let cm_idx = note_commitments.iter().position(|c| c == ¬e_cm).unwrap();
|
||||
let note_cm_path = cl::merkle::path(cm_leaves, cm_idx);
|
||||
let cm_root = cl::merkle::root(cm_leaves);
|
||||
let cm_root = cl::merkle::root(cm_leaves);
|
||||
|
||||
let leader_private = LeaderPrivate {
|
||||
input: *input,
|
||||
input_cm_path: note_cm_path,
|
||||
};
|
||||
let leader_private = LeaderPrivate {
|
||||
input: *input,
|
||||
input_cm_path: note_cm_path,
|
||||
};
|
||||
|
||||
let leader_public = LeaderPublic::new(
|
||||
cm_root,
|
||||
epoch_nonce,
|
||||
slot,
|
||||
active_slot_coefficient,
|
||||
total_stake,
|
||||
input.nullifier(),
|
||||
input.evolve_output(cl::BalanceWitness::new(Scalar::ZERO)).commit_note(),
|
||||
);
|
||||
let leader_public = LeaderPublic::new(
|
||||
cm_root,
|
||||
epoch_nonce,
|
||||
slot,
|
||||
active_slot_coefficient,
|
||||
total_stake,
|
||||
input.nullifier(),
|
||||
input
|
||||
.evolve_output(cl::BalanceWitness::new(Scalar::ZERO))
|
||||
.commit_note(),
|
||||
);
|
||||
|
||||
let env = risc0_zkvm::ExecutorEnv::builder()
|
||||
.write(&leader_public)
|
||||
@ -56,7 +60,7 @@ impl ProvedLeader {
|
||||
// This struct contains the receipt along with statistics about execution of the guest
|
||||
let opts = risc0_zkvm::ProverOpts::succinct();
|
||||
let prove_info = prover
|
||||
.prove_with_opts(env, nomos_pol_risc0_proofs::PROOF_OF_LEADERSHIP_ELF, &opts)
|
||||
.prove_with_opts(env, pol_risc0_proofs::PROOF_OF_LEADERSHIP_ELF, &opts)
|
||||
.unwrap();
|
||||
|
||||
println!(
|
||||
@ -85,12 +89,11 @@ impl ProvedLeader {
|
||||
self.leader == proved_public_inputs
|
||||
&& self
|
||||
.risc0_receipt
|
||||
.verify(nomos_pol_risc0_proofs::PROOF_OF_LEADERSHIP_ID)
|
||||
.verify(pol_risc0_proofs::PROOF_OF_LEADERSHIP_ID)
|
||||
.is_ok()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
fn note_commitment_leaves(note_commitments: &[cl::NoteCommitment]) -> [[u8; 32]; MAX_NOTE_COMMS] {
|
||||
let note_comm_bytes = Vec::from_iter(note_commitments.iter().map(|c| c.as_bytes().to_vec()));
|
||||
let cm_leaves = cl::merkle::padded_leaves::<MAX_NOTE_COMMS>(¬e_comm_bytes);
|
||||
@ -115,29 +118,37 @@ mod test {
|
||||
};
|
||||
|
||||
let notes = vec![input.note_commitment()];
|
||||
let epoch_nonce = [0u8; 32];
|
||||
let slot = 0;
|
||||
let active_slot_coefficient = 0.05;
|
||||
let total_stake = 1000;
|
||||
let epoch_nonce = [0u8; 32];
|
||||
let slot = 0;
|
||||
let active_slot_coefficient = 0.05;
|
||||
let total_stake = 1000;
|
||||
|
||||
let mut expected_public_inputs = LeaderPublic::new(
|
||||
cl::merkle::root(note_commitment_leaves(¬es)),
|
||||
epoch_nonce,
|
||||
slot,
|
||||
active_slot_coefficient,
|
||||
total_stake,
|
||||
input.nullifier(),
|
||||
input.evolve_output(cl::BalanceWitness::new(Scalar::ZERO)).commit_note(),
|
||||
);
|
||||
cl::merkle::root(note_commitment_leaves(¬es)),
|
||||
epoch_nonce,
|
||||
slot,
|
||||
active_slot_coefficient,
|
||||
total_stake,
|
||||
input.nullifier(),
|
||||
input
|
||||
.evolve_output(cl::BalanceWitness::new(Scalar::ZERO))
|
||||
.commit_note(),
|
||||
);
|
||||
|
||||
while !expected_public_inputs.check_winning(&input) {
|
||||
expected_public_inputs.slot += 1;
|
||||
}
|
||||
while !expected_public_inputs.check_winning(&input) {
|
||||
expected_public_inputs.slot += 1;
|
||||
}
|
||||
|
||||
println!("slot={}", expected_public_inputs.slot);
|
||||
|
||||
let proved_leader = ProvedLeader::prove(&input, expected_public_inputs.epoch_nonce, expected_public_inputs.slot, active_slot_coefficient, total_stake, ¬es);
|
||||
println!("slot={}", expected_public_inputs.slot);
|
||||
|
||||
let proved_leader = ProvedLeader::prove(
|
||||
&input,
|
||||
expected_public_inputs.epoch_nonce,
|
||||
expected_public_inputs.slot,
|
||||
active_slot_coefficient,
|
||||
total_stake,
|
||||
¬es,
|
||||
);
|
||||
|
||||
assert_eq!(proved_leader.leader, expected_public_inputs);
|
||||
assert!(proved_leader.verify());
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
[package]
|
||||
name = "nomos_pol_risc0_proofs"
|
||||
name = "pol_risc0_proofs"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
|
||||
@ -4,8 +4,8 @@ edition = { workspace = true }
|
||||
|
||||
[dependencies]
|
||||
reth-ethereum = { workspace = true }
|
||||
executor-http-client = { git = "https://github.com/logos-co/nomos", branch = "master" }
|
||||
logos-blockchain-executor-http-client = { git = "https://github.com/logos-blockchain/logos-blockchain", branch = "master" }
|
||||
reqwest = "0.11"
|
||||
kzgrs-backend = { git = "https://github.com/logos-co/nomos", branch = "master" }
|
||||
logos-blockchain-kzgrs-backend = { git = "https://github.com/logos-blockchain/logos-blockchain", branch = "master" }
|
||||
bincode = "1"
|
||||
reth-tracing = { workspace = true }
|
||||
reth-tracing = { workspace = true }
|
||||
|
||||
@ -1,19 +1,17 @@
|
||||
use reth_ethereum::Block;
|
||||
use executor_http_client::{ExecutorHttpClient, Error};
|
||||
pub use executor_http_client::BasicAuthCredentials;
|
||||
use reqwest::Url;
|
||||
use reth_tracing::tracing::{info, error};
|
||||
use executor_http_client::{Error, ExecutorHttpClient};
|
||||
use kzgrs_backend::{dispersal::Metadata, encoder::DaEncoderParams};
|
||||
use reqwest::Url;
|
||||
use reth_ethereum::Block;
|
||||
use reth_tracing::tracing::{error, info};
|
||||
|
||||
pub struct Processor {
|
||||
da: NomosDa,
|
||||
da: LogosBlockchainDa,
|
||||
}
|
||||
|
||||
impl Processor {
|
||||
pub fn new(da: NomosDa) -> Self {
|
||||
Self {
|
||||
da
|
||||
}
|
||||
pub fn new(da: LogosBlockchainDa) -> Self {
|
||||
Self { da }
|
||||
}
|
||||
|
||||
pub async fn process_blocks(&mut self, new_blocks: impl Iterator<Item = Block>) {
|
||||
@ -26,8 +24,7 @@ impl Processor {
|
||||
std::iter::repeat(0)
|
||||
.take(DaEncoderParams::MAX_BLS12_381_ENCODING_CHUNK_SIZE - remainder),
|
||||
);
|
||||
if let Err(e) = self.da.disperse(blob, metadata).await
|
||||
{
|
||||
if let Err(e) = self.da.disperse(blob, metadata).await {
|
||||
error!("Failed to disperse block: {e}");
|
||||
} else {
|
||||
info!("Dispersed block: {:?}", block);
|
||||
@ -36,26 +33,22 @@ impl Processor {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
pub struct NomosDa {
|
||||
pub struct LogosBlockchainDa {
|
||||
url: Url,
|
||||
client: ExecutorHttpClient,
|
||||
}
|
||||
|
||||
|
||||
|
||||
impl NomosDa {
|
||||
impl LogosBlockchainDa {
|
||||
pub fn new(basic_auth: BasicAuthCredentials, url: Url) -> Self {
|
||||
Self {
|
||||
client: ExecutorHttpClient::new(Some(basic_auth)),
|
||||
url,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub async fn disperse(&self, data: Vec<u8>, metadata: Metadata) -> Result<(), Error> {
|
||||
self.client
|
||||
.publish_blob(self.url.clone(), data, metadata).await
|
||||
|
||||
.publish_blob(self.url.clone(), data, metadata)
|
||||
.await
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
use evm_processor::{Processor, NomosDa, BasicAuthCredentials};
|
||||
use evm_processor::{BasicAuthCredentials, LogosBlockchainDa, Processor};
|
||||
use futures::TryStreamExt as _;
|
||||
use reth::{
|
||||
api::{FullNodeTypes, NodePrimitives, NodeTypes},
|
||||
@ -10,7 +10,7 @@ use reth_ethereum::{
|
||||
};
|
||||
use reth_tracing::tracing::info;
|
||||
|
||||
const TESTNET_EXECUTOR: &str = "https://testnet.nomos.tech/node/3/";
|
||||
const TESTNET_EXECUTOR: &str = "https://devnet.blockchain.logos.co/node/3/";
|
||||
|
||||
async fn process_blocks<Node: FullNodeComponents>(
|
||||
mut ctx: ExExContext<Node>,
|
||||
@ -25,13 +25,15 @@ where
|
||||
continue;
|
||||
};
|
||||
info!(committed_chain = ?new.range(), "Received commit");
|
||||
processor.process_blocks(
|
||||
new.inner()
|
||||
.0
|
||||
.clone()
|
||||
.into_blocks()
|
||||
.map(reth_ethereum::primitives::RecoveredBlock::into_block),
|
||||
).await;
|
||||
processor
|
||||
.process_blocks(
|
||||
new.inner()
|
||||
.0
|
||||
.clone()
|
||||
.into_blocks()
|
||||
.map(reth_ethereum::primitives::RecoveredBlock::into_block),
|
||||
)
|
||||
.await;
|
||||
|
||||
ctx.events
|
||||
.send(ExExEvent::FinishedHeight(new.tip().num_hash()))
|
||||
@ -53,10 +55,13 @@ fn main() -> eyre::Result<()> {
|
||||
.unwrap()
|
||||
.run(|builder, _| {
|
||||
Box::pin(async move {
|
||||
let url = std::env::var("NOMOS_EXECUTOR").unwrap_or(TESTNET_EXECUTOR.to_string());
|
||||
let user = std::env::var("NOMOS_USER").unwrap_or_default();
|
||||
let password = std::env::var("NOMOS_PASSWORD").unwrap_or_default();
|
||||
let da = NomosDa::new( BasicAuthCredentials::new(user, Some(password)), url::Url::parse(&url).unwrap());
|
||||
let url = std::env::var("LB_EXECUTOR").unwrap_or(TESTNET_EXECUTOR.to_string());
|
||||
let user = std::env::var("LB_USER").unwrap_or_default();
|
||||
let password = std::env::var("LB_PASSWORD").unwrap_or_default();
|
||||
let da = LogosBlockchainDa::new(
|
||||
BasicAuthCredentials::new(user, Some(password)),
|
||||
url::Url::parse(&url).unwrap(),
|
||||
);
|
||||
let processor = Processor::new(da);
|
||||
let handle = Box::pin(
|
||||
builder
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
|
||||
# ZKSync Era-based Validium Deployment
|
||||
|
||||
This repository documents the deployment of a **ZKSync Era-based Validium proof-of-concept (PoC)** showcased by **Nomos** during **IFT All-Hands 2025** in Split.
|
||||
This repository documents the deployment of a **ZKSync Era-based Validium proof-of-concept (PoC)** showcased by **Logos Blockchain** during **IFT All-Hands 2025** in Split.
|
||||
|
||||
It uses a forked version of the ZKSync Era framework. You can find the repository here:
|
||||
👉 [logos-co/zksync-era][zksync-era-fork-repo]
|
||||
@ -17,9 +17,9 @@ For detailed documentation, including architecture and components of the framewo
|
||||
|
||||
---
|
||||
|
||||
## Deploy a ZKSync Era Validium with Nomos DA
|
||||
## Deploy a ZKSync Era Validium with Logos Blockchain DA
|
||||
|
||||
This guide walks you through setting up a **GPU-proved Validium L2** chain using **Nomos DA** and the forked ZKSync Era framework.
|
||||
This guide walks you through setting up a **GPU-proved Validium L2** chain using **Logos Blockchain DA** and the forked ZKSync Era framework.
|
||||
|
||||
If you need to modify any parameters, refer to the official ZKSync documentation to understand their implications.
|
||||
|
||||
@ -95,8 +95,8 @@ zkstack ecosystem create \
|
||||
--verbose
|
||||
```
|
||||
|
||||
3. When prompted, choose `"Nomos"` as the DA provider and enter:
|
||||
- Nomos DA disperal endpoint URL
|
||||
3. When prompted, choose `"Logos Blockchain"` as the DA provider and enter:
|
||||
- Logos Blockchain DA disperal endpoint URL
|
||||
- Username/password for HTTP basic auth according to the node configuration
|
||||
- A 64-character hex App ID (without the `0x`), e.g.:
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user