aptos-core icon indicating copy to clipboard operation
aptos-core copied to clipboard

[crypto+move] added support for SHA2-512, SHA3-512 and RIPEMD-160 in Move

Open alinush opened this issue 3 years ago • 9 comments

Description

Added support for SHA2-512, SHA3-512 and RIPEMD-160, to support folks write bridge contracts to other platforms, as per conversations with @JoshLind.

This PR should be good to go:

  • it is feature-gated
  • it has (reasonable) gas costs for the new hash functions, marked with optional
  • it bumps up the gas feature version

Test Plan

This PR merely exports existing hash function crates, which are either already used throughout aptos-core/ or are believed to be trustworthy implementations. Therefore, we only made sure the native implementation give the expected hash values for the empty string "" and for b"testing".


This change is Reviewable

alinush avatar Sep 14 '22 03:09 alinush

Forge is running suite land_blocking on 3b016bcbd163f3fd4b26069fe2b36e4176df0bb1

:white_check_mark: Forge suite land_blocking success on 3b016bcbd163f3fd4b26069fe2b36e4176df0bb1

performance benchmark with full nodes : 8020 TPS, 4950 ms latency, 7500 ms p99 latency,no expired txns
Test Ok

github-actions[bot] avatar Sep 14 '22 22:09 github-actions[bot]

Forge is running suite compat on testnet ==> 3b016bcbd163f3fd4b26069fe2b36e4176df0bb1

:white_check_mark: Forge suite compat success on testnet ==> 3b016bcbd163f3fd4b26069fe2b36e4176df0bb1

Compatibility test results for testnet ==> 3b016bcbd163f3fd4b26069fe2b36e4176df0bb1 (PR)
1. Check liveness of validators at old version: testnet
compatibility::simple-validator-upgrade::liveness-check : 8564 TPS, 4319 ms latency, 6400 ms p99 latency,no expired txns
2. Upgrading first Validator to new version: 3b016bcbd163f3fd4b26069fe2b36e4176df0bb1
compatibility::simple-validator-upgrade::single-validator-upgrade : 5783 TPS, 6307 ms latency, 8000 ms p99 latency,no expired txns
3. Upgrading rest of first batch to new version: 3b016bcbd163f3fd4b26069fe2b36e4176df0bb1
compatibility::simple-validator-upgrade::half-validator-upgrade : 5742 TPS, 6435 ms latency, 7800 ms p99 latency,no expired txns
4. upgrading second batch to new version: 3b016bcbd163f3fd4b26069fe2b36e4176df0bb1
compatibility::simple-validator-upgrade::rest-validator-upgrade : 7799 TPS, 4815 ms latency, 7900 ms p99 latency,no expired txns
5. check swarm health
Compatibility test for testnet ==> 3b016bcbd163f3fd4b26069fe2b36e4176df0bb1 passed
Test Ok

github-actions[bot] avatar Sep 14 '22 22:09 github-actions[bot]

The main blocker for this PR, besides @davidiw's blessing, is a generic way of estimating gas costs for any native function. Will work with @vgao1996 on that and then we can push this through.

But yes, other than that, it's a trivial PR.

alinush avatar Oct 03 '22 19:10 alinush

@alinush yeah as we discussed offline, I'm currently busy with some urgent hotfixes... Let's try not to land this before launch. We'll get back to it later

vgao1996 avatar Oct 03 '22 19:10 vgao1996

@davidiw, this PR is ready to be approved now:

  • it is feature-gated
  • it has the (reasonable) gas costs, marked with optional
  • it bumps up the gas version

...whenever you are ready!

alinush avatar Oct 28 '22 21:10 alinush

Forge is running suite land_blocking on fa58ea74244849a620d12153f618b9b98f8d6bdb

github-actions[bot] avatar Oct 28 '22 21:10 github-actions[bot]

Forge is running suite compat on 2d8b1b57553d869190f61df1aaf7f31a8fc19a7b ==> fa58ea74244849a620d12153f618b9b98f8d6bdb

github-actions[bot] avatar Oct 28 '22 21:10 github-actions[bot]

:white_check_mark: Forge suite land_blocking success on fa58ea74244849a620d12153f618b9b98f8d6bdb

performance benchmark with full nodes : 6905 TPS, 5748 ms latency, 8100 ms p99 latency,no expired txns
Test Ok

github-actions[bot] avatar Oct 28 '22 22:10 github-actions[bot]

:white_check_mark: Forge suite compat success on 2d8b1b57553d869190f61df1aaf7f31a8fc19a7b ==> fa58ea74244849a620d12153f618b9b98f8d6bdb

Compatibility test results for 2d8b1b57553d869190f61df1aaf7f31a8fc19a7b ==> fa58ea74244849a620d12153f618b9b98f8d6bdb (PR)
1. Check liveness of validators at old version: 2d8b1b57553d869190f61df1aaf7f31a8fc19a7b
compatibility::simple-validator-upgrade::liveness-check : 7163 TPS, 5413 ms latency, 7200 ms p99 latency,no expired txns
2. Upgrading first Validator to new version: fa58ea74244849a620d12153f618b9b98f8d6bdb
compatibility::simple-validator-upgrade::single-validator-upgrade : 4327 TPS, 9502 ms latency, 13100 ms p99 latency,no expired txns
3. Upgrading rest of first batch to new version: fa58ea74244849a620d12153f618b9b98f8d6bdb
compatibility::simple-validator-upgrade::half-validator-upgrade : 4710 TPS, 8698 ms latency, 12100 ms p99 latency,no expired txns
4. upgrading second batch to new version: fa58ea74244849a620d12153f618b9b98f8d6bdb
compatibility::simple-validator-upgrade::rest-validator-upgrade : 6541 TPS, 5946 ms latency, 10800 ms p99 latency,no expired txns
5. check swarm health
Compatibility test for 2d8b1b57553d869190f61df1aaf7f31a8fc19a7b ==> fa58ea74244849a620d12153f618b9b98f8d6bdb passed
Test Ok

github-actions[bot] avatar Oct 28 '22 22:10 github-actions[bot]