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

[move][natives] added batch bulletproof natives #15832

Merged

Conversation

dovgopoly
Copy link
Contributor

@dovgopoly dovgopoly commented Jan 28, 2025

Description

Adds Move native functions for batch verification of Bulletproof ZK range proofs.

What

This pull request introduces native Move functions that wrap the batch operations provided by the underlying dalek-cryptography's Bulletproofs library.

Why

The primary goal is to reduce gas overhead when multiple range proofs of the same structure are needed to be verified at once. By batching the proofs together, the system minimizes repetitive computational costs, thereby enhancing performance.

How

The implementation leverages the existing Rust logic from the Bulletproofs library by wrapping its prove_multiple and verify_multiple functions as native functions in Move.

Other fixes/contributions:

  • Fixes an outstanding issue in aptos-crypto that this PR was about to fix.
  • Adds a TEST_FILTER environment variable to filter unit tests when testing the Move framework code with cargo test inside aptos-move/framework

How Has This Been Tested?

Key Areas to Review

Type of Change

  • New feature
  • Bug fix
  • Breaking change
  • Performance improvement
  • Refactoring
  • Dependency update
  • Documentation update
  • Tests

Which Components or Systems Does This Change Impact?

  • Validator Node
  • Full Node (API, Indexer, etc.)
  • Move/Aptos Virtual Machine
  • Aptos Framework
  • Aptos CLI/SDK
  • Developer Infrastructure
  • Move Compiler
  • Other (specify)

Checklist

  • I have read and followed the CONTRIBUTING doc
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I identified and added all stakeholders and component owners affected by this change as reviewers
  • I tested both happy and unhappy path of the functionality
  • I have made corresponding changes to the documentation

Copy link

trunk-io bot commented Jan 28, 2025

⏱️ 9m total CI duration on this PR
Job Cumulative Duration Recent Runs
check-dynamic-deps 3m 🟩
permission-check 2m 🟥🟥🟩🟩🟩 (+28 more)
rust-cargo-deny 2m 🟩
permission-check 2m 🟥🟥🟩🟩🟩 (+28 more)
general-lints 27s 🟩
semgrep/ci 21s 🟩
file_change_determinator 13s 🟩

settingsfeedbackdocs ⋅ learn more about trunk.io

@dovgopoly dovgopoly force-pushed the distributedlab/batch-rp-natives branch from cc4a57b to b07b143 Compare January 29, 2025 16:56
@dovgopoly dovgopoly changed the title [move][natives] added move bulletproof natives and rust wrappers (draft, wip) [move][natives] added batch bulletproof natives Jan 29, 2025
@dovgopoly dovgopoly marked this pull request as ready for review January 29, 2025 16:57
@dovgopoly dovgopoly force-pushed the distributedlab/batch-rp-natives branch from b07b143 to 49abefc Compare January 29, 2025 18:20
@zjma
Copy link
Contributor

zjma commented Feb 4, 2025

i can take care of the rebase.

Copy link
Contributor

@alinush alinush left a comment

Choose a reason for hiding this comment

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

Thank you @dovgopoly for addressing everything!

@zjma to take care of a few more things & then we'll merge.

@zjma zjma force-pushed the distributedlab/batch-rp-natives branch from 75998e2 to 87a0ef8 Compare February 6, 2025 10:45
@zjma zjma enabled auto-merge (squash) February 7, 2025 03:05

This comment has been minimized.

This comment has been minimized.

This comment has been minimized.

This comment has been minimized.

This comment has been minimized.

This comment has been minimized.

This comment has been minimized.

This comment has been minimized.

This comment has been minimized.

Copy link
Contributor

github-actions bot commented Feb 7, 2025

✅ Forge suite compat success on 255673e8f2757ed8634a7d65d7aca11de7016cde ==> 0f6acbe3d41208c3b38bd33afc3ddf77fdc5eed6

