Lower data receipt cost (Sep 2021)

Reproducing

cd ./nearcore
cargo run --release --package neard --bin neard -- --home /tmp/data init --test-seed=alice.near --account-id=test.near --fast
cargo run --release --package runtime-params-estimator --features required --bin runtime-params-estimator -- --docker --home /tmp/data --accounts-num 20000 --additional-accounts-num 200000 --iters 1 --warmup-iters 1 --metric icount --full
./target/release/runtime-params-estimator --additional-accounts-num 0 --costs-file costs-$YOUR_DATE_TIME.txt --home /tmp/data

Difference

% python3 ./runtime/runtime-params-estimator/emu-cost/compare_costs.py ./nearcore/res/runtime_configs/42.json ./nearcore/res/runtime_configs/115.json --diff
transaction_costs.data_receipt_creation_config.base_cost.send_sir: first=4697339419375 second=36486732312 second/first=0.01
transaction_costs.data_receipt_creation_config.base_cost.send_not_sir: first=4697339419375 second=36486732312 second/first=0.01
transaction_costs.data_receipt_creation_config.base_cost.execution: first=4697339419375 second=36486732312 second/first=0.01
transaction_costs.data_receipt_creation_config.cost_per_byte.send_sir: first=59357464 second=17212011 second/first=0.29
transaction_costs.data_receipt_creation_config.cost_per_byte.send_not_sir: first=59357464 second=17212011 second/first=0.29
transaction_costs.data_receipt_creation_config.cost_per_byte.execution: first=59357464 second=17212011 second/first=0.29

Costs file

ActionReceiptCreation                         333_455_875_000
ActionSirReceiptCreation                      244_844_875_000
DataReceiptCreationBase                        72_973_464_625
DataReceiptCreationPerByte                         34_424_023
ActionCreateAccount                            72_283_125_000
ActionDeployContractBase                    2_096_893_419_272
ActionDeployContractPerByte                       400_609_352
ActionFunctionCallBase                        341_995_500_000
ActionFunctionCallPerByte                              64_435
ActionTransfer                                 54_365_750_000
ActionStake                                   125_890_250_000
ActionAddFullAccessKey                        103_484_125_000
ActionAddFunctionAccessKeyBase                 63_198_125_000
ActionAddFunctionAccessKeyPerByte                  25_692_687
ActionDeleteKey                                35_840_250_000
ActionDeleteAccount                           276_588_250_000
HostFunctionCall                                  104_001_330
WasmInstruction                                     1_603_479
ReadMemoryBase                                    281_047_100
ReadMemoryByte                                      1_268_409
WriteMemoryBase                                   354_655_450
WriteMemoryByte                                        62_581
ReadRegisterBase                                  248_330_812
ReadRegisterByte                                       33_194
WriteRegisterBase                                 385_806_087
WriteRegisterByte                                   1_268_511
Utf8DecodingBase                                  491_071_412
Utf8DecodingByte                                  119_616_686
Utf16DecodingBase                                 638_526_925
Utf16DecodingByte                                  65_667_397
Sha256Base                                      1_056_921_225
Sha256Byte                                          9_541_417
Keccak256Base                                   1_381_437_987
Keccak256Byte                                       7_088_617
Keccak512Base                                   1_376_478_050
Keccak512Byte                                      12_130_535
Ripemd160Base                                     746_618_062
Ripemd160Block                                    311_012_256
EcrecoverBase                                  93_267_272_600
LogBase                                           638_526_925
LogByte                                             4_127_069
StorageWriteBase                               14_999_582_250
StorageWriteKeyByte                                26_046_745
StorageWriteValueByte                              14_066_952
StorageWriteEvictedByte                            12_976_428
StorageReadBase                                22_919_981_375
StorageReadKeyByte                                 10_796_004
StorageReadValueByte                                2_324_327
StorageRemoveBase                              32_597_807_125
StorageRemoveKeyByte                               23_824_882
StorageRemoveRetValueByte                           3_280_154
StorageHasKeyBase                              20_610_690_375
StorageHasKeyByte                                  10_633_154
TouchingTrieNode                                6_548_566_107
PromiseAndBase                                    497_005_486
PromiseAndPerPromise                                2_145_839
PromiseReturn                                     153_044_323

Runtime Config

