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: store configuration #53

Merged
merged 2 commits into from
Nov 2, 2023
Merged

fix: store configuration #53

merged 2 commits into from
Nov 2, 2023

Conversation

JordyRo1
Copy link
Contributor

@JordyRo1 JordyRo1 commented Nov 2, 2023

Just realize why we add an gas increase on the previous merge, we implemented ourselves the pack/unpack, which was removed during another merge. This implementation cost was lower than the usual starknet::Store. We initially chose to implement our own version of pack/unpack because cairo did not support starknet::Store at the time for structs containing enums, but it seems that the problem is solve right now. We can then either chose more security and using starknet::Store, or still stick to our implementation of pack/unpack which is less expensive

Copy link

github-actions bot commented Nov 2, 2023

Output from Compare Snapshot:

****IMPROVEMENTS****
pragma::tests::test_oracle::get_data_for_sources 25965100 --> 25244636 -2.77 %
pragma::tests::test_oracle::get_data_median 36405650 --> 35394786 -2.78 %
pragma::tests::test_oracle::get_data_median_for_sources 22945620 --> 22321956 -2.72 %
pragma::tests::test_oracle::get_data_median_for_sources_should_fail_if_wrong_sources 20809040 --> 20275076 -2.57 %
pragma::tests::test_oracle::test_add_currency_should_fail_if_currency_id_null 20329770 --> 19802906 -2.59 %
pragma::tests::test_oracle::test_add_pair_should_panic_if_base_currency_do_not_corresponds 20474740 --> 19947876 -2.57 %
pragma::tests::test_oracle::test_add_pair_should_panic_if_quote_currency_do_not_corresponds 20499740 --> 19972876 -2.57 %
pragma::tests::test_oracle::test_data_entry 22614540 --> 21899576 -3.16 %
pragma::tests::test_oracle::test_data_entry_should_fail_if_not_found 20184940 --> 19640976 -2.69 %
pragma::tests::test_oracle::test_data_entry_should_fail_if_not_found_2 20184940 --> 19640976 -2.69 %
pragma::tests::test_oracle::test_data_entry_should_fail_if_not_found_3 20184940 --> 19640976 -2.69 %
pragma::tests::test_oracle::test_data_median_multi_should_fail_if_no_expiration_time_associated 20796240 --> 20252276 -2.62 %
pragma::tests::test_oracle::test_data_median_multi_should_fail_if_wrong_data_types 21585000 --> 21002636 -2.70 %
pragma::tests::test_oracle::test_data_median_multi_should_fail_if_wrong_sources 21603410 --> 21021046 -2.70 %
pragma::tests::test_oracle::test_get_admin_address 20052160 --> 19525296 -2.63 %
pragma::tests::test_oracle::test_get_data 43512560 --> 42308096 -2.77 %
pragma::tests::test_oracle::test_get_data_entry_for_publishers 53263600 --> 51848360 -2.66 %
pragma::tests::test_oracle::test_get_data_median_multi 32721090 --> 31807026 -2.79 %
pragma::tests::test_oracle::test_get_data_with_USD_hop_should_fail_if_wrong_id 21379920 --> 20853056 -2.46 %
pragma::tests::test_oracle::test_get_data_with_usd_hop 32143000 --> 31325736 -2.54 %
pragma::tests::test_oracle::test_get_data_with_usd_hop_diff 24780040 --> 24156376 -2.52 %
pragma::tests::test_oracle::test_get_decimals 21034170 --> 20507306 -2.50 %
pragma::tests::test_oracle::test_get_decimals_should_fail_if_not_found 20191260 --> 19664396 -2.61 %
pragma::tests::test_oracle::test_get_decimals_should_fail_if_not_found_2 20191260 --> 19664396 -2.61 %
pragma::tests::test_oracle::test_get_last_checkpoint_before 28458360 --> 27409456 -3.69 %
pragma::tests::test_oracle::test_get_last_checkpoint_before_should_fail_if_timestamp_too_old 27869540 --> 26924786 -3.39 %
pragma::tests::test_oracle::test_get_last_checkpoint_before_should_fail_if_wrong_data_type 27869540 --> 26924786 -3.39 %
pragma::tests::test_oracle::test_max_publish_multiple_entries 56112420 --> 54053088 -3.67 %
pragma::tests::test_oracle::test_multiple_publishers_price 68445150 --> 66275550 -3.17 %
pragma::tests::test_oracle::test_publish_multiple_entries 32006350 --> 30983690 -3.20 %
pragma::tests::test_oracle::test_set_checkpoint 28179980 --> 27233276 -3.36 %
pragma::tests::test_oracle::test_set_checkpoint_should_fail_if_wrong_data_type 20937950 --> 20346016 -2.83 %
pragma::tests::test_summary_stats::test_set_future_checkpoint 71276700 --> 66229848 -7.08 %
pragma::tests::test_summary_stats::test_summary_stats_mean_mean 68171000 --> 62979382 -7.62 %
pragma::tests::test_summary_stats::test_summary_stats_mean_median 68171000 --> 62979382 -7.62 %
pragma::tests::test_yield_curve::test_yield_curve_computation 21770250 --> 21357682 -1.90 %
pragma::tests::test_yield_curve::test_yield_curve_empty 6326200 --> 6319100 -0.11 %


