diff --git a/src/proto_alpha/lib_protocol/michelson_v1_gas.ml b/src/proto_alpha/lib_protocol/michelson_v1_gas.ml index e0e406b87e2c39e25ac874f16c12ce41cdb9e3f8..38b80c962ea56cae34f594e360c4e297a78e9566 100644 --- a/src/proto_alpha/lib_protocol/michelson_v1_gas.ml +++ b/src/proto_alpha/lib_protocol/michelson_v1_gas.ml @@ -123,6 +123,9 @@ module Cost_of = struct let cost_N_IApply rec_flag = if rec_flag then S.safe_int 220 else S.safe_int 140 + (* model N_IBalance *) + let cost_N_IBalance = S.safe_int 10 + (* model N_IBlake2b *) (* Approximating 1.120804 x term *) let cost_N_IBlake2b size = @@ -1306,6 +1309,8 @@ module Cost_of = struct let amount = atomic_step_cost cost_N_IAmount + let balance = atomic_step_cost cost_N_IBalance + let chain_id = atomic_step_cost cost_N_IChainId let ticket = atomic_step_cost cost_N_ITicket @@ -1572,9 +1577,6 @@ module Cost_of = struct let concat_bytes total_bytes = atomic_step_cost S.(add (S.safe_int 100) (S.shift_right total_bytes 1)) - (* Cost of access taken care of in Contract_storage.get_balance_carbonated *) - let balance = Gas.free - (* Cost of Unpack pays two integer comparisons, and a Bytes slice *) let unpack bytes = let blen = Bytes.length bytes in diff --git a/tests_python/tests_alpha/_regtest_outputs/test_contract_onchain_opcodes.TestContractOnchainOpcodes::test_slice_success[(Pair 0xe009ab79e8b84ef0e55c43a9a857214d8761e67b.7da5c9014e.out b/tests_python/tests_alpha/_regtest_outputs/test_contract_onchain_opcodes.TestContractOnchainOpcodes::test_slice_success[(Pair 0xe009ab79e8b84ef0e55c43a9a857214d8761e67b.7da5c9014e.out index d73e376618a7542c68809630d7f3e9718d0f050a..b9df79fcf2339ee838aff7367f85c20bb5d79079 100644 --- a/tests_python/tests_alpha/_regtest_outputs/test_contract_onchain_opcodes.TestContractOnchainOpcodes::test_slice_success[(Pair 0xe009ab79e8b84ef0e55c43a9a857214d8761e67b.7da5c9014e.out +++ b/tests_python/tests_alpha/_regtest_outputs/test_contract_onchain_opcodes.TestContractOnchainOpcodes::test_slice_success[(Pair 0xe009ab79e8b84ef0e55c43a9a857214d8761e67b.7da5c9014e.out @@ -1,7 +1,7 @@ tests_alpha/test_contract_onchain_opcodes.py::TestContractOnchainOpcodes::test_slice_success[(Pair 0xe009ab79e8b84ef0e55c43a9a857214d8761e67b75ba63500a5694fb2ffe174acc2de22d01ccb7259342437f05e1987949f0ad82e9f32e9a0b79cb252d7f7b8236ad728893f4e7150742eefdbeda254970f9fcd92c6228c178e1a923e5600758eb83f2a05edd0be7625657901f2ba81eaf145d003dbef78e33f43a32a3788bdf0501000000085341554349535345 "spsig1PPUFZucuAQybs5wsqsNQ68QNgFaBnVKMFaoZZfi1BtNnuCAWnmL9wVy5HfHkR6AeodjVGxpBVVSYcJKyMURn6K1yknYLm")] Node is bootstrapped. -Estimated gas: 3595.324 units (will add 100 for safety) +Estimated gas: 3595.334 units (will add 100 for safety) Estimated storage: 257 bytes added (will add 20 for safety) Operation successfully injected in the node. Operation hash is '[BLOCK_HASH]' @@ -29,7 +29,7 @@ This sequence of operations was run: Updated storage: [OPERATION_HASH]48f709699019725ba Storage size: 578 bytes - Consumed gas: 2595.324 + Consumed gas: 2595.334 Internal operations: Internal Transaction: Amount: ꜩ1000 diff --git a/tests_python/tests_alpha/_regtest_outputs/test_contract_opcodes.TestContractOpcodes::test_balance[0.5].out b/tests_python/tests_alpha/_regtest_outputs/test_contract_opcodes.TestContractOpcodes::test_balance[0.5].out index a9ccd828c40f95202cba3b998e69a689c96dce70..eec483839a4b896870566248fb635b075f8434c9 100644 --- a/tests_python/tests_alpha/_regtest_outputs/test_contract_opcodes.TestContractOpcodes::test_balance[0.5].out +++ b/tests_python/tests_alpha/_regtest_outputs/test_contract_opcodes.TestContractOpcodes::test_balance[0.5].out @@ -11,11 +11,11 @@ trace [ (Pair Unit 0) ] - location: 7 (remaining gas: 1039995.723 units remaining) [ ] - - location: 8 (remaining gas: 1039995.723 units remaining) + - location: 8 (remaining gas: 1039995.713 units remaining) [ 500000 ] - - location: 9 (remaining gas: 1039995.713 units remaining) + - location: 9 (remaining gas: 1039995.703 units remaining) [ {} 500000 ] - - location: 11 (remaining gas: 1039995.703 units remaining) + - location: 11 (remaining gas: 1039995.693 units remaining) [ (Pair {} 500000) ] diff --git a/tests_python/tests_alpha/_regtest_outputs/test_contract_opcodes.TestContractOpcodes::test_balance[0].out b/tests_python/tests_alpha/_regtest_outputs/test_contract_opcodes.TestContractOpcodes::test_balance[0].out index c13fa69bb55c8f83a02c611dcd1eced072a76bc3..8c7c4dbe4ee17767162d6b9abcdfaba0ba13c3c8 100644 --- a/tests_python/tests_alpha/_regtest_outputs/test_contract_opcodes.TestContractOpcodes::test_balance[0].out +++ b/tests_python/tests_alpha/_regtest_outputs/test_contract_opcodes.TestContractOpcodes::test_balance[0].out @@ -11,11 +11,11 @@ trace [ (Pair Unit 0) ] - location: 7 (remaining gas: 1039995.723 units remaining) [ ] - - location: 8 (remaining gas: 1039995.723 units remaining) + - location: 8 (remaining gas: 1039995.713 units remaining) [ 0 ] - - location: 9 (remaining gas: 1039995.713 units remaining) + - location: 9 (remaining gas: 1039995.703 units remaining) [ {} 0 ] - - location: 11 (remaining gas: 1039995.703 units remaining) + - location: 11 (remaining gas: 1039995.693 units remaining) [ (Pair {} 0) ] diff --git a/tests_python/tests_alpha/_regtest_outputs/test_contract_opcodes.TestContractOpcodes::test_balance[1000].out b/tests_python/tests_alpha/_regtest_outputs/test_contract_opcodes.TestContractOpcodes::test_balance[1000].out index bf614c2e684f6236d1e40f92f9008bc5c7b84fe8..f7edacace175c4b73eea998c718286ed1d767d3c 100644 --- a/tests_python/tests_alpha/_regtest_outputs/test_contract_opcodes.TestContractOpcodes::test_balance[1000].out +++ b/tests_python/tests_alpha/_regtest_outputs/test_contract_opcodes.TestContractOpcodes::test_balance[1000].out @@ -11,11 +11,11 @@ trace [ (Pair Unit 0) ] - location: 7 (remaining gas: 1039995.723 units remaining) [ ] - - location: 8 (remaining gas: 1039995.723 units remaining) + - location: 8 (remaining gas: 1039995.713 units remaining) [ 1000000000 ] - - location: 9 (remaining gas: 1039995.713 units remaining) + - location: 9 (remaining gas: 1039995.703 units remaining) [ {} 1000000000 ] - - location: 11 (remaining gas: 1039995.703 units remaining) + - location: 11 (remaining gas: 1039995.693 units remaining) [ (Pair {} 1000000000) ] diff --git a/tests_python/tests_alpha/_regtest_outputs/test_contract_opcodes.TestContractOpcodes::test_balance[1].out b/tests_python/tests_alpha/_regtest_outputs/test_contract_opcodes.TestContractOpcodes::test_balance[1].out index 792094d124c4fd8e0de746cf8887930a29d60015..3b4aaad003c2563f1cd3118a2186a00dcfb52267 100644 --- a/tests_python/tests_alpha/_regtest_outputs/test_contract_opcodes.TestContractOpcodes::test_balance[1].out +++ b/tests_python/tests_alpha/_regtest_outputs/test_contract_opcodes.TestContractOpcodes::test_balance[1].out @@ -11,11 +11,11 @@ trace [ (Pair Unit 0) ] - location: 7 (remaining gas: 1039995.723 units remaining) [ ] - - location: 8 (remaining gas: 1039995.723 units remaining) + - location: 8 (remaining gas: 1039995.713 units remaining) [ 1000000 ] - - location: 9 (remaining gas: 1039995.713 units remaining) + - location: 9 (remaining gas: 1039995.703 units remaining) [ {} 1000000 ] - - location: 11 (remaining gas: 1039995.703 units remaining) + - location: 11 (remaining gas: 1039995.693 units remaining) [ (Pair {} 1000000) ] diff --git a/tests_python/tests_alpha/_regtest_outputs/test_contract_opcodes.TestContractOpcodes::test_balance[1e-06].out b/tests_python/tests_alpha/_regtest_outputs/test_contract_opcodes.TestContractOpcodes::test_balance[1e-06].out index a5cb9f25da089f4d849947d420f318f02b54c75d..cf11c25ce395873e47a494be7464e4d4c00fc4c6 100644 --- a/tests_python/tests_alpha/_regtest_outputs/test_contract_opcodes.TestContractOpcodes::test_balance[1e-06].out +++ b/tests_python/tests_alpha/_regtest_outputs/test_contract_opcodes.TestContractOpcodes::test_balance[1e-06].out @@ -11,11 +11,11 @@ trace [ (Pair Unit 0) ] - location: 7 (remaining gas: 1039995.723 units remaining) [ ] - - location: 8 (remaining gas: 1039995.723 units remaining) + - location: 8 (remaining gas: 1039995.713 units remaining) [ 1 ] - - location: 9 (remaining gas: 1039995.713 units remaining) + - location: 9 (remaining gas: 1039995.703 units remaining) [ {} 1 ] - - location: 11 (remaining gas: 1039995.703 units remaining) + - location: 11 (remaining gas: 1039995.693 units remaining) [ (Pair {} 1) ] diff --git a/tests_python/tests_alpha/_regtest_outputs/test_contract_opcodes.TestContractOpcodes::test_balance[5].out b/tests_python/tests_alpha/_regtest_outputs/test_contract_opcodes.TestContractOpcodes::test_balance[5].out index a5896a8463be530cc823e7a04fabe248354a1298..ed4d948ccaeceb9f10f6accebad7648f1e942a27 100644 --- a/tests_python/tests_alpha/_regtest_outputs/test_contract_opcodes.TestContractOpcodes::test_balance[5].out +++ b/tests_python/tests_alpha/_regtest_outputs/test_contract_opcodes.TestContractOpcodes::test_balance[5].out @@ -11,11 +11,11 @@ trace [ (Pair Unit 0) ] - location: 7 (remaining gas: 1039995.723 units remaining) [ ] - - location: 8 (remaining gas: 1039995.723 units remaining) + - location: 8 (remaining gas: 1039995.713 units remaining) [ 5000000 ] - - location: 9 (remaining gas: 1039995.713 units remaining) + - location: 9 (remaining gas: 1039995.703 units remaining) [ {} 5000000 ] - - location: 11 (remaining gas: 1039995.703 units remaining) + - location: 11 (remaining gas: 1039995.693 units remaining) [ (Pair {} 5000000) ] diff --git a/tests_python/tests_alpha/_regtest_outputs/test_contract_opcodes.TestContractOpcodes::test_balance[8000000000000.0].out b/tests_python/tests_alpha/_regtest_outputs/test_contract_opcodes.TestContractOpcodes::test_balance[8000000000000.0].out index 472399fd5d5c53ed82ec68b6d1aa05cf5ce5f7ae..1ce6d7a299a116fb1ed2d959a630be88c37b932d 100644 --- a/tests_python/tests_alpha/_regtest_outputs/test_contract_opcodes.TestContractOpcodes::test_balance[8000000000000.0].out +++ b/tests_python/tests_alpha/_regtest_outputs/test_contract_opcodes.TestContractOpcodes::test_balance[8000000000000.0].out @@ -11,11 +11,11 @@ trace [ (Pair Unit 0) ] - location: 7 (remaining gas: 1039995.723 units remaining) [ ] - - location: 8 (remaining gas: 1039995.723 units remaining) + - location: 8 (remaining gas: 1039995.713 units remaining) [ 8000000000000000000 ] - - location: 9 (remaining gas: 1039995.713 units remaining) + - location: 9 (remaining gas: 1039995.703 units remaining) [ {} 8000000000000000000 ] - - location: 11 (remaining gas: 1039995.703 units remaining) + - location: 11 (remaining gas: 1039995.693 units remaining) [ (Pair {} 8000000000000000000) ] diff --git a/tests_python/tests_alpha/_regtest_outputs/test_contract_opcodes.TestContractOpcodes::test_contract_input_output[balance.tz-111-Unit-4000000000000].out b/tests_python/tests_alpha/_regtest_outputs/test_contract_opcodes.TestContractOpcodes::test_contract_input_output[balance.tz-111-Unit-4000000000000].out index 3dcff5104715a1fa6520d5dc031e0020e56df51b..c3fff51cb6995571b9475258b2a7c03316d2542c 100644 --- a/tests_python/tests_alpha/_regtest_outputs/test_contract_opcodes.TestContractOpcodes::test_contract_input_output[balance.tz-111-Unit-4000000000000].out +++ b/tests_python/tests_alpha/_regtest_outputs/test_contract_opcodes.TestContractOpcodes::test_contract_input_output[balance.tz-111-Unit-4000000000000].out @@ -11,11 +11,11 @@ trace [ (Pair Unit 111) ] - location: 7 (remaining gas: 1039995.723 units remaining) [ ] - - location: 8 (remaining gas: 1039995.723 units remaining) + - location: 8 (remaining gas: 1039995.713 units remaining) [ 4000000000000 ] - - location: 9 (remaining gas: 1039995.713 units remaining) + - location: 9 (remaining gas: 1039995.703 units remaining) [ {} 4000000000000 ] - - location: 11 (remaining gas: 1039995.703 units remaining) + - location: 11 (remaining gas: 1039995.693 units remaining) [ (Pair {} 4000000000000) ] diff --git a/tezt/tests/expected/self_address_transfer.ml/Alpha- Self address transfer.out b/tezt/tests/expected/self_address_transfer.ml/Alpha- Self address transfer.out index 4fb824805e838ea68a70bcee5351edab881763cf..65eb8c2a34113fc782698d3554f77ecb63779d2f 100644 --- a/tezt/tests/expected/self_address_transfer.ml/Alpha- Self address transfer.out +++ b/tezt/tests/expected/self_address_transfer.ml/Alpha- Self address transfer.out @@ -101,7 +101,7 @@ Contract memorized as self_address_receiver.tz. ./octez-client --mode mockup --wait none transfer 0 from bootstrap2 to '[CONTRACT_HASH]' --burn-cap 2 --arg '"[CONTRACT_HASH]"' Node is bootstrapped. -Estimated gas: 4691.615 units (will add 100 for safety) +Estimated gas: 4691.625 units (will add 100 for safety) Estimated storage: no bytes added Operation successfully injected in the node. Operation hash is '[OPERATION_HASH]' @@ -127,7 +127,7 @@ This sequence of operations was run: This transaction was successfully applied Updated storage: Unit Storage size: 82 bytes - Consumed gas: 2575.775 + Consumed gas: 2575.785 Internal operations: Internal Transaction: Amount: ꜩ0