package tezos-protocol-alpha

  1. Overview
  2. Docs
Tezos protocol alpha package

Install

Dune Dependency

Authors

Maintainers

Sources

tezos-18.0.tar.gz
sha256=dbc3b675aee59c2c574e5d0a771193a2ecfca31e7a5bc5aed66598080596ce1c
sha512=b97ed762b9d24744305c358af0d20f394376b64bfdd758dd4a81775326caf445caa57c4f6445da3dd6468ff492de18e4c14af6f374dfcbb7e4d64b7b720e5e2a

doc/tezos_raw_protocol_alpha/Tezos_raw_protocol_alpha/Script_cache/index.html

Module Tezos_raw_protocol_alpha.Script_cacheSource

This module manages the cache for smart contracts.

This cache must be consistent with the on-disk representation of the smart contracts. In particular, update must be called each time a contract storage is updated.

Sourcetype identifier

Each cached script has a unique identifier in the cache.

The cache holds the unparsed and the internal representation of the contract.

find ctxt contract returns (ctxt', identifier, script) where:

  • ctxt' is ctxt with less gas;
  • identifier is the identifier identifying the contract in the cache;
  • script = None if there is no such contract in ctxt;
  • script = Some (unparsed_script, ir_script) where
  • unparsed_script is the contract code and storage;
  • script_ir is a typed internal representation of the contract, i.e., the abstract syntax tree of its code as well as its storage.

This function consumes gas depending on the cache. If the contract is not in the cache, then the function also consumes the gas of Contract.get_script and Script_ir_translator.parse_script.

update ctxt identifier unparsed_script ir_script size refreshes the cached contract identified by identifier with a new unparsed_script, a new ir_script, and a new size.

entries ctxt returns the contracts in the cache as well as their respective size. The list is sorted by date of last modification: the least recently updated entry comes first.

Sourceval contract_rank : Alpha_context.context -> Contract_hash.t -> int option

contract_rank ctxt contract returns the number of contracts older than contract in the cache of ctxt. This function returns None if contract does not exist in the cache of ctxt.

Sourceval size : Alpha_context.context -> int

size ctxt is an overapproximation of the cache size in memory (in bytes).

Sourceval size_limit : Alpha_context.context -> int

size_limit ctxt is the maximal size of the cache (in bytes).

insert is a variant of update which identifies the contract to update by its address (of type Contract_hash.t) instead of its cache identifier.

OCaml

Innovation. Community. Security.