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

Feature: Add protocol update for crypto utils #1675

Merged

Conversation

talekhinezh
Copy link
Member

No description provided.

@talekhinezh talekhinezh changed the title Feature: Add protocol update to crypto utils Feature: Add protocol update for crypto utils Jan 12, 2024
Copy link

github-actions bot commented Jan 12, 2024

Benchmark for b577ddd

Click to view benchmark
Test Base PR %
costing::bench_prepare_wasm 65.2±0.20ms 65.9±0.32ms +1.07%
costing::decode_sbor 12.9±0.04µs 13.2±0.06µs +2.33%
costing::decode_sbor_bytes 38.2±0.07µs 35.9±0.06µs -6.02%
costing::deserialize_wasm 1232.6±7.40µs 1231.9±1.84µs -0.06%
costing::instantiate_flash_loan 3.9±0.42ms 3.9±0.42ms 0.00%
costing::instantiate_radiswap 5.1±0.08ms 5.2±0.08ms +1.96%
costing::spin_loop 21.5±0.02ms 21.6±0.01ms +0.47%
costing::validate_sbor_payload 24.6±0.04µs 24.2±0.02µs -1.63%
costing::validate_sbor_payload_bytes 341.1±0.37ns 339.0±0.37ns -0.62%
costing::validate_secp256k1 80.3±0.08µs 80.3±0.09µs 0.00%
costing::validate_wasm 34.7±0.10ms 34.7±0.03ms 0.00%
decimal::add/0 7.2±0.00ns 7.2±0.00ns 0.00%
decimal::add/rust-native 9.5±0.01ns 9.5±0.01ns 0.00%
decimal::add/wasmer 137.3±0.07ns 137.8±0.07ns +0.36%
decimal::add/wasmer-call-native 522.2±0.18ns 518.3±0.13ns -0.75%
decimal::add/wasmi 485.5±0.09ns 441.2±0.08ns -9.12%
decimal::add/wasmi-call-native 3.6±0.04µs 3.4±0.01µs -5.56%
decimal::div/0 165.8±0.07ns 171.3±0.05ns +3.32%
decimal::from_string/0 154.6±0.08ns 153.9±0.06ns -0.45%
decimal::mul/0 128.6±0.07ns 133.5±0.07ns +3.81%
decimal::mul/rust-native 132.5±0.08ns 131.6±0.06ns -0.68%
decimal::mul/wasmer 1732.6±0.29ns 1725.1±0.62ns -0.43%
decimal::mul/wasmer-call-native 654.8±0.50ns 653.9±0.32ns -0.14%
decimal::mul/wasmi 26.6±0.02µs 26.8±0.05µs +0.75%
decimal::mul/wasmi-call-native 3.6±0.02µs 3.6±0.01µs 0.00%
decimal::pow/0 648.8±0.18ns 620.4±0.19ns -4.38%
decimal::pow/rust-native 604.9±0.14ns 605.3±0.27ns +0.07%
decimal::pow/wasmer 7.6±0.00µs 7.6±0.00µs 0.00%
decimal::pow/wasmer-call-native 1080.2±0.22ns 1085.4±0.13ns +0.48%
decimal::pow/wasmi 125.2±0.12µs 126.5±0.09µs +1.04%
decimal::pow/wasmi-call-native 3.5±0.01µs 3.5±0.02µs 0.00%
decimal::root/0 9.1±0.01µs 9.3±0.00µs +2.20%
decimal::sub/0 7.2±0.00ns 7.2±0.00ns 0.00%
decimal::to_string/0 493.8±0.30ns 491.5±0.60ns -0.47%
precise_decimal::add/0 8.0±0.00ns 10.1±0.01ns +26.25%
precise_decimal::add/rust-native 10.4±0.01ns 10.4±0.01ns 0.00%
precise_decimal::add/wasmer 141.8±0.25ns 140.9±0.14ns -0.63%
precise_decimal::add/wasmer-call-native 532.7±0.28ns 533.4±0.62ns +0.13%
precise_decimal::add/wasmi 535.7±0.17ns 537.1±0.21ns +0.26%
precise_decimal::add/wasmi-call-native 3.7±0.00µs 3.7±0.02µs 0.00%
precise_decimal::div/0 265.6±0.04ns 269.9±0.03ns +1.62%
precise_decimal::from_string/0 200.0±0.24ns 200.5±0.10ns +0.25%
precise_decimal::mul/0 285.0±0.15ns 296.1±0.25ns +3.89%
precise_decimal::mul/rust-native 258.3±0.06ns 258.3±0.07ns 0.00%
precise_decimal::mul/wasmer 4.1±0.00µs 4.1±0.00µs 0.00%
precise_decimal::mul/wasmer-call-native 821.1±0.37ns 819.6±0.28ns -0.18%
precise_decimal::mul/wasmi 74.2±0.04µs 75.0±0.05µs +1.08%
precise_decimal::mul/wasmi-call-native 4.0±0.01µs 4.0±0.03µs 0.00%
precise_decimal::pow/0 1574.6±0.32ns 1565.1±0.27ns -0.60%
precise_decimal::pow/rust-native 1282.0±0.39ns 1276.3±1.88ns -0.44%
precise_decimal::pow/wasmer 19.0±0.01µs 19.2±0.01µs +1.05%
precise_decimal::pow/wasmer-call-native 2.0±0.00µs 2.0±0.00µs 0.00%
precise_decimal::pow/wasmi 358.3±0.23µs 361.9±0.16µs +1.00%
precise_decimal::pow/wasmi-call-native 7.6±0.02µs 7.7±0.04µs +1.32%
precise_decimal::root/0 60.4±0.02µs 60.8±0.03µs +0.66%
precise_decimal::sub/0 8.3±0.00ns 10.3±0.00ns +24.10%
precise_decimal::to_string/0 741.3±0.41ns 743.5±0.30ns +0.30%
schema::validate_payload 324.7±0.46µs 325.7±0.61µs +0.31%
transaction::radiswap 5.2±0.05ms 5.2±0.05ms 0.00%
transaction::transfer 1686.1±3.29µs 1705.4±5.69µs +1.14%
transaction_processing::prepare 2.4±0.00ms 2.5±0.00ms +4.17%
transaction_processing::prepare_and_decompile 6.1±0.02ms 6.1±0.01ms 0.00%
transaction_processing::prepare_and_decompile_and_recompile 23.4±0.28ms 24.6±0.21ms +5.13%
transaction_validation::validate_manifest 43.9±0.04µs 43.9±0.03µs 0.00%
transaction_validation::verify_bls_2KB 1002.9±1.18µs 1000.0±1.12µs -0.29%
transaction_validation::verify_bls_32B 1001.1±1.50µs 1032.3±14.70µs +3.12%
transaction_validation::verify_ecdsa 78.1±0.11µs 80.0±0.10µs +2.43%
transaction_validation::verify_ed25519 51.5±0.06µs 51.4±0.17µs -0.19%

