Important: revision 011_PtHangzH of protocol Hangzhou contains a bug that is corrected in the latest version 011_PtHangz2
This page contains all the relevant information for protocol Hangzhou (see Protocol naming).
The code can be found in the src/proto_011_PtHangz2 directory of the
master branch of Tezos.
This page documents the changes brought by protocol Hangzhou with respect to Granada.
New Environment Version (V3)¶
This protocol requires a different protocol environment than Granada. It requires protocol environment V3, compared to V2 for Granada. (MR !3040)
Removed legacy logging interface. (MR !2876)
Removed data-encoding backwards compatibility layer. (MR !2686)
tag_size. (MR !2948)
Lwtreslib.List. (MR !3116)
Environment now uses
Lwtreslib. (MR !3124)
Updated to data-encoding version 0.4. (MR !3149)
Documented and renamed operation ordering in
Updater. (MR !3179)
Lwtreslib: now provides exception-catching functions. (MR !2886)
Added context hash version. (MR !3163)
fork_test_chainfunction. (MR !3213)
Resultand catching helpers. (MR !3154)
Added support for chunking in RPCs. (MR !3189)
Source of the Alpha protocol can mostly be compiled into Coq with
coq-of-ocaml. (MR !3152)
Encapsulated script caching. (MR !3352)
Updated Zarith to version 1.12. (MR !2970)
Receipts, Balance Updates¶
Breaking change: Rewards balance updates for nonce revelations or endorsements now mention the cycle at which the rewards were granted instead of the cycle of the level carried by the operation. Likewise for deposits balance updates related to endorsement operations, they now mention the cycle at which the funds have been deposited. (MR !3270)
POST ../endorsing_powerhas been removed. Clients already used
GET ../helpers/endorsing_rightswhich is clearer, as powerful and equally costly in terms of computation for the node. (MR !3395)
GET ../context/delegates/[PUBLIC_KEY_HASH]/..now fail gracefully with a specific error
PUBLIC_KEY_HASHis not a delegate instead of the generic
context.storage_error. (MR !3258, issues #450, #451, and #1276)
GET ../context/constantsexposes the “fixed” constants
Michelson On-Chain Views¶
Views are a new mechanism for contract calls that:
are read-only: they may depend on the contract storage but cannot modify it nor emit operations (but they can call other views);
take arguments as input in addition to the contract storage;
return results as output;
are synchronous: the result is immediately available on the stack of the caller contract.
There are two added Michelson primitives:
VIEW (instruction) and
view (top-level keyword).
A new manager operation and corresponding CLI command have been added allowing users to register Micheline expressions in a global table of constants, returning an index to the expression. A new primitive
constant <string>has been added that allows contracts to reference these constants by their index. When a contract is called, any constants are expanded into their registered values. The result is that users can use constants to originate larger contracts, as well as share code between contracts.
A chain-sensitive cache is now available to the protocol developers. This cache can be seen as an in-memory context providing fast access to the most recently used values.
The protocol now keeps contracts’ source code and storage in the cache. This reduces the gas consumption for the most recently used contracts.
The new RPC
context/cache/contracts/allreturns the list of contracts in the cache.
The new RPC
context/cache/contracts/sizereturns an overapproximation of the cache size (in bytes).
The new RPC
context/cache/contracts/size_limitreturns the maximal cache size (in bytes). When this size is reached, the cache removes the least recently used entries.
The new RPC
context/cache/contracts/rankgives the number of contracts that are less recently used than the one provided as argument.
The new RPC
scripts/script_sizegives the size of the script and its storage when stored in the cache.
Gas instrumentation implemented in MR !3430
Context Storage Flattening¶
Hex-nested directories like
/12/af/83/3d/ are removed from the
context. This results in better context access performance. (MR !2771)
Gas computation has been adapted to this new flattened context layout. (MR !2771)
Gas improvements for typechecking instruction
CONTRACT(MR !3241) and general gas cost adjustments (MRs !3441 !3724)
Other internal refactorings or documentation. (MRs !2021 !2984 !3042 !3049 !3088 !3075 !3266 !3270 !3285 !3375 !3247)
Set the predecessor version of the protocol to Granada (MR !3347)
Check order in the validation of endorsements has changed to not compute all endorsement slots of a level if the endorsement is invalid. (MR !3395)
Fix handling of potential negative integer in
Raw_level_reprencoding. (MR !3273)
GET ../helpers/baking_rewardshave been moved into the RPC plugin. Nothing has changed from the end-user perspective for now but further improvements to their performance will become easier now that they are decoupled from the protocol development cycle. (MR !3368)
Gives an increase to the liquidity baking sunset level of 211,681 blocks, or five voting periods plus 6,881 blocks to sync with the following voting period, roughly an additional two months and a half. Without this, the subsidy would halt during the lifespan of this protocol. With this change the subsidy can continue until the protocol after this one is activated, even accounting for some delays in proposal injection and/or a restarted voting process, while still making sure it won’t extend to two protocols after this one without a more significant increase. This follows the spirit of the liquidity baking TZIP in that it is still roughly six months from Granada activation and requires a referendum on the subsidy in the protocol after this one. (MR !3425 !3464)
Logging. It now has Lwt-less APIs and the messages are handled by the shell. (MR !3225)
The size limit on Michelson types has been roughly doubled (from 1000 to 2001). (MR !3434)