This project is mirrored from https://gitlab.com/tezos/tezos.git. Pull mirroring updated .
  1. 20 Sep, 2019 1 commit
  2. 18 Sep, 2019 39 commits
    • vbot's avatar
      Client: fix `run script` command output format · cbaf08ce
      vbot authored
      cbaf08ce
    • vbot's avatar
    • Raphaël Cauderlier's avatar
    • Raphaël Cauderlier's avatar
      91840e8d
    • Benjamin Canou's avatar
      1c5e2d13
    • Tomáš Zemanovič's avatar
    • Benjamin Canou's avatar
      6d26cdce
    • Benjamin Canou's avatar
      bf7eb4bf
    • vbot's avatar
      88722037
    • Benjamin Canou's avatar
      Docs: synchronise Michelson specification · c81b334e
      Benjamin Canou authored
        - Updates the documentation of `big_map`s.
        - Adds a short documentation of entrypoints.
        - Adds the chain_id type and the `CHAIN_ID` instruction
        - Adds `COMPARE` variants.
        - Adds documentation for `APPLY`.
      c81b334e
    • Benjamin Canou's avatar
      Tests/Bash: adapt to the new protocol · 21e505de
      Benjamin Canou authored
      21e505de
    • Benjamin Canou's avatar
      Tests/Contracts: update Michelson test contracts and bash tests · d332429d
      Benjamin Canou authored
       - Update tests for the new semantics of CREATE_CONTRACT.
       - Adds tests for DIG, DUG, DROP and DIP.
       - Test the new CHAIN_ID instruction.
       - Test the new APPLY instruction.
      d332429d
    • Benjamin Canou's avatar
      Tests/Python: update Python tests · 4f0c556d
      Benjamin Canou authored
       - Add all constants to parameters.
       - Adapt the tests to the new constants and semantics.
       - Adapt for minimum proposal quorum.
       - Adapt test_multinode_snapshot to Emmy+.
       - Adapt to Michelson lightweight multiple entrypoints
      4f0c556d
    • Marco Stronati's avatar
      Tests/Flextesa: adapt to the new protocol · b39355cf
      Marco Stronati authored
       - Adapt the test to the new constants.
       - Adapt for minimum proposal quorum.
      b39355cf
    • Benjamin Canou's avatar
      Tests/OCaml: Adapt to the new protocol · 0bfad1ba
      Benjamin Canou authored
       - Add test to quorum caps.
       - Adapt tests to the new endorsement semantics.
       - Adapt tests for delegatable implicit accounts.
       - Add tests for minimum proposal quorum.
       - Adapt tests for lightweight multiple entrypoints.
       - Adapt tests for disabled storage of values of type contract t
      0bfad1ba
    • Tomáš Zemanovič's avatar
      Parameters: add constants for Emmy+, proposal_quorum and quorum caps · 5139955c
      Tomáš Zemanovič authored
      This is not a patch for the protocol.
      It does not affect the hash, but it adds the new constants for Emmy+,
      proposal quorum and quorum caps to the parameters used to bootstrap a
      protocol in tests or test-nets.
      5139955c
    • Raphaël Cauderlier's avatar
      Proto/Michelson: Deprecate instruction STEPS_TO_QUOTA · 7481eef8
      Raphaël Cauderlier authored
      The semantics of the STEPS_TO_QUOTA instruction changes each time the
      gas constants are modified to better reflect the real costs.
      
      Moreover, because of STEPS_TO_QUOTA, the interpreter is not monotonic:
      it is easy to write a contract that runs successfully at some gas
      amount but fails when more gas is given.
      7481eef8
    • Ilias Garnier's avatar
      Proto/Michelson: expose internal function of the Michelson interpreter · 1283fb3d
      Ilias Garnier authored
      This patch is a refactor that does not change the semantics. It will
      allow external tools such as steppers or debuggers to control more
      finely the Michelson interpreter from outside the protocol.
      1283fb3d
    • Gabriel Alfour's avatar
      Proto/Michelson: add `APPLY` instruction to partially apply a lambda · 19820f97
      Gabriel Alfour authored
      This instruction applies a tuplified function from the stack.  Such a
      lambda is storable, and thus values that cannot be stored (values of
      type `operation`, `contract _` and `big_map _ _`) cannot be
      captured by `APPLY` (cannot appear in ``'a``).
      19820f97
    • Benjamin Canou's avatar
      Proto/Migration: switch scripted KT1s to new `big_map` storage · fceeb3d2
      Benjamin Canou authored
      This patch looks for big_maps in existing smart contracts, and moves
      them to their new storage path.
      fceeb3d2
    • Benjamin Canou's avatar
      Client: adapt to relaxed big_map restrictions · ea7ba3e3
      Benjamin Canou authored
      This is not a patch for the protocol.
      It does not affect the hash, but is needed for the client to work.
      ea7ba3e3
    • Benjamin Canou's avatar
      Proto/Michelson: relax big_map restrictions · 35df3988
      Benjamin Canou authored
      A contract can now have more than one big_map, they can be placed
      anywhere in the storage. Big maps can be transferred from a contract
      to another, either as parameter (transactions) or storage
      (originations). In this case, they are morally duplicated (as opposed
      to shared) from the contract point of view. In the implementation,
      sharing happens. Big maps can be created with `EMPTY_BIG_MAP t` and
      cleared on the fly.
      
      The big_map type still cannot appear as argument of big_map, PUSH or
      UNPACK. When you duplicate a big map, you are charged with the full
      storage cost.
      
      This patch moves the big maps outside of the contracts in the context,
      in their own prefix path and indexed by integers. Big_map literals in
      Michelson expressions are now either the same as maps or their integer
      index.
      
      A temporary zone is introduced, necessary to make sure that big_maps
      are not spuriously cleared or left dangling during big_map transfers
      in internal operations. These are represented by negative indexes, and
      don't persist.
      35df3988
    • Ilias Garnier's avatar
      Proto/Michelson: new gas costs · e70fc610
      Ilias Garnier authored
      The cost functions in Michelson_v1_gas were to a large extent
      automatically generated. Please refer to meta_model.ml
      
      The (abstract) cost model makes large use of floating-point
      coefficient. These were converted to either integer
      multiplication/divisions or to statically generated fixed-point
      computations.
      e70fc610
    • Ilias Garnier's avatar
      Proto/Michelson: finer-grained cost accounting for the interpreter · beca4b73
      Ilias Garnier authored
      I. Rescaling step cost
      - Rescale step_cost by 2^7 to allow finer cost accounting in the
        interpeter.
      - Expose new function atomic_step_cost exposing finer resolution step
        increments.
      
      II. Provide facilities for interpreter-specific cost accounting
      
      Introduce new functions `Gas.incr_interpreter_cost` and
      `Gas.bill_interpreter_cost`.
      
      - The context stores a new counter 'interpreter_cost' of type
        Gas_limit_repr.cost
      - functions are provided to:
        - increment this counter (incr_interpreter_cost) and
        - bill for the gas corresponding to this counter and reset this
        counter. Until bill_interpreter_cost is called, the interpreter_cost
        is _not_ taken into account into the effectively consumed gas.
      - Each call to incr_interpreter_cost still checks that we are under
        the operation and block gas limits.
      - The interpreter uses these functions instead of the usual
        Gas.consume.
      
      The invariant that has to be respected for this to be transparent to
      the rest of the protocol is that all continuations of the `step`
      function to other functions should bill and reset the interpreter_cost
      beforehand. This concerns calls to interp, calls to the typechecker,
      calls to read from a big map, calls to the
      serialization/deserialization  mechanism, etc; in short, all calls to
      other parts of the protocol should have a context in a state where
      this fine-grained gas bookkeeping has been settled and reset.
      beca4b73
    • Ilias Garnier's avatar
      Proto/Michelson: add comparable_ty type witness in boxed sets · cc482e17
      Ilias Garnier authored
      Some cost functions require computing the size of keys/elts of
      maps/sets. Not being able to dispatch on the element type was making
      this impossible outside of the interpreter (where the element type of
      the set could be accessed elsewhere). This patch fixes that.
      cc482e17
    • Ilias Garnier's avatar
      Proto/Michelson: unshare cost functions of the interpeter & the rest of the protocol · acc5d4b6
      Ilias Garnier authored
      This patch is a refactor to prepare for the gas costs rehaul. It
      dissociates the gas consumed by the interpreter, which is the part
      that is updated according to thorough benchmarking, from other source
      of gas consumption in the protocol (typechecking, serialization etc.)
      which are left untouched in this update.
      acc5d4b6
    • Benjamin Canou's avatar
      Proto/Michelson: extend comparison to linear pair structures · 6ecec57e
      Benjamin Canou authored
      Michelson's `COMPARE` instruction can currently only compare simple
      values (`string`s, `int`s, etc.). This limitation also applies to
      `set`, `map` and `big_map` indexes.
      
      This is an issue in particular for `big_map`s that cannot be nested,
      because it prevents indexing data by a pair of indexes, such as a
      `key_hash` and a `string`.
      
      This patch lifts that restriction, allowing to compare `pair`s of
      values, as long as their left component remains a simple value,
      impicitly making comparable values right combs whose leaves are simple
      values. The ordering is naturally lexicographic.
      
      This patch also refactors a bit the comparison code to simplify it and
      reduce code duplication.
      6ecec57e
    • Raphaël Proust's avatar
      Proto/Michelson: comparisons return -1, 0, or 1, as per the documentation · 09df4654
      Raphaël Proust authored
      The Michelson documentation states that `COMPARE` pushes -1 (resp. 1)
      if the top element of the stack is smaller (resp. greater) than the
      second. However, the implementation can actually push a negative
      number instead of -1 and a positive number instead of 1 depending on
      the type and values.
      
      This semantics should not break any code as the result of `COMPARE` is
      almost always comsumed by comparison projectors such as `GT` or `LT`
      who only care about the sign. However, for the sake of consistency,
      this patches makes `COMPARE` return only -1, 0 or 1.
      
      This fixes issue #546
      09df4654
    • Tomáš Zemanovič's avatar
      Proto/Michelson: add special encoding for `do` and `set/remove_delegate` entrypoints · 5c130921
      Tomáš Zemanovič authored
      This patch optimises the binary representation of transactions to
      usual entrypoints. The `do` entrypoint is used by manager.tz script
      and the `set_delegate` and `remove_delegate` by spendable script
      transformation.
      5c130921
    • Tomáš Zemanovič's avatar
      Client: update to the new tz1/KT1 policy · 497e6be2
      Tomáš Zemanovič authored
      This is not a patch for the protocol.
      It does not affect the hash, but is needed for the client to work.
      497e6be2
    • Tomáš Zemanovič's avatar
      Proto: all KT1s must now be scripted · 65d01a8f
      Tomáš Zemanovič authored
      Contains BREAKING CHANGES (see end of message).
      
      It removes the manager, spendable and delegatable flags and counter from all KT1s.
      
      It deprecates CREATE_ACCOUNT from use in new contracts, as well as the
      manager, spendable and delegatable arguments from CREATE_CONTRACT.
      
      Already deployed contracts with deprecated instructions will continue
      to work by using legacy support scripts (deploying `manager.tz` for
      `CREATE_ACCOUNT` and adding entrypoints for `CREATE_CONTRACT`).
      
      This change will impact all users of the RPC API as well as anyone who
      forges operations. The source of manager operations is now a tz1, tz2
      or tz3, and no longer a KT1. The manager field and the spendable and
      delegatable flags disappear from the origination operation format
      (JSON and binary) as well as everywhere in the RPC API.
      65d01a8f
    • Benjamin Canou's avatar
      Proto/Migration: handle default entrypoint originated before migration · 6a5705df
      Benjamin Canou authored
      This patch updates contracts deployed before the migration with a
      `%default` entrypoint. This is done by adding a `%root` entrypoint as
      detailed in a previous patch.
      6a5705df
    • Benjamin Canou's avatar
      Proto/Michelson: handle default entrypoint originated before migration · a6e718c8
      Benjamin Canou authored
      This patch preserves the semantics of `CREATE_CONTRACT` instructions
      for contracts deployed before the migration that deploy a contract
      with a default entrypoint. This is done by adding a `%root` entrypoint
      as detailed in a previous patch.
      a6e718c8
    • Benjamin Canou's avatar
      Proto: add code stubs to handle `%default` entrypoints originated before migration · 06f0b182
      Benjamin Canou authored
      This code stub adds a `%root` entrypoint to contracts that have a
      default entrypoint, and rewrite their calls to `SELF` into `SELF
      %root`. This is used to preserve the typing of `SELF` within contracts
      with deployed before the migration that have a `%default` entrypoint.
      06f0b182
    • Raphaël Cauderlier's avatar
      Client: add a chain_id parameter to RPCs and update the multisig support · 61bd15e1
      Raphaël Cauderlier authored
      This is not a patch for the protocol.
      It does not affect the hash, but is needed for the client to work.
      61bd15e1
    • Raphaël Cauderlier's avatar
      Proto/Migration: update deployed multisigs to the newest supported version · c1e4b13b
      Raphaël Cauderlier authored
      Contains a BREAKING CHANGE (see end of message).
      
      This does not change the behaviour of the multisig. It adds a call to
      the newly introduced `CHAIN_ID` instruction in order to add extra
      replay protection between the main chain and the test chain.
      
      Smart contract users that do not use the `tezos-client` but a custom
      tool to interact with multi-signature contracts deployed with the
      `tezos-client` should also include the `CHAIN_ID` in the commands they
      sign.
      c1e4b13b
    • Raphaël Cauderlier's avatar
      Proto/Michelson: Add CHAIN_ID and chain_id · f93c0669
      Raphaël Cauderlier authored
      Add an abstract type and an instruction to obtain the chain id from
      Michelson code.
      
      This is to implement replay protection between the main chain and the
      test chain spawned in phase 3 of the voting procedure.
      f93c0669
    • Benjamin Canou's avatar
      Proto/Migration: migrate KT1s with and without script · fde27ecc
      Benjamin Canou authored
      Contains a BREAKING CHANGE (see end of message).
      
      All spendable, scriptless contracts are migrated to 'manager.tz' script.
      
      Contracts that have a spendable flag set are augmented with a `%do`
      entrypoint. Contracts that have a delegatable flag set are augmented
      with `%set_delegate` and `%remove_delegate` entrypoints.
      
      Interacting with converted contracts must now be done via smart
      contract calls. As an example, here is how `tezos-client` handles
      retro-compatibility for the `transfer` and `set delegate` commands.
      
      When crafting a transaction, if the source is a KT1, if checks that
      its storage is either of type `key_hash` or `pair key_hash _`, and
      retrieve this `key_hash`. Let's name this `key_hash` <manager>.
      
      To implement `tezos-client set delegate for <contract> to <delegate>`,
      it starts by looking for entrypoints.
      
      If `%set_delegate` is present, it does the equivalent of
        'tezos-client transfer 0 from <manager> to <contract> \
                        --entrypoint 'set_delegate' --arg '<delegate>'
      where <manager> is the key_hash found in the contract's storage
      
      If `%do` is present, it does the equivalent of
         'tezos-client transfer 0 from <manager> to <contract> \
                       --entrypoint 'do' \
                       --arg '{ NIL operation ; \
                                PUSH key_hash <delegate> ; \
                                SOME ; \
                                SET_DELEGATE ; \
                                CONS }'
         where <manager> is the key_hash found in the contract's storage
      
      To implement `tezos-client transfer <amount> from <contract> to <destination>`,
      when the destination is a simple adress or a contract of type `unit`,
      it does the equivalent of
      ```
      tezos-client transfer 0 from <manager> to <contract> \
                   --entrypoint "do" \
                   --arg '{ NIL operation ; \
                            PUSH address <destination> ; \
                            CONTRACT unit;
                            AMOUNT ; \
                            UNIT ; \
                            TRANSFER_TOKENS ; \
                            CONS ; \
                            PAIR }'
      ```
      
      To implement `tezos-client transfer <amount> from <contract> to <destination> \
                      [--arg <value>] [--entrypoint <entrypoint>]`,
      it starts by checking that the contract has a `%do` entrypoint.
      
      Then it look for type `<entrypoint>` of contract `<destination>` in the chain
      
      And it does the equivalent of
      ```
      tezos-client transfer 0 from <manager> to <contract> \
                   --entrypoint "do" \
                   --arg '{ NIL operation ; \
                            PUSH address <destination> ; \
                            CONTRACT %<entrypoint> <type>; # Omit <entrypoint> if not given
                            AMOUNT ; \
                            PUSH <type> <value> ; \ # UNIT if <arg> not given
                            TRANSFER_TOKENS ; \
                            CONS ; \
                            PAIR }'
      ```
      fde27ecc
    • Tomáš Zemanovič's avatar
      Proto: add Michelson code stubs to replicate manager operations on KT1s · 3ea9a1c9
      Tomáš Zemanovič authored
      Spendable, scriptless contracts are simulated by the 'manager.tz' script,
      which replaces their functionality. It allows for the contract's manager to set
      and withdraw delegate, spend the contract's funds and to set a new manager,
      which is written into script's storage.
      
      The 'manager.tz' script's parameters have field annotations, which in
      combination with script entry-points allows for friendlier commands for
      running the script.
      
      Spendable and delegatable flags are simulated by adding entrypoints to
      a scripted contract.
      3ea9a1c9