-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
[Features] support bn254_algebra in aptos_stdlib #11142
Conversation
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.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Currently, the crypto_algebra framework keeps the actual group element data in a VM extension. Only a pointer is stored on the Move side. The actual data won't be disposed until the end of the VM session, even if the corressponding Move object is dropped in the middle. Because of that, we set a 1MB limit to the total size of the actual data in a session. However, according to @nanne007's test, zkmove txns can easily exceed this limit. We probably need a bigger change. A few approaches:
I think: (1) is too naive; (2) is non-trivial (and not sure if it's possible); (3) works but is not cool; (4) is the best. |
3 seems idiomatic way to me but I don't have much context |
Many thanks for the reply! As for the possible solutions that @zjma gave, I prefer the 4th. the 3rd is also fine to me, while the drawback is developers have to track every elements and drop it manually. In comparison, I would suggest that we go the 4th way. |
Perhaps we can complete the current solution first and deploy it to the devnet, and then further optimize it after collecting more real data. |
Signed-off-by: caojiafeng <funfriendcjf@gmail.com>
Signed-off-by: caojiafeng <funfriendcjf@gmail.com>
* [feat][aptos-stdlib] crypto algebra bn254 Signed-off-by: caojiafeng <funfriendcjf@gmail.com> * scripts: fix update_algebra_gas_params.py Signed-off-by: caojiafeng <funfriendcjf@gmail.com> * add bn254 to default features to make unit test pass * fix a bug mentioned in the comments * initial * update * initial gas param * benches for fq and fq2 * it compiles * gas script now also specifies quantity types * update scripts --------- Signed-off-by: caojiafeng <funfriendcjf@gmail.com> Co-authored-by: caojiafeng <funfriendcjf@gmail.com>
aptos-move/framework/aptos-stdlib/sources/cryptography/bn254_algebra.move
Outdated
Show resolved
Hide resolved
aptos-move/framework/aptos-stdlib/sources/cryptography/bn254_algebra.move
Outdated
Show resolved
Hide resolved
aptos-move/framework/aptos-stdlib/sources/cryptography/bn254_algebra.move
Outdated
Show resolved
Hide resolved
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
@@ -44,4 +46,4 @@ | |||
/// global operations. | |||
/// - V1 | |||
/// - TBA | |||
pub const LATEST_GAS_FEATURE_VERSION: u64 = 12; | |||
pub const LATEST_GAS_FEATURE_VERSION: u64 = 13; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FYI, a gas version bump here.
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.
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.
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.
This comment has been minimized.
✅ Forge suite
|
✅ Forge suite
|
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
❌ Forge suite
|
Description
The PR tries to add native support for BN254 elliptic curves in
aptos_std::crypto_algebra
andaptos_std::bn254_algebra
. This PR implements all thecrypto_algebra
natives for BN254, excepthash_to_curve
(as BN254 has no support on this).TODOs
arkworks-rs
issue