package octez-protocol-019-PtParisB-libs

  1. Overview
  2. Docs
Octez protocol 019-PtParisB libraries

Install

Dune Dependency

Authors

Maintainers

Sources

tezos-octez-v20.1.tag.bz2
sha256=ddfb5076eeb0b32ac21c1eed44e8fc86a6743ef18ab23fff02d36e365bb73d61
sha512=d22a827df5146e0aa274df48bc2150b098177ff7e5eab52c6109e867eb0a1f0ec63e6bfbb0e3645a6c2112de3877c91a17df32ccbff301891ce4ba630c997a65

doc/octez-protocol-019-PtParisB-libs.test-helpers/Tezos_019_PtParisB_test_helpers/Liquidity_baking_generator/index.html

Module Tezos_019_PtParisB_test_helpers.Liquidity_baking_generatorSource

This module provides a set of abstractions to reason about the so-called “liquidity baking” feature1.

1: https://gitlab.com/tezos/tzip/-/blob/367628e1a576c3926bedc1d6107b2945607c2605/drafts/current/draft-liquidity_baking.md

We remind that this feature is built upon three smart contracts: (1) a CPMM contract initially based on Dexter 2, and (2) two tokens contracts.

Our purpose for Liquidity Baking is to easily express and test invariants regarding the execution of these contracts. To that end, we have introduced a set of dedicated types to describe arbitrary contexts in terms of account balances (see Liquidity_baking_machine.specs), along with build functions that turn a description of a context into concrete states.

In this module, we provide QCheck2 generators which allow to construct arbitrary specifications for states, and so-called scenarios (i.e., sequences of entrypoint calls).

gen_specs max_tzbtc max_liquidity constructs arbitrary Liquidity Baking specs for an initial state, where at most max_tzbtc and max_liquidity are shared among an arbitrary number of implicit accounts.

gen_scenario max_tzbtc max_liquidity size constructs arbitrary Liquidity Baking specs with a semantics similar to gen_specs, along with sequences of valid scenarios (i.e., sequences of entrypoint calls) of length size. By valid, we mean that running the scenario using a Liquidity baking machine initialized with the specs should succeed.

print_scenario scenario produces a string representation of scenario, as produced by gen_scenario.

gen_adversary_scenario max_tzbtc max_liquidity size constructs arbitrary scenarios that can be used to challenge the “no global gain” property of Liquidity Baking.

The key idea of this property is the following: a given contract cannot profit from Liquidity Baking if they are the only one to interact with the CPMM (in the absence of subsidies). The scenario generated by gen_adversary_scenario only consists in step performed by one contract. This contract is identified by the contract_id returned by this function.

print_adversary_scenario scenario produces a string representation of scenario, as produced by gen_adversary_scenario.

OCaml

Innovation. Community. Security.