Skip to content

Commit

Permalink
Refactor/btcio config and other renamings (#595)
Browse files Browse the repository at this point in the history
* Rename inscription -> envelope

* Rename crate tx-parser to l1tx

* Move envelope builder and parse in envelope module

* Rename blob to payload

* Add L1Payload type with data and payload_type

* Add checkpoint and da tags to params and data tools

* Refactor btcio config

* Fix tests

* Some cleanups

* Rename state::da_blob module and move to primitives

* Split primitives l1 module

* Update/Add docs

* Rename PayloadSpec -> BlobSpec, PayloadDest -> BlobDest

* Split btcio config to reader and writer

* Some more renamings

* Fix failing ci

---------

Co-authored-by: Bibek Pandey <[email protected]>
  • Loading branch information
bewakes and Bibek Pandey authored Jan 15, 2025
1 parent 89578af commit c527f70
Show file tree
Hide file tree
Showing 95 changed files with 1,497 additions and 1,315 deletions.
56 changes: 28 additions & 28 deletions Cargo.lock

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

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ members = [
"crates/eectl",
"crates/evmexec",
"crates/key-derivation",
"crates/l1tx",
"crates/primitives",
"crates/zkvm/adapters/risc0",
"crates/zkvm/adapters/sp1",
Expand Down Expand Up @@ -42,7 +43,6 @@ members = [
"crates/sync",
"crates/tasks",
"crates/test-utils",
"crates/tx-parser",
"crates/util/mmr",
"crates/util/shrex",
"crates/vtxjmt",
Expand Down Expand Up @@ -90,6 +90,7 @@ strata-db = { path = "crates/db" }
strata-eectl = { path = "crates/eectl" }
strata-evmexec = { path = "crates/evmexec" }
strata-key-derivation = { path = "crates/key-derivation" }
strata-l1tx = { path = "crates/l1tx" }
strata-mmr = { path = "crates/util/mmr" }
strata-native-zkvm-adapter = { path = "crates/zkvm/adapters/native" }
strata-primitives = { path = "crates/primitives" }
Expand Down Expand Up @@ -118,7 +119,6 @@ strata-storage = { path = "crates/storage" }
strata-sync = { path = "crates/sync" }
strata-tasks = { path = "crates/tasks" }
strata-test-utils = { path = "crates/test-utils" }
strata-tx-parser = { path = "crates/tx-parser" }
strata-zkvm = { path = "crates/zkvm/zkvm" }
strata-zkvm-hosts = { path = "crates/zkvm/hosts" }

Expand Down
2 changes: 1 addition & 1 deletion bin/bridge-client/src/modes/operator/bootstrap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ use strata_bridge_exec::{
};
use strata_bridge_sig_manager::prelude::SignatureManager;
use strata_bridge_tx_builder::prelude::TxBuildContext;
use strata_btcio::rpc::{traits::Reader, BitcoinClient};
use strata_btcio::rpc::{traits::ReaderRpc, BitcoinClient};
use strata_primitives::bridge::OperatorIdx;
use strata_rocksdb::{
bridge::db::{BridgeDutyIndexRocksDb, BridgeDutyRocksDb, BridgeTxRocksDb},
Expand Down
12 changes: 6 additions & 6 deletions bin/bridge-client/src/modes/operator/task_manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use strata_bridge_exec::{
handler::ExecHandler,
};
use strata_bridge_tx_builder::{prelude::BuildContext, TxKind};
use strata_btcio::rpc::traits::Broadcaster;
use strata_btcio::rpc::traits::BroadcasterRpc;
use strata_rpc_api::StrataApiClient;
use strata_rpc_types::RpcBridgeDuties;
use strata_state::bridge_duties::{BridgeDuty, BridgeDutyStatus};
Expand All @@ -26,7 +26,7 @@ use crate::errors::{PollDutyError, TaskManagerError};
pub(super) struct TaskManager<TxBuildContext, Bcast>
where
TxBuildContext: BuildContext + Sync + Send,
Bcast: Broadcaster,
Bcast: BroadcasterRpc,
{
pub(super) exec_handler: Arc<ExecHandler<TxBuildContext>>,
pub(super) broadcaster: Arc<Bcast>,
Expand All @@ -37,7 +37,7 @@ where
impl<TxBuildContext, Bcast> TaskManager<TxBuildContext, Bcast>
where
TxBuildContext: BuildContext + Sync + Send + 'static,
Bcast: Broadcaster + Sync + Send + 'static,
Bcast: BroadcasterRpc + Sync + Send + 'static,
{
pub(super) async fn start(
&self,
Expand Down Expand Up @@ -201,7 +201,7 @@ async fn process_duty<TxBuildContext, Bcast>(
) -> ExecResult<()>
where
TxBuildContext: BuildContext + Sync + Send,
Bcast: Broadcaster,
Bcast: BroadcasterRpc,
{
match duty {
BridgeDuty::SignDeposit(deposit_info) => {
Expand Down Expand Up @@ -264,7 +264,7 @@ async fn execute_duty<TxBuildContext, Tx, Bcast>(
where
TxBuildContext: BuildContext + Sync + Send,
Tx: TxKind + Debug,
Bcast: Broadcaster,
Bcast: BroadcasterRpc,
{
if let Err(e) = duty_status_ops
.put_duty_status_async(tracker_txid, BridgeDutyStatus::Received)
Expand Down Expand Up @@ -328,7 +328,7 @@ async fn aggregate_and_broadcast<TxBuildContext, Bcast>(
) -> ExecResult<()>
where
TxBuildContext: BuildContext + Sync + Send,
Bcast: Broadcaster,
Bcast: BroadcasterRpc,
{
exec_handler.collect_nonces(txid).await?;
let signed_tx = exec_handler.collect_signatures(txid).await?;
Expand Down
13 changes: 13 additions & 0 deletions bin/datatool/src/args.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ pub(crate) struct Args {
pub(crate) subc: Subcommand,
}

#[allow(clippy::large_enum_variant)]
#[derive(FromArgs, PartialEq, Debug)]
#[argh(subcommand)]
pub(crate) enum Subcommand {
Expand Down Expand Up @@ -126,6 +127,18 @@ pub(crate) struct SubcParams {
)]
pub(crate) name: Option<String>,

#[argh(
option,
description = "DA tag, used in envelopes (default 'strata-da')"
)]
pub(crate) da_tag: Option<String>,

#[argh(
option,
description = "checkpoint tag, used in envelopes (default 'strata-ckpt')"
)]
pub(crate) checkpoint_tag: Option<String>,

#[argh(
option,
description = "sequencer pubkey (default unchecked)",
Expand Down
8 changes: 8 additions & 0 deletions bin/datatool/src/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,8 @@ fn exec_genparams(cmd: SubcParams, ctx: &mut CmdContext) -> anyhow::Result<()> {

let config = ParamsConfig {
name: cmd.name.unwrap_or_else(|| "strata-testnet".to_string()),
checkpoint_tag: cmd.checkpoint_tag.unwrap_or("strata-ckpt".to_string()),
da_tag: cmd.da_tag.unwrap_or("strata-da".to_string()),
bitcoin_network: ctx.bitcoin_network,
// TODO make these consts
block_time_sec: cmd.block_time.unwrap_or(15),
Expand Down Expand Up @@ -390,6 +392,10 @@ fn resolve_xpriv(
pub struct ParamsConfig {
/// Name of the network.
name: String,
/// Tagname used to identify DA envelopes
da_tag: String,
/// Tagname used to identify Checkpoint envelopes
checkpoint_tag: String,
/// Network to use.
#[allow(unused)]
bitcoin_network: Network,
Expand Down Expand Up @@ -435,6 +441,8 @@ fn construct_params(config: ParamsConfig) -> RollupParams {
RollupParams {
rollup_name: config.name,
block_time: config.block_time_sec * 1000,
da_tag: config.da_tag,
checkpoint_tag: config.checkpoint_tag,
cred_rule: cr,
// TODO do we want to remove this?
horizon_l1_height: config.genesis_trigger / 2,
Expand Down
2 changes: 1 addition & 1 deletion bin/prover-client/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ path = "src/main.rs"
strata-btcio.workspace = true
strata-common.workspace = true
strata-db.workspace = true
strata-l1tx.workspace = true
strata-native-zkvm-adapter.workspace = true
strata-primitives.workspace = true
strata-proofimpl-btc-blockspace.workspace = true
Expand All @@ -25,7 +26,6 @@ strata-rpc-api = { workspace = true, features = ["client"] }
strata-rpc-types.workspace = true
strata-rpc-utils.workspace = true
strata-state.workspace = true
strata-tx-parser.workspace = true
strata-zkvm.workspace = true

alloy-rpc-types.workspace = true
Expand Down
2 changes: 1 addition & 1 deletion bin/prover-client/src/operators/btc.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use std::sync::Arc;

use strata_btcio::rpc::{traits::Reader, BitcoinClient};
use strata_btcio::rpc::{traits::ReaderRpc, BitcoinClient};
use strata_primitives::{
params::RollupParams,
proof::{ProofContext, ProofKey},
Expand Down
2 changes: 1 addition & 1 deletion bin/prover-client/src/operators/l1_batch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use bitcoin::{params::MAINNET, Block};
use strata_btcio::{
reader::query::get_verification_state,
rpc::{
traits::{Reader, Wallet},
traits::{ReaderRpc, WalletRpc},
BitcoinClient,
},
};
Expand Down
2 changes: 1 addition & 1 deletion bin/strata-client/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ strata-db.workspace = true
strata-eectl.workspace = true
strata-evmexec.workspace = true
strata-key-derivation.workspace = true
strata-l1tx.workspace = true
strata-primitives.workspace = true
strata-rocksdb.workspace = true
strata-rpc-api.workspace = true
Expand All @@ -28,7 +29,6 @@ strata-status.workspace = true
strata-storage.workspace = true
strata-sync.workspace = true
strata-tasks.workspace = true
strata-tx-parser.workspace = true
strata-zkvm.workspace = true

alloy-rpc-types.workspace = true
Expand Down
Loading

0 comments on commit c527f70

Please sign in to comment.