Skip to content

Commit d615897

Browse files
committed
chore: improve logging in verification
1 parent a82e3eb commit d615897

File tree

1 file changed

+23
-5
lines changed

1 file changed

+23
-5
lines changed

crates/cdk/src/mint/verification.rs

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ impl Mint {
2424
.len()
2525
.ne(&proof_count)
2626
{
27+
tracing::debug!("Transaction attempted with duplicate inputs");
2728
return Err(Error::DuplicateInputs);
2829
}
2930

@@ -42,6 +43,7 @@ impl Mint {
4243
.len()
4344
.ne(&output_count)
4445
{
46+
tracing::debug!("Transaction attempted with duplicate outputs");
4547
return Err(Error::DuplicateOutputs);
4648
}
4749

@@ -64,12 +66,19 @@ impl Mint {
6466
match self.localstore.get_keyset_info(id).await? {
6567
Some(keyset) => {
6668
if !keyset.active {
69+
tracing::debug!(
70+
"Transaction attempted with inactive keyset in outputs: {}.",
71+
id
72+
);
6773
return Err(Error::InactiveKeyset);
6874
}
6975
keyset_units.insert(keyset.unit);
7076
}
7177
None => {
72-
tracing::info!("Swap request with unknown keyset in outputs");
78+
tracing::debug!(
79+
"Transaction attempted with unknown keyset in outputs: {}.",
80+
id
81+
);
7382
return Err(Error::UnknownKeySet);
7483
}
7584
}
@@ -79,7 +88,10 @@ impl Mint {
7988
// in the future it maybe possible to support multiple units but unsupported for
8089
// now
8190
if keyset_units.len() != 1 {
82-
tracing::error!("Only one unit is allowed in request: {:?}", keyset_units);
91+
tracing::debug!(
92+
"Transaction attempted with multiple units in outputs: {:?}.",
93+
keyset_units
94+
);
8395
return Err(Error::MultipleUnits);
8496
}
8597

@@ -104,7 +116,10 @@ impl Mint {
104116
keyset_units.insert(keyset.unit);
105117
}
106118
None => {
107-
tracing::info!("Swap request with unknown keyset in outputs");
119+
tracing::debug!(
120+
"Transaction attempted with unknown keyset in inputs: {}.",
121+
id
122+
);
108123
return Err(Error::UnknownKeySet);
109124
}
110125
}
@@ -114,7 +129,10 @@ impl Mint {
114129
// in the future it maybe possible to support multiple units but unsupported for
115130
// now
116131
if keyset_units.len() != 1 {
117-
tracing::error!("Only one unit is allowed in request: {:?}", keyset_units);
132+
tracing::debug!(
133+
"Transaction attempted with multiple units in inputs: {:?}.",
134+
keyset_units
135+
);
118136
return Err(Error::MultipleUnits);
119137
}
120138

@@ -141,7 +159,7 @@ impl Mint {
141159
.next()
142160
.is_some()
143161
{
144-
tracing::info!("Output has already been signed",);
162+
tracing::debug!("Transaction attempted where output is already signed.");
145163

146164
return Err(Error::BlindedMessageAlreadySigned);
147165
}

0 commit comments

Comments
 (0)