RuntimeConfig {
    storage_amount_per_byte: 90900000000000000000,
    transaction_costs: RuntimeFeesConfig {
        action_receipt_creation_config: Fee {
            send_sir: 166727937500,
            send_not_sir: 166727937500,
            execution: 166727937500,
        },
        data_receipt_creation_config: DataReceiptCreationConfig {
            base_cost: Fee {
                send_sir: 36486732312,
                send_not_sir: 36486732312,
                execution: 36486732312,
            },
            cost_per_byte: Fee {
                send_sir: 17212011,
                send_not_sir: 17212011,
                execution: 17212011,
            },
        },
        action_creation_config: ActionCreationConfig {
            create_account_cost: Fee {
                send_sir: 36141562500,
                send_not_sir: 36141562500,
                execution: 36141562500,
            },
            deploy_contract_cost: Fee {
                send_sir: 1048446709636,
                send_not_sir: 1048446709636,
                execution: 1048446709636,
            },
            deploy_contract_cost_per_byte: Fee {
                send_sir: 200304676,
                send_not_sir: 200304676,
                execution: 200304676,
            },
            function_call_cost: Fee {
                send_sir: 170997750000,
                send_not_sir: 170997750000,
                execution: 170997750000,
            },
            function_call_cost_per_byte: Fee {
                send_sir: 32217,
                send_not_sir: 32217,
                execution: 32217,
            },
            transfer_cost: Fee {
                send_sir: 27182875000,
                send_not_sir: 27182875000,
                execution: 27182875000,
            },
            stake_cost: Fee {
                send_sir: 62945125000,
                send_not_sir: 62945125000,
                execution: 62945125000,
            },
            add_key_cost: AccessKeyCreationConfig {
                full_access_cost: Fee {
                    send_sir: 51742062500,
                    send_not_sir: 51742062500,
                    execution: 51742062500,
                },
                function_call_cost: Fee {
                    send_sir: 31599062500,
                    send_not_sir: 31599062500,
                    execution: 31599062500,
                },
                function_call_cost_per_byte: Fee {
                    send_sir: 12846343,
                    send_not_sir: 12846343,
                    execution: 12846343,
                },
            },
            delete_key_cost: Fee {
                send_sir: 17920125000,
                send_not_sir: 17920125000,
                execution: 17920125000,
            },
            delete_account_cost: Fee {
                send_sir: 138294125000,
                send_not_sir: 138294125000,
                execution: 138294125000,
            },
        },
        storage_usage_config: StorageUsageConfig {
            num_bytes_account: 100,
            num_extra_bytes_record: 40,
        },
        burnt_gas_reward: Ratio {
            numer: 3,
            denom: 10,
        },
        pessimistic_gas_price_inflation_ratio: Ratio {
            numer: 103,
            denom: 100,
        },
    },
    wasm_config: VMConfig {
        ext_costs: ExtCostsConfig {
            base: 104001330,
            contract_compile_base: 0,
            contract_compile_bytes: 0,
            read_memory_base: 281047100,
            read_memory_byte: 1268409,
            write_memory_base: 354655450,
            write_memory_byte: 62581,
            read_register_base: 248330812,
            read_register_byte: 33194,
            write_register_base: 385806087,
            write_register_byte: 1268511,
            utf8_decoding_base: 491071412,
            utf8_decoding_byte: 119616686,
            utf16_decoding_base: 638526925,
            utf16_decoding_byte: 65667397,
            sha256_base: 1056921225,
            sha256_byte: 9541417,
            keccak256_base: 1381437987,
            keccak256_byte: 7088617,
            keccak512_base: 1376478050,
            keccak512_byte: 12130535,
            ripemd160_base: 746618062,
            ripemd160_block: 311012256,
            ecrecover_base: 93267272600,
            log_base: 638526925,
            log_byte: 4127069,
            storage_write_base: 14999582250,
            storage_write_key_byte: 26046745,
            storage_write_value_byte: 14066952,
            storage_write_evicted_byte: 12976428,
            storage_read_base: 22919981375,
            storage_read_key_byte: 10796004,
            storage_read_value_byte: 2324327,
            storage_remove_base: 32597807125,
            storage_remove_key_byte: 23824882,
            storage_remove_ret_value_byte: 3280154,
            storage_has_key_base: 20610690375,
            storage_has_key_byte: 10633154,
            storage_iter_create_prefix_base: 0,
            storage_iter_create_prefix_byte: 0,
            storage_iter_create_range_base: 0,
            storage_iter_create_from_byte: 0,
            storage_iter_create_to_byte: 0,
            storage_iter_next_base: 0,
            storage_iter_next_key_byte: 0,
            storage_iter_next_value_byte: 0,
            touching_trie_node: 6548566107,
            promise_and_base: 497005486,
            promise_and_per_promise: 2145839,
            promise_return: 153044323,
            validator_stake_base: 303944908800,
            validator_total_stake_base: 303944908800,
        },
        grow_mem_cost: 1,
        regular_op_cost: 1603479,
        limit_config: VMLimitConfig {
            max_gas_burnt: 200000000000000,
            max_gas_burnt_view: 200000000000000,
            max_stack_height: 16384,
            initial_memory_pages: 1024,
            max_memory_pages: 2048,
            registers_memory_limit: 1073741824,
            max_register_size: 104857600,
            max_number_registers: 100,
            max_number_logs: 100,
            max_total_log_length: 16384,
            max_total_prepaid_gas: 300000000000000,
            max_actions_per_receipt: 100,
            max_number_bytes_method_names: 2000,
            max_length_method_name: 256,
            max_arguments_length: 4194304,
            max_length_returned_data: 4194304,
            max_contract_size: 4194304,
            max_transaction_size: 4194304,
            max_length_storage_key: 4194304,
            max_length_storage_value: 4194304,
            max_promises_per_function_call_action: 1024,
            max_number_input_data_dependencies: 128,
        },
    },
    account_creation_config: AccountCreationConfig {
        min_allowed_top_level_account_length: 0,
        registrar_account_id: AccountId(
            "registrar",
        ),
    },
}

