Skip to content

Commit

Permalink
Merge branch 'feat/mock-signing' into feat/dkg-verification-buffer-me…
Browse files Browse the repository at this point in the history
…ssages
  • Loading branch information
cylewitruk committed Feb 7, 2025
2 parents 0940f18 + ea00224 commit e0db3d6
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 24 deletions.
8 changes: 3 additions & 5 deletions signer/src/bitcoin/utxo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -719,9 +719,7 @@ impl SignerUtxo {
///
/// The Bitcoin transaction has the following layout:
/// 1. The first input is spending the signers' UTXO.
/// 2. There is only one output which is an OP_RETURN with the bytes [0x01,
/// 0x02, 0x03] as the data and amount equal to the UTXO's value (i.e. the
/// transaction has a zero-fee).
/// 2. There is only one output which is an OP_RETURN and an amount equal to 0.
#[derive(Debug)]
pub struct UnsignedMockTransaction {
/// The Bitcoin transaction that needs to be signed.
Expand Down Expand Up @@ -825,8 +823,8 @@ impl UnsignedMockTransaction {

/// Construct an unsigned mock transaction.
///
/// This will use the provided `aggregate_key` and `amount` to
/// construct a [`Transaction`] with a single input and output.
/// This will use the provided `aggregate_key` to construct
/// a [`Transaction`] with a single input and output with value 0.
pub fn new(signer_public_key: XOnlyPublicKey) -> Self {
let utxo = SignerUtxo {
outpoint: OutPoint::null(),
Expand Down
5 changes: 0 additions & 5 deletions signer/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,6 @@ pub enum Error {
#[error("invalid signing request")]
InvalidSigningOperation,

/// The pre-rotate-key frost verification signing round was not reported as
/// successful.
#[error("rotate-key frost verification signing round not reported as successful")]
DkgVerificationNotSuccessful,

/// The rotate-key frost verification signing round failed for the aggregate
/// key.
#[error("rotate-key frost verification signing failed for aggregate key: {0}")]
Expand Down
8 changes: 1 addition & 7 deletions signer/src/transaction_signer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -908,11 +908,6 @@ where
)
.await?;

if request.message.len() != 32 {
tracing::warn!("🔐 data received for DKG verification signing is not 32 bytes");
return Err(Error::InvalidSigningOperation);
}

let (state_machine_id, _) =
self.ensure_dkg_verification_state_machine(new_key).await?;

Expand Down Expand Up @@ -1192,8 +1187,7 @@ where
mock_tx
.verify_signature(signature)
.inspect_err(|e| tracing::warn!(?e, "🔐 signature verification failed"))?;

tracing::info!("🔐 \x1b[1;32msignature verification successful\x1b[0m");
tracing::info!("🔐 signature verification successful");

self.context
.get_storage_mut()
Expand Down
9 changes: 8 additions & 1 deletion signer/tests/integration/postgres.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3489,7 +3489,14 @@ async fn revoke_dkg_shares_succeeds() {
signer::testing::storage::drop_db(db).await;
}

/// This tests checks that calling
/// This test checks that DKG shares verification status follows a one-way state transition:
///
/// 1. Unverified -> Verified: Once shares are verified, they cannot be revoked
/// 2. Unverified -> Failed: Once shares are marked as failed, they cannot be verified
///
/// The test verifies both transition paths:
/// - Unverified -> Verified -> (attempt revoke, stays Verified)
/// - Unverified -> Failed -> (attempt verify, stays Failed)
#[tokio::test]
async fn verification_status_one_way_street() {
let db = testing::storage::new_test_database().await;
Expand Down
6 changes: 0 additions & 6 deletions signer/tests/integration/transaction_signer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -290,12 +290,6 @@ async fn new_state_machine_per_valid_sighash() {
// creates two bitcoin block.
let setup = TestSweepSetup2::new_setup(signers, faucet, &[]);

// Store the necessary data for passing validation
let dummy_block = model::BitcoinBlock {
block_hash: setup.deposit_block_hash.into(),
..Faker.fake_with_rng(&mut rng)
};
db.write_bitcoin_block(&dummy_block).await.unwrap();
setup.store_dkg_shares(&db).await;

// Initialize the transaction signer event loop
Expand Down

0 comments on commit e0db3d6

Please sign in to comment.