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

fix: Better align NativeProof / NativeBucket functionality with Scrypto #1859

Merged
merged 3 commits into from
Aug 7, 2024

Conversation

dhedey
Copy link
Contributor

@dhedey dhedey commented Jul 24, 2024

Summary

After reports from a user on Telegram struggling with the TestEnvironment, and observing some issues using FungibleBucket / NonFungibleBucket in Radquest, this fixes:

  • FungibleBucket and NonFungibleBucket to have features like .resource_manager() and not need manually converting into a Bucket.
  • native-sdk's ResourceManager and scrypto-test's ResourceBuilder to return FungibleBucket / NonFungibleBucket from relevant methods

Builds on top of system-api-interface-refactor #1857 (and actually motivated it).

Note this PR doesn't fully split fungible/non-fungible-specific functionality out of NativeBucket and NativeProof as those would be breaking changes - but maybe we should; as I have introduced breaking changes to ResourceBuilder and ResourceManager to make them easier to use.

Copy link

Phylum Report Link

@dhedey dhedey force-pushed the tweak/native-bucket-improvements branch from f40d07f to 08ad00a Compare July 24, 2024 16:01
Copy link

github-actions bot commented Jul 24, 2024

Docker tags
docker.io/radixdlt/private-scrypto-builder:0454466516

Copy link

github-actions bot commented Jul 24, 2024

Benchmark for 0454466

Click to view benchmark
Test Base PR %
costing::bench_prepare_wasm 63.2±0.29ms 62.6±0.15ms -0.95%
costing::decode_sbor 10.8±0.01µs 10.8±0.02µs 0.00%
costing::decode_sbor_bytes 29.5±0.16µs 29.6±0.59µs +0.34%
costing::deserialize_wasm 1271.7±3.46µs 1285.9±7.60µs +1.12%
costing::instantiate_flash_loan 1000.8±1043.86µs 989.7±1073.51µs -1.11%
costing::instantiate_radiswap 984.2±1056.31µs 1343.7±3726.66µs +36.53%
costing::spin_loop 20.7±0.07ms 20.7±0.05ms 0.00%
costing::validate_sbor_payload 29.9±0.18µs 28.5±0.21µs -4.68%
costing::validate_sbor_payload_bytes 243.5±0.86ns 239.0±0.54ns -1.85%
costing::validate_secp256k1 76.3±0.24µs 76.2±0.05µs -0.13%
costing::validate_wasm 33.3±0.04ms 33.5±0.24ms +0.60%
decimal::add/0 8.4±0.00ns 8.4±0.00ns 0.00%
decimal::add/rust-native 9.8±0.02ns 9.8±0.01ns 0.00%
decimal::add/wasmi 221.8±0.27ns 220.8±0.48ns -0.45%
decimal::add/wasmi-call-native 2.1±0.00µs 2.1±0.00µs 0.00%
decimal::div/0 185.6±0.33ns 187.0±0.14ns +0.75%
decimal::from_string/0 156.6±0.68ns 156.5±0.68ns -0.06%
decimal::mul/0 148.7±0.41ns 149.5±0.08ns +0.54%
decimal::mul/rust-native 150.4±0.28ns 146.3±0.04ns -2.73%
decimal::mul/wasmi 11.8±0.06µs 11.8±0.02µs 0.00%
decimal::mul/wasmi-call-native 2.2±0.00µs 2.3±0.01µs +4.55%
decimal::pow/0 700.6±0.32ns 701.4±0.36ns +0.11%
decimal::pow/rust-native 665.5±0.43ns 664.7±1.27ns -0.12%
decimal::pow/wasmi 56.7±0.21µs 56.4±0.21µs -0.53%
decimal::pow/wasmi-call-native 2.4±0.00µs 2.5±0.00µs +4.17%
decimal::root/0 7.9±0.01µs 7.7±0.02µs -2.53%
decimal::sub/0 8.1±0.01ns 8.2±0.01ns +1.23%
decimal::to_string/0 438.9±0.60ns 438.5±0.94ns -0.09%
precise_decimal::add/0 8.8±0.01ns 8.9±0.00ns +1.14%
precise_decimal::add/rust-native 10.7±0.00ns 10.7±0.06ns 0.00%
precise_decimal::add/wasmi 291.0±0.69ns 275.5±0.84ns -5.33%
precise_decimal::add/wasmi-call-native 2.7±0.00µs 2.8±0.01µs +3.70%
precise_decimal::div/0 323.4±2.52ns 335.6±1.57ns +3.77%
precise_decimal::from_string/0 197.6±0.23ns 198.8±0.25ns +0.61%
precise_decimal::mul/0 362.2±0.58ns 361.9±0.20ns -0.08%
precise_decimal::mul/rust-native 320.2±0.29ns 324.3±2.58ns +1.28%
precise_decimal::mul/wasmi 34.1±0.22µs 33.4±0.18µs -2.05%
precise_decimal::mul/wasmi-call-native 3.2±0.01µs 3.2±0.03µs 0.00%
precise_decimal::pow/0 1945.3±4.50ns 1939.6±1.58ns -0.29%
precise_decimal::pow/rust-native 1529.9±3.11ns 1527.5±3.09ns -0.16%
precise_decimal::pow/wasmi 163.6±0.72µs 160.6±0.47µs -1.83%
precise_decimal::pow/wasmi-call-native 5.8±0.01µs 5.8±0.01µs 0.00%
precise_decimal::root/0 59.1±0.02µs 59.0±0.10µs -0.17%
precise_decimal::sub/0 9.0±0.04ns 9.2±0.03ns +2.22%
precise_decimal::to_string/0 704.7±0.64ns 702.8±0.57ns -0.27%
schema::validate_payload 314.1±3.08µs 312.4±5.20µs -0.54%
transaction::radiswap 5.0±0.03ms 5.0±0.04ms 0.00%
transaction::transfer 1817.9±7.22µs 1809.4±16.30µs -0.47%
transaction_processing::prepare 1405.0±5.01µs 1410.8±6.98µs +0.41%
transaction_processing::prepare_and_decompile 5.2±0.01ms 5.1±0.02ms -1.92%
transaction_processing::prepare_and_decompile_and_recompile 24.0±1.00ms 26.2±1.86ms +9.17%
transaction_validation::validate_manifest 42.1±0.02µs 42.2±0.38µs +0.24%
transaction_validation::verify_bls_2KB 971.2±24.58µs 970.4±14.68µs -0.08%
transaction_validation::verify_bls_32B 1012.3±35.96µs 1034.1±65.37µs +2.15%
transaction_validation::verify_ecdsa 74.1±0.05µs 74.2±0.09µs +0.13%
transaction_validation::verify_ed25519 54.7±0.05µs 55.2±0.20µs +0.91%

@dhedey dhedey marked this pull request as ready for review July 26, 2024 23:34
@dhedey dhedey changed the base branch from system-api-interface-refactor to develop August 7, 2024 07:28
@dhedey dhedey force-pushed the tweak/native-bucket-improvements branch from ae8529c to 9cb53be Compare August 7, 2024 08:43
@dhedey dhedey changed the title fix: Better align NativeProof / NativeBucket functionality with Scrypto fix: Better align NativeProof / NativeBucket functionality with Scrypto Aug 7, 2024
@dhedey dhedey merged commit 184da10 into develop Aug 7, 2024
29 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.

2 participants