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_keys.mli \
|
||||
client/client_protocols.mli \
|
||||
client/client_blocks.mli \
|
||||
client/client_network.mli \
|
||||
|
||||
CLIENT_LIB_IMPLS := \
|
||||
@ -357,7 +356,6 @@ CLIENT_LIB_IMPLS := \
|
||||
client/client_tags.ml \
|
||||
client/client_keys.ml \
|
||||
client/client_protocols.ml \
|
||||
client/client_blocks.ml \
|
||||
client/client_network.ml \
|
||||
|
||||
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 ;
|
||||
timestamp: Time.t ;
|
||||
}
|
||||
let net cctxt h =
|
||||
call_service1 cctxt Services.Blocks.net h ()
|
||||
let net_id cctxt h =
|
||||
call_service1 cctxt Services.Blocks.net_id h ()
|
||||
let level cctxt h =
|
||||
call_service1 cctxt Services.Blocks.level h ()
|
||||
let predecessor cctxt h =
|
||||
|
@ -72,7 +72,7 @@ module Blocks : sig
|
||||
| `Hash of Block_hash.t
|
||||
]
|
||||
|
||||
val net:
|
||||
val net_id:
|
||||
config ->
|
||||
block -> Net_id.t tzresult Lwt.t
|
||||
val level:
|
||||
|
@ -326,3 +326,10 @@ let call_describe0 cctxt service path arg =
|
||||
let meth, prefix, arg = RPC.forge_request service () arg in
|
||||
get_json cctxt meth (prefix @ path) arg >>=? fun 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 ->
|
||||
(unit, unit, 'a, 'b) RPC.service ->
|
||||
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)
|
||||
|
||||
let blocks_from_cycle cctxt block cycle =
|
||||
let block =
|
||||
match block with
|
||||
| `Prevalidation -> `Head 0
|
||||
| `Test_prevalidation -> `Test_head 0
|
||||
| _ -> block in
|
||||
let block = Client_rpcs.last_mined_block block in
|
||||
Client_proto_rpcs.Context.level cctxt block >>=? fun level ->
|
||||
Client_proto_rpcs.Helpers.levels cctxt block cycle >>=? fun (first, last) ->
|
||||
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
|
||||
block level ?async ?force
|
||||
src_sk source slot =
|
||||
Client_blocks.get_block_hash cctxt.rpc_config block >>=? fun block_hash ->
|
||||
Client_node_rpcs.Blocks.net cctxt.rpc_config block >>=? fun net ->
|
||||
let block = Client_rpcs.last_mined_block block in
|
||||
Client_node_rpcs.Blocks.info cctxt.rpc_config block >>=? fun bi ->
|
||||
Client_proto_rpcs.Helpers.Forge.Delegate.endorsement cctxt.rpc_config
|
||||
block
|
||||
~net
|
||||
~net_id:bi.net_id
|
||||
~source
|
||||
~block:block_hash
|
||||
~block:bi.hash
|
||||
~slot:slot
|
||||
() >>=? fun bytes ->
|
||||
let signed_bytes = Ed25519.Signature.append src_sk bytes in
|
||||
Client_node_rpcs.inject_operation
|
||||
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
|
||||
|
||||
|
||||
@ -152,14 +152,9 @@ let check_endorsement cctxt level slot =
|
||||
let forge_endorsement cctxt
|
||||
block ?(force = false)
|
||||
~src_sk ?slot ?max_priority src_pk =
|
||||
let block =
|
||||
match block with
|
||||
| `Prevalidation -> `Head 0
|
||||
| `Test_prevalidation -> `Test_head 0
|
||||
| _ -> block in
|
||||
let block = Client_rpcs.last_mined_block block in
|
||||
let src_pkh = Ed25519.Public_key.hash src_pk in
|
||||
Client_proto_rpcs.Context.level cctxt.rpc_config block >>=? fun level ->
|
||||
let level = Raw_level.succ level.level in
|
||||
Client_proto_rpcs.Context.next_level cctxt.rpc_config block >>=? fun { level } ->
|
||||
begin
|
||||
match slot with
|
||||
| Some slot -> return slot
|
||||
|
@ -43,7 +43,7 @@ let inject_block cctxt block
|
||||
?force
|
||||
~priority ~timestamp ~fitness ~seed_nonce
|
||||
~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 ->
|
||||
let seed_nonce_hash = Nonce.hash seed_nonce in
|
||||
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 ->
|
||||
Client_proto_rpcs.Helpers.Forge.block cctxt
|
||||
block
|
||||
~net:bi.net_id
|
||||
~net_id:bi.net_id
|
||||
~predecessor:bi.hash
|
||||
~timestamp
|
||||
~fitness
|
||||
@ -80,13 +80,8 @@ let forge_block cctxt block
|
||||
?timestamp
|
||||
~priority
|
||||
~seed_nonce ~src_sk () =
|
||||
let block =
|
||||
match block with
|
||||
| `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
|
||||
let block = Client_rpcs.last_mined_block block in
|
||||
Client_proto_rpcs.Context.next_level cctxt block >>=? fun { level } ->
|
||||
begin
|
||||
match operations with
|
||||
| None ->
|
||||
|
@ -16,9 +16,9 @@ let inject_seed_nonce_revelation cctxt block ?force ?async nonces =
|
||||
List.map
|
||||
(fun (level, nonce) ->
|
||||
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
|
||||
block ~net operations >>=? fun bytes ->
|
||||
block ~net_id operations >>=? fun bytes ->
|
||||
Client_node_rpcs.inject_operation cctxt ?force ?async bytes >>=? fun oph ->
|
||||
return oph
|
||||
|
||||
|
@ -21,7 +21,7 @@ let transfer rpc_config
|
||||
block ?force
|
||||
~source ~src_pk ~src_sk ~destination ?arg ~amount ~fee () =
|
||||
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
|
||||
| Some arg ->
|
||||
Client_proto_programs.parse_data arg >>=? fun arg ->
|
||||
@ -33,7 +33,7 @@ let transfer rpc_config
|
||||
let counter = Int32.succ pcounter in
|
||||
Client_proto_rpcs.Helpers.Forge.Manager.transaction
|
||||
rpc_config block
|
||||
~net ~source ~sourcePubKey:src_pk ~counter ~amount
|
||||
~net_id ~source ~sourcePubKey:src_pk ~counter ~amount
|
||||
~destination ?parameters ~fee () >>=? fun bytes ->
|
||||
Client_node_rpcs.Blocks.predecessor rpc_config block >>=? fun predecessor ->
|
||||
let signature = Ed25519.sign src_sk bytes in
|
||||
@ -69,12 +69,12 @@ let originate_account rpc_config
|
||||
block ?force
|
||||
~source ~src_pk ~src_sk ~manager_pkh
|
||||
?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
|
||||
rpc_config block source >>=? fun pcounter ->
|
||||
let counter = Int32.succ pcounter in
|
||||
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
|
||||
?delegatable ?delegatePubKey:delegate ~fee () >>=? fun bytes ->
|
||||
let signature = Ed25519.sign src_sk bytes in
|
||||
@ -89,9 +89,9 @@ let originate_contract rpc_config
|
||||
Client_proto_rpcs.Context.Contract.counter
|
||||
rpc_config block source >>=? fun pcounter ->
|
||||
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
|
||||
~net ~source ~sourcePubKey:src_pk ~managerPubKey:manager_pkh
|
||||
~net_id ~source ~sourcePubKey:src_pk ~managerPubKey:manager_pkh
|
||||
~counter ~balance ~spendable:!spendable
|
||||
?delegatable ?delegatePubKey
|
||||
~script:{ code ; storage } ~fee () >>=? fun bytes ->
|
||||
@ -99,23 +99,23 @@ let originate_contract rpc_config
|
||||
originate rpc_config ?force ~block ~signature bytes
|
||||
|
||||
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 ->
|
||||
let counter = Int32.succ pcounter in
|
||||
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
|
||||
|
||||
let delegate_contract rpc_config
|
||||
block ?force
|
||||
~source ?src_pk ~manager_sk
|
||||
~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
|
||||
rpc_config block source >>=? fun pcounter ->
|
||||
let counter = Int32.succ pcounter in
|
||||
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 ->
|
||||
let signature = Environment.Ed25519.sign manager_sk bytes in
|
||||
let signed_bytes = MBytes.concat bytes signature in
|
||||
@ -126,9 +126,9 @@ let delegate_contract rpc_config
|
||||
return oph
|
||||
|
||||
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
|
||||
rpc_config block ~net command >>=? fun bytes ->
|
||||
rpc_config block ~net_id command >>=? fun bytes ->
|
||||
let signature = Ed25519.sign seckey bytes in
|
||||
let signed_bytes = MBytes.concat bytes signature in
|
||||
let oph = Operation_hash.hash_bytes [ signed_bytes ] in
|
||||
@ -207,9 +207,9 @@ let group =
|
||||
title = "Block contextual commands (see option -block)" }
|
||||
|
||||
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
|
||||
rpc_config block ~net command >>=? fun bytes ->
|
||||
rpc_config block ~net_id command >>=? fun bytes ->
|
||||
let signature = Ed25519.sign seckey bytes in
|
||||
let signed_bytes = MBytes.concat bytes signature in
|
||||
let oph = Operation_hash.hash_bytes [ signed_bytes ] in
|
||||
|
@ -182,25 +182,25 @@ module Helpers = struct
|
||||
|
||||
module Manager = struct
|
||||
let operations cctxt
|
||||
block ~net ~source ?sourcePubKey ~counter ~fee operations =
|
||||
block ~net_id ~source ?sourcePubKey ~counter ~fee operations =
|
||||
let ops =
|
||||
Manager_operations { source ; public_key = sourcePubKey ;
|
||||
counter ; operations ; fee } in
|
||||
(call_error_service1 cctxt Services.Helpers.Forge.operations block
|
||||
({net_id=net}, Sourced_operations ops))
|
||||
({net_id}, Sourced_operations ops))
|
||||
let transaction cctxt
|
||||
block ~net ~source ?sourcePubKey ~counter
|
||||
block ~net_id ~source ?sourcePubKey ~counter
|
||||
~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 }]
|
||||
let origination cctxt
|
||||
block ~net
|
||||
block ~net_id
|
||||
~source ?sourcePubKey ~counter
|
||||
~managerPubKey ~balance
|
||||
?(spendable = true)
|
||||
?(delegatable = true)
|
||||
?delegatePubKey ?script ~fee () =
|
||||
operations cctxt block ~net ~source ?sourcePubKey ~counter ~fee
|
||||
operations cctxt block ~net_id ~source ?sourcePubKey ~counter ~fee
|
||||
Tezos_context.[
|
||||
Origination { manager = managerPubKey ;
|
||||
delegate = delegatePubKey ;
|
||||
@ -210,59 +210,59 @@ module Helpers = struct
|
||||
credit = balance }
|
||||
]
|
||||
let delegation cctxt
|
||||
block ~net ~source ?sourcePubKey ~counter ~fee delegate =
|
||||
operations cctxt block ~net ~source ?sourcePubKey ~counter ~fee
|
||||
block ~net_id ~source ?sourcePubKey ~counter ~fee delegate =
|
||||
operations cctxt block ~net_id ~source ?sourcePubKey ~counter ~fee
|
||||
Tezos_context.[Delegation delegate]
|
||||
end
|
||||
module Delegate = struct
|
||||
let operations cctxt
|
||||
block ~net ~source operations =
|
||||
block ~net_id ~source operations =
|
||||
let ops = Delegate_operations { source ; operations } in
|
||||
(call_error_service1 cctxt Services.Helpers.Forge.operations block
|
||||
({net_id=net}, Sourced_operations ops))
|
||||
({net_id}, Sourced_operations ops))
|
||||
let endorsement cctxt
|
||||
b ~net ~source ~block ~slot () =
|
||||
operations cctxt b ~net ~source
|
||||
b ~net_id ~source ~block ~slot () =
|
||||
operations cctxt b ~net_id ~source
|
||||
Tezos_context.[Endorsement { block ; slot }]
|
||||
let proposals cctxt
|
||||
b ~net ~source ~period ~proposals () =
|
||||
operations cctxt b ~net ~source
|
||||
b ~net_id ~source ~period ~proposals () =
|
||||
operations cctxt b ~net_id ~source
|
||||
Tezos_context.[Proposals { period ; proposals }]
|
||||
let ballot cctxt
|
||||
b ~net ~source ~period ~proposal ~ballot () =
|
||||
operations cctxt b ~net ~source
|
||||
b ~net_id ~source ~period ~proposal ~ballot () =
|
||||
operations cctxt b ~net_id ~source
|
||||
Tezos_context.[Ballot { period ; proposal ; ballot }]
|
||||
end
|
||||
module Dictator = struct
|
||||
let operation cctxt
|
||||
block ~net operation =
|
||||
block ~net_id operation =
|
||||
let op = Dictator_operation operation in
|
||||
(call_error_service1 cctxt Services.Helpers.Forge.operations block
|
||||
({net_id=net}, Sourced_operations op))
|
||||
({net_id}, Sourced_operations op))
|
||||
let activate cctxt
|
||||
b ~net hash =
|
||||
operation cctxt b ~net (Activate hash)
|
||||
b ~net_id hash =
|
||||
operation cctxt b ~net_id (Activate hash)
|
||||
let activate_testnet cctxt
|
||||
b ~net hash =
|
||||
operation cctxt b ~net (Activate_testnet hash)
|
||||
b ~net_id hash =
|
||||
operation cctxt b ~net_id (Activate_testnet hash)
|
||||
end
|
||||
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
|
||||
({net_id=net}, Anonymous_operations operations))
|
||||
({net_id}, Anonymous_operations operations))
|
||||
let seed_nonce_revelation cctxt
|
||||
block ~net ~level ~nonce () =
|
||||
operations cctxt block ~net [Seed_nonce_revelation { level ; nonce }]
|
||||
block ~net_id ~level ~nonce () =
|
||||
operations cctxt block ~net_id [Seed_nonce_revelation { level ; nonce }]
|
||||
let faucet cctxt
|
||||
block ~net ~id counter =
|
||||
block ~net_id ~id counter =
|
||||
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
|
||||
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 () =
|
||||
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))
|
||||
end
|
||||
|
||||
|
@ -197,7 +197,7 @@ module Helpers : sig
|
||||
val operations:
|
||||
Client_rpcs.config ->
|
||||
block ->
|
||||
net:Net_id.t ->
|
||||
net_id:Net_id.t ->
|
||||
source:Contract.t ->
|
||||
?sourcePubKey:public_key ->
|
||||
counter:int32 ->
|
||||
@ -207,7 +207,7 @@ module Helpers : sig
|
||||
val transaction:
|
||||
Client_rpcs.config ->
|
||||
block ->
|
||||
net:Net_id.t ->
|
||||
net_id:Net_id.t ->
|
||||
source:Contract.t ->
|
||||
?sourcePubKey:public_key ->
|
||||
counter:int32 ->
|
||||
@ -219,7 +219,7 @@ module Helpers : sig
|
||||
val origination:
|
||||
Client_rpcs.config ->
|
||||
block ->
|
||||
net:Net_id.t ->
|
||||
net_id:Net_id.t ->
|
||||
source:Contract.t ->
|
||||
?sourcePubKey:public_key ->
|
||||
counter:int32 ->
|
||||
@ -235,7 +235,7 @@ module Helpers : sig
|
||||
val delegation:
|
||||
Client_rpcs.config ->
|
||||
block ->
|
||||
net:Net_id.t ->
|
||||
net_id:Net_id.t ->
|
||||
source:Contract.t ->
|
||||
?sourcePubKey:public_key ->
|
||||
counter:int32 ->
|
||||
@ -247,19 +247,19 @@ module Helpers : sig
|
||||
val operation:
|
||||
Client_rpcs.config ->
|
||||
block ->
|
||||
net:Net_id.t ->
|
||||
net_id:Net_id.t ->
|
||||
dictator_operation ->
|
||||
MBytes.t tzresult Lwt.t
|
||||
val activate:
|
||||
Client_rpcs.config ->
|
||||
block ->
|
||||
net:Net_id.t ->
|
||||
net_id:Net_id.t ->
|
||||
Protocol_hash.t ->
|
||||
MBytes.t tzresult Lwt.t
|
||||
val activate_testnet:
|
||||
Client_rpcs.config ->
|
||||
block ->
|
||||
net:Net_id.t ->
|
||||
net_id:Net_id.t ->
|
||||
Protocol_hash.t ->
|
||||
MBytes.t tzresult Lwt.t
|
||||
end
|
||||
@ -267,14 +267,14 @@ module Helpers : sig
|
||||
val operations:
|
||||
Client_rpcs.config ->
|
||||
block ->
|
||||
net:Net_id.t ->
|
||||
net_id:Net_id.t ->
|
||||
source:public_key ->
|
||||
delegate_operation list ->
|
||||
MBytes.t tzresult Lwt.t
|
||||
val endorsement:
|
||||
Client_rpcs.config ->
|
||||
block ->
|
||||
net:Net_id.t ->
|
||||
net_id:Net_id.t ->
|
||||
source:public_key ->
|
||||
block:Block_hash.t ->
|
||||
slot:int ->
|
||||
@ -282,7 +282,7 @@ module Helpers : sig
|
||||
val proposals:
|
||||
Client_rpcs.config ->
|
||||
block ->
|
||||
net:Net_id.t ->
|
||||
net_id:Net_id.t ->
|
||||
source:public_key ->
|
||||
period:Voting_period.t ->
|
||||
proposals:Hash.Protocol_hash.t list ->
|
||||
@ -290,7 +290,7 @@ module Helpers : sig
|
||||
val ballot:
|
||||
Client_rpcs.config ->
|
||||
block ->
|
||||
net:Net_id.t ->
|
||||
net_id:Net_id.t ->
|
||||
source:public_key ->
|
||||
period:Voting_period.t ->
|
||||
proposal:Hash.Protocol_hash.t ->
|
||||
@ -301,27 +301,27 @@ module Helpers : sig
|
||||
val operations:
|
||||
Client_rpcs.config ->
|
||||
block ->
|
||||
net:Net_id.t ->
|
||||
net_id:Net_id.t ->
|
||||
anonymous_operation list ->
|
||||
MBytes.t tzresult Lwt.t
|
||||
val seed_nonce_revelation:
|
||||
Client_rpcs.config ->
|
||||
block ->
|
||||
net:Net_id.t ->
|
||||
net_id:Net_id.t ->
|
||||
level:Raw_level.t ->
|
||||
nonce:Nonce.t ->
|
||||
unit -> MBytes.t tzresult Lwt.t
|
||||
val faucet:
|
||||
Client_rpcs.config ->
|
||||
block ->
|
||||
net:Net_id.t ->
|
||||
net_id:Net_id.t ->
|
||||
id:public_key_hash ->
|
||||
int32 -> MBytes.t tzresult Lwt.t
|
||||
end
|
||||
val block:
|
||||
Client_rpcs.config ->
|
||||
block ->
|
||||
net:Net_id.t ->
|
||||
net_id:Net_id.t ->
|
||||
predecessor:Block_hash.t ->
|
||||
timestamp:Time.t ->
|
||||
fitness:Fitness.t ->
|
||||
|
@ -34,11 +34,7 @@ let demo cctxt =
|
||||
return ()
|
||||
|
||||
let mine cctxt =
|
||||
let block =
|
||||
match Client_commands.(cctxt.config.block) with
|
||||
| `Prevalidation -> `Head 0
|
||||
| `Test_prevalidation -> `Test_head 0
|
||||
| b -> b in
|
||||
let block = Client_rpcs.last_mined_block cctxt.Client_commands.config.block in
|
||||
Client_node_rpcs.Blocks.info cctxt.rpc_config block >>=? fun bi ->
|
||||
let fitness =
|
||||
match bi.fitness with
|
||||
|
@ -25,23 +25,20 @@ let call_error_service1 rpc_config s block a1 =
|
||||
|
||||
let forge_block
|
||||
rpc_config block net_id ?(timestamp = Time.now ()) command fitness =
|
||||
let block =
|
||||
match block with
|
||||
| `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 block = Client_rpcs.last_mined_block block in
|
||||
Client_node_rpcs.Blocks.info rpc_config block >>=? fun pred ->
|
||||
let proto_level =
|
||||
match command with
|
||||
| Data.Command.Activate _ -> 1
|
||||
| Data.Command.Activate_testnet (_,_) -> 0 in
|
||||
call_service1 rpc_config
|
||||
Services.Forge.block block
|
||||
((net_id, Int32.succ level, proto_level,
|
||||
pred, timestamp, fitness), command)
|
||||
((net_id, Int32.succ pred.level, proto_level,
|
||||
pred.hash, timestamp, fitness), command)
|
||||
|
||||
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
|
||||
rpc_config ?timestamp block bi.net_id command fitness >>=? fun blk ->
|
||||
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 ->
|
||||
RPC.Answer.return bi.net_id in
|
||||
RPC.register1 dir
|
||||
Services.Blocks.net implementation in
|
||||
Services.Blocks.net_id implementation in
|
||||
let dir =
|
||||
let implementation b () =
|
||||
Node.RPC.block_info node b >>= fun bi ->
|
||||
|
@ -198,12 +198,12 @@ module Blocks = struct
|
||||
~output: block_info_encoding
|
||||
block_path
|
||||
|
||||
let net =
|
||||
let net_id =
|
||||
RPC.service
|
||||
~description:"Returns the net of the chain in which the block belongs."
|
||||
~input: empty
|
||||
~output: (obj1 (req "net" Net_id.encoding))
|
||||
RPC.Path.(block_path / "net")
|
||||
~output: (obj1 (req "net_id" Net_id.encoding))
|
||||
RPC.Path.(block_path / "net_id")
|
||||
|
||||
let level =
|
||||
RPC.service
|
||||
|
@ -49,7 +49,7 @@ module Blocks : sig
|
||||
|
||||
val info:
|
||||
(unit, unit * block, bool, block_info) RPC.service
|
||||
val net:
|
||||
val net_id:
|
||||
(unit, unit * block, unit, Net_id.t) RPC.service
|
||||
val level:
|
||||
(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_proto_rpcs.Context.next_level rpc_config block >>=? fun next_level ->
|
||||
Client_proto_rpcs.Helpers.Forge.Delegate.proposals rpc_config block
|
||||
~net:block_info.net_id
|
||||
~net_id:block_info.net_id
|
||||
~source:pk
|
||||
~period:next_level.voting_period
|
||||
~proposals
|
||||
@ -263,7 +263,7 @@ module Protocol = struct
|
||||
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.Helpers.Forge.Delegate.ballot rpc_config block
|
||||
~net:block_info.net_id
|
||||
~net_id:block_info.net_id
|
||||
~source:pk
|
||||
~period:next_level.voting_period
|
||||
~proposal
|
||||
@ -460,7 +460,7 @@ module Mining = struct
|
||||
block src_sk shell priority seed_nonce_hash >>=? fun proof_of_work_nonce ->
|
||||
Client_proto_rpcs.Helpers.Forge.block rpc_config
|
||||
block
|
||||
~net:bi.net_id
|
||||
~net_id:bi.net_id
|
||||
~predecessor:bi.hash
|
||||
~timestamp
|
||||
~fitness
|
||||
@ -526,10 +526,11 @@ module Endorse = struct
|
||||
src_sk
|
||||
source
|
||||
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
|
||||
block
|
||||
~net:net_id
|
||||
~net_id:net_id
|
||||
~source
|
||||
~block:hash
|
||||
~slot:slot
|
||||
|
Loading…
Reference in New Issue
Block a user