****WORSENED****
None


Overall gas change: performance improvement, gas consumption-3.53 %

Copy link

github-actions bot commented Nov 2, 2023

Output from Compare Snapshot:

****IMPROVEMENTS****
pragma::tests::test_oracle::get_data_for_sources 25965100 --> 24565736 -5.39 %
pragma::tests::test_oracle::get_data_median 36405650 --> 34715886 -4.64 %
pragma::tests::test_oracle::get_data_median_for_sources 22945620 --> 21643056 -5.68 %
pragma::tests::test_oracle::get_data_median_for_sources_should_fail_if_wrong_sources 20809040 --> 19596176 -5.83 %
pragma::tests::test_oracle::test_add_currency_should_fail_if_currency_id_null 20329770 --> 19077006 -6.16 %
pragma::tests::test_oracle::test_add_pair_should_panic_if_base_currency_do_not_corresponds 20474740 --> 19221976 -6.12 %
pragma::tests::test_oracle::test_add_pair_should_panic_if_quote_currency_do_not_corresponds 20499740 --> 19246976 -6.11 %
pragma::tests::test_oracle::test_data_entry 22614540 --> 21220676 -6.16 %
pragma::tests::test_oracle::test_data_entry_should_fail_if_not_found 20184940 --> 18962076 -6.06 %
pragma::tests::test_oracle::test_data_entry_should_fail_if_not_found_2 20184940 --> 18962076 -6.06 %
pragma::tests::test_oracle::test_data_entry_should_fail_if_not_found_3 20184940 --> 18962076 -6.06 %
pragma::tests::test_oracle::test_data_median_multi_should_fail_if_no_expiration_time_associated 20796240 --> 19573376 -5.88 %
pragma::tests::test_oracle::test_data_median_multi_should_fail_if_wrong_data_types 21585000 --> 20323736 -5.84 %
pragma::tests::test_oracle::test_data_median_multi_should_fail_if_wrong_sources 21603410 --> 20342146 -5.84 %
pragma::tests::test_oracle::test_get_admin_address 20052160 --> 18846396 -6.01 %
pragma::tests::test_oracle::test_get_data 43512560 --> 41629196 -4.33 %
pragma::tests::test_oracle::test_get_data_entry_for_publishers 53263600 --> 50193160 -5.76 %
pragma::tests::test_oracle::test_get_data_median_multi 32721090 --> 31128126 -4.87 %
pragma::tests::test_oracle::test_get_data_with_USD_hop_should_fail_if_wrong_id 21379920 --> 20174156 -5.64 %
pragma::tests::test_oracle::test_get_data_with_usd_hop 32143000 --> 30646836 -4.65 %
pragma::tests::test_oracle::test_get_data_with_usd_hop_diff 24780040 --> 23477476 -5.26 %
pragma::tests::test_oracle::test_get_decimals 21034170 --> 19828406 -5.73 %
pragma::tests::test_oracle::test_get_decimals_should_fail_if_not_found 20191260 --> 18985496 -5.97 %
pragma::tests::test_oracle::test_get_decimals_should_fail_if_not_found_2 20191260 --> 18985496 -5.97 %
pragma::tests::test_oracle::test_get_last_checkpoint_before 28458360 --> 26636556 -6.40 %
pragma::tests::test_oracle::test_get_last_checkpoint_before_should_fail_if_timestamp_too_old 27869540 --> 26151886 -6.16 %
pragma::tests::test_oracle::test_get_last_checkpoint_before_should_fail_if_wrong_data_type 27869540 --> 26151886 -6.16 %
pragma::tests::test_oracle::test_max_publish_multiple_entries 56112420 --> 51879988 -7.54 %
pragma::tests::test_oracle::test_multiple_publishers_price 68445150 --> 64965950 -5.08 %
pragma::tests::test_oracle::test_publish_multiple_entries 32006350 --> 29967390 -6.37 %
pragma::tests::test_oracle::test_set_checkpoint 28179980 --> 26460376 -6.10 %
pragma::tests::test_oracle::test_set_checkpoint_should_fail_if_wrong_data_type 20937950 --> 19620116 -6.29 %
pragma::tests::test_publisher_registry::test_add_publisher 1505800 --> 1453500 -3.47 %
pragma::tests::test_publisher_registry::test_add_publisher_should_fail_if_not_admin 1362890 --> 1310590 -3.84 %
pragma::tests::test_publisher_registry::test_add_publisher_should_fail_if_publisher_already_exists 1367890 --> 1315590 -3.82 %
pragma::tests::test_publisher_registry::test_add_source 1843950 --> 1763000 -4.39 %
pragma::tests::test_publisher_registry::test_add_source_should_fail_if_not_admin 1393290 --> 1317340 -5.45 %
pragma::tests::test_publisher_registry::test_add_source_should_fail_if_source_already_exists 1520630 --> 1444680 -4.99 %
pragma::tests::test_publisher_registry::test_change_admin 1429980 --> 1377680 -3.66 %
pragma::tests::test_publisher_registry::test_change_admin_should_fail_if_admin_is_same_as_current_admin 1311110 --> 1258810 -3.99 %
pragma::tests::test_publisher_registry::test_change_admin_should_fail_if_admin_is_same_as_current_admin_2 1513620 --> 1461320 -3.46 %
pragma::tests::test_publisher_registry::test_change_admin_should_fail_if_admin_is_zero 1313030 --> 1260730 -3.98 %
pragma::tests::test_publisher_registry::test_change_admin_should_fail_if_not_admin 1306110 --> 1253810 -4.00 %
pragma::tests::test_publisher_registry::test_register_non_admin_fail 1362890 --> 1310590 -3.84 %
pragma::tests::test_publisher_registry::test_remove_publisher 1586720 --> 1534420 -3.30 %
pragma::tests::test_publisher_registry::test_remove_publisher_should_fail_if_not_admin 1432890 --> 1380590 -3.65 %
pragma::tests::test_publisher_registry::test_remove_publisher_should_fail_if_publisher_does_not_exist 1437890 --> 1385590 -3.64 %
pragma::tests::test_publisher_registry::test_remove_source 1722740 --> 1670440 -3.04 %
pragma::tests::test_publisher_registry::test_remove_source_should_fail_if_not_admin 1376720 --> 1324420 -3.80 %
pragma::tests::test_publisher_registry::test_remove_source_should_fail_if_source_does_not_exist 1511480 --> 1459180 -3.46 %
pragma::tests::test_publisher_registry::test_update_publisher_address 1413260 --> 1361660 -3.65 %
pragma::tests::test_publisher_registry::test_update_publisher_should_fail_if_not_publisher 1290350 --> 1238750 -4.00 %
pragma::tests::test_summary_stats::test_set_future_checkpoint 71276700 --> 65098098 -8.67 %
pragma::tests::test_summary_stats::test_summary_stats_mean_mean 68171000 --> 62167882 -8.81 %
pragma::tests::test_summary_stats::test_summary_stats_mean_median 68171000 --> 62167882 -8.81 %
pragma::tests::test_yield_curve::test_yield_curve_computation 21770250 --> 21016182 -3.46 %
pragma::tests::test_yield_curve::test_yield_curve_deploy 5550400 --> 5498100 -0.94 %
pragma::tests::test_yield_curve::test_yield_curve_empty 6326200 --> 6266800 -0.94 %


****WORSENED****
None


Overall gas change: performance improvement, gas consumption-6.07 %

@JordyRo1 JordyRo1 merged commit bcce707 into main Nov 2, 2023
6 checks passed
@JordyRo1 JordyRo1 deleted the audit/store-packing branch November 2, 2023 18:55
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