Skip to content

Conversation

@PastaPastaPasta
Copy link
Member

@PastaPastaPasta PastaPastaPasta commented Aug 12, 2025

On this branch, previously all these tests were failing. This was overall fixed via dashpay/agora-blsful#3

running 6 tests
test sml::masternode_list_engine::tests::validate_from_mn_list_diff_chain_locks ... ok
test sml::masternode_list_engine::tests::deserialize_mn_list_engine_and_validate_rotated_quorums_collectively ... ok
test sml::masternode_list_engine::tests::deserialize_mn_list_engine_and_validate_non_rotated_quorums_when_reconstructing_chain_locks ... ok
test sml::masternode_list_engine::tests::deserialize_mn_list_engine_and_validate_non_rotated_quorums ... ok
test sml::masternode_list_engine::tests::validate_from_qr_info_and_mn_list_diffs ... ok
test sml::masternode_list_engine::tests::deserialize_mn_list_engine_and_validate_rotated_quorums_individually ... ok

test result: ok. 6 passed; 0 failed; 0 ignored; 0 measured; 545 filtered out; finished in 6.17s

     Running tests/psbt.rs (target/debug/deps/psbt-b5c5fa47cda6eabc)

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 1 filtered out; finished in 0.00s

     Running tests/serde_opcodes.rs (target/debug/deps/serde_opcodes-c19c32cdfed1713e)

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s

   Doc-tests dashcore

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 39 filtered out; finished in 0.00s

Summary by CodeRabbit

  • Bug Fixes

    • Improved reliability and consistency of aggregated signature verification for quorum commitments, with clearer error reporting during validation.
  • Refactor

    • Simplified signature handling in quorum validation, reducing complexity and potential edge-case failures.
  • Chores

    • Updated underlying cryptography dependency to a newer revision for improved stability and compatibility.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Aug 12, 2025

Walkthrough

Updated blsful dependency revision in Cargo.toml and refactored quorum aggregated signature verification to use a unified blsful Signature conversion (try_into) and verify_secure over collected public keys, removing legacy aggregated-signature branching. Error mapping updated; public APIs unchanged.

Changes

Cohort / File(s) Summary
Dependency revision
dash/Cargo.toml
Updated blsful git rev from 5f017aa… to be108b2…; URL and optional flag unchanged.
Quorum aggregated signature verification
dash/src/sml/quorum_entry/validation.rs
Replaced legacy/format-specific aggregated-signature handling with try_into to Signature and verify_secure over public keys; removed uses_any_legacy logic; adjusted imports and error mapping; no public API changes.

Sequence Diagram(s)

sequenceDiagram
  actor Caller
  participant QQE as QualifiedQuorumEntry
  participant Keys as Operator Public Keys
  participant Sig as blsful::Signature
  participant BLS as verify_secure

  Caller->>QQE: verify_aggregated_commitment_signature(operator_keys)
  QQE->>Keys: Deserialize per-key (Legacy/Modern)
  QQE->>Sig: Convert aggregated bytes via try_into()
  QQE->>BLS: signature.verify_secure(Keys, message)
  BLS-->>QQE: Ok or Error
  QQE-->>Caller: Result<(), QuorumValidationError>
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~15 minutes

Possibly related PRs

Poem

A rabbit signs with ears held high,
Aggregates the keys that try,
One path now, secure and neat,
Bytes hop into a Signature seat.
Verify, nod—no legacy maze,
Commits aligned in modern ways.
Thump-thump: merged! 🐇✨

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/mnlist-engine-test-failures

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@PastaPastaPasta
Copy link
Member Author

@coderabbitai review

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Aug 12, 2025

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@PastaPastaPasta PastaPastaPasta merged commit f87f669 into v0.40-dev Aug 12, 2025
16 of 17 checks passed
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (3)
dash/src/sml/quorum_entry/validation.rs (3)

4-6: Unused import: verify_secure_basic_with_mode

Line 5 imports verify_secure_basic_with_mode but it's no longer used in the main code after the refactoring to use verify_secure. It's only used in test code.

Move this import to the test module where it's actually used:

-use blsful::verify_secure_basic_with_mode;
 use blsful::{Bls12381G2Impl, PublicKey, SerializationFormat, Signature, SignatureSchemes};

And add it to the benchmarks module:

 mod benchmarks {
     use super::super::*;
     use blsful::{
-        Bls12381G2Impl, PublicKey, Signature, SignatureSchemes, verify_secure_basic_with_mode,
+        Bls12381G2Impl, PublicKey, Signature, SignatureSchemes,
+        verify_secure_basic_with_mode,
     };

393-396: Potential panic in test code

The benchmark test assumes the signature will always be Basic variant and will panic otherwise. While this is test code, it would be more robust to handle this gracefully.

Consider using a more graceful error handling:

-            let inner_sig = match sig {
-                Signature::Basic(s) => s,
-                _ => panic!("Expected Basic signature"),
-            };
+            let inner_sig = match sig {
+                Signature::Basic(s) => s,
+                _ => {
+                    eprintln!("Skipping benchmark: Expected Basic signature");
+                    return;
+                }
+            };

410-421: Consider using the new verify_secure API in benchmarks

The benchmark is still using the old verify_secure_basic_with_mode API while the main code has been refactored to use the simpler verify_secure API. Consider updating the benchmark to test the actual code path being used.

Update the benchmark to use the same API as the production code:

-            for _ in 0..iterations {
-                let _ = verify_secure_basic_with_mode::<Bls12381G2Impl, _>(
-                    &operator_keys,
-                    inner_sig.clone(),
-                    msg,
-                    SerializationFormat::Modern,
-                );
-            }
+            // Create a proper Signature for benchmarking
+            let sig = Signature::<Bls12381G2Impl>::from_bytes_with_mode(
+                &sig_bytes,
+                SignatureSchemes::Basic,
+                SerializationFormat::Modern,
+            ).unwrap();
+            
+            for _ in 0..iterations {
+                let _ = sig.verify_secure(&operator_keys, msg);
+            }
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 408d4c7 and 92d4f17.

📒 Files selected for processing (2)
  • dash/Cargo.toml (1 hunks)
  • dash/src/sml/quorum_entry/validation.rs (2 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (5)
  • GitHub Check: fuzz (hashes_json)
  • GitHub Check: fuzz (hashes_ripemd160)
  • GitHub Check: fuzz (dash_deserialize_address)
  • GitHub Check: fuzz (dash_deserialize_amount)
  • GitHub Check: fuzz (hashes_sha512)
🔇 Additional comments (2)
dash/Cargo.toml (1)

69-69: Dependency update looks good.

The blsful dependency revision has been updated to incorporate the fix for test failures as mentioned in the PR description. This aligns with the PR objective of fixing mnlist engine test failures.

dash/src/sml/quorum_entry/validation.rs (1)

65-71: Simplified signature verification implementation.

Good refactoring! The new implementation is cleaner and more straightforward:

  • Uses try_into() for direct conversion to Signature<Bls12381G2Impl>
  • Calls verify_secure directly without manual format detection
  • Properly maps errors to domain-specific error types

This change aligns well with the PR's goal of fixing test failures through the updated blsful dependency.

@QuantumExplorer QuantumExplorer deleted the fix/mnlist-engine-test-failures branch October 20, 2025 08:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants