Protocol: Make contract balance a step constant.
Context
The main motivation for this change is adding --self-address option to the tezos-client script command, which will be done in separate MR. Currently that command originates a fresh contract to run the given script for, thus assigning it a random address. If the address is to be fixed, the balance must be decoupled from the account within the interpreter. Making it a step constant solves the problem.
In addition to this, it reduces gas costs and baker fees for executing contracts using BALANCE instruction. The constant is loaded for free, so even contracts which used the instruction just once are better. An unfortunate side effect is that scripts using the VIEW instruction must also load the balance of the viewed contract, which is carbonated, so gas cost for contracts using views will increase. This effect might be reduced by caching though.
Manually testing the MR
The change should have no visible effect except for changed gas costs. See updated regression tests for details.
Checklist
- n/a Document the interface of any function added or modified (see the coding guidelines)
- n/a Document any change to the user interface, including configuration parameters (see node configuration)
- n/a Provide automatic testing (see the testing guide).
- n/a For new features and bug fixes, add an item in the appropriate changelog (
docs/protocols/alpha.rstfor the protocol and the environment, theDevelopment Versionsection ofCHANGES.mdfor everything else). -
Select suitable reviewers using the Reviewersfield below. -
Select as Assigneethe next person who should take action on that MR