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
26 changes: 20 additions & 6 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,11 +1,25 @@
# Example configuration for Sepolia + Celestia Mocha.
TENDERMINT_RPC_URL=https://rpc.celestia-mocha.com/
CHAIN_ID=11155111
RPC_URL=https://ethereum-sepolia.publicnode.com/
CONTRACT_ADDRESS=
# Key for relaying to the contract.

# Optional: Key for relaying to the contract.
PRIVATE_KEY=

NETWORK_PRIVATE_KEY=
# Optional: Set if you're using a custom RPC URL.
NETWORK_RPC_URL=
NETWORK_RPC_URL=
NETWORK_PRIVATE_KEY=

BLOCK_UPDATE_INTERVAL=
LOOP_INTERVAL_MINS=

# Optional: Set if you're using the KMS relayer.
SECURE_RELAYER_API_KEY=
SECURE_RELAYER_ENDPOINT=
USE_KMS_RELAYER=

# Optional: Set if you're using `ChainConfig::from_env`.
# Only provide one of each.
CONTRACT_ADDRESS=
RPC_URL=

# Optional: Path to the `chains.json` file.
CHAINS_PATH=
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,8 @@ pgo-data.profdata
.idea

filtered_transactions/**.csv
filtered_transactions
filtered_transactions

chains.json
chains*.json
!chains.example.json
38 changes: 5 additions & 33 deletions Cargo.lock

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

2 changes: 0 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,8 @@ dotenv = "0.15.0"
subtle-encoding = "0.5.1"
anyhow = "1.0.82"
clap = { version = "4.0", features = ["derive", "env"] }
log = "0.4.21"
hex = "0.4.3"
futures = "0.3.30"
env_logger = "0.11.3"
serde_json = "1"
chrono = "0.4.38"
csv = "1.3.1"
Expand Down
7 changes: 7 additions & 0 deletions chains.example.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[
{
"name": "chain",
"rpc_url": "https://rpc.chain.com",
"blobstream_address": "0xA83ca7775Bc2889825BcDeDfFa5b758cf69e8794"
}
]
7 changes: 4 additions & 3 deletions script/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,16 @@ serde = { workspace = true }
serde_cbor = { workspace = true }
dotenv = { workspace = true }
subtle-encoding = { workspace = true }
anyhow = { workspace = true }
anyhow.workspace = true
clap = { workspace = true }
log = { workspace = true }
hex = { workspace = true }
futures = { workspace = true }
env_logger = { workspace = true }
serde_json = { workspace = true }
chrono = { workspace = true }
csv = { workspace = true }
async-trait = "0.1.86"
tracing = "0.1.41"
tracing-subscriber = "0.3.19"

[build-dependencies]
sp1-build = "4.0.0-rc.8"
7 changes: 6 additions & 1 deletion script/bin/costs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ use clap::Parser;
use futures::StreamExt;
use reqwest::Url;
use std::{cmp::Ordering, collections::HashMap, env, fs, str::FromStr};
use tracing_subscriber::EnvFilter;

#[derive(Parser, Debug, Clone)]
#[command(about = "Get transaction costs for an address in a given month")]
Expand Down Expand Up @@ -153,7 +154,11 @@ async fn get_receipts_for_chain(
async fn main() -> Result<()> {
env::set_var("RUST_LOG", "info");
dotenv::dotenv().ok();
env_logger::init();

// Set up tracing.
tracing_subscriber::fmt::fmt()
.with_env_filter(EnvFilter::from_default_env())
.init();

let args = CostScriptArgs::parse();

Expand Down
27 changes: 21 additions & 6 deletions script/bin/genesis.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,12 @@
//!

use clap::Parser;
use log::info;
use sp1_blobstream_script::util::TendermintRPCClient;
use sp1_blobstream_script::util::*;
use sp1_blobstream_script::TendermintRPCClient;
use sp1_sdk::{HashableKey, Prover, ProverClient};
use std::env;
use tracing::info;
use tracing_subscriber::EnvFilter;
const BLOBSTREAMX_ELF: &[u8] = include_bytes!("../../elf/blobstream-elf");

#[derive(Parser, Debug, Clone)]
Expand All @@ -25,24 +27,37 @@ pub struct GenesisArgs {
pub async fn main() {
env::set_var("RUST_LOG", "info");
dotenv::dotenv().ok();
env_logger::init();

// Set up tracing.
tracing_subscriber::fmt::fmt()
.with_env_filter(EnvFilter::from_default_env())
.init();

let data_fetcher = TendermintRPCClient::default();
let args = GenesisArgs::parse();

let client = ProverClient::builder().mock().build();
let (_pk, vk) = client.setup(BLOBSTREAMX_ELF);

if let Some(block) = args.block {
let header_hash = data_fetcher.fetch_header_hash(block).await;
let header_hash = fetch_header_hash(&data_fetcher, block)
.await
.expect("Failed to fetch genesis header hash");

info!(
"\nGENESIS_HEIGHT={:?}\nGENESIS_HEADER={}\nSP1_BLOBSTREAM_PROGRAM_VKEY={}\n",
block,
header_hash.to_string(),
vk.bytes32(),
);
} else {
let latest_block_height = data_fetcher.get_latest_block_height().await;
let header_hash = data_fetcher.fetch_header_hash(latest_block_height).await;
let latest_block_height = get_latest_block_height(&data_fetcher)
.await
.expect("Can get latest block hash");

let header_hash = fetch_header_hash(&data_fetcher, latest_block_height)
.await
.expect("Failed to fetch latest block header hash");

info!(
"\nGENESIS_HEIGHT={:?}\nGENESIS_HEADER={}\nSP1_BLOBSTREAM_PROGRAM_VKEY={}\n",
Expand Down
Loading
Loading