This project is mirrored from https://gitlab.com/tezos/tezos.git. Updated .
  1. 02 Aug, 2019 1 commit
  2. 01 Aug, 2019 1 commit
  3. 31 Jul, 2019 38 commits
    • Tomáš Zemanovič's avatar
    • Benjamin Canou's avatar
      5532af37
    • Benjamin Canou's avatar
      0f463a9d
    • vbot's avatar
      7d05b592
    • Benjamin Canou's avatar
      Docs: synchronise Michelson specification · 9f9bb656
      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`.
      9f9bb656
    • Benjamin Canou's avatar
      Tests/Bash: adapt to the new protocol · 2976746a
      Benjamin Canou authored
      2976746a
    • Benjamin Canou's avatar
      Tests/Contracts: update Michelson test contracts and bash tests · 2e3d9785
      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.
      2e3d9785
    • Benjamin Canou's avatar
      Tests/Python: update Python tests · a7ecc0cb
      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
      a7ecc0cb
    • Marco Stronati's avatar
      Tests/Flextesa: adapt to the new protocol · b601166c
      Marco Stronati authored
       - Adapt the test to the new constants.
       - Adapt for minimum proposal quorum.
      b601166c
    • Benjamin Canou's avatar
      Tests/OCaml: Adapt to the new protocol · 53d4c383
      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
      53d4c383
    • Tomáš Zemanovič's avatar
      Parameters: add constants for Emmy+, proposal_quorum and quorum caps · b1b4e5fb
      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.
      b1b4e5fb
    • Raphaël Cauderlier's avatar
      Proto/Michelson: Deprecate instruction STEPS_TO_QUOTA · 4583f573
      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.
      4583f573
    • Ilias Garnier's avatar
      Proto/Michelson: expose internal function of the Michelson interpreter · 9eabc27a
      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.
      9eabc27a
    • Gabriel Alfour's avatar
      Proto/Michelson: add `APPLY` instruction to partially apply a lambda · 939d47f8
      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``).
      939d47f8
    • Benjamin Canou's avatar
      Proto/Migration: switch scripted KT1s to new `big_map` storage · 4c3717ea
      Benjamin Canou authored
      This patch looks for big_maps in existing smart contracts, and moves
      them to their new storage path.
      4c3717ea
    • Benjamin Canou's avatar
      Client: adapt to relaxed big_map restrictions · 86a140ab
      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.
      86a140ab
    • Benjamin Canou's avatar
      Proto/Michelson: relax big_map restrictions · 5e85ee8f
      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.
      5e85ee8f
    • Ilias Garnier's avatar
      Proto/Michelson: new gas costs · 0b930cb7
      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.
      0b930cb7
    • Ilias Garnier's avatar
      Proto/Michelson: finer-grained cost accounting for the interpreter · cdd22224
      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.
      cdd22224
    • Ilias Garnier's avatar
      Proto/Michelson: add comparable_ty type witness in boxed sets · 377cb611
      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.
      377cb611
    • Ilias Garnier's avatar
      Proto/Michelson: unshare cost functions of the interpeter & the rest of the protocol · 7ec211a1
      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.
      7ec211a1
    • Benjamin Canou's avatar
      Proto/Michelson: extend comparison to linear pair structures · 669bccf4
      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.
      669bccf4
    • Raphaël Proust's avatar
      Proto/Michelson: comparisons return -1, 0, or 1, as per the documentation · 9386dc84
      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
      9386dc84
    • Tomáš Zemanovič's avatar
      Proto/Michelson: add special encoding for `do` and `set/remove_delegate` entrypoints · 162a46bd
      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.
      162a46bd
    • Tomáš Zemanovič's avatar
      Client: update to the new tz1/KT1 policy · b5f754d3
      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.
      b5f754d3
    • Tomáš Zemanovič's avatar
      Proto: all KT1s must now be scripted · d716244e
      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.
      d716244e
    • Benjamin Canou's avatar
      Proto/Migration: handle default entrypoint originated before migration · 88eb68ea
      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.
      88eb68ea
    • Benjamin Canou's avatar
      Proto/Michelson: handle default entrypoint originated before migration · 4ea69e66
      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.
      4ea69e66
    • Benjamin Canou's avatar
      Proto: add code stubs to handle `%default` entrypoints originated before migration · 79b3889b
      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.
      79b3889b
    • Raphaël Cauderlier's avatar
      Client: add a chain_id parameter to RPCs and update the multisig support · ab2d5e45
      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.
      ab2d5e45
    • Raphaël Cauderlier's avatar
      Proto/Migration: update deployed multisigs to the newest supported version · d100bf34
      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.
      d100bf34
    • Raphaël Cauderlier's avatar
      Proto/Michelson: Add CHAIN_ID and chain_id · f85f271b
      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.
      f85f271b
    • Benjamin Canou's avatar
      Proto/Migration: migrate KT1s with and without script · 6030c934
      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 }'
      ```
      6030c934
    • Tomáš Zemanovič's avatar
      Proto: add Michelson code stubs to replicate manager operations on KT1s · 9bb92867
      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.
      9bb92867
    • Tomáš Zemanovič's avatar
      Client: Add client 'call' command aliasing 'transfer 0' · ae15764c
      Tomáš Zemanovič authored
      This is not a patch for the protocol.
      ae15764c
    • Tomáš Zemanovič's avatar
      Client: fix 'Invalid_arity' error pretty-print argument order · a0585915
      Tomáš Zemanovič authored
      This is not a patch for the protocol.
      a0585915
    • Raphaël Proust's avatar
      Proto: do not use parallel iterators · 6641fac8
      Raphaël Proust authored
      This patch does not change the semantics.
      
      Using serial iterators (map_s) instead of parallel iterators (map_p)
      increases the determinism of the protocol.
      6641fac8
    • Benjamin Canou's avatar
      Client: make macros DIIIP and DUUUP use new indexed instructions · cc0c8c79
      Benjamin Canou authored
      This is not a patch for the protocol.
      It makes existing macros produce cheaper code thatnks to the new stack
      instructions.
      cc0c8c79