Compatibility test results for 255673e8f2757ed8634a7d65d7aca11de7016cde ==> 0f6acbe3d41208c3b38bd33afc3ddf77fdc5eed6 (PR)
1. Check liveness of validators at old version: 255673e8f2757ed8634a7d65d7aca11de7016cde
compatibility::simple-validator-upgrade::liveness-check : committed: 10871.79 txn/s, latency: 2885.73 ms, (p50: 2600 ms, p70: 2900, p90: 4300 ms, p99: 6600 ms), latency samples: 368120
2. Upgrading first Validator to new version: 0f6acbe3d41208c3b38bd33afc3ddf77fdc5eed6
compatibility::simple-validator-upgrade::single-validator-upgrading : committed: 3258.40 txn/s, latency: 9070.15 ms, (p50: 9600 ms, p70: 11000, p90: 11700 ms, p99: 12000 ms), latency samples: 71340
compatibility::simple-validator-upgrade::single-validator-upgrade : committed: 3300.02 txn/s, latency: 10449.73 ms, (p50: 11500 ms, p70: 11700, p90: 12000 ms, p99: 12100 ms), latency samples: 127080
3. Upgrading rest of first batch to new version: 0f6acbe3d41208c3b38bd33afc3ddf77fdc5eed6
compatibility::simple-validator-upgrade::half-validator-upgrading : committed: 3060.04 txn/s, latency: 9605.38 ms, (p50: 10200 ms, p70: 11800, p90: 12500 ms, p99: 12700 ms), latency samples: 68020
compatibility::simple-validator-upgrade::half-validator-upgrade : committed: 3353.72 txn/s, latency: 10287.30 ms, (p50: 11000 ms, p70: 11800, p90: 12000 ms, p99: 12000 ms), latency samples: 127800
4. upgrading second batch to new version: 0f6acbe3d41208c3b38bd33afc3ddf77fdc5eed6
compatibility::simple-validator-upgrade::rest-validator-upgrading : committed: 1727.95 txn/s, submitted: 1728.26 txn/s, expired: 0.31 txn/s, latency: 5515.21 ms, (p50: 6300 ms, p70: 6700, p90: 7600 ms, p99: 7800 ms), latency samples: 106601
compatibility::simple-validator-upgrade::rest-validator-upgrade : committed: 5387.56 txn/s, latency: 6286.85 ms, (p50: 6400 ms, p70: 7200, p90: 7900 ms, p99: 8100 ms), latency samples: 189480
5. check swarm health
Compatibility test for 255673e8f2757ed8634a7d65d7aca11de7016cde ==> 0f6acbe3d41208c3b38bd33afc3ddf77fdc5eed6 passed
Test Ok

This comment has been minimized.

Copy link
Contributor

github-actions bot commented Feb 7, 2025

✅ Forge suite framework_upgrade success on 255673e8f2757ed8634a7d65d7aca11de7016cde ==> 0f6acbe3d41208c3b38bd33afc3ddf77fdc5eed6

Compatibility test results for 255673e8f2757ed8634a7d65d7aca11de7016cde ==> 0f6acbe3d41208c3b38bd33afc3ddf77fdc5eed6 (PR)
Upgrade the nodes to version: 0f6acbe3d41208c3b38bd33afc3ddf77fdc5eed6
framework_upgrade::framework-upgrade::full-framework-upgrade : committed: 1702.83 txn/s, submitted: 1707.06 txn/s, failed submission: 4.23 txn/s, expired: 4.23 txn/s, latency: 1702.13 ms, (p50: 1500 ms, p70: 1800, p90: 2500 ms, p99: 3900 ms), latency samples: 152980
framework_upgrade::framework-upgrade::full-framework-upgrade : committed: 1806.03 txn/s, submitted: 1811.31 txn/s, failed submission: 5.28 txn/s, expired: 5.28 txn/s, latency: 1612.60 ms, (p50: 1500 ms, p70: 1800, p90: 2100 ms, p99: 3200 ms), latency samples: 164041
5. check swarm health
Compatibility test for 255673e8f2757ed8634a7d65d7aca11de7016cde ==> 0f6acbe3d41208c3b38bd33afc3ddf77fdc5eed6 passed
Upgrade the remaining nodes to version: 0f6acbe3d41208c3b38bd33afc3ddf77fdc5eed6
framework_upgrade::framework-upgrade::full-framework-upgrade : committed: 1634.85 txn/s, submitted: 1638.19 txn/s, failed submission: 3.34 txn/s, expired: 3.34 txn/s, latency: 1798.90 ms, (p50: 1800 ms, p70: 2100, p90: 2400 ms, p99: 3300 ms), latency samples: 147020
Test Ok

This comment has been minimized.

Copy link
Contributor

github-actions bot commented Feb 7, 2025

✅ Forge suite realistic_env_max_load success on 0f6acbe3d41208c3b38bd33afc3ddf77fdc5eed6

two traffics test: inner traffic : committed: 12831.18 txn/s, submitted: 12836.60 txn/s, expired: 5.42 txn/s, latency: 3070.57 ms, (p50: 2700 ms, p70: 3000, p90: 4500 ms, p99: 5400 ms), latency samples: 4878780
two traffics test : committed: 99.99 txn/s, latency: 2975.56 ms, (p50: 2500 ms, p70: 3200, p90: 4800 ms, p99: 5300 ms), latency samples: 1840
Latency breakdown for phase 0: ["MempoolToBlockCreation: max: 1.088, avg: 0.543", "ConsensusProposalToOrdered: max: 0.320, avg: 0.312", "ConsensusOrderedToCommit: max: 0.963, avg: 0.649", "ConsensusProposalToCommit: max: 1.271, avg: 0.961"]
Max non-epoch-change gap was: 0 rounds at version 0 (avg 0.00) [limit 4], 1.24s no progress at version 2354167 (avg 0.21s) [limit 15].
Max epoch-change gap was: 0 rounds at version 0 (avg 0.00) [limit 4], 0.75s no progress at version 2354145 (avg 0.75s) [limit 16].
Test Ok

@zjma zjma merged commit 3eaf7a5 into aptos-labs:main Feb 7, 2025
43 of 46 checks passed
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