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

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

dovgopoly
Copy link

@dovgopoly dovgopoly commented Jan 28, 2025

Description

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

⏱️ 2m total CI duration on this PR

Job Cumulative Duration Recent Runs
permission-check 53s 🟥🟥🟥🟥🟥 (+10 more)
permission-check 49s 🟥🟥🟥🟥🟥 (+10 more)

settingsfeedbackdocs ⋅ learn more about trunk.io

@@ -76,6 +76,7 @@ pub enum FeatureFlag {
GasPayerEnabled,
AptosUniqueIdentifiers,
BulletproofsNatives,
BulletproofsBatchNatives,
Copy link
Contributor

Choose a reason for hiding this comment

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

this has to go the end of the list so existing feature -> id mapping remain the same.

Copy link
Contributor

Choose a reason for hiding this comment

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

oh maybe for this enum it doesn't matter... still recommend put it at the end though

Copy link
Author

Choose a reason for hiding this comment

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

Reordered

@@ -129,6 +251,17 @@ module aptos_std::ristretto255_bulletproofs {
num_bits: u64,
dst: vector<u8>): bool;

/// Aborts with `error::invalid_argument(E_DESERIALIZE_RANGE_PROOF)` if `proof` is not a valid serialization of a
Copy link
Contributor

Choose a reason for hiding this comment

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

It seems our move api accepts arbitrary bytes as RangeProof. In case of invalid serialization, better return false instead of aborting? just from API design perspective.

Copy link
Author

Choose a reason for hiding this comment

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

Made E_DESERIALIZE_RANGE_PROOF deprecated

@@ -83,8 +93,10 @@ module aptos_std::ristretto255_bulletproofs {
)
}

/// Verifies a zero-knowledge range proof that the value `v` committed in `com` (as v * val_base + r * rand_base,
/// for some randomness `r`) satisfies `v` in `[0, 2^num_bits)`. Only works for `num_bits` in `{8, 16, 32, 64}`.
/// Verifies a zero-knowledge range proof for a batch of commitments `comms` (each of the form
Copy link
Contributor

Choose a reason for hiding this comment

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

accidentally copied from the batch version?

Copy link
Author

Choose a reason for hiding this comment

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

Thanks, fixed

@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
@@ -30,7 +30,7 @@ use std::collections::VecDeque;
pub mod abort_codes {
/// Abort code when deserialization fails (leading 0x01 == INVALID_ARGUMENT)
/// NOTE: This must match the code in the Move implementation
pub const NFE_DESERIALIZE_RANGE_PROOF: u64 = 0x01_0001;
pub const _NFE_DESERIALIZE_RANGE_PROOF: u64 = 0x01_0001;
Copy link
Contributor

Choose a reason for hiding this comment

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

we can delete.

Copy link
Author

@dovgopoly dovgopoly Jan 29, 2025

Choose a reason for hiding this comment

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

Done

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.

2 participants