Open
Conversation
Adds the optional 'super-swiper' feature to fastcrypto-tbls, adding dependencies on a local solver and num-rational. Implements Nodes::new_super_swiper_reduced for advanced weight reduction using the super_swiper algorithm, and provides a dedicated test for this functionality with realistic validator weights.
Adds a copy of the 'weight-reduction' repo under fastcrypto-tbls, including solver algorithms, utilities, tests, and datasets. Includes Cargo.toml, license, documentation, and data files for reproducibility and usage as described in the referenced research paper.
Added scripts to fetch all Sui validators and generate CSVs of stake weights and ticket assignments under src/weight-reduction/scripts. Integrated super_swiper_test.rs as a conditional test module and updated its path and imports. Added a new data file (sui_stakes_and_tickets.csv) for validator stake/ticket analysis.
Added sui_real_all.dat and sui_real_all_details.txt containing Sui validator stake amounts and corresponding validator names for use in weight reduction analysis.
Removed unused parameters 't' and 'total_weight_lower_bound' from Nodes::new_super_swiper_reduced and updated threshold calculation to use beta ratio directly. Updated tests to match new API and added a new test for additional weight scenarios.
Deleted several solver implementations and their associated tests from the weight-reduction module, including bruteforce_sorted, faster_swiper, gcd_wr, and swiper. Updated mod.rs to only include super_swiper. This streamlines the codebase by removing unused or deprecated algorithms and their test files.
The 'super-swiper' feature flag and related optional dependencies were removed, making the super_swiper functionality always available.
Introduces the weight_reduction_checks module for validating weight reduction properties, and updates Nodes::new_super_swiper_reduced to iteratively adjust beta to meet a total weight upper bound and validate reductions. Test cases are expanded to cover new validation logic, CSV output, and upper bound scenarios.
Updated Nodes::new_super_swiper_reduced to use a slack-based approach for weight reduction validation, replacing the previous total weight upper bound check. The function now iterates beta to satisfy a configurable slack constraint, and returns additional beta parameters. Tests and weight_reduction_checks were updated to support and verify the new slack-based logic.
Introduces voting power data files for epochs 100, 200, 400, 800, and renames the previous file to epoch_974. Updates test helpers and adds a comprehensive test to compare weight reduction algorithms across all epochs. The fetch script is enhanced to support epoch selection via command line and outputs files with epoch-specific names.
jonas-lj
reviewed
Dec 15, 2025
jonas-lj
reviewed
Dec 15, 2025
jonas-lj
reviewed
Dec 15, 2025
jonas-lj
reviewed
Dec 15, 2025
jonas-lj
reviewed
Dec 15, 2025
jonas-lj
reviewed
Dec 15, 2025
jonas-lj
reviewed
Dec 15, 2025
jonas-lj
reviewed
Dec 15, 2025
jonas-lj
reviewed
Dec 15, 2025
jonas-lj
reviewed
Dec 15, 2025
jonas-lj
reviewed
Dec 15, 2025
jonas-lj
reviewed
Dec 19, 2025
jonas-lj
reviewed
Jan 23, 2026
Refactored the super_swiper weight reduction logic to use a new precision loss calculation (compute_precision_loss) instead of the previous delta check, and updated the iteration logic for beta selection. Added new test utilities and CSV generation for per-epoch validator weight reductions, and improved comparison and reporting in tests. Introduced compute_precision_loss in weight_reduction_checks.rs for more accurate measurement of reduction precision loss.
jonas-lj
reviewed
Jan 28, 2026
| /// 1. Take reduced weights to reach 2t' - 1 | ||
| /// 2. Let w1 = sum of old weights corresponding to the subset | ||
| /// 3. Then delta = w1 - (2t - 1), where t is the input threshold | ||
| pub fn get_delta( |
Contributor
There was a problem hiding this comment.
This is not used anymore, right?
Author
There was a problem hiding this comment.
Kept it there for future testing, but we can remove once confident in the precision loss based parameter tuning.
Added detailed DKG safety and liveness constraints to the super_swiper algorithm in nodes.rs, referencing a new PROOF.md with formal definitions and proofs. Refactored the API and comments for clarity, updated test types and output in super_swiper_test.rs, and improved documentation and comments in weight_reduction_checks.rs to match the formal proof. No functional changes to the core reduction logic.
PROOF.md expanded with formal upper/lower bound proofs and a derived combined inequality for admissible f', t', and W' to match the implementation changes. The algorithm uses the precision loss (δ) and effective divisor (d) to derive tight lower/upper bounds for f' (from PROOF.md), selects a valid integer f' and verifies all constraints while iterating β. Tests updated to expect and display the extra f' and β info.
Replace the previous iterative search for beta with a direct formula beta = alpha + (allowed_delta - 1)/W and simplify the super_swiper weight reduction logic accordingly.
Refactor Nodes::new_super_swiper_reduced to remove the f parameter and f' calculation, change t' formula to (t + δ)/d, and return (Nodes, t') instead of (Nodes, t', f'). Use original_total_weight consistently for ratio calculations and tighten the beta loop condition (beta must be > α). Update call sites and construction accordingly. Revamp the super_swiper tests: replace the single ad-hoc test with a comprehensive epoch-comparison suite that supports both new_super_swiper_reduced and new_reduced, introduces helpers for epoch charting, f/f' derivation, and precision-loss reporting, and adds multiple test cases and printing improvements to validate the new behavior and signatures.
Replace the single-β loop with a double loop over α (0.10..0.90) and β (α+0.01..α+0.20, β<1). For each (α,β) the code calls solve, computes reduced total weight and precision loss, and selects the best feasible reduction (2·δ ≤ allowed_delta and W' ≥ total_weight_lower_bound). Tie-breaking prefers smaller W', then smaller δ. The old α computation and early-return-on-below-bound behavior were removed so invalid β values are skipped instead of failing. Also shorten test labels in super_swiper tests to simpler names.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR adds a "super_swiper" algorithm for weight reduction in the
fastcrypto-tblscrate, adds supporting infrastructure for weight reduction experiments, and enhances the codebase with tools and data for working with real validator sets.The super_swiper code is adapted from: https://github.com/tolikzinovyev/weight-reduction
The implementation of the algorithms presented in the paper:
Weight reduction in distributed protocols: new algorithms and analysis, by Anatoliy Zinovyev
(https://eprint.iacr.org/2025/1076).