Client: minor renaming
This commit is contained in:
parent
f96ecbf667
commit
565654a242
@ -343,7 +343,6 @@ CLIENT_LIB_INTFS := \
|
|||||||
client/client_tags.mli \
|
client/client_tags.mli \
|
||||||
client/client_keys.mli \
|
client/client_keys.mli \
|
||||||
client/client_protocols.mli \
|
client/client_protocols.mli \
|
||||||
client/client_blocks.mli \
|
|
||||||
client/client_network.mli \
|
client/client_network.mli \
|
||||||
|
|
||||||
CLIENT_LIB_IMPLS := \
|
CLIENT_LIB_IMPLS := \
|
||||||
@ -357,7 +356,6 @@ CLIENT_LIB_IMPLS := \
|
|||||||
client/client_tags.ml \
|
client/client_tags.ml \
|
||||||
client/client_keys.ml \
|
client/client_keys.ml \
|
||||||
client/client_protocols.ml \
|
client/client_protocols.ml \
|
||||||
client/client_blocks.ml \
|
|
||||||
client/client_network.ml \
|
client/client_network.ml \
|
||||||
|
|
||||||
CLIENT_IMPLS := \
|
CLIENT_IMPLS := \
|
||||||
|
@ -1,27 +0,0 @@
|
|||||||
(**************************************************************************)
|
|
||||||
(* *)
|
|
||||||
(* Copyright (c) 2014 - 2016. *)
|
|
||||||
(* Dynamic Ledger Solutions, Inc. <contact@tezos.com> *)
|
|
||||||
(* *)
|
|
||||||
(* All rights reserved. No warranty, explicit or implicit, provided. *)
|
|
||||||
(* *)
|
|
||||||
(**************************************************************************)
|
|
||||||
|
|
||||||
let genesis =
|
|
||||||
Block_hash.of_b58check_exn
|
|
||||||
"BLockGenesisGenesisGenesisGenesisGenesisGeneskvg68z"
|
|
||||||
|
|
||||||
let get_block_hash config = function
|
|
||||||
| `Hash hash -> return hash
|
|
||||||
| `Genesis | `Head _ | `Test_head _ as block ->
|
|
||||||
Client_node_rpcs.Blocks.hash config block
|
|
||||||
| `Prevalidation -> Client_node_rpcs.Blocks.hash config (`Head 0)
|
|
||||||
| `Test_prevalidation -> Client_node_rpcs.Blocks.hash config (`Test_head 0)
|
|
||||||
|
|
||||||
let get_block_info config block =
|
|
||||||
let block =
|
|
||||||
match block with
|
|
||||||
| `Prevalidation -> `Head 0
|
|
||||||
| `Test_prevalidation -> `Test_head 0
|
|
||||||
| b -> b in
|
|
||||||
Client_node_rpcs.Blocks.info config block
|
|
@ -1,20 +0,0 @@
|
|||||||
(**************************************************************************)
|
|
||||||
(* *)
|
|
||||||
(* Copyright (c) 2014 - 2016. *)
|
|
||||||
(* Dynamic Ledger Solutions, Inc. <contact@tezos.com> *)
|
|
||||||
(* *)
|
|
||||||
(* All rights reserved. No warranty, explicit or implicit, provided. *)
|
|
||||||
(* *)
|
|
||||||
(**************************************************************************)
|
|
||||||
|
|
||||||
val genesis: Block_hash.t
|
|
||||||
|
|
||||||
val get_block_hash:
|
|
||||||
Client_rpcs.config ->
|
|
||||||
Client_node_rpcs.Blocks.block ->
|
|
||||||
Block_hash.Table.key tzresult Lwt.t
|
|
||||||
|
|
||||||
val get_block_info:
|
|
||||||
Client_rpcs.config ->
|
|
||||||
Client_node_rpcs.Blocks.block ->
|
|
||||||
Client_node_rpcs.Blocks.block_info tzresult Lwt.t
|
|
@ -81,8 +81,8 @@ module Blocks = struct
|
|||||||
fitness: MBytes.t list ;
|
fitness: MBytes.t list ;
|
||||||
timestamp: Time.t ;
|
timestamp: Time.t ;
|
||||||
}
|
}
|
||||||
let net cctxt h =
|
let net_id cctxt h =
|
||||||
call_service1 cctxt Services.Blocks.net h ()
|
call_service1 cctxt Services.Blocks.net_id h ()
|
||||||
let level cctxt h =
|
let level cctxt h =
|
||||||
call_service1 cctxt Services.Blocks.level h ()
|
call_service1 cctxt Services.Blocks.level h ()
|
||||||
let predecessor cctxt h =
|
let predecessor cctxt h =
|
||||||
|
@ -72,7 +72,7 @@ module Blocks : sig
|
|||||||
| `Hash of Block_hash.t
|
| `Hash of Block_hash.t
|
||||||
]
|
]
|
||||||
|
|
||||||
val net:
|
val net_id:
|
||||||
config ->
|
config ->
|
||||||
block -> Net_id.t tzresult Lwt.t
|
block -> Net_id.t tzresult Lwt.t
|
||||||
val level:
|
val level:
|
||||||
|
@ -326,3 +326,10 @@ let call_describe0 cctxt service path arg =
|
|||||||
let meth, prefix, arg = RPC.forge_request service () arg in
|
let meth, prefix, arg = RPC.forge_request service () arg in
|
||||||
get_json cctxt meth (prefix @ path) arg >>=? fun json ->
|
get_json cctxt meth (prefix @ path) arg >>=? fun json ->
|
||||||
parse_answer cctxt service prefix json
|
parse_answer cctxt service prefix json
|
||||||
|
|
||||||
|
type block = Node_rpc_services.Blocks.block
|
||||||
|
|
||||||
|
let last_mined_block = function
|
||||||
|
| `Prevalidation -> `Head 0
|
||||||
|
| `Test_prevalidation -> `Test_head 0
|
||||||
|
| `Genesis | `Head _ | `Test_head _ | `Hash _ as block -> block
|
||||||
|
@ -77,3 +77,13 @@ val call_describe0:
|
|||||||
config ->
|
config ->
|
||||||
(unit, unit, 'a, 'b) RPC.service ->
|
(unit, unit, 'a, 'b) RPC.service ->
|
||||||
string list -> 'a -> 'b tzresult Lwt.t
|
string list -> 'a -> 'b tzresult Lwt.t
|
||||||
|
|
||||||
|
type block = Node_rpc_services.Blocks.block
|
||||||
|
|
||||||
|
val last_mined_block:
|
||||||
|
block -> [>
|
||||||
|
| `Genesis
|
||||||
|
| `Head of int
|
||||||
|
| `Test_head of int
|
||||||
|
| `Hash of Block_hash.t
|
||||||
|
]
|
||||||
|
@ -66,11 +66,7 @@ let monitor cctxt
|
|||||||
return (Lwt_stream.map_s convert block_stream)
|
return (Lwt_stream.map_s convert block_stream)
|
||||||
|
|
||||||
let blocks_from_cycle cctxt block cycle =
|
let blocks_from_cycle cctxt block cycle =
|
||||||
let block =
|
let block = Client_rpcs.last_mined_block block in
|
||||||
match block with
|
|
||||||
| `Prevalidation -> `Head 0
|
|
||||||
| `Test_prevalidation -> `Test_head 0
|
|
||||||
| _ -> block in
|
|
||||||
Client_proto_rpcs.Context.level cctxt block >>=? fun level ->
|
Client_proto_rpcs.Context.level cctxt block >>=? fun level ->
|
||||||
Client_proto_rpcs.Helpers.levels cctxt block cycle >>=? fun (first, last) ->
|
Client_proto_rpcs.Helpers.levels cctxt block cycle >>=? fun (first, last) ->
|
||||||
let length = Int32.to_int (Raw_level.diff level.level first) in
|
let length = Int32.to_int (Raw_level.diff level.level first) in
|
||||||
|
@ -119,19 +119,19 @@ let get_signing_slots cctxt ?max_priority block delegate level =
|
|||||||
let inject_endorsement cctxt
|
let inject_endorsement cctxt
|
||||||
block level ?async ?force
|
block level ?async ?force
|
||||||
src_sk source slot =
|
src_sk source slot =
|
||||||
Client_blocks.get_block_hash cctxt.rpc_config block >>=? fun block_hash ->
|
let block = Client_rpcs.last_mined_block block in
|
||||||
Client_node_rpcs.Blocks.net cctxt.rpc_config block >>=? fun net ->
|
Client_node_rpcs.Blocks.info cctxt.rpc_config block >>=? fun bi ->
|
||||||
Client_proto_rpcs.Helpers.Forge.Delegate.endorsement cctxt.rpc_config
|
Client_proto_rpcs.Helpers.Forge.Delegate.endorsement cctxt.rpc_config
|
||||||
block
|
block
|
||||||
~net
|
~net_id:bi.net_id
|
||||||
~source
|
~source
|
||||||
~block:block_hash
|
~block:bi.hash
|
||||||
~slot:slot
|
~slot:slot
|
||||||
() >>=? fun bytes ->
|
() >>=? fun bytes ->
|
||||||
let signed_bytes = Ed25519.Signature.append src_sk bytes in
|
let signed_bytes = Ed25519.Signature.append src_sk bytes in
|
||||||
Client_node_rpcs.inject_operation
|
Client_node_rpcs.inject_operation
|
||||||
cctxt.rpc_config ?force ?async signed_bytes >>=? fun oph ->
|
cctxt.rpc_config ?force ?async signed_bytes >>=? fun oph ->
|
||||||
State.record_endorsement cctxt level block_hash slot oph >>=? fun () ->
|
State.record_endorsement cctxt level bi.hash slot oph >>=? fun () ->
|
||||||
return oph
|
return oph
|
||||||
|
|
||||||
|
|
||||||
@ -152,14 +152,9 @@ let check_endorsement cctxt level slot =
|
|||||||
let forge_endorsement cctxt
|
let forge_endorsement cctxt
|
||||||
block ?(force = false)
|
block ?(force = false)
|
||||||
~src_sk ?slot ?max_priority src_pk =
|
~src_sk ?slot ?max_priority src_pk =
|
||||||
let block =
|
let block = Client_rpcs.last_mined_block block in
|
||||||
match block with
|
|
||||||
| `Prevalidation -> `Head 0
|
|
||||||
| `Test_prevalidation -> `Test_head 0
|
|
||||||
| _ -> block in
|
|
||||||
let src_pkh = Ed25519.Public_key.hash src_pk in
|
let src_pkh = Ed25519.Public_key.hash src_pk in
|
||||||
Client_proto_rpcs.Context.level cctxt.rpc_config block >>=? fun level ->
|
Client_proto_rpcs.Context.next_level cctxt.rpc_config block >>=? fun { level } ->
|
||||||
let level = Raw_level.succ level.level in
|
|
||||||
begin
|
begin
|
||||||
match slot with
|
match slot with
|
||||||
| Some slot -> return slot
|
| Some slot -> return slot
|
||||||
|
@ -43,7 +43,7 @@ let inject_block cctxt block
|
|||||||
?force
|
?force
|
||||||
~priority ~timestamp ~fitness ~seed_nonce
|
~priority ~timestamp ~fitness ~seed_nonce
|
||||||
~src_sk operations =
|
~src_sk operations =
|
||||||
let block = match block with `Prevalidation -> `Head 0 | block -> block in
|
let block = Client_rpcs.last_mined_block block in
|
||||||
Client_node_rpcs.Blocks.info cctxt block >>=? fun bi ->
|
Client_node_rpcs.Blocks.info cctxt block >>=? fun bi ->
|
||||||
let seed_nonce_hash = Nonce.hash seed_nonce in
|
let seed_nonce_hash = Nonce.hash seed_nonce in
|
||||||
Client_proto_rpcs.Context.next_level cctxt block >>=? fun level ->
|
Client_proto_rpcs.Context.next_level cctxt block >>=? fun level ->
|
||||||
@ -58,7 +58,7 @@ let inject_block cctxt block
|
|||||||
src_sk shell priority seed_nonce_hash >>=? fun proof_of_work_nonce ->
|
src_sk shell priority seed_nonce_hash >>=? fun proof_of_work_nonce ->
|
||||||
Client_proto_rpcs.Helpers.Forge.block cctxt
|
Client_proto_rpcs.Helpers.Forge.block cctxt
|
||||||
block
|
block
|
||||||
~net:bi.net_id
|
~net_id:bi.net_id
|
||||||
~predecessor:bi.hash
|
~predecessor:bi.hash
|
||||||
~timestamp
|
~timestamp
|
||||||
~fitness
|
~fitness
|
||||||
@ -80,13 +80,8 @@ let forge_block cctxt block
|
|||||||
?timestamp
|
?timestamp
|
||||||
~priority
|
~priority
|
||||||
~seed_nonce ~src_sk () =
|
~seed_nonce ~src_sk () =
|
||||||
let block =
|
let block = Client_rpcs.last_mined_block block in
|
||||||
match block with
|
Client_proto_rpcs.Context.next_level cctxt block >>=? fun { level } ->
|
||||||
| `Prevalidation -> `Head 0
|
|
||||||
| `Test_prevalidation -> `Test_head 0
|
|
||||||
| block -> block in
|
|
||||||
Client_proto_rpcs.Context.level cctxt block >>=? fun level ->
|
|
||||||
let level = Raw_level.succ level.level in
|
|
||||||
begin
|
begin
|
||||||
match operations with
|
match operations with
|
||||||
| None ->
|
| None ->
|
||||||
|
@ -16,9 +16,9 @@ let inject_seed_nonce_revelation cctxt block ?force ?async nonces =
|
|||||||
List.map
|
List.map
|
||||||
(fun (level, nonce) ->
|
(fun (level, nonce) ->
|
||||||
Seed_nonce_revelation { level ; nonce }) nonces in
|
Seed_nonce_revelation { level ; nonce }) nonces in
|
||||||
Client_node_rpcs.Blocks.net cctxt block >>=? fun net ->
|
Client_node_rpcs.Blocks.net_id cctxt block >>=? fun net_id ->
|
||||||
Client_proto_rpcs.Helpers.Forge.Anonymous.operations cctxt
|
Client_proto_rpcs.Helpers.Forge.Anonymous.operations cctxt
|
||||||
block ~net operations >>=? fun bytes ->
|
block ~net_id operations >>=? fun bytes ->
|
||||||
Client_node_rpcs.inject_operation cctxt ?force ?async bytes >>=? fun oph ->
|
Client_node_rpcs.inject_operation cctxt ?force ?async bytes >>=? fun oph ->
|
||||||
return oph
|
return oph
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@ let transfer rpc_config
|
|||||||
block ?force
|
block ?force
|
||||||
~source ~src_pk ~src_sk ~destination ?arg ~amount ~fee () =
|
~source ~src_pk ~src_sk ~destination ?arg ~amount ~fee () =
|
||||||
let open Cli_entries in
|
let open Cli_entries in
|
||||||
Client_node_rpcs.Blocks.net rpc_config block >>=? fun net ->
|
Client_node_rpcs.Blocks.net_id rpc_config block >>=? fun net_id ->
|
||||||
begin match arg with
|
begin match arg with
|
||||||
| Some arg ->
|
| Some arg ->
|
||||||
Client_proto_programs.parse_data arg >>=? fun arg ->
|
Client_proto_programs.parse_data arg >>=? fun arg ->
|
||||||
@ -33,7 +33,7 @@ let transfer rpc_config
|
|||||||
let counter = Int32.succ pcounter in
|
let counter = Int32.succ pcounter in
|
||||||
Client_proto_rpcs.Helpers.Forge.Manager.transaction
|
Client_proto_rpcs.Helpers.Forge.Manager.transaction
|
||||||
rpc_config block
|
rpc_config block
|
||||||
~net ~source ~sourcePubKey:src_pk ~counter ~amount
|
~net_id ~source ~sourcePubKey:src_pk ~counter ~amount
|
||||||
~destination ?parameters ~fee () >>=? fun bytes ->
|
~destination ?parameters ~fee () >>=? fun bytes ->
|
||||||
Client_node_rpcs.Blocks.predecessor rpc_config block >>=? fun predecessor ->
|
Client_node_rpcs.Blocks.predecessor rpc_config block >>=? fun predecessor ->
|
||||||
let signature = Ed25519.sign src_sk bytes in
|
let signature = Ed25519.sign src_sk bytes in
|
||||||
@ -69,12 +69,12 @@ let originate_account rpc_config
|
|||||||
block ?force
|
block ?force
|
||||||
~source ~src_pk ~src_sk ~manager_pkh
|
~source ~src_pk ~src_sk ~manager_pkh
|
||||||
?delegatable ?spendable ?delegate ~balance ~fee () =
|
?delegatable ?spendable ?delegate ~balance ~fee () =
|
||||||
Client_node_rpcs.Blocks.net rpc_config block >>=? fun net ->
|
Client_node_rpcs.Blocks.net_id rpc_config block >>=? fun net_id ->
|
||||||
Client_proto_rpcs.Context.Contract.counter
|
Client_proto_rpcs.Context.Contract.counter
|
||||||
rpc_config block source >>=? fun pcounter ->
|
rpc_config block source >>=? fun pcounter ->
|
||||||
let counter = Int32.succ pcounter in
|
let counter = Int32.succ pcounter in
|
||||||
Client_proto_rpcs.Helpers.Forge.Manager.origination rpc_config block
|
Client_proto_rpcs.Helpers.Forge.Manager.origination rpc_config block
|
||||||
~net ~source ~sourcePubKey:src_pk ~managerPubKey:manager_pkh
|
~net_id ~source ~sourcePubKey:src_pk ~managerPubKey:manager_pkh
|
||||||
~counter ~balance ?spendable
|
~counter ~balance ?spendable
|
||||||
?delegatable ?delegatePubKey:delegate ~fee () >>=? fun bytes ->
|
?delegatable ?delegatePubKey:delegate ~fee () >>=? fun bytes ->
|
||||||
let signature = Ed25519.sign src_sk bytes in
|
let signature = Ed25519.sign src_sk bytes in
|
||||||
@ -89,9 +89,9 @@ let originate_contract rpc_config
|
|||||||
Client_proto_rpcs.Context.Contract.counter
|
Client_proto_rpcs.Context.Contract.counter
|
||||||
rpc_config block source >>=? fun pcounter ->
|
rpc_config block source >>=? fun pcounter ->
|
||||||
let counter = Int32.succ pcounter in
|
let counter = Int32.succ pcounter in
|
||||||
Client_node_rpcs.Blocks.net rpc_config block >>=? fun net ->
|
Client_node_rpcs.Blocks.net_id rpc_config block >>=? fun net_id ->
|
||||||
Client_proto_rpcs.Helpers.Forge.Manager.origination rpc_config block
|
Client_proto_rpcs.Helpers.Forge.Manager.origination rpc_config block
|
||||||
~net ~source ~sourcePubKey:src_pk ~managerPubKey:manager_pkh
|
~net_id ~source ~sourcePubKey:src_pk ~managerPubKey:manager_pkh
|
||||||
~counter ~balance ~spendable:!spendable
|
~counter ~balance ~spendable:!spendable
|
||||||
?delegatable ?delegatePubKey
|
?delegatable ?delegatePubKey
|
||||||
~script:{ code ; storage } ~fee () >>=? fun bytes ->
|
~script:{ code ; storage } ~fee () >>=? fun bytes ->
|
||||||
@ -99,23 +99,23 @@ let originate_contract rpc_config
|
|||||||
originate rpc_config ?force ~block ~signature bytes
|
originate rpc_config ?force ~block ~signature bytes
|
||||||
|
|
||||||
let faucet rpc_config block ?force ~manager_pkh () =
|
let faucet rpc_config block ?force ~manager_pkh () =
|
||||||
Client_node_rpcs.Blocks.net rpc_config block >>=? fun net ->
|
Client_node_rpcs.Blocks.net_id rpc_config block >>=? fun net_id ->
|
||||||
Client_proto_rpcs.Context.faucet_counter rpc_config block >>=? fun pcounter ->
|
Client_proto_rpcs.Context.faucet_counter rpc_config block >>=? fun pcounter ->
|
||||||
let counter = Int32.succ pcounter in
|
let counter = Int32.succ pcounter in
|
||||||
Client_proto_rpcs.Helpers.Forge.Anonymous.faucet
|
Client_proto_rpcs.Helpers.Forge.Anonymous.faucet
|
||||||
rpc_config block ~net ~id:manager_pkh counter >>=? fun bytes ->
|
rpc_config block ~net_id ~id:manager_pkh counter >>=? fun bytes ->
|
||||||
originate rpc_config ?force ~block bytes
|
originate rpc_config ?force ~block bytes
|
||||||
|
|
||||||
let delegate_contract rpc_config
|
let delegate_contract rpc_config
|
||||||
block ?force
|
block ?force
|
||||||
~source ?src_pk ~manager_sk
|
~source ?src_pk ~manager_sk
|
||||||
~fee delegate_opt =
|
~fee delegate_opt =
|
||||||
Client_node_rpcs.Blocks.net rpc_config block >>=? fun net ->
|
Client_node_rpcs.Blocks.net_id rpc_config block >>=? fun net_id ->
|
||||||
Client_proto_rpcs.Context.Contract.counter
|
Client_proto_rpcs.Context.Contract.counter
|
||||||
rpc_config block source >>=? fun pcounter ->
|
rpc_config block source >>=? fun pcounter ->
|
||||||
let counter = Int32.succ pcounter in
|
let counter = Int32.succ pcounter in
|
||||||
Client_proto_rpcs.Helpers.Forge.Manager.delegation rpc_config block
|
Client_proto_rpcs.Helpers.Forge.Manager.delegation rpc_config block
|
||||||
~net ~source ?sourcePubKey:src_pk ~counter ~fee delegate_opt
|
~net_id ~source ?sourcePubKey:src_pk ~counter ~fee delegate_opt
|
||||||
>>=? fun bytes ->
|
>>=? fun bytes ->
|
||||||
let signature = Environment.Ed25519.sign manager_sk bytes in
|
let signature = Environment.Ed25519.sign manager_sk bytes in
|
||||||
let signed_bytes = MBytes.concat bytes signature in
|
let signed_bytes = MBytes.concat bytes signature in
|
||||||
@ -126,9 +126,9 @@ let delegate_contract rpc_config
|
|||||||
return oph
|
return oph
|
||||||
|
|
||||||
let dictate rpc_config block command seckey =
|
let dictate rpc_config block command seckey =
|
||||||
Client_node_rpcs.Blocks.net rpc_config block >>=? fun net ->
|
Client_node_rpcs.Blocks.net_id rpc_config block >>=? fun net_id ->
|
||||||
Client_proto_rpcs.Helpers.Forge.Dictator.operation
|
Client_proto_rpcs.Helpers.Forge.Dictator.operation
|
||||||
rpc_config block ~net command >>=? fun bytes ->
|
rpc_config block ~net_id command >>=? fun bytes ->
|
||||||
let signature = Ed25519.sign seckey bytes in
|
let signature = Ed25519.sign seckey bytes in
|
||||||
let signed_bytes = MBytes.concat bytes signature in
|
let signed_bytes = MBytes.concat bytes signature in
|
||||||
let oph = Operation_hash.hash_bytes [ signed_bytes ] in
|
let oph = Operation_hash.hash_bytes [ signed_bytes ] in
|
||||||
@ -207,9 +207,9 @@ let group =
|
|||||||
title = "Block contextual commands (see option -block)" }
|
title = "Block contextual commands (see option -block)" }
|
||||||
|
|
||||||
let dictate rpc_config block command seckey =
|
let dictate rpc_config block command seckey =
|
||||||
Client_node_rpcs.Blocks.net rpc_config block >>=? fun net ->
|
Client_node_rpcs.Blocks.net_id rpc_config block >>=? fun net_id ->
|
||||||
Client_proto_rpcs.Helpers.Forge.Dictator.operation
|
Client_proto_rpcs.Helpers.Forge.Dictator.operation
|
||||||
rpc_config block ~net command >>=? fun bytes ->
|
rpc_config block ~net_id command >>=? fun bytes ->
|
||||||
let signature = Ed25519.sign seckey bytes in
|
let signature = Ed25519.sign seckey bytes in
|
||||||
let signed_bytes = MBytes.concat bytes signature in
|
let signed_bytes = MBytes.concat bytes signature in
|
||||||
let oph = Operation_hash.hash_bytes [ signed_bytes ] in
|
let oph = Operation_hash.hash_bytes [ signed_bytes ] in
|
||||||
|
@ -182,25 +182,25 @@ module Helpers = struct
|
|||||||
|
|
||||||
module Manager = struct
|
module Manager = struct
|
||||||
let operations cctxt
|
let operations cctxt
|
||||||
block ~net ~source ?sourcePubKey ~counter ~fee operations =
|
block ~net_id ~source ?sourcePubKey ~counter ~fee operations =
|
||||||
let ops =
|
let ops =
|
||||||
Manager_operations { source ; public_key = sourcePubKey ;
|
Manager_operations { source ; public_key = sourcePubKey ;
|
||||||
counter ; operations ; fee } in
|
counter ; operations ; fee } in
|
||||||
(call_error_service1 cctxt Services.Helpers.Forge.operations block
|
(call_error_service1 cctxt Services.Helpers.Forge.operations block
|
||||||
({net_id=net}, Sourced_operations ops))
|
({net_id}, Sourced_operations ops))
|
||||||
let transaction cctxt
|
let transaction cctxt
|
||||||
block ~net ~source ?sourcePubKey ~counter
|
block ~net_id ~source ?sourcePubKey ~counter
|
||||||
~amount ~destination ?parameters ~fee ()=
|
~amount ~destination ?parameters ~fee ()=
|
||||||
operations cctxt block ~net ~source ?sourcePubKey ~counter ~fee
|
operations cctxt block ~net_id ~source ?sourcePubKey ~counter ~fee
|
||||||
Tezos_context.[Transaction { amount ; parameters ; destination }]
|
Tezos_context.[Transaction { amount ; parameters ; destination }]
|
||||||
let origination cctxt
|
let origination cctxt
|
||||||
block ~net
|
block ~net_id
|
||||||
~source ?sourcePubKey ~counter
|
~source ?sourcePubKey ~counter
|
||||||
~managerPubKey ~balance
|
~managerPubKey ~balance
|
||||||
?(spendable = true)
|
?(spendable = true)
|
||||||
?(delegatable = true)
|
?(delegatable = true)
|
||||||
?delegatePubKey ?script ~fee () =
|
?delegatePubKey ?script ~fee () =
|
||||||
operations cctxt block ~net ~source ?sourcePubKey ~counter ~fee
|
operations cctxt block ~net_id ~source ?sourcePubKey ~counter ~fee
|
||||||
Tezos_context.[
|
Tezos_context.[
|
||||||
Origination { manager = managerPubKey ;
|
Origination { manager = managerPubKey ;
|
||||||
delegate = delegatePubKey ;
|
delegate = delegatePubKey ;
|
||||||
@ -210,59 +210,59 @@ module Helpers = struct
|
|||||||
credit = balance }
|
credit = balance }
|
||||||
]
|
]
|
||||||
let delegation cctxt
|
let delegation cctxt
|
||||||
block ~net ~source ?sourcePubKey ~counter ~fee delegate =
|
block ~net_id ~source ?sourcePubKey ~counter ~fee delegate =
|
||||||
operations cctxt block ~net ~source ?sourcePubKey ~counter ~fee
|
operations cctxt block ~net_id ~source ?sourcePubKey ~counter ~fee
|
||||||
Tezos_context.[Delegation delegate]
|
Tezos_context.[Delegation delegate]
|
||||||
end
|
end
|
||||||
module Delegate = struct
|
module Delegate = struct
|
||||||
let operations cctxt
|
let operations cctxt
|
||||||
block ~net ~source operations =
|
block ~net_id ~source operations =
|
||||||
let ops = Delegate_operations { source ; operations } in
|
let ops = Delegate_operations { source ; operations } in
|
||||||
(call_error_service1 cctxt Services.Helpers.Forge.operations block
|
(call_error_service1 cctxt Services.Helpers.Forge.operations block
|
||||||
({net_id=net}, Sourced_operations ops))
|
({net_id}, Sourced_operations ops))
|
||||||
let endorsement cctxt
|
let endorsement cctxt
|
||||||
b ~net ~source ~block ~slot () =
|
b ~net_id ~source ~block ~slot () =
|
||||||
operations cctxt b ~net ~source
|
operations cctxt b ~net_id ~source
|
||||||
Tezos_context.[Endorsement { block ; slot }]
|
Tezos_context.[Endorsement { block ; slot }]
|
||||||
let proposals cctxt
|
let proposals cctxt
|
||||||
b ~net ~source ~period ~proposals () =
|
b ~net_id ~source ~period ~proposals () =
|
||||||
operations cctxt b ~net ~source
|
operations cctxt b ~net_id ~source
|
||||||
Tezos_context.[Proposals { period ; proposals }]
|
Tezos_context.[Proposals { period ; proposals }]
|
||||||
let ballot cctxt
|
let ballot cctxt
|
||||||
b ~net ~source ~period ~proposal ~ballot () =
|
b ~net_id ~source ~period ~proposal ~ballot () =
|
||||||
operations cctxt b ~net ~source
|
operations cctxt b ~net_id ~source
|
||||||
Tezos_context.[Ballot { period ; proposal ; ballot }]
|
Tezos_context.[Ballot { period ; proposal ; ballot }]
|
||||||
end
|
end
|
||||||
module Dictator = struct
|
module Dictator = struct
|
||||||
let operation cctxt
|
let operation cctxt
|
||||||
block ~net operation =
|
block ~net_id operation =
|
||||||
let op = Dictator_operation operation in
|
let op = Dictator_operation operation in
|
||||||
(call_error_service1 cctxt Services.Helpers.Forge.operations block
|
(call_error_service1 cctxt Services.Helpers.Forge.operations block
|
||||||
({net_id=net}, Sourced_operations op))
|
({net_id}, Sourced_operations op))
|
||||||
let activate cctxt
|
let activate cctxt
|
||||||
b ~net hash =
|
b ~net_id hash =
|
||||||
operation cctxt b ~net (Activate hash)
|
operation cctxt b ~net_id (Activate hash)
|
||||||
let activate_testnet cctxt
|
let activate_testnet cctxt
|
||||||
b ~net hash =
|
b ~net_id hash =
|
||||||
operation cctxt b ~net (Activate_testnet hash)
|
operation cctxt b ~net_id (Activate_testnet hash)
|
||||||
end
|
end
|
||||||
module Anonymous = struct
|
module Anonymous = struct
|
||||||
let operations cctxt block ~net operations =
|
let operations cctxt block ~net_id operations =
|
||||||
(call_error_service1 cctxt Services.Helpers.Forge.operations block
|
(call_error_service1 cctxt Services.Helpers.Forge.operations block
|
||||||
({net_id=net}, Anonymous_operations operations))
|
({net_id}, Anonymous_operations operations))
|
||||||
let seed_nonce_revelation cctxt
|
let seed_nonce_revelation cctxt
|
||||||
block ~net ~level ~nonce () =
|
block ~net_id ~level ~nonce () =
|
||||||
operations cctxt block ~net [Seed_nonce_revelation { level ; nonce }]
|
operations cctxt block ~net_id [Seed_nonce_revelation { level ; nonce }]
|
||||||
let faucet cctxt
|
let faucet cctxt
|
||||||
block ~net ~id counter =
|
block ~net_id ~id counter =
|
||||||
let nonce = Sodium.Random.Bigbytes.generate 16 in
|
let nonce = Sodium.Random.Bigbytes.generate 16 in
|
||||||
operations cctxt block ~net [Faucet { id ; counter ; nonce }]
|
operations cctxt block ~net_id [Faucet { id ; counter ; nonce }]
|
||||||
end
|
end
|
||||||
let block cctxt
|
let block cctxt
|
||||||
block ~net ~predecessor ~timestamp ~fitness ~operations_hash
|
block ~net_id ~predecessor ~timestamp ~fitness ~operations_hash
|
||||||
~level ~priority ~proto_level ~seed_nonce_hash ~proof_of_work_nonce () =
|
~level ~priority ~proto_level ~seed_nonce_hash ~proof_of_work_nonce () =
|
||||||
call_error_service1 cctxt Services.Helpers.Forge.block block
|
call_error_service1 cctxt Services.Helpers.Forge.block block
|
||||||
((net, predecessor, timestamp, fitness, operations_hash),
|
((net_id, predecessor, timestamp, fitness, operations_hash),
|
||||||
(level, priority, proto_level, seed_nonce_hash, proof_of_work_nonce))
|
(level, priority, proto_level, seed_nonce_hash, proof_of_work_nonce))
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -197,7 +197,7 @@ module Helpers : sig
|
|||||||
val operations:
|
val operations:
|
||||||
Client_rpcs.config ->
|
Client_rpcs.config ->
|
||||||
block ->
|
block ->
|
||||||
net:Net_id.t ->
|
net_id:Net_id.t ->
|
||||||
source:Contract.t ->
|
source:Contract.t ->
|
||||||
?sourcePubKey:public_key ->
|
?sourcePubKey:public_key ->
|
||||||
counter:int32 ->
|
counter:int32 ->
|
||||||
@ -207,7 +207,7 @@ module Helpers : sig
|
|||||||
val transaction:
|
val transaction:
|
||||||
Client_rpcs.config ->
|
Client_rpcs.config ->
|
||||||
block ->
|
block ->
|
||||||
net:Net_id.t ->
|
net_id:Net_id.t ->
|
||||||
source:Contract.t ->
|
source:Contract.t ->
|
||||||
?sourcePubKey:public_key ->
|
?sourcePubKey:public_key ->
|
||||||
counter:int32 ->
|
counter:int32 ->
|
||||||
@ -219,7 +219,7 @@ module Helpers : sig
|
|||||||
val origination:
|
val origination:
|
||||||
Client_rpcs.config ->
|
Client_rpcs.config ->
|
||||||
block ->
|
block ->
|
||||||
net:Net_id.t ->
|
net_id:Net_id.t ->
|
||||||
source:Contract.t ->
|
source:Contract.t ->
|
||||||
?sourcePubKey:public_key ->
|
?sourcePubKey:public_key ->
|
||||||
counter:int32 ->
|
counter:int32 ->
|
||||||
@ -235,7 +235,7 @@ module Helpers : sig
|
|||||||
val delegation:
|
val delegation:
|
||||||
Client_rpcs.config ->
|
Client_rpcs.config ->
|
||||||
block ->
|
block ->
|
||||||
net:Net_id.t ->
|
net_id:Net_id.t ->
|
||||||
source:Contract.t ->
|
source:Contract.t ->
|
||||||
?sourcePubKey:public_key ->
|
?sourcePubKey:public_key ->
|
||||||
counter:int32 ->
|
counter:int32 ->
|
||||||
@ -247,19 +247,19 @@ module Helpers : sig
|
|||||||
val operation:
|
val operation:
|
||||||
Client_rpcs.config ->
|
Client_rpcs.config ->
|
||||||
block ->
|
block ->
|
||||||
net:Net_id.t ->
|
net_id:Net_id.t ->
|
||||||
dictator_operation ->
|
dictator_operation ->
|
||||||
MBytes.t tzresult Lwt.t
|
MBytes.t tzresult Lwt.t
|
||||||
val activate:
|
val activate:
|
||||||
Client_rpcs.config ->
|
Client_rpcs.config ->
|
||||||
block ->
|
block ->
|
||||||
net:Net_id.t ->
|
net_id:Net_id.t ->
|
||||||
Protocol_hash.t ->
|
Protocol_hash.t ->
|
||||||
MBytes.t tzresult Lwt.t
|
MBytes.t tzresult Lwt.t
|
||||||
val activate_testnet:
|
val activate_testnet:
|
||||||
Client_rpcs.config ->
|
Client_rpcs.config ->
|
||||||
block ->
|
block ->
|
||||||
net:Net_id.t ->
|
net_id:Net_id.t ->
|
||||||
Protocol_hash.t ->
|
Protocol_hash.t ->
|
||||||
MBytes.t tzresult Lwt.t
|
MBytes.t tzresult Lwt.t
|
||||||
end
|
end
|
||||||
@ -267,14 +267,14 @@ module Helpers : sig
|
|||||||
val operations:
|
val operations:
|
||||||
Client_rpcs.config ->
|
Client_rpcs.config ->
|
||||||
block ->
|
block ->
|
||||||
net:Net_id.t ->
|
net_id:Net_id.t ->
|
||||||
source:public_key ->
|
source:public_key ->
|
||||||
delegate_operation list ->
|
delegate_operation list ->
|
||||||
MBytes.t tzresult Lwt.t
|
MBytes.t tzresult Lwt.t
|
||||||
val endorsement:
|
val endorsement:
|
||||||
Client_rpcs.config ->
|
Client_rpcs.config ->
|
||||||
block ->
|
block ->
|
||||||
net:Net_id.t ->
|
net_id:Net_id.t ->
|
||||||
source:public_key ->
|
source:public_key ->
|
||||||
block:Block_hash.t ->
|
block:Block_hash.t ->
|
||||||
slot:int ->
|
slot:int ->
|
||||||
@ -282,7 +282,7 @@ module Helpers : sig
|
|||||||
val proposals:
|
val proposals:
|
||||||
Client_rpcs.config ->
|
Client_rpcs.config ->
|
||||||
block ->
|
block ->
|
||||||
net:Net_id.t ->
|
net_id:Net_id.t ->
|
||||||
source:public_key ->
|
source:public_key ->
|
||||||
period:Voting_period.t ->
|
period:Voting_period.t ->
|
||||||
proposals:Hash.Protocol_hash.t list ->
|
proposals:Hash.Protocol_hash.t list ->
|
||||||
@ -290,7 +290,7 @@ module Helpers : sig
|
|||||||
val ballot:
|
val ballot:
|
||||||
Client_rpcs.config ->
|
Client_rpcs.config ->
|
||||||
block ->
|
block ->
|
||||||
net:Net_id.t ->
|
net_id:Net_id.t ->
|
||||||
source:public_key ->
|
source:public_key ->
|
||||||
period:Voting_period.t ->
|
period:Voting_period.t ->
|
||||||
proposal:Hash.Protocol_hash.t ->
|
proposal:Hash.Protocol_hash.t ->
|
||||||
@ -301,27 +301,27 @@ module Helpers : sig
|
|||||||
val operations:
|
val operations:
|
||||||
Client_rpcs.config ->
|
Client_rpcs.config ->
|
||||||
block ->
|
block ->
|
||||||
net:Net_id.t ->
|
net_id:Net_id.t ->
|
||||||
anonymous_operation list ->
|
anonymous_operation list ->
|
||||||
MBytes.t tzresult Lwt.t
|
MBytes.t tzresult Lwt.t
|
||||||
val seed_nonce_revelation:
|
val seed_nonce_revelation:
|
||||||
Client_rpcs.config ->
|
Client_rpcs.config ->
|
||||||
block ->
|
block ->
|
||||||
net:Net_id.t ->
|
net_id:Net_id.t ->
|
||||||
level:Raw_level.t ->
|
level:Raw_level.t ->
|
||||||
nonce:Nonce.t ->
|
nonce:Nonce.t ->
|
||||||
unit -> MBytes.t tzresult Lwt.t
|
unit -> MBytes.t tzresult Lwt.t
|
||||||
val faucet:
|
val faucet:
|
||||||
Client_rpcs.config ->
|
Client_rpcs.config ->
|
||||||
block ->
|
block ->
|
||||||
net:Net_id.t ->
|
net_id:Net_id.t ->
|
||||||
id:public_key_hash ->
|
id:public_key_hash ->
|
||||||
int32 -> MBytes.t tzresult Lwt.t
|
int32 -> MBytes.t tzresult Lwt.t
|
||||||
end
|
end
|
||||||
val block:
|
val block:
|
||||||
Client_rpcs.config ->
|
Client_rpcs.config ->
|
||||||
block ->
|
block ->
|
||||||
net:Net_id.t ->
|
net_id:Net_id.t ->
|
||||||
predecessor:Block_hash.t ->
|
predecessor:Block_hash.t ->
|
||||||
timestamp:Time.t ->
|
timestamp:Time.t ->
|
||||||
fitness:Fitness.t ->
|
fitness:Fitness.t ->
|
||||||
|
@ -34,11 +34,7 @@ let demo cctxt =
|
|||||||
return ()
|
return ()
|
||||||
|
|
||||||
let mine cctxt =
|
let mine cctxt =
|
||||||
let block =
|
let block = Client_rpcs.last_mined_block cctxt.Client_commands.config.block in
|
||||||
match Client_commands.(cctxt.config.block) with
|
|
||||||
| `Prevalidation -> `Head 0
|
|
||||||
| `Test_prevalidation -> `Test_head 0
|
|
||||||
| b -> b in
|
|
||||||
Client_node_rpcs.Blocks.info cctxt.rpc_config block >>=? fun bi ->
|
Client_node_rpcs.Blocks.info cctxt.rpc_config block >>=? fun bi ->
|
||||||
let fitness =
|
let fitness =
|
||||||
match bi.fitness with
|
match bi.fitness with
|
||||||
|
@ -25,23 +25,20 @@ let call_error_service1 rpc_config s block a1 =
|
|||||||
|
|
||||||
let forge_block
|
let forge_block
|
||||||
rpc_config block net_id ?(timestamp = Time.now ()) command fitness =
|
rpc_config block net_id ?(timestamp = Time.now ()) command fitness =
|
||||||
let block =
|
let block = Client_rpcs.last_mined_block block in
|
||||||
match block with
|
Client_node_rpcs.Blocks.info rpc_config block >>=? fun pred ->
|
||||||
| `Prevalidation -> `Head 0
|
|
||||||
| block -> block in
|
|
||||||
Client_blocks.get_block_hash rpc_config block >>=? fun pred ->
|
|
||||||
Client_node_rpcs.Blocks.level rpc_config block >>=? fun level ->
|
|
||||||
let proto_level =
|
let proto_level =
|
||||||
match command with
|
match command with
|
||||||
| Data.Command.Activate _ -> 1
|
| Data.Command.Activate _ -> 1
|
||||||
| Data.Command.Activate_testnet (_,_) -> 0 in
|
| Data.Command.Activate_testnet (_,_) -> 0 in
|
||||||
call_service1 rpc_config
|
call_service1 rpc_config
|
||||||
Services.Forge.block block
|
Services.Forge.block block
|
||||||
((net_id, Int32.succ level, proto_level,
|
((net_id, Int32.succ pred.level, proto_level,
|
||||||
pred, timestamp, fitness), command)
|
pred.hash, timestamp, fitness), command)
|
||||||
|
|
||||||
let mine rpc_config ?timestamp block command fitness seckey =
|
let mine rpc_config ?timestamp block command fitness seckey =
|
||||||
Client_blocks.get_block_info rpc_config block >>=? fun bi ->
|
let block = Client_rpcs.last_mined_block block in
|
||||||
|
Client_node_rpcs.Blocks.info rpc_config block >>=? fun bi ->
|
||||||
forge_block
|
forge_block
|
||||||
rpc_config ?timestamp block bi.net_id command fitness >>=? fun blk ->
|
rpc_config ?timestamp block bi.net_id command fitness >>=? fun blk ->
|
||||||
let signed_blk = Environment.Ed25519.Signature.append seckey blk in
|
let signed_blk = Environment.Ed25519.Signature.append seckey blk in
|
||||||
|
@ -58,7 +58,7 @@ let register_bi_dir node dir =
|
|||||||
Node.RPC.block_info node b >>= fun bi ->
|
Node.RPC.block_info node b >>= fun bi ->
|
||||||
RPC.Answer.return bi.net_id in
|
RPC.Answer.return bi.net_id in
|
||||||
RPC.register1 dir
|
RPC.register1 dir
|
||||||
Services.Blocks.net implementation in
|
Services.Blocks.net_id implementation in
|
||||||
let dir =
|
let dir =
|
||||||
let implementation b () =
|
let implementation b () =
|
||||||
Node.RPC.block_info node b >>= fun bi ->
|
Node.RPC.block_info node b >>= fun bi ->
|
||||||
|
@ -198,12 +198,12 @@ module Blocks = struct
|
|||||||
~output: block_info_encoding
|
~output: block_info_encoding
|
||||||
block_path
|
block_path
|
||||||
|
|
||||||
let net =
|
let net_id =
|
||||||
RPC.service
|
RPC.service
|
||||||
~description:"Returns the net of the chain in which the block belongs."
|
~description:"Returns the net of the chain in which the block belongs."
|
||||||
~input: empty
|
~input: empty
|
||||||
~output: (obj1 (req "net" Net_id.encoding))
|
~output: (obj1 (req "net_id" Net_id.encoding))
|
||||||
RPC.Path.(block_path / "net")
|
RPC.Path.(block_path / "net_id")
|
||||||
|
|
||||||
let level =
|
let level =
|
||||||
RPC.service
|
RPC.service
|
||||||
|
@ -49,7 +49,7 @@ module Blocks : sig
|
|||||||
|
|
||||||
val info:
|
val info:
|
||||||
(unit, unit * block, bool, block_info) RPC.service
|
(unit, unit * block, bool, block_info) RPC.service
|
||||||
val net:
|
val net_id:
|
||||||
(unit, unit * block, unit, Net_id.t) RPC.service
|
(unit, unit * block, unit, Net_id.t) RPC.service
|
||||||
val level:
|
val level:
|
||||||
(unit, unit * block, unit, Int32.t) RPC.service
|
(unit, unit * block, unit, Int32.t) RPC.service
|
||||||
|
@ -251,7 +251,7 @@ module Protocol = struct
|
|||||||
Client_node_rpcs.Blocks.info rpc_config block >>=? fun block_info ->
|
Client_node_rpcs.Blocks.info rpc_config block >>=? fun block_info ->
|
||||||
Client_proto_rpcs.Context.next_level rpc_config block >>=? fun next_level ->
|
Client_proto_rpcs.Context.next_level rpc_config block >>=? fun next_level ->
|
||||||
Client_proto_rpcs.Helpers.Forge.Delegate.proposals rpc_config block
|
Client_proto_rpcs.Helpers.Forge.Delegate.proposals rpc_config block
|
||||||
~net:block_info.net_id
|
~net_id:block_info.net_id
|
||||||
~source:pk
|
~source:pk
|
||||||
~period:next_level.voting_period
|
~period:next_level.voting_period
|
||||||
~proposals
|
~proposals
|
||||||
@ -263,7 +263,7 @@ module Protocol = struct
|
|||||||
Client_node_rpcs.Blocks.info rpc_config block >>=? fun block_info ->
|
Client_node_rpcs.Blocks.info rpc_config block >>=? fun block_info ->
|
||||||
Client_proto_rpcs.Context.next_level rpc_config block >>=? fun next_level ->
|
Client_proto_rpcs.Context.next_level rpc_config block >>=? fun next_level ->
|
||||||
Client_proto_rpcs.Helpers.Forge.Delegate.ballot rpc_config block
|
Client_proto_rpcs.Helpers.Forge.Delegate.ballot rpc_config block
|
||||||
~net:block_info.net_id
|
~net_id:block_info.net_id
|
||||||
~source:pk
|
~source:pk
|
||||||
~period:next_level.voting_period
|
~period:next_level.voting_period
|
||||||
~proposal
|
~proposal
|
||||||
@ -460,7 +460,7 @@ module Mining = struct
|
|||||||
block src_sk shell priority seed_nonce_hash >>=? fun proof_of_work_nonce ->
|
block src_sk shell priority seed_nonce_hash >>=? fun proof_of_work_nonce ->
|
||||||
Client_proto_rpcs.Helpers.Forge.block rpc_config
|
Client_proto_rpcs.Helpers.Forge.block rpc_config
|
||||||
block
|
block
|
||||||
~net:bi.net_id
|
~net_id:bi.net_id
|
||||||
~predecessor:bi.hash
|
~predecessor:bi.hash
|
||||||
~timestamp
|
~timestamp
|
||||||
~fitness
|
~fitness
|
||||||
@ -526,10 +526,11 @@ module Endorse = struct
|
|||||||
src_sk
|
src_sk
|
||||||
source
|
source
|
||||||
slot =
|
slot =
|
||||||
Client_blocks.get_block_info rpc_config block >>=? fun { hash ; net_id } ->
|
let block = Client_rpcs.last_mined_block block in
|
||||||
|
Client_node_rpcs.Blocks.info rpc_config block >>=? fun { hash ; net_id } ->
|
||||||
Client_proto_rpcs.Helpers.Forge.Delegate.endorsement rpc_config
|
Client_proto_rpcs.Helpers.Forge.Delegate.endorsement rpc_config
|
||||||
block
|
block
|
||||||
~net:net_id
|
~net_id:net_id
|
||||||
~source
|
~source
|
||||||
~block:hash
|
~block:hash
|
||||||
~slot:slot
|
~slot:slot
|
||||||
|
Loading…
Reference in New Issue
Block a user