Bonus: cost table for 100k

Diff (weird)

ActionAddFullAccessKey: first=103484125000 second=66585750000 second/first=0.64
ActionDeleteKey: first=35840250000 second=29515875000 second/first=0.82
Utf16DecodingBase: first=638526925 second=807107300 second/first=1.26
LogBase: first=638526925 second=807107300 second/first=1.26
ActionReceiptCreation                         380_214_000_000
ActionSirReceiptCreation                      280_321_625_000
DataReceiptCreationBase                        77_066_807_000
DataReceiptCreationPerByte                         34_418_089
ActionCreateAccount                            69_450_875_000
ActionDeployContractBase                    2_113_236_763_216
ActionDeployContractPerByte                       400_555_345
ActionFunctionCallBase                        339_407_875_000
ActionFunctionCallPerByte                              59_106
ActionTransfer                                 59_136_125_000
ActionStake                                   124_326_625_000
ActionAddFullAccessKey                         66_585_750_000
ActionAddFunctionAccessKeyBase                 61_889_375_000
ActionAddFunctionAccessKeyPerByte                  25_654_425
ActionDeleteKey                                29_515_875_000
ActionDeleteAccount                           301_623_500_000
HostFunctionCall                                  104_014_022
WasmInstruction                                     1_596_534
ReadMemoryBase                                    281_569_850
ReadMemoryByte                                      1_268_409
WriteMemoryBase                                   356_472_375
WriteMemoryByte                                        62_581
ReadRegisterBase                                  249_392_350
ReadRegisterByte                                       33_034
WriteRegisterBase                                 386_952_675
WriteRegisterByte                                   1_268_510
Utf8DecodingBase                                  492_544_025
Utf8DecodingByte                                  119_612_130
Utf16DecodingBase                                 807_107_300
Utf16DecodingByte                                  65_665_569
Sha256Base                                      1_057_965_687
Sha256Byte                                          9_525_620
Keccak256Base                                   1_382_562_575
Keccak256Byte                                       7_072_488
Keccak512Base                                   1_378_324_425
Keccak512Byte                                      12_130_976
Ripemd160Base                                     747_458_075
Ripemd160Block                                    311_010_555
EcrecoverBase                                  92_932_529_562
LogBase                                           807_107_300
LogByte                                             4_114_062
StorageWriteBase                               14_919_839_750
StorageWriteKeyByte                                26_107_728
StorageWriteValueByte                              14_085_175
StorageWriteEvictedByte                            13_103_057
StorageReadBase                                23_001_637_250
StorageReadKeyByte                                 10_863_355
StorageReadValueByte                                2_345_661
StorageRemoveBase                              32_412_804_250
StorageRemoveKeyByte                               24_152_796
StorageRemoveRetValueByte                           3_549_108
StorageHasKeyBase                              21_330_633_000
StorageHasKeyByte                                  10_625_309
TouchingTrieNode                                6_571_896_357
PromiseAndBase                                    496_993_706
PromiseAndPerPromise                                2_137_265
PromiseReturn                                     153_189_731
Select a repo