Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Finish early mono sign when skipping factor #342

Merged
merged 11 commits into from
Jan 20, 2025

Conversation

micbakos-rdx
Copy link
Contributor

@micbakos-rdx micbakos-rdx commented Jan 14, 2025

Updated mono sign, to return no request when there are no remaining per transaction requests. When a user skips a factor source, the signature collector will iterate to the next factor source. There if there are no more remaining still to be signed as valid transactions, the iterator continues. This ends up ending the collector's signing process, with an unsuccessful outcome.

  • Updated the tests to incorporate skipping of a factor source instead of just failing one.
  • Added some missing kotlin extensions needed in host to sign, with a mnemonic, multiple per transaction signables at once and also an extension to derive factor source ids. Both were required for the integration with the host

Copy link

codecov bot commented Jan 14, 2025

Codecov Report

Attention: Patch coverage is 87.09677% with 4 lines in your changes missing coverage. Please review.

Project coverage is 92.84%. Comparing base (eca2370) to head (c3fdaf8).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
.../app/signing/src/collector/signatures_collector.rs 75.00% 4 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main     #342   +/-   ##
=======================================
  Coverage   92.84%   92.84%           
=======================================
  Files        1160     1160           
  Lines       25797    25815   +18     
  Branches       85       85           
=======================================
+ Hits        23952    23969   +17     
- Misses       1834     1835    +1     
  Partials       11       11           
Flag Coverage Δ
kotlin 97.90% <100.00%> (+0.02%) ⬆️
rust 92.37% <76.47%> (-0.01%) ⬇️
swift 93.76% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@micbakos-rdx micbakos-rdx force-pushed the micbakos/finish_early_mono_sign branch from 18e54c3 to 6a6e3ba Compare January 17, 2025 11:12
@micbakos-rdx micbakos-rdx self-assigned this Jan 17, 2025
@micbakos-rdx micbakos-rdx added Rust 🦀 Changes in Rust Sargon Kotlin 🤖 Changes in Kotlin Sargon labels Jan 17, 2025
@micbakos-rdx micbakos-rdx force-pushed the micbakos/finish_early_mono_sign branch from 6a6e3ba to 9cab818 Compare January 17, 2025 11:38
@micbakos-rdx micbakos-rdx marked this pull request as ready for review January 17, 2025 11:38
}

pub fn prudent_with_skips(simulated_skips: SimulatedSkips) -> Self {
Self::new(SimulatedUserMode::Prudent, None, simulated_skips)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Prudent means "never skips". So this looks wrong. Better let this be ctor of Lazy. And update definition of Lazy:

-    /// Emulation of a "lazy" user, that skips signing with as many factor
-    /// sources as possible.
+    /// Emulation of a "lazy" user, that skips signing with as some factor
+    /// sources, depending on `Laziness`.
    Lazy(Laziness),

Copy link
Contributor Author

@micbakos-rdx micbakos-rdx Jan 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, but Laziness has no option to sign all the rest of the factor sources except the ones defined in simulated_skips. This is what I wanted to achieve.

Lazyness describes a user that either skips all all or signs the minimum.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes so we update Laziness enum with a third variant..?

SkipsSpecific(IndexSet<_>)

@micbakos-rdx micbakos-rdx force-pushed the micbakos/finish_early_mono_sign branch from 9cab818 to c3fdaf8 Compare January 20, 2025 09:39
@micbakos-rdx
Copy link
Contributor Author

@matiasbzurovski @CyonAlexRDX

Latest changes:

  1. Added to user mode a user that skips specific factors.
  2. Introduced a new error for when the user fails to sign since too many factors neglected.
  3. Added --locked to cargo ndk.

@micbakos-rdx micbakos-rdx merged commit 5c4ff91 into main Jan 20, 2025
12 of 13 checks passed
@micbakos-rdx micbakos-rdx deleted the micbakos/finish_early_mono_sign branch January 20, 2025 12:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Kotlin 🤖 Changes in Kotlin Sargon Rust 🦀 Changes in Rust Sargon
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants