Skip to content
Closed
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
177 changes: 160 additions & 17 deletions Cargo.lock

Large diffs are not rendered by default.

11 changes: 10 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ members = [
"crates/asm/txs/bridge-v1",
"crates/asm-types",
"crates/asm/worker",
"crates/btc-types",
"crates/btcio",
"crates/chainexec",
"crates/chaintsn",
Expand All @@ -37,11 +38,13 @@ members = [
"crates/ee-chain-types",
"crates/eectl",
"crates/evmexec",
"crates/identifiers",
"crates/key-derivation",
"crates/l1tx",
"crates/mpt",
"crates/ol-chain-types",
"crates/ol-chainstate-types",
"crates/params",
"crates/primitives",
"crates/proof-impl/checkpoint",
"crates/proof-impl/cl-stf",
Expand Down Expand Up @@ -141,6 +144,7 @@ strata-asm-txs-admin = { path = "crates/asm/txs/admin" }
strata-asm-txs-bridge-v1 = { path = "crates/asm/txs/bridge-v1" }
strata-asm-types = { path = "crates/asm-types" }
strata-asm-worker = { path = "crates/asm/worker" }
strata-btc-types = { path = "crates/btc-types" }
strata-btcio = { path = "crates/btcio" }
strata-chain-worker = { path = "crates/chain-worker" }
strata-chainexec = { path = "crates/chainexec" }
Expand All @@ -160,12 +164,14 @@ strata-ee-acct-types = { path = "crates/ee-acct-types" }
strata-ee-chain-types = { path = "crates/ee-chain-types" }
strata-eectl = { path = "crates/eectl" }
strata-evmexec = { path = "crates/evmexec" }
strata-identifiers = { path = "crates/identifiers" }
strata-key-derivation = { path = "crates/key-derivation" }
strata-l1tx = { path = "crates/l1tx" }
strata-mmr = { path = "crates/util/mmr" }
strata-mpt = { path = "crates/mpt" }
strata-ol-chain-types = { path = "crates/ol-chain-types" }
strata-ol-chainstate-types = { path = "crates/ol-chainstate-types" }
strata-params = { path = "crates/params" }
strata-primitives = { path = "crates/primitives" }
strata-proofimpl-checkpoint = { path = "crates/proof-impl/checkpoint" }
strata-proofimpl-cl-stf = { path = "crates/proof-impl/cl-stf" }
Expand Down Expand Up @@ -322,14 +328,17 @@ bdk_esplora = { version = "0.20.1", features = [
], default-features = false }
bdk_wallet = "1.0.0"
bincode = "1.3"
bitcoin = { version = "0.32.6", features = ["serde"] }
bitcoin = { version = "0.32.7", features = ["serde"] }
bitcoin-bosd = { version = "0.4.0", default-features = false }
bitcoin_hashes = "0.15"
bitcoin-primitives = "0.101"
bitcoind-async-client = "0.1.1"
bitvec = "1.0.1"
borsh = { version = "1.5.0", features = ["derive"] }
bytes = "1.6.0"
cfg-if = "1.0.0"
chrono = "0.4.38"
const-hex = "1.14"
clap = { version = "4.5.39", default-features = false, features = ["derive"] }
criterion = { version = "0.7.0", features = ["html_reports"] }
deadpool = "0.12.1"
Expand Down
2 changes: 1 addition & 1 deletion bin/alpen-cli/src/cmd/deposit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ use indicatif::ProgressBar;
use rand_core::OsRng;
use shrex::encode;
use strata_cli_common::errors::{DisplayableError, DisplayedError};
use strata_primitives::crypto::even_kp;
use strata_crypto::schnorr::even_kp;

use crate::{
alpen::AlpenWallet,
Expand Down
2 changes: 1 addition & 1 deletion bin/prover-client/src/errors.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use strata_db::DbError;
use strata_primitives::proof::ProofKey;
use strata_crypto::proof_vk::ProofKey;
use thiserror::Error;
use zkaleido::ZkVmError;

Expand Down
2 changes: 1 addition & 1 deletion bin/prover-client/src/operators/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ use std::sync::Arc;

use strata_db::traits::ProofDatabase;
use strata_db_store_sled::prover::ProofDBSled;
use strata_primitives::proof::{ProofContext, ProofKey};
use strata_crypto::proof_vk::{ProofContext, ProofKey};
use tokio::sync::Mutex;
use tracing::{error, info, instrument};
use zkaleido::{ZkVmHost, ZkVmProgram};
Expand Down
4 changes: 2 additions & 2 deletions bin/prover-client/src/prover_manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use std::{collections::HashMap, sync::Arc, time::Duration};

use strata_db::traits::ProofDatabase;
use strata_db_store_sled::prover::ProofDBSled;
use strata_primitives::proof::{ProofContext, ProofKey, ProofZkVm};
use strata_crypto::proof_vk::{ProofContext, ProofKey, ProofZkVm};
use tokio::{spawn, sync::Mutex, time::sleep};
use tracing::{debug, error, info, warn};

Expand Down Expand Up @@ -260,7 +260,7 @@ fn handle_checkpoint_error(chkpt_err: CheckpointError) -> ProvingTaskError {
mod tests {
use std::collections::HashMap;

use strata_primitives::proof::{ProofContext, ProofZkVm};
use strata_crypto::proof_vk::{ProofContext, ProofZkVm};
use strata_rpc_types::ProofKey;

use super::{handle_task_error, ProverManagerConfig, ProvingTaskError, ProvingTaskStatus};
Expand Down
2 changes: 1 addition & 1 deletion bin/prover-client/src/task_tracker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use std::collections::{hash_map::Entry, HashMap, HashSet};

use strata_db::traits::ProofDatabase;
use strata_db_store_sled::prover::ProofDBSled;
use strata_primitives::proof::{ProofContext, ProofKey, ProofZkVm};
use strata_crypto::proof_vk::{ProofContext, ProofKey, ProofZkVm};
use tracing::{info, warn};

use crate::{errors::ProvingTaskError, status::ProvingTaskStatus};
Expand Down
2 changes: 1 addition & 1 deletion bin/strata-client/src/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use std::io;

use alloy_rpc_types::engine::JwtError;
use format_serde_error::SerdeError;
use strata_primitives::params::ParamsError;
use strata_params::ParamsError;
use thiserror::Error;

#[derive(Debug, Error)]
Expand Down
2 changes: 1 addition & 1 deletion bin/strata-client/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ use strata_db::{
};
use strata_eectl::engine::{ExecEngineCtl, L2BlockRef};
use strata_evmexec::{engine::RpcExecEngineCtl, EngineRpcClient};
use strata_primitives::params::{Params, ProofPublishMode};
use strata_params::{Params, ProofPublishMode};
use strata_rpc_api::{
StrataAdminApiServer, StrataApiServer, StrataDebugApiServer, StrataSequencerApiServer,
};
Expand Down
4 changes: 2 additions & 2 deletions bin/strata-client/src/network.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use std::{
fs,
};

use strata_primitives::params::RollupParams;
use strata_params::RollupParams;
use tracing::warn;

/// Rollup params we initialize with if not overridden. Optionally set at compile time.
Expand Down Expand Up @@ -49,7 +49,7 @@ pub(crate) fn get_envvar_params() -> anyhow::Result<Option<RollupParams>> {

#[cfg(test)]
mod tests {
use strata_primitives::params::RollupParams;
use strata_params::RollupParams;

use super::DEFAULT_NETWORK_ROLLUP_PARAMS;

Expand Down
2 changes: 1 addition & 1 deletion bin/strata-dbtool/src/cmd/chainstate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use strata_db::{
types::IntentStatus,
};
use strata_ol_chainstate_types::WriteBatch;
use strata_primitives::l2::L2BlockId;
use strata_identifiers::L2BlockId;

use super::{
checkpoint::get_latest_checkpoint_entry,
Expand Down
2 changes: 1 addition & 1 deletion bin/strata-dbtool/src/cmd/l1.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use argh::FromArgs;
use strata_cli_common::errors::{DisplayableError, DisplayedError};
use strata_db::traits::{DatabaseBackend, L1Database};
use strata_primitives::l1::L1BlockId;
use strata_identifiers::L1BlockId;

use crate::{
cli::OutputFormat,
Expand Down
2 changes: 1 addition & 1 deletion bin/strata-dbtool/src/cmd/writer.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use argh::FromArgs;
use strata_cli_common::errors::{DisplayableError, DisplayedError};
use strata_db::traits::L1WriterDatabase;
use strata_primitives::buf::Buf32;
use strata_identifiers::Buf32;

use super::checkpoint::{get_checkpoint_at_index, get_checkpoint_index_range};
use crate::{
Expand Down
2 changes: 1 addition & 1 deletion bin/strata-dbtool/src/output/broadcaster.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use std::fmt;
use hex::encode_to_slice;
use serde::Serialize;
use strata_db::types::L1TxStatus;
use strata_primitives::buf::Buf32;
use strata_identifiers::Buf32;

use super::{helpers::porcelain_field, traits::Formattable};

Expand Down
2 changes: 1 addition & 1 deletion bin/strata-dbtool/src/output/l1.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//! L1 block formatting implementations

use strata_asm_types::{L1Tx, ProtocolOperation};
use strata_primitives::l1::L1BlockId;
use strata_identifiers::L1BlockId;

use super::{checkpoint::format_signed_checkpoint, helpers::porcelain_field, traits::Formattable};

Expand Down
3 changes: 3 additions & 0 deletions crates/asm-types/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@ version = "0.3.0-alpha.1"
workspace = true

[dependencies]
strata-btc-types.workspace = true
strata-checkpoint-types.workspace = true
strata-identifiers.workspace = true
strata-params.workspace = true
strata-primitives.workspace = true

arbitrary.workspace = true
Expand Down
94 changes: 2 additions & 92 deletions crates/asm-types/src/block.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
use arbitrary::Arbitrary;
use borsh::{BorshDeserialize, BorshSerialize};
use serde::{Deserialize, Serialize};
use strata_primitives::{
buf::Buf32,
l1::{L1BlockCommitment, L1BlockId},
};

use super::{L1HeaderRecord, L1Tx};
use strata_identifiers::{Buf32, L1BlockCommitment, L1BlockId};
use strata_btc_types::{L1HeaderRecord, L1Tx};

/// Reference to a Bitcoin transaction by block ID and transaction index.
#[derive(
Expand Down Expand Up @@ -45,89 +41,3 @@ impl From<(&L1BlockId, u32)> for L1TxRef {
Self::new(*val.0, val.1)
}
}

/// Bitcoin-anchored block manifest containing header record and transactions.
#[derive(
Clone, Debug, PartialEq, Eq, Arbitrary, BorshSerialize, BorshDeserialize, Deserialize, Serialize,
)]
pub struct L1BlockManifest {
/// The actual l1 record
record: L1HeaderRecord,

/// List of interesting transactions we took out.
txs: Vec<L1Tx>,

/// Epoch, which was used to generate this manifest.
epoch: u64,

/// Block height.
height: u64,
}

impl L1BlockManifest {
pub fn new(record: L1HeaderRecord, txs: Vec<L1Tx>, epoch: u64, height: u64) -> Self {
Self {
record,
txs,
epoch,
height,
}
}

pub fn record(&self) -> &L1HeaderRecord {
&self.record
}

pub fn txs(&self) -> &[L1Tx] {
&self.txs
}

pub fn txs_vec(&self) -> &Vec<L1Tx> {
&self.txs
}

pub fn epoch(&self) -> u64 {
self.epoch
}

pub fn blkid(&self) -> &L1BlockId {
&self.record.blkid
}

#[deprecated(note = "use .blkid()")]
pub fn block_hash(&self) -> L1BlockId {
*self.record.blkid()
}

pub fn height(&self) -> u64 {
self.height
}

pub fn header(&self) -> &[u8] {
self.record.buf()
}

pub fn txs_root(&self) -> Buf32 {
*self.record.wtxs_root()
}

pub fn get_prev_blockid(&self) -> L1BlockId {
self.record().parent_blkid()
}

pub fn into_record(self) -> L1HeaderRecord {
self.record
}
}

impl From<L1BlockManifest> for L1BlockCommitment {
fn from(value: L1BlockManifest) -> Self {
Self::from_height_u64(value.height(), *value.blkid()).expect("height should be valid")
}
}

impl From<&L1BlockManifest> for L1BlockCommitment {
fn from(value: &L1BlockManifest) -> Self {
Self::from_height_u64(value.height(), *value.blkid()).expect("height should be valid")
}
}
2 changes: 1 addition & 1 deletion crates/asm-types/src/header.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use arbitrary::Arbitrary;
use borsh::{BorshDeserialize, BorshSerialize};
use serde::{Deserialize, Serialize};
use strata_primitives::{buf::Buf32, hash, l1::L1BlockId};
use strata_identifiers::{Buf32, L1BlockId, hash};

/// Header and the wtxs root.
///
Expand Down
11 changes: 4 additions & 7 deletions crates/asm-types/src/header_verification.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,9 @@ use bitcoin::{
};
use borsh::{BorshDeserialize, BorshSerialize};
use serde::{Deserialize, Serialize};
use strata_primitives::{
buf::Buf32,
hash::compute_borsh_hash,
l1::{BtcParams, L1BlockCommitment, L1BlockId},
params::GenesisL1View,
};
use strata_identifiers::{Buf32, L1BlockCommitment, L1BlockId, hash::compute_borsh_hash};
use strata_params::GenesisL1View;
use strata_primitives::l1::BtcParams;
use thiserror::Error;

use super::{timestamp_store::TimestampStore, utils::compute_block_hash, BtcWork};
Expand Down Expand Up @@ -216,7 +213,7 @@ impl HeaderVerificationState {
self.last_verified_block.height().to_consensus_u32() + 1,
)
.expect("height + 1 should be valid");
self.last_verified_block = L1BlockCommitment::new(next_height, block_hash_raw.into());
self.last_verified_block = L1BlockCommitment::new_btc(next_height, block_hash_raw.into());

// Update the timestamps
self.update_timestamps(header.time);
Expand Down
Loading