From 65283a82ece0ee523813753091bf9314b4f994f8 Mon Sep 17 00:00:00 2001 From: ok300 <106775972+ok300@users.noreply.github.com> Date: Tue, 28 Jan 2025 12:33:07 +0100 Subject: [PATCH 1/2] Include pure integration tests in `just final-check` --- justfile | 3 +++ 1 file changed, 3 insertions(+) diff --git a/justfile b/justfile index 4e36977e..67053476 100644 --- a/justfile +++ b/justfile @@ -47,6 +47,9 @@ test: build fi cargo test --lib + # Run pure integration tests + cargo test -p cdk-integration-tests --test integration_tests_pure + # run `cargo clippy` on everything clippy *ARGS="--locked --offline --workspace --all-targets": cargo clippy {{ARGS}} From a2005e1ff0ac8d68d7db9ec8508e16854e1730db Mon Sep 17 00:00:00 2001 From: ok300 <106775972+ok300@users.noreply.github.com> Date: Tue, 28 Jan 2025 12:34:21 +0100 Subject: [PATCH 2/2] Remove Default implementation of MintMeltLimits The default would have been min=0, max=0. This made any mint initialized with MintMeltLimits::default() to fail every mint and melt operation, because the amount was out of bounds. --- crates/cdk-integration-tests/src/init_pure_tests.rs | 2 +- crates/cdk/src/mint/builder.rs | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/crates/cdk-integration-tests/src/init_pure_tests.rs b/crates/cdk-integration-tests/src/init_pure_tests.rs index 85b0f09b..7ab29a3f 100644 --- a/crates/cdk-integration-tests/src/init_pure_tests.rs +++ b/crates/cdk-integration-tests/src/init_pure_tests.rs @@ -167,7 +167,7 @@ pub async fn create_and_start_test_mint() -> anyhow::Result> { mint_builder = mint_builder.add_ln_backend( CurrencyUnit::Sat, PaymentMethod::Bolt11, - MintMeltLimits::default(), + MintMeltLimits::new(1, 1_000), ln_fake_backend, ); diff --git a/crates/cdk/src/mint/builder.rs b/crates/cdk/src/mint/builder.rs index f0ebafab..cb68bccf 100644 --- a/crates/cdk/src/mint/builder.rs +++ b/crates/cdk/src/mint/builder.rs @@ -242,8 +242,8 @@ impl MintBuilder { } } -/// Mint Melt Limits -#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Default)] +/// Mint and Melt Limits +#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] pub struct MintMeltLimits { /// Min mint amount pub mint_min: Amount, @@ -256,7 +256,7 @@ pub struct MintMeltLimits { } impl MintMeltLimits { - /// Create new [`MintMeltLimits`] + /// Create new [`MintMeltLimits`]. The `min` and `max` limits apply to both minting and melting. pub fn new(min: u64, max: u64) -> Self { Self { mint_min: min.into(),