Alpha: rename Tezos_context
-> Alpha_context
This commit is contained in:
parent
6a5a235d42
commit
5fff7b3c1b
@ -30,7 +30,7 @@ These layers follow the linking order: the first modules are the tower’s
|
|||||||
foundation that talk to the raw key-value store, and going forward in
|
foundation that talk to the raw key-value store, and going forward in
|
||||||
the module list means climbing up the abstraction tower.
|
the module list means climbing up the abstraction tower.
|
||||||
|
|
||||||
The big abstraction barrier: ``Tezos_context``
|
The big abstraction barrier: ``Alpha_context``
|
||||||
----------------------------------------------
|
----------------------------------------------
|
||||||
|
|
||||||
the proof-of-stake algorithm, as described in the white paper, relies on
|
the proof-of-stake algorithm, as described in the white paper, relies on
|
||||||
@ -43,31 +43,31 @@ The proof-of-stake is thus implemented over a generic key-value store
|
|||||||
whose keys and associated binary data must implement the abstract
|
whose keys and associated binary data must implement the abstract
|
||||||
structure.
|
structure.
|
||||||
|
|
||||||
The ``Tezos_context`` module enforces the separation of concerns
|
The ``Alpha_context`` module enforces the separation of concerns
|
||||||
between, on one hand, mapping the abstract state of the ledger to the
|
between, on one hand, mapping the abstract state of the ledger to the
|
||||||
concrete structure of the key-value store, and, on the other hand,
|
concrete structure of the key-value store, and, on the other hand,
|
||||||
implementing the proof-of-stake algorithm over this state.
|
implementing the proof-of-stake algorithm over this state.
|
||||||
|
|
||||||
In more practical terms, ``Tezos_context`` defines a type ``t`` that
|
In more practical terms, ``Alpha_context`` defines a type ``t`` that
|
||||||
represents a state of the ledger. This state is an abstracted out
|
represents a state of the ledger. This state is an abstracted out
|
||||||
version of the key-value store that can only be manipulated through the
|
version of the key-value store that can only be manipulated through the
|
||||||
use of the few selected manipulations reexported by ``Tezos_context``,
|
use of the few selected manipulations reexported by ``Alpha_context``,
|
||||||
that always preserve the well-typed aspect and internal consistency
|
that always preserve the well-typed aspect and internal consistency
|
||||||
invariants of the state.
|
invariants of the state.
|
||||||
|
|
||||||
When validating a block, the low-level state that result from the
|
When validating a block, the low-level state that result from the
|
||||||
predecessor block is read from the disk, then abstracted out to a
|
predecessor block is read from the disk, then abstracted out to a
|
||||||
``Tezos_context.t``, which is then only updated by high level operations
|
``Alpha_context.t``, which is then only updated by high level operations
|
||||||
that preserve consistency, and finally, the low level state is extracted
|
that preserve consistency, and finally, the low level state is extracted
|
||||||
to be committed on disk.
|
to be committed on disk.
|
||||||
|
|
||||||
This way, we have two well separated parts in the code. The code below
|
This way, we have two well separated parts in the code. The code below
|
||||||
``Tezos_context`` implements the ledger’s state storage, while the code
|
``Alpha_context`` implements the ledger’s state storage, while the code
|
||||||
on top of it is the proof-of-stake algorithm. Thanks to this barrier,
|
on top of it is the proof-of-stake algorithm. Thanks to this barrier,
|
||||||
the latter can remain nice, readable OCaml that only manipulates plain
|
the latter can remain nice, readable OCaml that only manipulates plain
|
||||||
OCaml values.
|
OCaml values.
|
||||||
|
|
||||||
Below the ``Tezos_context``
|
Below the ``Alpha_context``
|
||||||
---------------------------
|
---------------------------
|
||||||
|
|
||||||
For this part, in a first discovery of the source code, you can start by
|
For this part, in a first discovery of the source code, you can start by
|
||||||
@ -137,7 +137,7 @@ These transaction do not go as far as checking that, for instance, when
|
|||||||
the destination of a transaction is credited, the source is also
|
the destination of a transaction is credited, the source is also
|
||||||
debitted, as in some cases, it might not be the case.
|
debitted, as in some cases, it might not be the case.
|
||||||
|
|
||||||
Above the ``Tezos_context``
|
Above the ``Alpha_context``
|
||||||
---------------------------
|
---------------------------
|
||||||
|
|
||||||
The three next sections describe the main entrypoints to the protocol:
|
The three next sections describe the main entrypoints to the protocol:
|
||||||
@ -158,7 +158,7 @@ understood with minimum OCaml knowledge.
|
|||||||
|
|
||||||
You want to start from the shell entry points (validation of the block
|
You want to start from the shell entry points (validation of the block
|
||||||
header, validation of an operation, finalization of a block validation),
|
header, validation of an operation, finalization of a block validation),
|
||||||
and follow the control flow until you hit the ``Tezos_context``
|
and follow the control flow until you hit the ``Alpha_context``
|
||||||
abstraction barrier. This will lead you to reading modules ``Baking``
|
abstraction barrier. This will lead you to reading modules ``Baking``
|
||||||
and ``Amendment``.
|
and ``Amendment``.
|
||||||
|
|
||||||
@ -175,7 +175,7 @@ Protocol RPC API
|
|||||||
~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
Finally, the RPCs specific to Alpha are also defined above the
|
Finally, the RPCs specific to Alpha are also defined above the
|
||||||
``Tezos_context`` barrier. The definition is split into two parts.
|
``Alpha_context`` barrier. The definition is split into two parts.
|
||||||
|
|
||||||
The first part, ``Services``, defines the RPC API: URL schemes with the
|
The first part, ``Services``, defines the RPC API: URL schemes with the
|
||||||
types of parameters, and input and output JSON schemas. This interface
|
types of parameters, and input and output JSON schemas. This interface
|
||||||
|
@ -40,11 +40,11 @@ let block_forged ?prev ops =
|
|||||||
let open Proto in
|
let open Proto in
|
||||||
let generate_proof_of_work_nonce () =
|
let generate_proof_of_work_nonce () =
|
||||||
Rand.generate
|
Rand.generate
|
||||||
Proto.Tezos_context.Constants.proof_of_work_nonce_size in
|
Proto.Alpha_context.Constants.proof_of_work_nonce_size in
|
||||||
let generate_seed_nonce () =
|
let generate_seed_nonce () =
|
||||||
match Proto.Nonce_storage.of_bytes @@
|
match Proto.Nonce_storage.of_bytes @@
|
||||||
Rand.generate
|
Rand.generate
|
||||||
Proto.Tezos_context.Constants.nonce_length with
|
Proto.Alpha_context.Constants.nonce_length with
|
||||||
| Error _ -> assert false
|
| Error _ -> assert false
|
||||||
| Ok nonce -> nonce in
|
| Ok nonce -> nonce in
|
||||||
Block_repr.forge_header (block ops)
|
Block_repr.forge_header (block ops)
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
(**************************************************************************)
|
(**************************************************************************)
|
||||||
|
|
||||||
open Proto_alpha
|
open Proto_alpha
|
||||||
open Tezos_context
|
open Alpha_context
|
||||||
|
|
||||||
type block_info = {
|
type block_info = {
|
||||||
hash: Block_hash.t ;
|
hash: Block_hash.t ;
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
(**************************************************************************)
|
(**************************************************************************)
|
||||||
|
|
||||||
open Proto_alpha
|
open Proto_alpha
|
||||||
open Tezos_context
|
open Alpha_context
|
||||||
|
|
||||||
type block_info = {
|
type block_info = {
|
||||||
hash: Block_hash.t ;
|
hash: Block_hash.t ;
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
(**************************************************************************)
|
(**************************************************************************)
|
||||||
|
|
||||||
open Proto_alpha
|
open Proto_alpha
|
||||||
open Tezos_context
|
open Alpha_context
|
||||||
|
|
||||||
val run:
|
val run:
|
||||||
#Client_commands.full_context ->
|
#Client_commands.full_context ->
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
(**************************************************************************)
|
(**************************************************************************)
|
||||||
|
|
||||||
open Proto_alpha
|
open Proto_alpha
|
||||||
open Tezos_context
|
open Alpha_context
|
||||||
|
|
||||||
open Logging.Client.Endorsement
|
open Logging.Client.Endorsement
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
(**************************************************************************)
|
(**************************************************************************)
|
||||||
|
|
||||||
open Proto_alpha
|
open Proto_alpha
|
||||||
open Tezos_context
|
open Alpha_context
|
||||||
|
|
||||||
val forge_endorsement:
|
val forge_endorsement:
|
||||||
#Client_commands.full_context ->
|
#Client_commands.full_context ->
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
(**************************************************************************)
|
(**************************************************************************)
|
||||||
|
|
||||||
open Proto_alpha
|
open Proto_alpha
|
||||||
open Tezos_context
|
open Alpha_context
|
||||||
|
|
||||||
open Logging.Client.Baking
|
open Logging.Client.Baking
|
||||||
|
|
||||||
@ -28,7 +28,7 @@ let forge_block_header
|
|||||||
let rec loop () =
|
let rec loop () =
|
||||||
let proof_of_work_nonce = generate_proof_of_work_nonce () in
|
let proof_of_work_nonce = generate_proof_of_work_nonce () in
|
||||||
let unsigned_header =
|
let unsigned_header =
|
||||||
Tezos_context.Block_header.forge_unsigned
|
Alpha_context.Block_header.forge_unsigned
|
||||||
shell { priority ; seed_nonce_hash ; proof_of_work_nonce } in
|
shell { priority ; seed_nonce_hash ; proof_of_work_nonce } in
|
||||||
Client_keys.append delegate_sk unsigned_header >>=? fun signed_header ->
|
Client_keys.append delegate_sk unsigned_header >>=? fun signed_header ->
|
||||||
let block_hash = Block_hash.hash_bytes [signed_header] in
|
let block_hash = Block_hash.hash_bytes [signed_header] in
|
||||||
@ -43,7 +43,7 @@ let empty_proof_of_work_nonce =
|
|||||||
(String.make Constants_repr.proof_of_work_nonce_size '\000')
|
(String.make Constants_repr.proof_of_work_nonce_size '\000')
|
||||||
|
|
||||||
let forge_faked_proto_header ~priority ~seed_nonce_hash =
|
let forge_faked_proto_header ~priority ~seed_nonce_hash =
|
||||||
Tezos_context.Block_header.forge_unsigned_proto_header
|
Alpha_context.Block_header.forge_unsigned_proto_header
|
||||||
{ priority ; seed_nonce_hash ;
|
{ priority ; seed_nonce_hash ;
|
||||||
proof_of_work_nonce = empty_proof_of_work_nonce }
|
proof_of_work_nonce = empty_proof_of_work_nonce }
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
(**************************************************************************)
|
(**************************************************************************)
|
||||||
|
|
||||||
open Proto_alpha
|
open Proto_alpha
|
||||||
open Tezos_context
|
open Alpha_context
|
||||||
|
|
||||||
val generate_seed_nonce: unit -> Nonce.t
|
val generate_seed_nonce: unit -> Nonce.t
|
||||||
(** [generate_seed_nonce ()] is a random nonce that is typically used
|
(** [generate_seed_nonce ()] is a random nonce that is typically used
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
(**************************************************************************)
|
(**************************************************************************)
|
||||||
|
|
||||||
open Proto_alpha
|
open Proto_alpha
|
||||||
open Tezos_context
|
open Alpha_context
|
||||||
|
|
||||||
let bake_block (cctxt : #Client_commands.full_context) block
|
let bake_block (cctxt : #Client_commands.full_context) block
|
||||||
?force ?max_priority ?(free_baking=false) ?src_sk delegate =
|
?force ?max_priority ?(free_baking=false) ?src_sk delegate =
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
(**************************************************************************)
|
(**************************************************************************)
|
||||||
|
|
||||||
open Proto_alpha
|
open Proto_alpha
|
||||||
open Tezos_context
|
open Alpha_context
|
||||||
|
|
||||||
(** Mine a block *)
|
(** Mine a block *)
|
||||||
val bake_block:
|
val bake_block:
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
(**************************************************************************)
|
(**************************************************************************)
|
||||||
|
|
||||||
open Proto_alpha
|
open Proto_alpha
|
||||||
open Tezos_context
|
open Alpha_context
|
||||||
|
|
||||||
type operation = {
|
type operation = {
|
||||||
hash: Operation_hash.t ;
|
hash: Operation_hash.t ;
|
||||||
@ -43,7 +43,7 @@ type valid_endorsement = {
|
|||||||
|
|
||||||
(*
|
(*
|
||||||
let filter_valid_endorsement cctxt ({ hash ; content } : operation) =
|
let filter_valid_endorsement cctxt ({ hash ; content } : operation) =
|
||||||
let open Tezos_context in
|
let open Alpha_context in
|
||||||
match content with
|
match content with
|
||||||
| None
|
| None
|
||||||
| Some { contents = Anonymous_operations _ }
|
| Some { contents = Anonymous_operations _ }
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
(**************************************************************************)
|
(**************************************************************************)
|
||||||
|
|
||||||
open Proto_alpha
|
open Proto_alpha
|
||||||
open Tezos_context
|
open Alpha_context
|
||||||
|
|
||||||
type operation = {
|
type operation = {
|
||||||
hash: Operation_hash.t ;
|
hash: Operation_hash.t ;
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
(**************************************************************************)
|
(**************************************************************************)
|
||||||
|
|
||||||
open Proto_alpha
|
open Proto_alpha
|
||||||
open Tezos_context
|
open Alpha_context
|
||||||
|
|
||||||
let inject_seed_nonce_revelation rpc_config block ?async nonces =
|
let inject_seed_nonce_revelation rpc_config block ?async nonces =
|
||||||
let operations =
|
let operations =
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
(**************************************************************************)
|
(**************************************************************************)
|
||||||
|
|
||||||
open Proto_alpha
|
open Proto_alpha
|
||||||
open Tezos_context
|
open Alpha_context
|
||||||
|
|
||||||
val inject_seed_nonce_revelation:
|
val inject_seed_nonce_revelation:
|
||||||
#RPC_context.simple ->
|
#RPC_context.simple ->
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
(**************************************************************************)
|
(**************************************************************************)
|
||||||
|
|
||||||
open Proto_alpha
|
open Proto_alpha
|
||||||
open Tezos_context
|
open Alpha_context
|
||||||
open Cli_entries
|
open Cli_entries
|
||||||
|
|
||||||
type error += Bad_tez_arg of string * string (* Arg_name * value *)
|
type error += Bad_tez_arg of string * string (* Arg_name * value *)
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
(**************************************************************************)
|
(**************************************************************************)
|
||||||
|
|
||||||
open Proto_alpha
|
open Proto_alpha
|
||||||
open Tezos_context
|
open Alpha_context
|
||||||
|
|
||||||
val tez_sym: string
|
val tez_sym: string
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
(**************************************************************************)
|
(**************************************************************************)
|
||||||
|
|
||||||
open Proto_alpha
|
open Proto_alpha
|
||||||
open Tezos_context
|
open Alpha_context
|
||||||
open Tezos_micheline
|
open Tezos_micheline
|
||||||
open Client_proto_contracts
|
open Client_proto_contracts
|
||||||
open Client_keys
|
open Client_keys
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
(**************************************************************************)
|
(**************************************************************************)
|
||||||
|
|
||||||
open Proto_alpha
|
open Proto_alpha
|
||||||
open Tezos_context
|
open Alpha_context
|
||||||
|
|
||||||
val list_contract_labels :
|
val list_contract_labels :
|
||||||
#Client_commands.full_context ->
|
#Client_commands.full_context ->
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
(**************************************************************************)
|
(**************************************************************************)
|
||||||
|
|
||||||
open Proto_alpha
|
open Proto_alpha
|
||||||
open Tezos_context
|
open Alpha_context
|
||||||
open Tezos_micheline
|
open Tezos_micheline
|
||||||
open Client_proto_context
|
open Client_proto_context
|
||||||
open Client_proto_contracts
|
open Client_proto_contracts
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
(**************************************************************************)
|
(**************************************************************************)
|
||||||
|
|
||||||
open Proto_alpha
|
open Proto_alpha
|
||||||
open Tezos_context
|
open Alpha_context
|
||||||
|
|
||||||
module ContractEntity = struct
|
module ContractEntity = struct
|
||||||
type t = Contract.t
|
type t = Contract.t
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
(**************************************************************************)
|
(**************************************************************************)
|
||||||
|
|
||||||
open Proto_alpha
|
open Proto_alpha
|
||||||
open Tezos_context
|
open Alpha_context
|
||||||
open Cli_entries
|
open Cli_entries
|
||||||
|
|
||||||
module RawContractAlias :
|
module RawContractAlias :
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
(**************************************************************************)
|
(**************************************************************************)
|
||||||
|
|
||||||
open Proto_alpha
|
open Proto_alpha
|
||||||
open Tezos_context
|
open Alpha_context
|
||||||
open Client_proto_contracts
|
open Client_proto_contracts
|
||||||
|
|
||||||
let group =
|
let group =
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
(**************************************************************************)
|
(**************************************************************************)
|
||||||
|
|
||||||
open Proto_alpha
|
open Proto_alpha
|
||||||
open Tezos_context
|
open Alpha_context
|
||||||
|
|
||||||
(* TODO locking... *)
|
(* TODO locking... *)
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
(**************************************************************************)
|
(**************************************************************************)
|
||||||
|
|
||||||
open Proto_alpha
|
open Proto_alpha
|
||||||
open Tezos_context
|
open Alpha_context
|
||||||
|
|
||||||
val mem:
|
val mem:
|
||||||
#Client_commands.wallet ->
|
#Client_commands.wallet ->
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
(**************************************************************************)
|
(**************************************************************************)
|
||||||
|
|
||||||
open Proto_alpha
|
open Proto_alpha
|
||||||
open Tezos_context
|
open Alpha_context
|
||||||
open Tezos_micheline
|
open Tezos_micheline
|
||||||
|
|
||||||
open Michelson_v1_printer
|
open Michelson_v1_printer
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
(**************************************************************************)
|
(**************************************************************************)
|
||||||
|
|
||||||
open Proto_alpha
|
open Proto_alpha
|
||||||
open Tezos_context
|
open Alpha_context
|
||||||
open Tezos_micheline
|
open Tezos_micheline
|
||||||
|
|
||||||
module Program : Client_aliases.Alias
|
module Program : Client_aliases.Alias
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
(**************************************************************************)
|
(**************************************************************************)
|
||||||
|
|
||||||
open Proto_alpha
|
open Proto_alpha
|
||||||
open Tezos_context
|
open Alpha_context
|
||||||
|
|
||||||
let make_call1 cctxt s=
|
let make_call1 cctxt s=
|
||||||
RPC_context.make_call1 (s Block_services.S.proto_path) cctxt
|
RPC_context.make_call1 (s Block_services.S.proto_path) cctxt
|
||||||
@ -184,7 +184,7 @@ module Helpers = struct
|
|||||||
block ~branch ~source ?sourcePubKey ~counter
|
block ~branch ~source ?sourcePubKey ~counter
|
||||||
~amount ~destination ?parameters ~fee ()=
|
~amount ~destination ?parameters ~fee ()=
|
||||||
operations cctxt block ~branch ~source ?sourcePubKey ~counter ~fee
|
operations cctxt block ~branch ~source ?sourcePubKey ~counter ~fee
|
||||||
Tezos_context.[Transaction { amount ; parameters ; destination }]
|
Alpha_context.[Transaction { amount ; parameters ; destination }]
|
||||||
let origination cctxt
|
let origination cctxt
|
||||||
block ~branch
|
block ~branch
|
||||||
~source ?sourcePubKey ~counter
|
~source ?sourcePubKey ~counter
|
||||||
@ -193,7 +193,7 @@ module Helpers = struct
|
|||||||
?(delegatable = true)
|
?(delegatable = true)
|
||||||
?delegatePubKey ?script ~fee () =
|
?delegatePubKey ?script ~fee () =
|
||||||
operations cctxt block ~branch ~source ?sourcePubKey ~counter ~fee
|
operations cctxt block ~branch ~source ?sourcePubKey ~counter ~fee
|
||||||
Tezos_context.[
|
Alpha_context.[
|
||||||
Origination { manager = managerPubKey ;
|
Origination { manager = managerPubKey ;
|
||||||
delegate = delegatePubKey ;
|
delegate = delegatePubKey ;
|
||||||
script ;
|
script ;
|
||||||
@ -204,7 +204,7 @@ module Helpers = struct
|
|||||||
let delegation cctxt
|
let delegation cctxt
|
||||||
block ~branch ~source ?sourcePubKey ~counter ~fee delegate =
|
block ~branch ~source ?sourcePubKey ~counter ~fee delegate =
|
||||||
operations cctxt block ~branch ~source ?sourcePubKey ~counter ~fee
|
operations cctxt block ~branch ~source ?sourcePubKey ~counter ~fee
|
||||||
Tezos_context.[Delegation delegate]
|
Alpha_context.[Delegation delegate]
|
||||||
end
|
end
|
||||||
module Delegate = struct
|
module Delegate = struct
|
||||||
let operations cctxt
|
let operations cctxt
|
||||||
@ -215,15 +215,15 @@ module Helpers = struct
|
|||||||
let endorsement cctxt
|
let endorsement cctxt
|
||||||
b ~branch ~source ~block ~slot () =
|
b ~branch ~source ~block ~slot () =
|
||||||
operations cctxt b ~branch ~source
|
operations cctxt b ~branch ~source
|
||||||
Tezos_context.[Endorsement { block ; slot }]
|
Alpha_context.[Endorsement { block ; slot }]
|
||||||
let proposals cctxt
|
let proposals cctxt
|
||||||
b ~branch ~source ~period ~proposals () =
|
b ~branch ~source ~period ~proposals () =
|
||||||
operations cctxt b ~branch ~source
|
operations cctxt b ~branch ~source
|
||||||
Tezos_context.[Proposals { period ; proposals }]
|
Alpha_context.[Proposals { period ; proposals }]
|
||||||
let ballot cctxt
|
let ballot cctxt
|
||||||
b ~branch ~source ~period ~proposal ~ballot () =
|
b ~branch ~source ~period ~proposal ~ballot () =
|
||||||
operations cctxt b ~branch ~source
|
operations cctxt b ~branch ~source
|
||||||
Tezos_context.[Ballot { period ; proposal ; ballot }]
|
Alpha_context.[Ballot { period ; proposal ; ballot }]
|
||||||
end
|
end
|
||||||
module Dictator = struct
|
module Dictator = struct
|
||||||
let operation cctxt
|
let operation cctxt
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
(**************************************************************************)
|
(**************************************************************************)
|
||||||
|
|
||||||
open Proto_alpha
|
open Proto_alpha
|
||||||
open Tezos_context
|
open Alpha_context
|
||||||
|
|
||||||
type block = Block_services.block
|
type block = Block_services.block
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
(**************************************************************************)
|
(**************************************************************************)
|
||||||
|
|
||||||
open Proto_alpha
|
open Proto_alpha
|
||||||
open Tezos_context
|
open Alpha_context
|
||||||
|
|
||||||
val print_expr :
|
val print_expr :
|
||||||
Format.formatter ->
|
Format.formatter ->
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
(**************************************************************************)
|
(**************************************************************************)
|
||||||
|
|
||||||
open Proto_alpha
|
open Proto_alpha
|
||||||
open Tezos_context
|
open Alpha_context
|
||||||
open Tezos_micheline
|
open Tezos_micheline
|
||||||
open Script_typed_ir
|
open Script_typed_ir
|
||||||
open Script_tc_errors
|
open Script_tc_errors
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
(**************************************************************************)
|
(**************************************************************************)
|
||||||
|
|
||||||
open Proto_alpha
|
open Proto_alpha
|
||||||
open Tezos_context
|
open Alpha_context
|
||||||
|
|
||||||
open Tezos_micheline
|
open Tezos_micheline
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
(**************************************************************************)
|
(**************************************************************************)
|
||||||
|
|
||||||
open Proto_alpha
|
open Proto_alpha
|
||||||
open Tezos_context
|
open Alpha_context
|
||||||
open Tezos_micheline
|
open Tezos_micheline
|
||||||
|
|
||||||
val print_expr :
|
val print_expr :
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
(**************************************************************************)
|
(**************************************************************************)
|
||||||
|
|
||||||
open Proto_alpha
|
open Proto_alpha
|
||||||
open Tezos_context
|
open Alpha_context
|
||||||
|
|
||||||
let (//) = Filename.concat
|
let (//) = Filename.concat
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
(**************************************************************************)
|
(**************************************************************************)
|
||||||
|
|
||||||
open Proto_alpha
|
open Proto_alpha
|
||||||
open Tezos_context
|
open Alpha_context
|
||||||
|
|
||||||
val init :
|
val init :
|
||||||
?exe:string ->
|
?exe:string ->
|
||||||
@ -19,7 +19,7 @@ val init :
|
|||||||
forked Tezos node and the block info of the block from where the
|
forked Tezos node and the block info of the block from where the
|
||||||
tests will begin. *)
|
tests will begin. *)
|
||||||
|
|
||||||
val level : Block_services.block -> Tezos_context.Level.t tzresult Lwt.t
|
val level : Block_services.block -> Alpha_context.Level.t tzresult Lwt.t
|
||||||
|
|
||||||
module Account : sig
|
module Account : sig
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
(**************************************************************************)
|
(**************************************************************************)
|
||||||
|
|
||||||
open Proto_alpha
|
open Proto_alpha
|
||||||
open Tezos_context
|
open Alpha_context
|
||||||
module Helpers = Proto_alpha_helpers
|
module Helpers = Proto_alpha_helpers
|
||||||
module Assert = Helpers.Assert
|
module Assert = Helpers.Assert
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
(**************************************************************************)
|
(**************************************************************************)
|
||||||
|
|
||||||
open Proto_alpha
|
open Proto_alpha
|
||||||
open Tezos_context
|
open Alpha_context
|
||||||
module Helpers = Proto_alpha_helpers
|
module Helpers = Proto_alpha_helpers
|
||||||
module Assert = Helpers.Assert
|
module Assert = Helpers.Assert
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
(**************************************************************************)
|
(**************************************************************************)
|
||||||
|
|
||||||
open Proto_alpha
|
open Proto_alpha
|
||||||
open Tezos_context
|
open Alpha_context
|
||||||
module Helpers = Proto_alpha_helpers
|
module Helpers = Proto_alpha_helpers
|
||||||
module Assert = Helpers.Assert
|
module Assert = Helpers.Assert
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
(**************************************************************************)
|
(**************************************************************************)
|
||||||
|
|
||||||
open Proto_alpha
|
open Proto_alpha
|
||||||
open Tezos_context
|
open Alpha_context
|
||||||
open Proto_alpha_helpers
|
open Proto_alpha_helpers
|
||||||
|
|
||||||
let demo_protocol =
|
let demo_protocol =
|
||||||
|
@ -43,7 +43,7 @@
|
|||||||
"Init_storage",
|
"Init_storage",
|
||||||
"Public_key_storage",
|
"Public_key_storage",
|
||||||
|
|
||||||
"Tezos_context",
|
"Alpha_context",
|
||||||
|
|
||||||
"Script_typed_ir",
|
"Script_typed_ir",
|
||||||
"Gas",
|
"Gas",
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
(* *)
|
(* *)
|
||||||
(**************************************************************************)
|
(**************************************************************************)
|
||||||
|
|
||||||
open Tezos_context
|
open Alpha_context
|
||||||
|
|
||||||
let () = ()
|
let () = ()
|
||||||
|
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
(* *)
|
(* *)
|
||||||
(**************************************************************************)
|
(**************************************************************************)
|
||||||
|
|
||||||
open Tezos_context
|
open Alpha_context
|
||||||
|
|
||||||
val may_start_new_voting_cycle:
|
val may_start_new_voting_cycle:
|
||||||
context -> context tzresult Lwt.t
|
context -> context tzresult Lwt.t
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
|
|
||||||
(** Tezos Protocol Implementation - Main Entry Points *)
|
(** Tezos Protocol Implementation - Main Entry Points *)
|
||||||
|
|
||||||
open Tezos_context
|
open Alpha_context
|
||||||
|
|
||||||
type error += Wrong_voting_period of Voting_period.t * Voting_period.t (* `Temporary *)
|
type error += Wrong_voting_period of Voting_period.t * Voting_period.t (* `Temporary *)
|
||||||
type error += Wrong_endorsement_predecessor of Block_hash.t * Block_hash.t (* `Temporary *)
|
type error += Wrong_endorsement_predecessor of Block_hash.t * Block_hash.t (* `Temporary *)
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
(**************************************************************************)
|
(**************************************************************************)
|
||||||
|
|
||||||
|
|
||||||
open Tezos_context
|
open Alpha_context
|
||||||
open Misc
|
open Misc
|
||||||
|
|
||||||
type error += Invalid_fitness_gap of int64 * int64 (* `Permanent *)
|
type error += Invalid_fitness_gap of int64 * int64 (* `Permanent *)
|
||||||
@ -114,7 +114,7 @@ let minimal_time c priority pred_timestamp =
|
|||||||
|
|
||||||
let check_timestamp c priority pred_timestamp =
|
let check_timestamp c priority pred_timestamp =
|
||||||
minimal_time c priority pred_timestamp >>=? fun minimal_time ->
|
minimal_time c priority pred_timestamp >>=? fun minimal_time ->
|
||||||
let timestamp = Tezos_context.Timestamp.current c in
|
let timestamp = Alpha_context.Timestamp.current c in
|
||||||
fail_unless Timestamp.(minimal_time <= timestamp)
|
fail_unless Timestamp.(minimal_time <= timestamp)
|
||||||
(Timestamp_too_early (minimal_time, timestamp))
|
(Timestamp_too_early (minimal_time, timestamp))
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
(**************************************************************************)
|
(**************************************************************************)
|
||||||
|
|
||||||
|
|
||||||
open Tezos_context
|
open Alpha_context
|
||||||
open Misc
|
open Misc
|
||||||
|
|
||||||
type error += Invalid_fitness_gap of int64 * int64 (* `Permanent *)
|
type error += Invalid_fitness_gap of int64 * int64 (* `Permanent *)
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
(* *)
|
(* *)
|
||||||
(**************************************************************************)
|
(**************************************************************************)
|
||||||
|
|
||||||
open Tezos_context
|
open Alpha_context
|
||||||
|
|
||||||
(* FIXME: this really is a preliminary estimation of costs,
|
(* FIXME: this really is a preliminary estimation of costs,
|
||||||
everything in this file needs to be tweaked and proofread. *)
|
everything in this file needs to be tweaked and proofread. *)
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
(* *)
|
(* *)
|
||||||
(**************************************************************************)
|
(**************************************************************************)
|
||||||
|
|
||||||
open Tezos_context
|
open Alpha_context
|
||||||
|
|
||||||
type t
|
type t
|
||||||
type cost
|
type cost
|
||||||
|
@ -9,13 +9,13 @@
|
|||||||
|
|
||||||
(* Tezos Protocol Implementation - Protocol Signature Instance *)
|
(* Tezos Protocol Implementation - Protocol Signature Instance *)
|
||||||
|
|
||||||
type operation = Tezos_context.operation
|
type operation = Alpha_context.operation
|
||||||
|
|
||||||
let parse_operation = Tezos_context.Operation.parse
|
let parse_operation = Alpha_context.Operation.parse
|
||||||
let acceptable_passes = Tezos_context.Operation.acceptable_passes
|
let acceptable_passes = Alpha_context.Operation.acceptable_passes
|
||||||
|
|
||||||
let max_block_length =
|
let max_block_length =
|
||||||
Tezos_context.Block_header.max_header_length
|
Alpha_context.Block_header.max_header_length
|
||||||
|
|
||||||
let validation_passes =
|
let validation_passes =
|
||||||
Updater.[ { max_size = 32 * 1024 ; max_op = None } ; (* 32kB FIXME *)
|
Updater.[ { max_size = 32 * 1024 ; max_op = None } ; (* 32kB FIXME *)
|
||||||
@ -25,31 +25,31 @@ let rpc_services = Services_registration.rpc_services
|
|||||||
|
|
||||||
type validation_mode =
|
type validation_mode =
|
||||||
| Application of {
|
| Application of {
|
||||||
block_header : Tezos_context.Block_header.t ;
|
block_header : Alpha_context.Block_header.t ;
|
||||||
baker : Tezos_context.public_key_hash ;
|
baker : Alpha_context.public_key_hash ;
|
||||||
}
|
}
|
||||||
| Partial_construction of {
|
| Partial_construction of {
|
||||||
predecessor : Block_hash.t ;
|
predecessor : Block_hash.t ;
|
||||||
}
|
}
|
||||||
| Full_construction of {
|
| Full_construction of {
|
||||||
predecessor : Block_hash.t ;
|
predecessor : Block_hash.t ;
|
||||||
block_proto_header : Tezos_context.Block_header.proto_header ;
|
block_proto_header : Alpha_context.Block_header.proto_header ;
|
||||||
baker : Tezos_context.public_key_hash ;
|
baker : Alpha_context.public_key_hash ;
|
||||||
}
|
}
|
||||||
|
|
||||||
type validation_state =
|
type validation_state =
|
||||||
{ mode : validation_mode ;
|
{ mode : validation_mode ;
|
||||||
ctxt : Tezos_context.t ;
|
ctxt : Alpha_context.t ;
|
||||||
op_count : int }
|
op_count : int }
|
||||||
|
|
||||||
let current_context { ctxt } =
|
let current_context { ctxt } =
|
||||||
return (Tezos_context.finalize ctxt).context
|
return (Alpha_context.finalize ctxt).context
|
||||||
|
|
||||||
let precheck_block
|
let precheck_block
|
||||||
~ancestor_context:_
|
~ancestor_context:_
|
||||||
~ancestor_timestamp:_
|
~ancestor_timestamp:_
|
||||||
raw_block =
|
raw_block =
|
||||||
Lwt.return (Tezos_context.Block_header.parse raw_block) >>=? fun _ ->
|
Lwt.return (Alpha_context.Block_header.parse raw_block) >>=? fun _ ->
|
||||||
(* TODO: decide what other properties should be checked *)
|
(* TODO: decide what other properties should be checked *)
|
||||||
return ()
|
return ()
|
||||||
|
|
||||||
@ -58,11 +58,11 @@ let begin_application
|
|||||||
~predecessor_timestamp:pred_timestamp
|
~predecessor_timestamp:pred_timestamp
|
||||||
~predecessor_fitness:pred_fitness
|
~predecessor_fitness:pred_fitness
|
||||||
raw_block =
|
raw_block =
|
||||||
Lwt.return (Tezos_context.Block_header.parse raw_block) >>=? fun block_header ->
|
Lwt.return (Alpha_context.Block_header.parse raw_block) >>=? fun block_header ->
|
||||||
let level = block_header.shell.level in
|
let level = block_header.shell.level in
|
||||||
let fitness = pred_fitness in
|
let fitness = pred_fitness in
|
||||||
let timestamp = block_header.shell.timestamp in
|
let timestamp = block_header.shell.timestamp in
|
||||||
Tezos_context.init ~level ~timestamp ~fitness ctxt >>=? fun ctxt ->
|
Alpha_context.init ~level ~timestamp ~fitness ctxt >>=? fun ctxt ->
|
||||||
Apply.begin_application
|
Apply.begin_application
|
||||||
ctxt block_header pred_timestamp >>=? fun (ctxt, baker) ->
|
ctxt block_header pred_timestamp >>=? fun (ctxt, baker) ->
|
||||||
let mode = Application { block_header ; baker } in
|
let mode = Application { block_header ; baker } in
|
||||||
@ -79,7 +79,7 @@ let begin_construction
|
|||||||
() =
|
() =
|
||||||
let level = Int32.succ pred_level in
|
let level = Int32.succ pred_level in
|
||||||
let fitness = pred_fitness in
|
let fitness = pred_fitness in
|
||||||
Tezos_context.init ~timestamp ~level ~fitness ctxt >>=? fun ctxt ->
|
Alpha_context.init ~timestamp ~level ~fitness ctxt >>=? fun ctxt ->
|
||||||
begin
|
begin
|
||||||
match proto_header with
|
match proto_header with
|
||||||
| None ->
|
| None ->
|
||||||
@ -107,7 +107,7 @@ let apply_operation ({ mode ; ctxt ; op_count } as data) operation =
|
|||||||
| Full_construction { predecessor ; block_proto_header ; baker } ->
|
| Full_construction { predecessor ; block_proto_header ; baker } ->
|
||||||
predecessor,
|
predecessor,
|
||||||
block_proto_header.priority,
|
block_proto_header.priority,
|
||||||
Some (Tezos_context.Contract.default_contract baker) in
|
Some (Alpha_context.Contract.default_contract baker) in
|
||||||
Apply.apply_operation
|
Apply.apply_operation
|
||||||
ctxt baker_contract pred_block block_prio operation
|
ctxt baker_contract pred_block block_prio operation
|
||||||
>>=? fun (ctxt, _contracts, _ignored_script_error) ->
|
>>=? fun (ctxt, _contracts, _ignored_script_error) ->
|
||||||
@ -116,25 +116,25 @@ let apply_operation ({ mode ; ctxt ; op_count } as data) operation =
|
|||||||
|
|
||||||
let finalize_block { mode ; ctxt ; op_count } = match mode with
|
let finalize_block { mode ; ctxt ; op_count } = match mode with
|
||||||
| Partial_construction _ ->
|
| Partial_construction _ ->
|
||||||
let ctxt = Tezos_context.finalize ctxt in
|
let ctxt = Alpha_context.finalize ctxt in
|
||||||
return ctxt
|
return ctxt
|
||||||
| Application
|
| Application
|
||||||
{ baker ; block_header = { proto = block_proto_header } }
|
{ baker ; block_header = { proto = block_proto_header } }
|
||||||
| Full_construction { block_proto_header ; baker } ->
|
| Full_construction { block_proto_header ; baker } ->
|
||||||
Apply.finalize_application ctxt block_proto_header baker >>=? fun ctxt ->
|
Apply.finalize_application ctxt block_proto_header baker >>=? fun ctxt ->
|
||||||
let { level } : Tezos_context.Level.t =
|
let { level } : Alpha_context.Level.t =
|
||||||
Tezos_context. Level.current ctxt in
|
Alpha_context. Level.current ctxt in
|
||||||
let priority = block_proto_header.priority in
|
let priority = block_proto_header.priority in
|
||||||
let level = Tezos_context.Raw_level.to_int32 level in
|
let level = Alpha_context.Raw_level.to_int32 level in
|
||||||
let fitness = Tezos_context.Fitness.current ctxt in
|
let fitness = Alpha_context.Fitness.current ctxt in
|
||||||
let commit_message =
|
let commit_message =
|
||||||
Format.asprintf
|
Format.asprintf
|
||||||
"lvl %ld, fit %Ld, prio %d, %d ops"
|
"lvl %ld, fit %Ld, prio %d, %d ops"
|
||||||
level fitness priority op_count in
|
level fitness priority op_count in
|
||||||
let ctxt = Tezos_context.finalize ~commit_message ctxt in
|
let ctxt = Alpha_context.finalize ~commit_message ctxt in
|
||||||
return ctxt
|
return ctxt
|
||||||
|
|
||||||
let compare_operations op1 op2 =
|
let compare_operations op1 op2 =
|
||||||
Apply.compare_operations op1 op2
|
Apply.compare_operations op1 op2
|
||||||
|
|
||||||
let configure_sandbox = Tezos_context.configure_sandbox
|
let configure_sandbox = Alpha_context.configure_sandbox
|
||||||
|
@ -9,4 +9,4 @@
|
|||||||
|
|
||||||
(** Tezos Protocol Implementation - Protocol Signature Instance *)
|
(** Tezos Protocol Implementation - Protocol Signature Instance *)
|
||||||
|
|
||||||
include Updater.PROTOCOL with type operation = Tezos_context.Operation.t
|
include Updater.PROTOCOL with type operation = Alpha_context.Operation.t
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
(* *)
|
(* *)
|
||||||
(**************************************************************************)
|
(**************************************************************************)
|
||||||
|
|
||||||
open Tezos_context
|
open Alpha_context
|
||||||
open Script
|
open Script
|
||||||
open Script_typed_ir
|
open Script_typed_ir
|
||||||
open Script_tc_errors
|
open Script_tc_errors
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
(* *)
|
(* *)
|
||||||
(**************************************************************************)
|
(**************************************************************************)
|
||||||
|
|
||||||
open Tezos_context
|
open Alpha_context
|
||||||
|
|
||||||
type error += Overflow of Script.location
|
type error += Overflow of Script.location
|
||||||
type error += Reject of Script.location
|
type error += Reject of Script.location
|
||||||
@ -18,7 +18,7 @@ val dummy_storage_fee : Tez.t
|
|||||||
|
|
||||||
val execute:
|
val execute:
|
||||||
Contract.origination_nonce ->
|
Contract.origination_nonce ->
|
||||||
Contract.t -> Contract.t -> Tezos_context.t ->
|
Contract.t -> Contract.t -> Alpha_context.t ->
|
||||||
Script.t -> Tez.t ->
|
Script.t -> Tez.t ->
|
||||||
Script.expr -> Gas.t ->
|
Script.expr -> Gas.t ->
|
||||||
(Script.expr * Script.expr * Gas.t * context * Contract.origination_nonce *
|
(Script.expr * Script.expr * Gas.t * context * Contract.origination_nonce *
|
||||||
@ -26,7 +26,7 @@ val execute:
|
|||||||
|
|
||||||
val trace:
|
val trace:
|
||||||
Contract.origination_nonce ->
|
Contract.origination_nonce ->
|
||||||
Contract.t -> Contract.t -> Tezos_context.t ->
|
Contract.t -> Contract.t -> Alpha_context.t ->
|
||||||
Script.t -> Tez.t ->
|
Script.t -> Tez.t ->
|
||||||
Script.expr -> Gas.t ->
|
Script.expr -> Gas.t ->
|
||||||
((Script.expr * Script.expr * Gas.t * context * Contract.origination_nonce * Script_typed_ir.ex_big_map option) *
|
((Script.expr * Script.expr * Gas.t * context * Contract.origination_nonce * Script_typed_ir.ex_big_map option) *
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
(* *)
|
(* *)
|
||||||
(**************************************************************************)
|
(**************************************************************************)
|
||||||
|
|
||||||
open Tezos_context
|
open Alpha_context
|
||||||
open Micheline
|
open Micheline
|
||||||
open Script
|
open Script
|
||||||
open Script_typed_ir
|
open Script_typed_ir
|
||||||
@ -2136,7 +2136,7 @@ let hash_data typ data =
|
|||||||
|
|
||||||
let big_map_mem ctx contract key { diff ; key_type } =
|
let big_map_mem ctx contract key { diff ; key_type } =
|
||||||
match map_get key diff with
|
match map_get key diff with
|
||||||
| None -> Tezos_context.Contract.Big_map_storage.mem ctx contract (hash_data key_type key)
|
| None -> Alpha_context.Contract.Big_map_storage.mem ctx contract (hash_data key_type key)
|
||||||
| Some None -> Lwt.return false
|
| Some None -> Lwt.return false
|
||||||
| Some (Some _) -> Lwt.return true
|
| Some (Some _) -> Lwt.return true
|
||||||
|
|
||||||
@ -2144,7 +2144,7 @@ let big_map_get ctx contract key { diff ; key_type ; value_type } =
|
|||||||
match map_get key diff with
|
match map_get key diff with
|
||||||
| Some x -> return x
|
| Some x -> return x
|
||||||
| None ->
|
| None ->
|
||||||
Tezos_context.Contract.Big_map_storage.get_opt
|
Alpha_context.Contract.Big_map_storage.get_opt
|
||||||
ctx contract
|
ctx contract
|
||||||
(hash_data key_type key) >>=? begin function
|
(hash_data key_type key) >>=? begin function
|
||||||
| None -> return None
|
| None -> return None
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
(* *)
|
(* *)
|
||||||
(**************************************************************************)
|
(**************************************************************************)
|
||||||
|
|
||||||
open Tezos_context
|
open Alpha_context
|
||||||
open Script_tc_errors
|
open Script_tc_errors
|
||||||
|
|
||||||
type ('ta, 'tb) eq = Eq : ('same, 'same) eq
|
type ('ta, 'tb) eq = Eq : ('same, 'same) eq
|
||||||
@ -38,9 +38,9 @@ val map_get : 'key -> ('key, 'value) Script_typed_ir.map -> 'value option
|
|||||||
val map_key_ty : ('a, 'b) Script_typed_ir.map -> 'a Script_typed_ir.comparable_ty
|
val map_key_ty : ('a, 'b) Script_typed_ir.map -> 'a Script_typed_ir.comparable_ty
|
||||||
val map_size : ('a, 'b) Script_typed_ir.map -> Script_int.n Script_int.num
|
val map_size : ('a, 'b) Script_typed_ir.map -> Script_int.n Script_int.num
|
||||||
|
|
||||||
val big_map_mem : context -> Tezos_context.Contract.t -> 'key -> ('key, 'value) Script_typed_ir.big_map -> bool Lwt.t
|
val big_map_mem : context -> Alpha_context.Contract.t -> 'key -> ('key, 'value) Script_typed_ir.big_map -> bool Lwt.t
|
||||||
val big_map_get :
|
val big_map_get :
|
||||||
context -> Tezos_context.Contract.t -> 'key -> ('key, 'value) Script_typed_ir.big_map ->
|
context -> Alpha_context.Contract.t -> 'key -> ('key, 'value) Script_typed_ir.big_map ->
|
||||||
'value option tzresult Lwt.t
|
'value option tzresult Lwt.t
|
||||||
val big_map_update :
|
val big_map_update :
|
||||||
'key -> 'value option -> ('key, 'value) Script_typed_ir.big_map ->
|
'key -> 'value option -> ('key, 'value) Script_typed_ir.big_map ->
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
(* *)
|
(* *)
|
||||||
(**************************************************************************)
|
(**************************************************************************)
|
||||||
|
|
||||||
open Tezos_context
|
open Alpha_context
|
||||||
open Script
|
open Script
|
||||||
open Script_typed_ir
|
open Script_typed_ir
|
||||||
|
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
(* *)
|
(* *)
|
||||||
(**************************************************************************)
|
(**************************************************************************)
|
||||||
|
|
||||||
open Tezos_context
|
open Alpha_context
|
||||||
open Micheline
|
open Micheline
|
||||||
open Script
|
open Script
|
||||||
open Script_typed_ir
|
open Script_typed_ir
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
(* *)
|
(* *)
|
||||||
(**************************************************************************)
|
(**************************************************************************)
|
||||||
|
|
||||||
open Tezos_context
|
open Alpha_context
|
||||||
open Script_int
|
open Script_int
|
||||||
|
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
(**************************************************************************)
|
(**************************************************************************)
|
||||||
|
|
||||||
open Data_encoding
|
open Data_encoding
|
||||||
open Tezos_context
|
open Alpha_context
|
||||||
|
|
||||||
let operations custom_root =
|
let operations custom_root =
|
||||||
RPC_service.post_service
|
RPC_service.post_service
|
||||||
@ -617,7 +617,7 @@ module Helpers = struct
|
|||||||
(req "nonce_hash" Nonce_hash.encoding)
|
(req "nonce_hash" Nonce_hash.encoding)
|
||||||
(dft "proof_of_work_nonce"
|
(dft "proof_of_work_nonce"
|
||||||
(Fixed.bytes
|
(Fixed.bytes
|
||||||
Tezos_context.Constants.proof_of_work_nonce_size)
|
Alpha_context.Constants.proof_of_work_nonce_size)
|
||||||
empty_proof_of_work_nonce))
|
empty_proof_of_work_nonce))
|
||||||
~output: (obj1 (req "proto_header" bytes))
|
~output: (obj1 (req "proto_header" bytes))
|
||||||
RPC_path.(custom_root / "helpers" / "forge" / "block_proto_header")
|
RPC_path.(custom_root / "helpers" / "forge" / "block_proto_header")
|
||||||
|
@ -7,14 +7,14 @@
|
|||||||
(* *)
|
(* *)
|
||||||
(**************************************************************************)
|
(**************************************************************************)
|
||||||
|
|
||||||
open Tezos_context
|
open Alpha_context
|
||||||
|
|
||||||
type rpc_context = {
|
type rpc_context = {
|
||||||
block_hash: Block_hash.t ;
|
block_hash: Block_hash.t ;
|
||||||
block_header: Block_header.raw ;
|
block_header: Block_header.raw ;
|
||||||
operation_hashes: unit -> Operation_hash.t list list Lwt.t ;
|
operation_hashes: unit -> Operation_hash.t list list Lwt.t ;
|
||||||
operations: unit -> Operation.raw list list Lwt.t ;
|
operations: unit -> Operation.raw list list Lwt.t ;
|
||||||
context: Tezos_context.t ;
|
context: Alpha_context.t ;
|
||||||
}
|
}
|
||||||
|
|
||||||
let rpc_init (rpc_context : Updater.rpc_context Lwt.t) =
|
let rpc_init (rpc_context : Updater.rpc_context Lwt.t) =
|
||||||
@ -23,7 +23,7 @@ let rpc_init (rpc_context : Updater.rpc_context Lwt.t) =
|
|||||||
let level = Int32.succ block_header.shell.level in
|
let level = Int32.succ block_header.shell.level in
|
||||||
let timestamp = block_header.shell.timestamp in
|
let timestamp = block_header.shell.timestamp in
|
||||||
let fitness = block_header.shell.fitness in
|
let fitness = block_header.shell.fitness in
|
||||||
Tezos_context.init ~level ~timestamp ~fitness context >>=? fun context ->
|
Alpha_context.init ~level ~timestamp ~fitness context >>=? fun context ->
|
||||||
return { block_hash ; block_header ; operation_hashes ; operations ; context }
|
return { block_hash ; block_header ; operation_hashes ; operations ; context }
|
||||||
|
|
||||||
let rpc_services = ref (RPC_directory.empty : Updater.rpc_context Lwt.t RPC_directory.t)
|
let rpc_services = ref (RPC_directory.empty : Updater.rpc_context Lwt.t RPC_directory.t)
|
||||||
@ -255,7 +255,7 @@ let minimal_timestamp ctxt prio =
|
|||||||
let () = register1
|
let () = register1
|
||||||
Services.Helpers.minimal_timestamp
|
Services.Helpers.minimal_timestamp
|
||||||
(fun ctxt () slot ->
|
(fun ctxt () slot ->
|
||||||
let timestamp = Tezos_context.Timestamp.current ctxt in
|
let timestamp = Alpha_context.Timestamp.current ctxt in
|
||||||
minimal_timestamp ctxt slot timestamp)
|
minimal_timestamp ctxt slot timestamp)
|
||||||
|
|
||||||
let () =
|
let () =
|
||||||
@ -268,7 +268,7 @@ let () =
|
|||||||
| None -> Error_monad.fail Operation.Cannot_parse_operation
|
| None -> Error_monad.fail Operation.Cannot_parse_operation
|
||||||
| Some (shell, contents) ->
|
| Some (shell, contents) ->
|
||||||
let operation = { hash ; shell ; contents ; signature } in
|
let operation = { hash ; shell ; contents ; signature } in
|
||||||
let level = Tezos_context.Level.current ctxt in
|
let level = Alpha_context.Level.current ctxt in
|
||||||
Baking.baking_priorities ctxt level >>=? fun (Misc.LCons (baker_pkh, _)) ->
|
Baking.baking_priorities ctxt level >>=? fun (Misc.LCons (baker_pkh, _)) ->
|
||||||
let baker_contract = Contract.default_contract baker_pkh in
|
let baker_contract = Contract.default_contract baker_pkh in
|
||||||
let block_prio = 0 in
|
let block_prio = 0 in
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
|
|
||||||
|
|
||||||
open Proto_alpha.Error_monad
|
open Proto_alpha.Error_monad
|
||||||
open Proto_alpha.Tezos_context
|
open Proto_alpha.Alpha_context
|
||||||
|
|
||||||
type account = {
|
type account = {
|
||||||
hpub : Ed25519.Public_key_hash.t ;
|
hpub : Ed25519.Public_key_hash.t ;
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
(**************************************************************************)
|
(**************************************************************************)
|
||||||
|
|
||||||
open Proto_alpha
|
open Proto_alpha
|
||||||
open Tezos_context
|
open Alpha_context
|
||||||
|
|
||||||
(** Facilities to deal with accounts , bootstrap accounts and make new
|
(** Facilities to deal with accounts , bootstrap accounts and make new
|
||||||
accounts *)
|
accounts *)
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
(** Functions to build and apply operations *)
|
(** Functions to build and apply operations *)
|
||||||
|
|
||||||
open Proto_alpha
|
open Proto_alpha
|
||||||
open Tezos_context
|
open Alpha_context
|
||||||
|
|
||||||
val operation :
|
val operation :
|
||||||
tc:context -> ?baker:Helpers_account.t -> ?src:Helpers_account.t ->
|
tc:context -> ?baker:Helpers_account.t -> ?src:Helpers_account.t ->
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
(**************************************************************************)
|
(**************************************************************************)
|
||||||
|
|
||||||
open Proto_alpha
|
open Proto_alpha
|
||||||
open Tezos_context
|
open Alpha_context
|
||||||
|
|
||||||
module Assert = struct
|
module Assert = struct
|
||||||
let fail expected given msg =
|
let fail expected given msg =
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
(**************************************************************************)
|
(**************************************************************************)
|
||||||
|
|
||||||
open Proto_alpha
|
open Proto_alpha
|
||||||
open Tezos_context
|
open Alpha_context
|
||||||
|
|
||||||
val fail : string -> string -> string -> 'a
|
val fail : string -> string -> string -> 'a
|
||||||
(** Raises [Failed] with the passed parameters
|
(** Raises [Failed] with the passed parameters
|
||||||
|
@ -12,7 +12,7 @@ open Error_monad
|
|||||||
|
|
||||||
type shell_header = Block_header.shell_header
|
type shell_header = Block_header.shell_header
|
||||||
type tezos_header = Block_header.t
|
type tezos_header = Block_header.t
|
||||||
type protocol_header = Proto_alpha.Tezos_context.Block_header.proto_header
|
type protocol_header = Proto_alpha.Alpha_context.Block_header.proto_header
|
||||||
type operation_header = Operation.shell_header
|
type operation_header = Operation.shell_header
|
||||||
|
|
||||||
type init_block = {
|
type init_block = {
|
||||||
@ -33,7 +33,7 @@ type result = {
|
|||||||
hash : Block_hash.t ;
|
hash : Block_hash.t ;
|
||||||
level : Int32.t ;
|
level : Int32.t ;
|
||||||
validation : Updater.validation_result ;
|
validation : Updater.validation_result ;
|
||||||
tezos_context : Proto_alpha.Tezos_context.t
|
tezos_context : Proto_alpha.Alpha_context.t
|
||||||
}
|
}
|
||||||
|
|
||||||
let get_op_header_res (res : result) : operation_header = {
|
let get_op_header_res (res : result) : operation_header = {
|
||||||
@ -43,7 +43,7 @@ let get_op_header_res (res : result) : operation_header = {
|
|||||||
let get_proto_header priority : protocol_header = {
|
let get_proto_header priority : protocol_header = {
|
||||||
priority ;
|
priority ;
|
||||||
proof_of_work_nonce = Helpers_crypto.generate_proof_of_work_nonce ();
|
proof_of_work_nonce = Helpers_crypto.generate_proof_of_work_nonce ();
|
||||||
seed_nonce_hash = Proto_alpha.Tezos_context.Nonce.hash @@ Helpers_crypto.generate_seed_nonce ()
|
seed_nonce_hash = Proto_alpha.Alpha_context.Nonce.hash @@ Helpers_crypto.generate_seed_nonce ()
|
||||||
}
|
}
|
||||||
|
|
||||||
let get_op_header pbh : operation_header = {
|
let get_op_header pbh : operation_header = {
|
||||||
@ -64,7 +64,7 @@ let init (pred_shell_header : shell_header) pred_block_hash
|
|||||||
let (sourced_operations, operation_hashs) = List.split src_ops_hashs in
|
let (sourced_operations, operation_hashs) = List.split src_ops_hashs in
|
||||||
let proto_header = get_proto_header priority in
|
let proto_header = get_proto_header priority in
|
||||||
let proto_header_bytes =
|
let proto_header_bytes =
|
||||||
Proto_alpha.Tezos_context.Block_header.forge_unsigned_proto_header
|
Proto_alpha.Alpha_context.Block_header.forge_unsigned_proto_header
|
||||||
proto_header
|
proto_header
|
||||||
in
|
in
|
||||||
let timestamp =
|
let timestamp =
|
||||||
@ -127,7 +127,7 @@ let get_header_hash
|
|||||||
shell = shell_header ;
|
shell = shell_header ;
|
||||||
proto = init_block.proto_header_bytes
|
proto = init_block.proto_header_bytes
|
||||||
} in
|
} in
|
||||||
Proto_alpha.Tezos_context.init
|
Proto_alpha.Alpha_context.init
|
||||||
validation_result.context
|
validation_result.context
|
||||||
~level
|
~level
|
||||||
~timestamp
|
~timestamp
|
||||||
|
@ -13,7 +13,7 @@ open Proto_alpha
|
|||||||
|
|
||||||
type shell_header = Block_header.shell_header
|
type shell_header = Block_header.shell_header
|
||||||
type tezos_header = Block_header.t
|
type tezos_header = Block_header.t
|
||||||
type protocol_header = Tezos_context.Block_header.proto_header
|
type protocol_header = Alpha_context.Block_header.proto_header
|
||||||
type operation_header = Operation.shell_header
|
type operation_header = Operation.shell_header
|
||||||
|
|
||||||
(** Block before application *)
|
(** Block before application *)
|
||||||
@ -37,23 +37,23 @@ type result = {
|
|||||||
hash : Block_hash.t;
|
hash : Block_hash.t;
|
||||||
level : Int32.t;
|
level : Int32.t;
|
||||||
validation : Updater.validation_result;
|
validation : Updater.validation_result;
|
||||||
tezos_context : Tezos_context.t;
|
tezos_context : Alpha_context.t;
|
||||||
}
|
}
|
||||||
val get_op_header_res : result -> operation_header
|
val get_op_header_res : result -> operation_header
|
||||||
val get_proto_header : int -> protocol_header
|
val get_proto_header : int -> protocol_header
|
||||||
val get_op_header : Block_hash.t -> operation_header
|
val get_op_header : Block_hash.t -> operation_header
|
||||||
val make_sourced_operation :
|
val make_sourced_operation :
|
||||||
Operation.shell_header ->
|
Operation.shell_header ->
|
||||||
Tezos_context.proto_operation *
|
Alpha_context.proto_operation *
|
||||||
Helpers_account.t ->
|
Helpers_account.t ->
|
||||||
((Proto_alpha.Main.operation * Helpers_account.t) * Operation_hash.t) proto_tzresult
|
((Proto_alpha.Main.operation * Helpers_account.t) * Operation_hash.t) proto_tzresult
|
||||||
val init :
|
val init :
|
||||||
shell_header -> Block_hash.t -> Int32.t -> int ->
|
shell_header -> Block_hash.t -> Int32.t -> int ->
|
||||||
(Tezos_context.proto_operation * Helpers_account.t) list ->
|
(Alpha_context.proto_operation * Helpers_account.t) list ->
|
||||||
Context.t -> init_block proto_tzresult
|
Context.t -> init_block proto_tzresult
|
||||||
val init_of_result :
|
val init_of_result :
|
||||||
?priority:int -> res:result ->
|
?priority:int -> res:result ->
|
||||||
ops:(Tezos_context.proto_operation * Helpers_account.t) list ->
|
ops:(Alpha_context.proto_operation * Helpers_account.t) list ->
|
||||||
init_block proto_tzresult
|
init_block proto_tzresult
|
||||||
val get_level : string option -> int32
|
val get_level : string option -> int32
|
||||||
val get_header_hash :
|
val get_header_hash :
|
||||||
@ -64,11 +64,11 @@ val begin_construction_pre :
|
|||||||
val make : init_block -> result proto_tzresult Lwt.t
|
val make : init_block -> result proto_tzresult Lwt.t
|
||||||
val make_init :
|
val make_init :
|
||||||
shell_header -> Block_hash.t -> Int32.t -> int ->
|
shell_header -> Block_hash.t -> Int32.t -> int ->
|
||||||
(Tezos_context.proto_operation * Helpers_account.t) list ->
|
(Alpha_context.proto_operation * Helpers_account.t) list ->
|
||||||
Context.t -> result proto_tzresult Lwt.t
|
Context.t -> result proto_tzresult Lwt.t
|
||||||
val of_res :
|
val of_res :
|
||||||
?priority:int ->
|
?priority:int ->
|
||||||
?ops:(Tezos_context.proto_operation * Helpers_account.t) list ->
|
?ops:(Alpha_context.proto_operation * Helpers_account.t) list ->
|
||||||
res:result ->
|
res:result ->
|
||||||
unit -> result proto_tzresult Lwt.t
|
unit -> result proto_tzresult Lwt.t
|
||||||
val endorsement :
|
val endorsement :
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
(* *)
|
(* *)
|
||||||
(**************************************************************************)
|
(**************************************************************************)
|
||||||
|
|
||||||
open Proto_alpha.Tezos_context
|
open Proto_alpha.Alpha_context
|
||||||
|
|
||||||
exception Tez_error
|
exception Tez_error
|
||||||
|
|
||||||
|
@ -7,11 +7,11 @@
|
|||||||
(* *)
|
(* *)
|
||||||
(**************************************************************************)
|
(**************************************************************************)
|
||||||
|
|
||||||
open Proto_alpha.Tezos_context
|
open Proto_alpha.Alpha_context
|
||||||
|
|
||||||
exception Tez_error
|
exception Tez_error
|
||||||
|
|
||||||
(** Common casts between Tezos_context types *)
|
(** Common casts between Alpha_context types *)
|
||||||
|
|
||||||
val tez_of_int : int -> Tez.tez
|
val tez_of_int : int -> Tez.tez
|
||||||
val cents_of_int : int -> Tez.tez
|
val cents_of_int : int -> Tez.tez
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
(* *)
|
(* *)
|
||||||
(**************************************************************************)
|
(**************************************************************************)
|
||||||
|
|
||||||
open Proto_alpha.Tezos_context
|
open Proto_alpha.Alpha_context
|
||||||
|
|
||||||
let generate_proof_of_work_nonce () =
|
let generate_proof_of_work_nonce () =
|
||||||
Rand.generate Constants.proof_of_work_nonce_size
|
Rand.generate Constants.proof_of_work_nonce_size
|
||||||
|
@ -10,4 +10,4 @@
|
|||||||
(** Extension of the Sodium module with helpers functions *)
|
(** Extension of the Sodium module with helpers functions *)
|
||||||
|
|
||||||
val generate_proof_of_work_nonce : unit -> MBytes.t
|
val generate_proof_of_work_nonce : unit -> MBytes.t
|
||||||
val generate_seed_nonce : unit -> Proto_alpha.Tezos_context.Nonce.nonce
|
val generate_seed_nonce : unit -> Proto_alpha.Alpha_context.Nonce.nonce
|
||||||
|
@ -37,7 +37,7 @@ let main () =
|
|||||||
} in
|
} in
|
||||||
let proto_header =
|
let proto_header =
|
||||||
Data_encoding.Binary.to_bytes
|
Data_encoding.Binary.to_bytes
|
||||||
Tezos_context.Block_header.proto_header_encoding
|
Alpha_context.Block_header.proto_header_encoding
|
||||||
(Helpers_block.get_proto_header 0) in
|
(Helpers_block.get_proto_header 0) in
|
||||||
let tezos_header = { Block_header.shell = header ; proto = proto_header } in
|
let tezos_header = { Block_header.shell = header ; proto = proto_header } in
|
||||||
Proto_alpha.Main.begin_construction
|
Proto_alpha.Main.begin_construction
|
||||||
@ -51,7 +51,7 @@ let main () =
|
|||||||
() >>=? fun vstate ->
|
() >>=? fun vstate ->
|
||||||
let hash = Block_header.hash tezos_header in
|
let hash = Block_header.hash tezos_header in
|
||||||
Proto_alpha.Main.finalize_block vstate >>=? fun validation ->
|
Proto_alpha.Main.finalize_block vstate >>=? fun validation ->
|
||||||
Tezos_context.init
|
Alpha_context.init
|
||||||
~level: (Int32.succ header.level)
|
~level: (Int32.succ header.level)
|
||||||
~timestamp: header.timestamp
|
~timestamp: header.timestamp
|
||||||
~fitness: header.fitness
|
~fitness: header.fitness
|
||||||
|
@ -9,12 +9,12 @@
|
|||||||
|
|
||||||
open Proto_alpha
|
open Proto_alpha
|
||||||
open Error_monad
|
open Error_monad
|
||||||
open Tezos_context
|
open Alpha_context
|
||||||
|
|
||||||
let sourced ops = Sourced_operations ops
|
let sourced ops = Sourced_operations ops
|
||||||
|
|
||||||
let manager (src : Helpers_account.t) ?(fee = Tez.zero) operations context =
|
let manager (src : Helpers_account.t) ?(fee = Tez.zero) operations context =
|
||||||
Tezos_context.init ~level:0l ~timestamp:(Time.now ()) ~fitness:[] context >>=? fun context ->
|
Alpha_context.init ~level:0l ~timestamp:(Time.now ()) ~fitness:[] context >>=? fun context ->
|
||||||
Contract.get_counter context src.contract >>=? fun counter ->
|
Contract.get_counter context src.contract >>=? fun counter ->
|
||||||
let counter = Int32.succ counter in
|
let counter = Int32.succ counter in
|
||||||
return @@
|
return @@
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
(**************************************************************************)
|
(**************************************************************************)
|
||||||
|
|
||||||
open Proto_alpha
|
open Proto_alpha
|
||||||
open Tezos_context
|
open Alpha_context
|
||||||
|
|
||||||
(** Functions building operations *)
|
(** Functions building operations *)
|
||||||
|
|
||||||
@ -46,7 +46,7 @@ val origination_full :
|
|||||||
proto_operation proto_tzresult Lwt.t
|
proto_operation proto_tzresult Lwt.t
|
||||||
|
|
||||||
val transaction_full :
|
val transaction_full :
|
||||||
?fee:Tez.tez -> ?parameters:Proto_alpha.Tezos_context.Script.expr -> Helpers_account.t -> Contract.contract -> Tez.t ->
|
?fee:Tez.tez -> ?parameters:Proto_alpha.Alpha_context.Script.expr -> Helpers_account.t -> Contract.contract -> Tez.t ->
|
||||||
Alpha_environment.Context.t -> proto_operation proto_tzresult Lwt.t
|
Alpha_environment.Context.t -> proto_operation proto_tzresult Lwt.t
|
||||||
|
|
||||||
val delegate :
|
val delegate :
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
|
|
||||||
open Proto_alpha
|
open Proto_alpha
|
||||||
open Error_monad
|
open Error_monad
|
||||||
open Tezos_context
|
open Alpha_context
|
||||||
|
|
||||||
let init_amount = 20000
|
let init_amount = 20000
|
||||||
|
|
||||||
@ -28,7 +28,7 @@ let execute_code_pred
|
|||||||
(Some op) op_header dummy_protop in
|
(Some op) op_header dummy_protop in
|
||||||
let dummy_nonce = Contract.initial_origination_nonce apply_op.hash in
|
let dummy_nonce = Contract.initial_origination_nonce apply_op.hash in
|
||||||
let amount = Tez.zero in
|
let amount = Tez.zero in
|
||||||
let gaz = Gas.of_int (Tezos_context.Constants.max_gas tc) in
|
let gaz = Gas.of_int (Alpha_context.Constants.max_gas tc) in
|
||||||
let return = Script_interpreter.execute
|
let return = Script_interpreter.execute
|
||||||
dummy_nonce op.contract dst
|
dummy_nonce op.contract dst
|
||||||
tc script amount argument gaz in
|
tc script amount argument gaz in
|
||||||
|
@ -8,11 +8,11 @@
|
|||||||
(**************************************************************************)
|
(**************************************************************************)
|
||||||
|
|
||||||
open Proto_alpha
|
open Proto_alpha
|
||||||
open Tezos_context
|
open Alpha_context
|
||||||
|
|
||||||
val init_amount : int
|
val init_amount : int
|
||||||
val execute_code_pred :
|
val execute_code_pred :
|
||||||
?tc:Tezos_context.t -> Helpers_block.result -> Script.t -> Script.expr ->
|
?tc:Alpha_context.t -> Helpers_block.result -> Script.t -> Script.expr ->
|
||||||
(Script.expr * Script.expr * Gas.t * context * Contract.origination_nonce * Script_typed_ir.ex_big_map option)
|
(Script.expr * Script.expr * Gas.t * context * Contract.origination_nonce * Script_typed_ir.ex_big_map option)
|
||||||
proto_tzresult Lwt.t
|
proto_tzresult Lwt.t
|
||||||
|
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
(* *)
|
(* *)
|
||||||
(**************************************************************************)
|
(**************************************************************************)
|
||||||
|
|
||||||
open Proto_alpha.Tezos_context
|
open Proto_alpha.Alpha_context
|
||||||
open Helpers_assert
|
open Helpers_assert
|
||||||
|
|
||||||
let endorsement_rights ~tc () =
|
let endorsement_rights ~tc () =
|
||||||
|
@ -12,9 +12,9 @@ open Proto_alpha
|
|||||||
(** Wrappers around Services_registration calls *)
|
(** Wrappers around Services_registration calls *)
|
||||||
|
|
||||||
val endorsement_rights :
|
val endorsement_rights :
|
||||||
tc:Tezos_context.context -> unit ->
|
tc:Alpha_context.context -> unit ->
|
||||||
(int * Tezos_context.public_key_hash) list tzresult Lwt.t
|
(int * Alpha_context.public_key_hash) list tzresult Lwt.t
|
||||||
|
|
||||||
val baking_rights :
|
val baking_rights :
|
||||||
tc:Tezos_context.context -> unit ->
|
tc:Alpha_context.context -> unit ->
|
||||||
(int * Tezos_context.public_key_hash) list tzresult Lwt.t
|
(int * Alpha_context.public_key_hash) list tzresult Lwt.t
|
||||||
|
@ -24,14 +24,14 @@ module Script = Helpers_script
|
|||||||
module Shorthands = struct
|
module Shorthands = struct
|
||||||
|
|
||||||
let to_tc_full ctxt level fitness =
|
let to_tc_full ctxt level fitness =
|
||||||
Tezos_context.init
|
Alpha_context.init
|
||||||
ctxt
|
ctxt
|
||||||
~level
|
~level
|
||||||
~fitness
|
~fitness
|
||||||
~timestamp:(Time.now())
|
~timestamp:(Time.now())
|
||||||
|
|
||||||
let get_tc_full (res:Block.result) =
|
let get_tc_full (res:Block.result) =
|
||||||
Tezos_context.init
|
Alpha_context.init
|
||||||
res.validation.context
|
res.validation.context
|
||||||
~level:res.level
|
~level:res.level
|
||||||
~timestamp:res.tezos_header.shell.timestamp
|
~timestamp:res.tezos_header.shell.timestamp
|
||||||
@ -40,7 +40,7 @@ module Shorthands = struct
|
|||||||
let get_balance_res (account:Account.t) (result:Block.result) =
|
let get_balance_res (account:Account.t) (result:Block.result) =
|
||||||
let open Alpha_environment.Error_monad in
|
let open Alpha_environment.Error_monad in
|
||||||
get_tc_full result >>=? fun tc ->
|
get_tc_full result >>=? fun tc ->
|
||||||
Tezos_context.Contract.get_balance tc account.contract
|
Alpha_context.Contract.get_balance tc account.contract
|
||||||
|
|
||||||
let chain_empty_block (result:Block.result) =
|
let chain_empty_block (result:Block.result) =
|
||||||
Block.empty
|
Block.empty
|
||||||
|
@ -19,14 +19,14 @@ module Assert = Helpers.Assert
|
|||||||
let (>>??) = Helpers.Assert.(>>??)
|
let (>>??) = Helpers.Assert.(>>??)
|
||||||
let (>>=??) = Helpers.Assert.(>>=??)
|
let (>>=??) = Helpers.Assert.(>>=??)
|
||||||
|
|
||||||
let parse_expr s : Proto_alpha.Tezos_context.Script.expr tzresult =
|
let parse_expr s : Proto_alpha.Alpha_context.Script.expr tzresult =
|
||||||
Micheline_parser.no_parsing_error (Michelson_v1_parser.parse_expression s) >>? fun parsed ->
|
Micheline_parser.no_parsing_error (Michelson_v1_parser.parse_expression s) >>? fun parsed ->
|
||||||
ok parsed.expanded
|
ok parsed.expanded
|
||||||
|
|
||||||
let parse_script code_str storage_str : Proto_alpha.Tezos_context.Script.t tzresult =
|
let parse_script code_str storage_str : Proto_alpha.Alpha_context.Script.t tzresult =
|
||||||
parse_expr code_str >>? fun code ->
|
parse_expr code_str >>? fun code ->
|
||||||
parse_expr storage_str >>? fun storage ->
|
parse_expr storage_str >>? fun storage ->
|
||||||
ok { Proto_alpha.Tezos_context.Script.code ; storage }
|
ok { Proto_alpha.Alpha_context.Script.code ; storage }
|
||||||
|
|
||||||
let code = {|
|
let code = {|
|
||||||
{ parameter (list (pair string int)) ;
|
{ parameter (list (pair string int)) ;
|
||||||
@ -47,7 +47,7 @@ let expect_big_map tc contract print_key key_type print_data data_type contents
|
|||||||
iter_p
|
iter_p
|
||||||
(fun (n, exp) ->
|
(fun (n, exp) ->
|
||||||
let key = Proto_alpha.Script_ir_translator.hash_data key_type n in
|
let key = Proto_alpha.Script_ir_translator.hash_data key_type n in
|
||||||
Proto_alpha.Tezos_context.Contract.Big_map_storage.get_opt tc contract key >>=? fun data ->
|
Proto_alpha.Alpha_context.Contract.Big_map_storage.get_opt tc contract key >>=? fun data ->
|
||||||
match data, exp with
|
match data, exp with
|
||||||
| None, None ->
|
| None, None ->
|
||||||
debug " - big_map[%a] is not defined (ok)" print_key n ;
|
debug " - big_map[%a] is not defined (ok)" print_key n ;
|
||||||
@ -86,9 +86,9 @@ let main () =
|
|||||||
expect_big_map tc contract
|
expect_big_map tc contract
|
||||||
(fun ppf k -> Format.fprintf ppf "%s" k)
|
(fun ppf k -> Format.fprintf ppf "%s" k)
|
||||||
Proto_alpha.Script_typed_ir.String_t
|
Proto_alpha.Script_typed_ir.String_t
|
||||||
(fun ppf n -> Format.fprintf ppf "%s" (Proto_alpha.Tezos_context.Script_int.to_string n))
|
(fun ppf n -> Format.fprintf ppf "%s" (Proto_alpha.Alpha_context.Script_int.to_string n))
|
||||||
Proto_alpha.Script_typed_ir.Int_t
|
Proto_alpha.Script_typed_ir.Int_t
|
||||||
(List.map (fun (n, v) -> (n, Option.map ~f:Proto_alpha.Tezos_context.Script_int.of_int v)) exp) in
|
(List.map (fun (n, v) -> (n, Option.map ~f:Proto_alpha.Alpha_context.Script_int.of_int v)) exp) in
|
||||||
expect_big_map tc
|
expect_big_map tc
|
||||||
[ "A", Some 1 ; "B", Some 2 ; "C", None ; "D", None ] >>=?? fun () ->
|
[ "A", Some 1 ; "B", Some 2 ; "C", None ; "D", None ] >>=?? fun () ->
|
||||||
debug "initial big map is ok" ;
|
debug "initial big map is ok" ;
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
(**************************************************************************)
|
(**************************************************************************)
|
||||||
|
|
||||||
open Proto_alpha
|
open Proto_alpha
|
||||||
open Tezos_context
|
open Alpha_context
|
||||||
open Error_monad
|
open Error_monad
|
||||||
|
|
||||||
let name = "Isolate Endorsement"
|
let name = "Isolate Endorsement"
|
||||||
@ -46,7 +46,7 @@ let test_wrong_delegate endorse_a starting_block =
|
|||||||
let test_endorsement_payment () =
|
let test_endorsement_payment () =
|
||||||
Init.main () >>=? fun root ->
|
Init.main () >>=? fun root ->
|
||||||
let bootstrap_accounts = Account.bootstrap_accounts in
|
let bootstrap_accounts = Account.bootstrap_accounts in
|
||||||
let open Proto_alpha.Tezos_context in
|
let open Proto_alpha.Alpha_context in
|
||||||
get_tc_full root >>=? fun tc ->
|
get_tc_full root >>=? fun tc ->
|
||||||
let level = Level.succ tc @@ Level.current tc in
|
let level = Level.succ tc @@ Level.current tc in
|
||||||
Proto_alpha.Services_registration.endorsement_rights tc level None >>=? fun (_, endorsers) ->
|
Proto_alpha.Services_registration.endorsement_rights tc level None >>=? fun (_, endorsers) ->
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
(**************************************************************************)
|
(**************************************************************************)
|
||||||
|
|
||||||
open Proto_alpha
|
open Proto_alpha
|
||||||
open Tezos_context
|
open Alpha_context
|
||||||
|
|
||||||
let name = "Isolate Michelson"
|
let name = "Isolate Michelson"
|
||||||
module Logger = Logging.Make(struct let name = name end)
|
module Logger = Logging.Make(struct let name = name end)
|
||||||
@ -25,15 +25,15 @@ open Shorthands
|
|||||||
let (>>??) = Assert.(>>??)
|
let (>>??) = Assert.(>>??)
|
||||||
let (>>=??) = Assert.(>>=??)
|
let (>>=??) = Assert.(>>=??)
|
||||||
|
|
||||||
let parse_param s : Proto_alpha.Tezos_context.Script.expr =
|
let parse_param s : Proto_alpha.Alpha_context.Script.expr =
|
||||||
let (parsed, _) = Michelson_v1_parser.parse_expression s in
|
let (parsed, _) = Michelson_v1_parser.parse_expression s in
|
||||||
parsed.expanded
|
parsed.expanded
|
||||||
|
|
||||||
|
|
||||||
let parse_script code_str storage_str : Proto_alpha.Tezos_context.Script.t =
|
let parse_script code_str storage_str : Proto_alpha.Alpha_context.Script.t =
|
||||||
let code = parse_param code_str in
|
let code = parse_param code_str in
|
||||||
let storage = parse_param storage_str in
|
let storage = parse_param storage_str in
|
||||||
let return: Proto_alpha.Tezos_context.Script.t = {code ; storage} in
|
let return: Proto_alpha.Alpha_context.Script.t = {code ; storage} in
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|
||||||
@ -291,7 +291,7 @@ let test_example () =
|
|||||||
|
|
||||||
let bootstrap_0 = List.nth Account.bootstrap_accounts 0 in
|
let bootstrap_0 = List.nth Account.bootstrap_accounts 0 in
|
||||||
get_balance_res bootstrap_0 sb >>=?? fun _balance ->
|
get_balance_res bootstrap_0 sb >>=?? fun _balance ->
|
||||||
let amount = Proto_alpha.Tezos_context.Tez.to_string @@ Cast.cents_of_int Script.init_amount in
|
let amount = Proto_alpha.Alpha_context.Tez.to_string @@ Cast.cents_of_int Script.init_amount in
|
||||||
(* Get the current balance of the contract *)
|
(* Get the current balance of the contract *)
|
||||||
test_output ~location: __LOC__ "balance" "Unit" "Unit" ("\"" ^ amount ^ "\"") >>=? fun _ ->
|
test_output ~location: __LOC__ "balance" "Unit" "Unit" ("\"" ^ amount ^ "\"") >>=? fun _ ->
|
||||||
|
|
||||||
@ -435,7 +435,7 @@ let test_example () =
|
|||||||
test_contract ~tc "create_contract" account_str account_str >>=? fun (cs, tc) ->
|
test_contract ~tc "create_contract" account_str account_str >>=? fun (cs, tc) ->
|
||||||
Assert.equal_int 1 @@ List.length cs ;
|
Assert.equal_int 1 @@ List.length cs ;
|
||||||
let contract = List.hd cs in
|
let contract = List.hd cs in
|
||||||
Proto_alpha.Tezos_context.Contract.get_script tc contract >>=?? fun res ->
|
Proto_alpha.Alpha_context.Contract.get_script tc contract >>=?? fun res ->
|
||||||
let script = Option.unopt_exn (Failure "get_script") res in
|
let script = Option.unopt_exn (Failure "get_script") res in
|
||||||
Script.execute_code_pred ~tc sb script (parse_param "\"abc\"") >>=?? fun (_, ret, _, _, _, _) ->
|
Script.execute_code_pred ~tc sb script (parse_param "\"abc\"") >>=?? fun (_, ret, _, _, _, _) ->
|
||||||
Assert.equal_string ~msg: __LOC__ "\"abc\"" @@ string_of_canon ret ;
|
Assert.equal_string ~msg: __LOC__ "\"abc\"" @@ string_of_canon ret ;
|
||||||
|
@ -65,7 +65,7 @@ let test_basic (): unit tzresult Lwt.t =
|
|||||||
(* Check sender/receiver balance post transaction *)
|
(* Check sender/receiver balance post transaction *)
|
||||||
transfer (account_a, account_b, 1000) >>=
|
transfer (account_a, account_b, 1000) >>=
|
||||||
Assert.ok_contract ~msg: __LOC__ >>=? fun (_,tc) ->
|
Assert.ok_contract ~msg: __LOC__ >>=? fun (_,tc) ->
|
||||||
Proto_alpha.Tezos_context.Contract.get_balance tc account_a.contract >>=? fun _balance ->
|
Proto_alpha.Alpha_context.Contract.get_balance tc account_a.contract >>=? fun _balance ->
|
||||||
Assert.equal_cents_balance ~msg: __LOC__ ~tc (account_a.contract, init_amount * 100 - 1000 - 10) >>=? fun () ->
|
Assert.equal_cents_balance ~msg: __LOC__ ~tc (account_a.contract, init_amount * 100 - 1000 - 10) >>=? fun () ->
|
||||||
Assert.equal_cents_balance ~msg: __LOC__ ~tc (account_b.contract, 1001000) >>=? fun () ->
|
Assert.equal_cents_balance ~msg: __LOC__ ~tc (account_b.contract, 1001000) >>=? fun () ->
|
||||||
debug "Transfer balances" ;
|
debug "Transfer balances" ;
|
||||||
|
Loading…
Reference in New Issue
Block a user