Copy link
Member

@0xOmarA 0xOmarA left a comment

Choose a reason for hiding this comment

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

Looks good, it might be worth checking with gateway team if they need the booloader to have a TypeInfo substate, or at least to let them know that it does not, in case they rely on all nodes having a type info substate.

Copy link
Member

@0xOmarA 0xOmarA left a comment

Choose a reason for hiding this comment

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

Looks good, it might be worth checking with gateway team if they need the booloader to have a TypeInfo substate, or at least to let them know that it does not, in case they rely on all nodes having a type info substate.

@@ -734,6 +734,12 @@ impl WasmModule {
}
}
CRYPTO_UTILS_BLS12381_V1_VERIFY_FUNCTION_NAME => {
if minor_version < 1 {
return Err(PrepareError::InvalidImport(
InvalidImport::ImportNotAllowed(entry.name.to_string()),
Copy link
Contributor

Choose a reason for hiding this comment

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

Just thinking that maybe we could use more informative error here, that version is not correct.

@@ -60,7 +60,7 @@ impl ScryptoV1WasmValidator {
) -> Result<(Vec<u8>, Vec<String>), PrepareError> {
WasmModule::init(code)?
.enforce_no_start_function()?
.enforce_import_limit()?
.enforce_import_limit(self.minor_version)?
Copy link
Contributor

Choose a reason for hiding this comment

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

minor thing, but the name is no longer adequate :)

@talekhinezh talekhinezh force-pushed the feature/add-protocol-update-to-crypto-utils branch from 245ba52 to 284aa45 Compare January 12, 2024 21:57
@talekhinezh talekhinezh merged commit 025de3d into feature/bls_signatures Jan 12, 2024
25 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants