Skip to content

Commit

Permalink
Merge branch 'feat/gnosis-backup' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
zengzengzenghuy authored Mar 3, 2025
2 parents 1381acf + f4634d3 commit a18d2f4
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 16 deletions.
2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,12 @@ sp1-helios-program = { path = "program" }
sp1-helios-primitives = { path = "primitives" }

# helios

helios = { git = "https://github.com/a16z/helios", tag = "0.8.1" }
helios-consensus-core = { git = "https://github.com/a16z/helios", tag = "0.8.1" }
helios-ethereum = { git = "https://github.com/a16z/helios", tag = "0.8.1" }


# general
dotenv = "0.15.0"
eyre = "0.6.12"
Expand Down
Binary file added elf/riscv32im-succinct-zkvm-elf
Binary file not shown.
8 changes: 4 additions & 4 deletions primitives/src/types.rs
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
use alloy_primitives::B256;
use alloy_sol_types::sol;
use helios_consensus_core::consensus_spec::MainnetConsensusSpec;
use helios_consensus_core::consensus_spec::GnosisConsensusSpec;
use helios_consensus_core::types::Forks;
use helios_consensus_core::types::{FinalityUpdate, LightClientStore, Update};
use serde::{Deserialize, Serialize};

#[derive(Serialize, Deserialize, Debug)]
pub struct ProofInputs {
pub sync_committee_updates: Vec<Update<MainnetConsensusSpec>>,
pub finality_update: FinalityUpdate<MainnetConsensusSpec>,
pub sync_committee_updates: Vec<Update<GnosisConsensusSpec>>,
pub finality_update: FinalityUpdate<GnosisConsensusSpec>,
pub expected_current_slot: u64,
pub store: LightClientStore<MainnetConsensusSpec>,
pub store: LightClientStore<GnosisConsensusSpec>,
pub genesis_root: B256,
pub forks: Forks,
}
Expand Down
6 changes: 3 additions & 3 deletions script/bin/genesis.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,9 @@ pub async fn main() -> Result<()> {
.tree_hash_root();
let genesis_time = helios_client.config.chain.genesis_time;
let genesis_root = helios_client.config.chain.genesis_root;
const SECONDS_PER_SLOT: u64 = 12;
const SLOTS_PER_EPOCH: u64 = 32;
const SLOTS_PER_PERIOD: u64 = SLOTS_PER_EPOCH * 256;
const SECONDS_PER_SLOT: u64 = 5;
const SLOTS_PER_EPOCH: u64 = 16;
const SLOTS_PER_PERIOD: u64 = SLOTS_PER_EPOCH * 512;
let source_chain_id: u64 = match env::var("SOURCE_CHAIN_ID") {
Ok(val) => val.parse().unwrap(),
Err(_) => {
Expand Down
4 changes: 2 additions & 2 deletions script/bin/operator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use alloy::{
};
use alloy_primitives::{B256, U256};
use anyhow::Result;
use helios_consensus_core::consensus_spec::MainnetConsensusSpec;
use helios_consensus_core::consensus_spec::GnosisConsensusSpec;
use helios_ethereum::consensus::Inner;
use helios_ethereum::rpc::http_rpc::HttpRpc;
use helios_ethereum::rpc::ConsensusRpc;
Expand Down Expand Up @@ -98,7 +98,7 @@ impl SP1HeliosOperator {
/// Fetch values and generate an 'update' proof for the SP1 Helios contract.
async fn request_update(
&self,
mut client: Inner<MainnetConsensusSpec, HttpRpc>,
mut client: Inner<GnosisConsensusSpec, HttpRpc>,
) -> Result<Option<SP1ProofWithPublicValues>> {
// Fetch required values.
let provider = ProviderBuilder::new().on_http(self.rpc_url.clone());
Expand Down
14 changes: 7 additions & 7 deletions script/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use alloy_primitives::B256;
use helios_consensus_core::{
calc_sync_period,
consensus_spec::MainnetConsensusSpec,
consensus_spec::GnosisConsensusSpec,
types::{BeaconBlock, Update},
};
use helios_ethereum::rpc::ConsensusRpc;
Expand All @@ -19,10 +19,10 @@ pub const MAX_REQUEST_LIGHT_CLIENT_UPDATES: u8 = 128;

/// Fetch updates for client
pub async fn get_updates(
client: &Inner<MainnetConsensusSpec, HttpRpc>,
) -> Vec<Update<MainnetConsensusSpec>> {
client: &Inner<GnosisConsensusSpec, HttpRpc>,
) -> Vec<Update<GnosisConsensusSpec>> {
let period =
calc_sync_period::<MainnetConsensusSpec>(client.store.finalized_header.beacon().slot);
calc_sync_period::<GnosisConsensusSpec>(client.store.finalized_header.beacon().slot);

let updates = client
.rpc
Expand Down Expand Up @@ -65,21 +65,21 @@ pub async fn get_checkpoint(slot: u64) -> B256 {
let (block_send, _) = channel(256);
let (finalized_block_send, _) = watch::channel(None);
let (channel_send, _) = watch::channel(None);
let client = Inner::<MainnetConsensusSpec, HttpRpc>::new(
let client = Inner::<GnosisConsensusSpec, HttpRpc>::new(
&consensus_rpc,
block_send,
finalized_block_send,
channel_send,
Arc::new(config),
);

let block: BeaconBlock<MainnetConsensusSpec> = client.rpc.get_block(slot).await.unwrap();
let block: BeaconBlock<GnosisConsensusSpec> = client.rpc.get_block(slot).await.unwrap();

B256::from_slice(block.tree_hash_root().as_ref())
}

/// Setup a client from a checkpoint.
pub async fn get_client(checkpoint: B256) -> Inner<MainnetConsensusSpec, HttpRpc> {
pub async fn get_client(checkpoint: B256) -> Inner<GnosisConsensusSpec, HttpRpc> {
let consensus_rpc = std::env::var("SOURCE_CONSENSUS_RPC_URL").unwrap();
let chain_id = std::env::var("SOURCE_CHAIN_ID").unwrap();
let network = Network::from_chain_id(chain_id.parse().unwrap()).unwrap();
Expand Down

0 comments on commit a18d2f4

Please sign in to comment.