Skip to content

Commit

Permalink
feat(bridge-exec)!: sign_tx and aggregate_sig
Browse files Browse the repository at this point in the history
  • Loading branch information
storopoli committed Sep 26, 2024
1 parent 493b21b commit 0c813d1
Show file tree
Hide file tree
Showing 16 changed files with 416 additions and 143 deletions.
5 changes: 5 additions & 0 deletions Cargo.lock

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

7 changes: 6 additions & 1 deletion crates/bridge-exec/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,17 @@ rust.unused_must_use = "deny"
rustdoc.all = "warn"

[dependencies]
alpen-express-btcio = { workspace = true }
alpen-express-primitives = { workspace = true }
alpen-express-rpc-api = { workspace = true, features = ["client"] }
express-bridge-sig-manager = { workspace = true }
express-bridge-tx-builder = { workspace = true }

async-trait = { workspace = true }
bitcoin = { workspace = true }
bitcoin = { workspace = true, features = ["rand-std"] }
format_serde_error = { workspace = true }
jsonrpsee = { workspace = true }
serde = { workspace = true }
thiserror = { workspace = true }
toml = { workspace = true }
tracing = { workspace = true }
28 changes: 0 additions & 28 deletions crates/bridge-exec/src/deposit_handler/errors.rs

This file was deleted.

22 changes: 0 additions & 22 deletions crates/bridge-exec/src/deposit_handler/handler.rs

This file was deleted.

7 changes: 0 additions & 7 deletions crates/bridge-exec/src/deposit_handler/mod.rs

This file was deleted.

53 changes: 53 additions & 0 deletions crates/bridge-exec/src/errors.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
//! Defines the error types associated with executing the withdrawal duties.

use alpen_express_btcio::rpc::error::ClientError as L1ClientError;
use express_bridge_tx_builder::errors::BridgeTxBuilderError;
use jsonrpsee::core::ClientError as L2ClientError;
use thiserror::Error;

/// Error during execution of the withdrawal duty.
#[derive(Error, Debug)]
pub enum ExecError {
/// Error creating the [`TxSigningData`](alpen_express_primitives::bridge::TxSigningData).
#[error("could not build withdraw transaction")]
TxBuilder(#[from] BridgeTxBuilderError),

/// Error while signing the withdrawal transaction.
#[error("signing error: {0}")]
Signing(String),

/// The request for signature is invalid.
#[error("invalid request")]
InvalidRequest,

/// Error while fetching a transaction state
#[error("transaction state fetching error: {0}")]
TxState(String),

/// Error while broadcasting the signature/transaction.
#[error("transaction broadcast error: {0}")]
Broadcast(String),

/// Error while processing withdrawal due to insufficient funds (for front-payments).
#[error("insufficient funds")]
InsufficientFunds,

/// Unexpected error during the handling of the withdrawal.
#[error("execution failed: {0}")]
Execution(String),

/// Error communicating with the Bitcoin RPC.
#[error("bitcoin RPC communication failed: {0}")]
L1Rpc(#[from] L1ClientError),

/// Error communicating with the rollup RPC.
#[error("rollup RPC communication failed: {0}")]
L2Rpc(#[from] L2ClientError),

/// Signer does not have access to the [`Xpriv`](bitcoin::bip32::Xpriv)
#[error("bitcoin signer do not have access to the private keys, i.e. xpriv")]
Xpriv,
}

/// Result of a execution that may produce an [`ExecError`].
pub type ExecResult<T> = Result<T, ExecError>;
Loading

0 comments on commit 0c813d1

Please sign in to comment.