RPC: remove subfield accessors
This is painful to maintain and `jq` works well.
This commit is contained in:
parent
e4ffbd2854
commit
632144b689
@ -10,8 +10,8 @@
|
|||||||
open Client_config
|
open Client_config
|
||||||
|
|
||||||
let get_commands_for_version ctxt block protocol =
|
let get_commands_for_version ctxt block protocol =
|
||||||
Shell_services.Blocks.Metadata.next_protocol_hash ctxt ~block () >>= function
|
Shell_services.Blocks.protocols ctxt ~block () >>= function
|
||||||
| Ok version -> begin
|
| Ok { next_protocol = version } -> begin
|
||||||
match protocol with
|
match protocol with
|
||||||
| None ->
|
| None ->
|
||||||
return (Some version, Client_commands.commands_for_version version)
|
return (Some version, Client_commands.commands_for_version version)
|
||||||
|
@ -19,9 +19,9 @@ protocol_version="PsgZ1PB2h82sTKznNbmZxtbsU432eKDv1W6cf1cJFhCFmGYSiJs"
|
|||||||
$admin_client inject protocol "$test_dir/demo"
|
$admin_client inject protocol "$test_dir/demo"
|
||||||
$admin_client list protocols
|
$admin_client list protocols
|
||||||
$client activate protocol $protocol_version with fitness 1 and key dictator and parameters $parameters_file
|
$client activate protocol $protocol_version with fitness 1 and key dictator and parameters $parameters_file
|
||||||
answ=$($client -p ProtoALphaALph rpc get /chains/main/blocks/head/metadata/next_protocol_hash 2>/dev/null)
|
answ=$($client -p ProtoALphaALph rpc get /chains/main/blocks/head/metadata 2>/dev/null)
|
||||||
|
|
||||||
if ! grep "$protocol_version" <<< $answ ; then
|
if ! grep "\"next_protocol\": \"$protocol_version\"" <<< $answ ; then
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -40,8 +40,8 @@ assert_propagation_level() {
|
|||||||
level=$1
|
level=$1
|
||||||
printf "\n\nAsserting all nodes have reached level %s\n" "$level"
|
printf "\n\nAsserting all nodes have reached level %s\n" "$level"
|
||||||
for client in "${client_instances[@]}"; do
|
for client in "${client_instances[@]}"; do
|
||||||
( $client rpc get /chains/main/blocks/head/header/shell/level \
|
( $client rpc get /chains/main/blocks/head/header/shell \
|
||||||
| assert_in_output "$level" ) \
|
| assert_in_output "\"level\": $level" ) \
|
||||||
|| exit 2
|
|| exit 2
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
@ -51,7 +51,7 @@ assert_protocol() {
|
|||||||
proto=$1
|
proto=$1
|
||||||
printf "\n\nAsserting protocol propagation\n"
|
printf "\n\nAsserting protocol propagation\n"
|
||||||
for client in "${client_instances[@]}"; do
|
for client in "${client_instances[@]}"; do
|
||||||
( $client rpc get /chains/main/blocks/head/metadata/next_protocol_hash | assert_in_output "$proto" ) \
|
( $client rpc get /chains/main/blocks/head/metadata | assert_in_output "\"next_protocol\": \"$proto\"" ) \
|
||||||
|| exit 2
|
|| exit 2
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
@ -27,8 +27,8 @@ let wait_for_operation_inclusion
|
|||||||
|
|
||||||
let fetch_predecessors block =
|
let fetch_predecessors block =
|
||||||
let rec loop acc block =
|
let rec loop acc block =
|
||||||
Block_services.Empty.Header.Shell.predecessor
|
Block_services.Empty.Header.shell_header
|
||||||
ctxt ~chain ~block:(`Hash (block, 0)) () >>=? fun predecessor ->
|
ctxt ~chain ~block:(`Hash (block, 0)) () >>=? fun { predecessor } ->
|
||||||
if Block_hash.Table.mem blocks predecessor then
|
if Block_hash.Table.mem blocks predecessor then
|
||||||
return acc
|
return acc
|
||||||
else
|
else
|
||||||
@ -48,8 +48,8 @@ let wait_for_operation_inclusion
|
|||||||
|
|
||||||
let process block =
|
let process block =
|
||||||
Shell_services.Blocks.hash ctxt ~chain ~block () >>=? fun hash ->
|
Shell_services.Blocks.hash ctxt ~chain ~block () >>=? fun hash ->
|
||||||
Shell_services.Blocks.Header.Shell.predecessor
|
Shell_services.Blocks.Header.shell_header
|
||||||
ctxt ~chain ~block () >>=? fun predecessor ->
|
ctxt ~chain ~block () >>=? fun { predecessor } ->
|
||||||
match Block_hash.Table.find blocks predecessor with
|
match Block_hash.Table.find blocks predecessor with
|
||||||
| Some (block_with_op, n) ->
|
| Some (block_with_op, n) ->
|
||||||
ctxt#answer
|
ctxt#answer
|
||||||
|
@ -56,7 +56,7 @@ let build_raw_rpc_directory
|
|||||||
|
|
||||||
(* block header *)
|
(* block header *)
|
||||||
|
|
||||||
register0 S.Header.header begin fun block () () ->
|
register0 S.header begin fun block () () ->
|
||||||
let chain_id = State.Block.chain_id block in
|
let chain_id = State.Block.chain_id block in
|
||||||
let hash = State.Block.hash block in
|
let hash = State.Block.hash block in
|
||||||
let header = State.Block.header block in
|
let header = State.Block.header block in
|
||||||
@ -70,30 +70,6 @@ let build_raw_rpc_directory
|
|||||||
register0 S.Header.shell_header begin fun block () () ->
|
register0 S.Header.shell_header begin fun block () () ->
|
||||||
return (State.Block.header block).shell
|
return (State.Block.header block).shell
|
||||||
end ;
|
end ;
|
||||||
register0 S.Header.Shell.level begin fun block () () ->
|
|
||||||
return (State.Block.header block).shell.level
|
|
||||||
end ;
|
|
||||||
register0 S.Header.Shell.protocol_level begin fun block () () ->
|
|
||||||
return (State.Block.header block).shell.proto_level
|
|
||||||
end ;
|
|
||||||
register0 S.Header.Shell.predecessor begin fun block () () ->
|
|
||||||
return (State.Block.header block).shell.predecessor
|
|
||||||
end ;
|
|
||||||
register0 S.Header.Shell.timestamp begin fun block () () ->
|
|
||||||
return (State.Block.header block).shell.timestamp
|
|
||||||
end ;
|
|
||||||
register0 S.Header.Shell.validation_passes begin fun block () () ->
|
|
||||||
return (State.Block.header block).shell.validation_passes
|
|
||||||
end ;
|
|
||||||
register0 S.Header.Shell.operations_hash begin fun block () () ->
|
|
||||||
return (State.Block.header block).shell.operations_hash
|
|
||||||
end ;
|
|
||||||
register0 S.Header.Shell.fitness begin fun block () () ->
|
|
||||||
return (State.Block.header block).shell.fitness
|
|
||||||
end ;
|
|
||||||
register0 S.Header.Shell.context_hash begin fun block () () ->
|
|
||||||
return (State.Block.header block).shell.context
|
|
||||||
end ;
|
|
||||||
register0 S.Header.protocol_data begin fun block () () ->
|
register0 S.Header.protocol_data begin fun block () () ->
|
||||||
let header = State.Block.header block in
|
let header = State.Block.header block in
|
||||||
return
|
return
|
||||||
@ -123,40 +99,9 @@ let build_raw_rpc_directory
|
|||||||
Next_proto.validation_passes ;
|
Next_proto.validation_passes ;
|
||||||
} in
|
} in
|
||||||
|
|
||||||
register0 S.Metadata.metadata begin fun block () () ->
|
register0 S.metadata begin fun block () () ->
|
||||||
metadata block
|
metadata block
|
||||||
end ;
|
end ;
|
||||||
register0 S.Metadata.protocol_data begin fun block () () ->
|
|
||||||
return
|
|
||||||
(Data_encoding.Binary.of_bytes_exn
|
|
||||||
Proto.block_header_metadata_encoding
|
|
||||||
(State.Block.metadata block))
|
|
||||||
end ;
|
|
||||||
register0 S.Metadata.protocol_hash begin fun _block () () ->
|
|
||||||
return Proto.hash
|
|
||||||
end ;
|
|
||||||
register0 S.Metadata.next_protocol_hash begin fun _block () () ->
|
|
||||||
return Next_proto.hash
|
|
||||||
end ;
|
|
||||||
register0 S.Metadata.test_chain_status begin fun block () () ->
|
|
||||||
State.Block.test_chain block >>= return
|
|
||||||
end ;
|
|
||||||
register0 S.Metadata.max_operations_ttl begin fun block () () ->
|
|
||||||
return (State.Block.max_operations_ttl block)
|
|
||||||
end ;
|
|
||||||
register0 S.Metadata.max_operation_data_length begin fun block () () ->
|
|
||||||
return (State.Block.max_operation_data_length block)
|
|
||||||
end ;
|
|
||||||
register0 S.Metadata.max_block_header_length begin fun _block () () ->
|
|
||||||
return (Next_proto.max_block_length) ;
|
|
||||||
end ;
|
|
||||||
register0 S.Metadata.operation_list_quota begin fun _block () () ->
|
|
||||||
return
|
|
||||||
(List.map
|
|
||||||
(fun { Tezos_protocol_environment_shell.max_size; max_op } ->
|
|
||||||
{ Tezos_shell_services.Block_services.max_size ; max_op } )
|
|
||||||
Next_proto.validation_passes)
|
|
||||||
end ;
|
|
||||||
|
|
||||||
(* operations *)
|
(* operations *)
|
||||||
|
|
||||||
|
@ -158,6 +158,24 @@ module type PROTO = sig
|
|||||||
(operation_data * operation_receipt) Data_encoding.t
|
(operation_data * operation_receipt) Data_encoding.t
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
type protocols = {
|
||||||
|
current_protocol: Protocol_hash.t ;
|
||||||
|
next_protocol: Protocol_hash.t ;
|
||||||
|
}
|
||||||
|
|
||||||
|
let raw_protocol_encoding =
|
||||||
|
conv
|
||||||
|
(fun { current_protocol ; next_protocol } ->
|
||||||
|
((current_protocol, next_protocol), ()))
|
||||||
|
(fun ((current_protocol, next_protocol), ()) ->
|
||||||
|
{ current_protocol ; next_protocol })
|
||||||
|
(merge_objs
|
||||||
|
(obj2
|
||||||
|
(req "protocol" Protocol_hash.encoding)
|
||||||
|
(req "next_protocol" Protocol_hash.encoding))
|
||||||
|
unit)
|
||||||
|
|
||||||
module Make(Proto : PROTO)(Next_proto : PROTO) = struct
|
module Make(Proto : PROTO)(Next_proto : PROTO) = struct
|
||||||
|
|
||||||
let protocol_hash = Protocol_hash.to_b58check Proto.hash
|
let protocol_hash = Protocol_hash.to_b58check Proto.hash
|
||||||
@ -310,17 +328,32 @@ module Make(Proto : PROTO)(Next_proto : PROTO) = struct
|
|||||||
~output: Block_hash.encoding
|
~output: Block_hash.encoding
|
||||||
RPC_path.(path / "hash")
|
RPC_path.(path / "hash")
|
||||||
|
|
||||||
|
let header =
|
||||||
|
RPC_service.get_service
|
||||||
|
~description:"The whole block header."
|
||||||
|
~query: RPC_query.empty
|
||||||
|
~output: block_header_encoding
|
||||||
|
RPC_path.(path / "header")
|
||||||
|
|
||||||
|
let metadata =
|
||||||
|
RPC_service.get_service
|
||||||
|
~description:"All the metadata associated to the block."
|
||||||
|
~query: RPC_query.empty
|
||||||
|
~output: block_metadata_encoding
|
||||||
|
RPC_path.(path / "metadata")
|
||||||
|
|
||||||
|
let protocols =
|
||||||
|
(* same endpoint than 'metadata' *)
|
||||||
|
RPC_service.get_service
|
||||||
|
~description:".. unexported ..."
|
||||||
|
~query: RPC_query.empty
|
||||||
|
~output: raw_protocol_encoding
|
||||||
|
RPC_path.(path / "metadata")
|
||||||
|
|
||||||
module Header = struct
|
module Header = struct
|
||||||
|
|
||||||
let path = RPC_path.(path / "header")
|
let path = RPC_path.(path / "header")
|
||||||
|
|
||||||
let header =
|
|
||||||
RPC_service.get_service
|
|
||||||
~description:"The whole block header."
|
|
||||||
~query: RPC_query.empty
|
|
||||||
~output: block_header_encoding
|
|
||||||
path
|
|
||||||
|
|
||||||
let shell_header =
|
let shell_header =
|
||||||
RPC_service.get_service
|
RPC_service.get_service
|
||||||
~description:"The shell-specific fragment of the block header."
|
~description:"The shell-specific fragment of the block header."
|
||||||
@ -340,142 +373,6 @@ module Make(Proto : PROTO)(Next_proto : PROTO) = struct
|
|||||||
Proto.block_header_data_encoding))
|
Proto.block_header_data_encoding))
|
||||||
RPC_path.(path / "protocol_data")
|
RPC_path.(path / "protocol_data")
|
||||||
|
|
||||||
module Shell = struct
|
|
||||||
|
|
||||||
let path = RPC_path.(path / "shell")
|
|
||||||
|
|
||||||
let level =
|
|
||||||
RPC_service.get_service
|
|
||||||
~description:"The block's level."
|
|
||||||
~query: RPC_query.empty
|
|
||||||
~output: int32
|
|
||||||
RPC_path.(path / "level")
|
|
||||||
|
|
||||||
let protocol_level =
|
|
||||||
RPC_service.get_service
|
|
||||||
~description:"The block's protocol level (modulo 256)."
|
|
||||||
~query: RPC_query.empty
|
|
||||||
~output: uint8
|
|
||||||
RPC_path.(path / "proto_level")
|
|
||||||
|
|
||||||
let predecessor =
|
|
||||||
RPC_service.get_service
|
|
||||||
~description:"The previous block's id."
|
|
||||||
~query: RPC_query.empty
|
|
||||||
~output: Block_hash.encoding
|
|
||||||
RPC_path.(path / "predecessor")
|
|
||||||
|
|
||||||
let timestamp =
|
|
||||||
RPC_service.get_service
|
|
||||||
~description:"The block's timestamp."
|
|
||||||
~query: RPC_query.empty
|
|
||||||
~output: Time.encoding
|
|
||||||
RPC_path.(path / "timestamp")
|
|
||||||
|
|
||||||
let validation_passes =
|
|
||||||
RPC_service.get_service
|
|
||||||
~description:"The number of validation passes for the block."
|
|
||||||
~query: RPC_query.empty
|
|
||||||
~output: uint8
|
|
||||||
RPC_path.(path / "validation_passes")
|
|
||||||
|
|
||||||
let operations_hash =
|
|
||||||
RPC_service.get_service
|
|
||||||
~description:"The hash of merkle tree of the operations included in the block."
|
|
||||||
~query: RPC_query.empty
|
|
||||||
~output: Operation_list_list_hash.encoding
|
|
||||||
RPC_path.(path / "operations_hash")
|
|
||||||
|
|
||||||
let fitness =
|
|
||||||
RPC_service.get_service
|
|
||||||
~description:"The block's fitness."
|
|
||||||
~query: RPC_query.empty
|
|
||||||
~output: Fitness.encoding
|
|
||||||
RPC_path.(path / "fitness")
|
|
||||||
|
|
||||||
let context_hash =
|
|
||||||
RPC_service.get_service
|
|
||||||
~description:"The hash of the resulting validation context."
|
|
||||||
~query: RPC_query.empty
|
|
||||||
~output: Context_hash.encoding
|
|
||||||
RPC_path.(path / "context_hash")
|
|
||||||
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
|
||||||
|
|
||||||
module Metadata = struct
|
|
||||||
|
|
||||||
let path = RPC_path.(path / "metadata")
|
|
||||||
|
|
||||||
let metadata =
|
|
||||||
RPC_service.get_service
|
|
||||||
~description:"All the metadata associated to the block."
|
|
||||||
~query: RPC_query.empty
|
|
||||||
~output: block_metadata_encoding
|
|
||||||
path
|
|
||||||
|
|
||||||
let protocol_data =
|
|
||||||
RPC_service.get_service
|
|
||||||
~description:"The protocol-specific metadata associated to the block."
|
|
||||||
~query: RPC_query.empty
|
|
||||||
~output:
|
|
||||||
(conv
|
|
||||||
(fun h -> ((), h)) (fun ((), h) -> h)
|
|
||||||
(merge_objs
|
|
||||||
(obj1 (req "protocol" (constant protocol_hash)))
|
|
||||||
Proto.block_header_metadata_encoding))
|
|
||||||
RPC_path.(path / "protocol_data")
|
|
||||||
|
|
||||||
let protocol_hash =
|
|
||||||
RPC_service.get_service
|
|
||||||
~description:"The protocol used to bake this block."
|
|
||||||
~query: RPC_query.empty
|
|
||||||
~output: Protocol_hash.encoding
|
|
||||||
RPC_path.(path / "protocol_hash")
|
|
||||||
|
|
||||||
let next_protocol_hash =
|
|
||||||
RPC_service.get_service
|
|
||||||
~description:"The protocol required to bake the next block."
|
|
||||||
~query: RPC_query.empty
|
|
||||||
~output: Protocol_hash.encoding
|
|
||||||
RPC_path.(path / "next_protocol_hash")
|
|
||||||
|
|
||||||
let test_chain_status =
|
|
||||||
RPC_service.get_service
|
|
||||||
~description:"The status of the associated test chain."
|
|
||||||
~query: RPC_query.empty
|
|
||||||
~output: Test_chain_status.encoding
|
|
||||||
RPC_path.(path / "test_chain_status")
|
|
||||||
|
|
||||||
let max_operations_ttl =
|
|
||||||
RPC_service.get_service
|
|
||||||
~description:"... FIXME ..."
|
|
||||||
~query: RPC_query.empty
|
|
||||||
~output: int31
|
|
||||||
RPC_path.(path / "max_operations_ttl")
|
|
||||||
|
|
||||||
let max_operation_data_length =
|
|
||||||
RPC_service.get_service
|
|
||||||
~description:"... FIXME ..."
|
|
||||||
~query: RPC_query.empty
|
|
||||||
~output: int31
|
|
||||||
RPC_path.(path / "max_operation_data_length")
|
|
||||||
|
|
||||||
let max_block_header_length =
|
|
||||||
RPC_service.get_service
|
|
||||||
~description:"... FIXME ..."
|
|
||||||
~query: RPC_query.empty
|
|
||||||
~output: int31
|
|
||||||
RPC_path.(path / "max_block_header_length")
|
|
||||||
|
|
||||||
let operation_list_quota =
|
|
||||||
RPC_service.get_service
|
|
||||||
~description:"... FIXME ..."
|
|
||||||
~query: RPC_query.empty
|
|
||||||
~output: (list operation_list_quota_encoding)
|
|
||||||
RPC_path.(path / "operation_list_quota")
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
module Operation = struct
|
module Operation = struct
|
||||||
@ -707,14 +604,25 @@ module Make(Proto : PROTO)(Next_proto : PROTO) = struct
|
|||||||
| `Hash (h, 0) -> return h
|
| `Hash (h, 0) -> return h
|
||||||
| _ -> f chain block () ()
|
| _ -> f chain block () ()
|
||||||
|
|
||||||
|
let header ctxt =
|
||||||
|
let f = make_call0 S.header ctxt in
|
||||||
|
fun ?(chain = `Main) ?(block = `Head 0) () ->
|
||||||
|
f chain block () ()
|
||||||
|
|
||||||
|
let metadata ctxt =
|
||||||
|
let f = make_call0 S.metadata ctxt in
|
||||||
|
fun ?(chain = `Main) ?(block = `Head 0) () ->
|
||||||
|
f chain block () ()
|
||||||
|
|
||||||
|
let protocols ctxt =
|
||||||
|
let f = make_call0 S.protocols ctxt in
|
||||||
|
fun ?(chain = `Main) ?(block = `Head 0) () ->
|
||||||
|
f chain block () ()
|
||||||
|
|
||||||
module Header = struct
|
module Header = struct
|
||||||
|
|
||||||
module S = S.Header
|
module S = S.Header
|
||||||
|
|
||||||
let header ctxt =
|
|
||||||
let f = make_call0 S.header ctxt in
|
|
||||||
fun ?(chain = `Main) ?(block = `Head 0) () ->
|
|
||||||
f chain block () ()
|
|
||||||
let shell_header ctxt =
|
let shell_header ctxt =
|
||||||
let f = make_call0 S.shell_header ctxt in
|
let f = make_call0 S.shell_header ctxt in
|
||||||
fun ?(chain = `Main) ?(block = `Head 0) () ->
|
fun ?(chain = `Main) ?(block = `Head 0) () ->
|
||||||
@ -724,103 +632,6 @@ module Make(Proto : PROTO)(Next_proto : PROTO) = struct
|
|||||||
fun ?(chain = `Main) ?(block = `Head 0) () ->
|
fun ?(chain = `Main) ?(block = `Head 0) () ->
|
||||||
f chain block () ()
|
f chain block () ()
|
||||||
|
|
||||||
module Shell = struct
|
|
||||||
|
|
||||||
module S = S.Shell
|
|
||||||
|
|
||||||
let level ctxt =
|
|
||||||
let f = make_call0 S.level ctxt in
|
|
||||||
fun ?(chain = `Main) ?(block = `Head 0) () ->
|
|
||||||
f chain block () ()
|
|
||||||
|
|
||||||
let protocol_level ctxt =
|
|
||||||
let f = make_call0 S.protocol_level ctxt in
|
|
||||||
fun ?(chain = `Main) ?(block = `Head 0) () ->
|
|
||||||
f chain block () ()
|
|
||||||
|
|
||||||
let predecessor ctxt =
|
|
||||||
let f = make_call0 S.predecessor ctxt in
|
|
||||||
fun ?(chain = `Main) ?(block = `Head 0) () ->
|
|
||||||
f chain block () ()
|
|
||||||
|
|
||||||
let timestamp ctxt =
|
|
||||||
let f = make_call0 S.timestamp ctxt in
|
|
||||||
fun ?(chain = `Main) ?(block = `Head 0) () ->
|
|
||||||
f chain block () ()
|
|
||||||
|
|
||||||
let validation_passes ctxt =
|
|
||||||
let f = make_call0 S.validation_passes ctxt in
|
|
||||||
fun ?(chain = `Main) ?(block = `Head 0) () ->
|
|
||||||
f chain block () ()
|
|
||||||
|
|
||||||
let operations_hash ctxt =
|
|
||||||
let f = make_call0 S.operations_hash ctxt in
|
|
||||||
fun ?(chain = `Main) ?(block = `Head 0) () ->
|
|
||||||
f chain block () ()
|
|
||||||
|
|
||||||
let fitness ctxt =
|
|
||||||
let f = make_call0 S.fitness ctxt in
|
|
||||||
fun ?(chain = `Main) ?(block = `Head 0) () ->
|
|
||||||
f chain block () ()
|
|
||||||
|
|
||||||
let context_hash ctxt =
|
|
||||||
let f = make_call0 S.context_hash ctxt in
|
|
||||||
fun ?(chain = `Main) ?(block = `Head 0) () ->
|
|
||||||
f chain block () ()
|
|
||||||
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
|
||||||
|
|
||||||
module Metadata = struct
|
|
||||||
|
|
||||||
module S = S.Metadata
|
|
||||||
|
|
||||||
let metadata ctxt =
|
|
||||||
let f = make_call0 S.metadata ctxt in
|
|
||||||
fun ?(chain = `Main) ?(block = `Head 0) () ->
|
|
||||||
f chain block () ()
|
|
||||||
|
|
||||||
let protocol_data ctxt =
|
|
||||||
let f = make_call0 S.protocol_data ctxt in
|
|
||||||
fun ?(chain = `Main) ?(block = `Head 0) () ->
|
|
||||||
f chain block () ()
|
|
||||||
|
|
||||||
let protocol_hash ctxt =
|
|
||||||
let f = make_call0 S.protocol_hash ctxt in
|
|
||||||
fun ?(chain = `Main) ?(block = `Head 0) () ->
|
|
||||||
f chain block () ()
|
|
||||||
|
|
||||||
let next_protocol_hash ctxt =
|
|
||||||
let f = make_call0 S.next_protocol_hash ctxt in
|
|
||||||
fun ?(chain = `Main) ?(block = `Head 0) () ->
|
|
||||||
f chain block () ()
|
|
||||||
|
|
||||||
let test_chain_status ctxt =
|
|
||||||
let f = make_call0 S.test_chain_status ctxt in
|
|
||||||
fun ?(chain = `Main) ?(block = `Head 0) () ->
|
|
||||||
f chain block () ()
|
|
||||||
|
|
||||||
let max_operations_ttl ctxt =
|
|
||||||
let f = make_call0 S.max_operations_ttl ctxt in
|
|
||||||
fun ?(chain = `Main) ?(block = `Head 0) () ->
|
|
||||||
f chain block () ()
|
|
||||||
|
|
||||||
let max_operation_data_length ctxt =
|
|
||||||
let f = make_call0 S.max_operation_data_length ctxt in
|
|
||||||
fun ?(chain = `Main) ?(block = `Head 0) () ->
|
|
||||||
f chain block () ()
|
|
||||||
|
|
||||||
let max_block_header_length ctxt =
|
|
||||||
let f = make_call0 S.max_block_header_length ctxt in
|
|
||||||
fun ?(chain = `Main) ?(block = `Head 0) () ->
|
|
||||||
f chain block () ()
|
|
||||||
|
|
||||||
let max_operation_list_length ctxt =
|
|
||||||
let f = make_call0 S.operation_list_quota ctxt in
|
|
||||||
fun ?(chain = `Main) ?(block = `Head 0) () ->
|
|
||||||
f chain block () ()
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
module Operation = struct
|
module Operation = struct
|
||||||
@ -961,3 +772,5 @@ let () =
|
|||||||
| Json_schema.Duplicate_definition _ ) as exn ->
|
| Json_schema.Duplicate_definition _ ) as exn ->
|
||||||
Some (Format.asprintf "%a" (fun ppf -> Json_schema.print_error ppf) exn)
|
Some (Format.asprintf "%a" (fun ppf -> Json_schema.print_error ppf) exn)
|
||||||
| _ -> None)
|
| _ -> None)
|
||||||
|
|
||||||
|
let protocols = Empty.protocols
|
||||||
|
@ -120,11 +120,16 @@ module Make(Proto : PROTO)(Next_proto : PROTO) : sig
|
|||||||
#simple -> ?chain:chain -> ?block:block ->
|
#simple -> ?chain:chain -> ?block:block ->
|
||||||
unit -> Block_hash.t tzresult Lwt.t
|
unit -> Block_hash.t tzresult Lwt.t
|
||||||
|
|
||||||
|
val header:
|
||||||
|
#simple -> ?chain:chain -> ?block:block ->
|
||||||
|
unit -> block_header tzresult Lwt.t
|
||||||
|
|
||||||
|
val metadata:
|
||||||
|
#simple -> ?chain:chain -> ?block:block ->
|
||||||
|
unit -> block_metadata tzresult Lwt.t
|
||||||
|
|
||||||
module Header : sig
|
module Header : sig
|
||||||
|
|
||||||
val header:
|
|
||||||
#simple -> ?chain:chain -> ?block:block ->
|
|
||||||
unit -> block_header tzresult Lwt.t
|
|
||||||
val shell_header:
|
val shell_header:
|
||||||
#simple -> ?chain:chain -> ?block:block ->
|
#simple -> ?chain:chain -> ?block:block ->
|
||||||
unit -> Block_header.shell_header tzresult Lwt.t
|
unit -> Block_header.shell_header tzresult Lwt.t
|
||||||
@ -132,67 +137,6 @@ module Make(Proto : PROTO)(Next_proto : PROTO) : sig
|
|||||||
#simple -> ?chain:chain -> ?block:block ->
|
#simple -> ?chain:chain -> ?block:block ->
|
||||||
unit -> Proto.block_header_data tzresult Lwt.t
|
unit -> Proto.block_header_data tzresult Lwt.t
|
||||||
|
|
||||||
module Shell : sig
|
|
||||||
|
|
||||||
val level:
|
|
||||||
#simple -> ?chain:chain -> ?block:block ->
|
|
||||||
unit -> Int32.t tzresult Lwt.t
|
|
||||||
val protocol_level:
|
|
||||||
#simple -> ?chain:chain -> ?block:block ->
|
|
||||||
unit -> int tzresult Lwt.t
|
|
||||||
val predecessor:
|
|
||||||
#simple -> ?chain:chain -> ?block:block ->
|
|
||||||
unit -> Block_hash.t tzresult Lwt.t
|
|
||||||
val timestamp:
|
|
||||||
#simple -> ?chain:chain -> ?block:block ->
|
|
||||||
unit -> Time.t tzresult Lwt.t
|
|
||||||
val validation_passes:
|
|
||||||
#simple -> ?chain:chain -> ?block:block ->
|
|
||||||
unit -> int tzresult Lwt.t
|
|
||||||
val operations_hash:
|
|
||||||
#simple -> ?chain:chain -> ?block:block ->
|
|
||||||
unit -> Operation_list_list_hash.t tzresult Lwt.t
|
|
||||||
val fitness:
|
|
||||||
#simple -> ?chain:chain -> ?block:block ->
|
|
||||||
unit -> Fitness.t tzresult Lwt.t
|
|
||||||
val context_hash:
|
|
||||||
#simple -> ?chain:chain -> ?block:block ->
|
|
||||||
unit -> Context_hash.t tzresult Lwt.t
|
|
||||||
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
|
||||||
|
|
||||||
module Metadata : sig
|
|
||||||
|
|
||||||
val metadata:
|
|
||||||
#simple -> ?chain:chain -> ?block:block ->
|
|
||||||
unit -> block_metadata tzresult Lwt.t
|
|
||||||
val protocol_data:
|
|
||||||
#simple -> ?chain:chain -> ?block:block ->
|
|
||||||
unit -> Proto.block_header_metadata tzresult Lwt.t
|
|
||||||
val protocol_hash:
|
|
||||||
#simple -> ?chain:chain -> ?block:block ->
|
|
||||||
unit -> Protocol_hash.t tzresult Lwt.t
|
|
||||||
val next_protocol_hash:
|
|
||||||
#simple -> ?chain:chain -> ?block:block ->
|
|
||||||
unit -> Protocol_hash.t tzresult Lwt.t
|
|
||||||
val test_chain_status:
|
|
||||||
#simple -> ?chain:chain -> ?block:block ->
|
|
||||||
unit -> Test_chain_status.t tzresult Lwt.t
|
|
||||||
val max_operations_ttl:
|
|
||||||
#simple -> ?chain:chain -> ?block:block ->
|
|
||||||
unit -> int tzresult Lwt.t
|
|
||||||
val max_operation_data_length:
|
|
||||||
#simple -> ?chain:chain -> ?block:block ->
|
|
||||||
unit -> int tzresult Lwt.t
|
|
||||||
val max_block_header_length:
|
|
||||||
#simple -> ?chain:chain -> ?block:block ->
|
|
||||||
unit -> int tzresult Lwt.t
|
|
||||||
val max_operation_list_length:
|
|
||||||
#simple -> ?chain:chain -> ?block:block ->
|
|
||||||
unit -> operation_list_quota list tzresult Lwt.t
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
module Operation : sig
|
module Operation : sig
|
||||||
@ -280,12 +224,17 @@ module Make(Proto : PROTO)(Next_proto : PROTO) : sig
|
|||||||
prefix, unit, unit,
|
prefix, unit, unit,
|
||||||
block_info) RPC_service.t
|
block_info) RPC_service.t
|
||||||
|
|
||||||
module Header : sig
|
val header:
|
||||||
|
([ `GET ], prefix,
|
||||||
|
prefix, unit, unit,
|
||||||
|
block_header) RPC_service.t
|
||||||
|
|
||||||
val header:
|
val metadata:
|
||||||
([ `GET ], prefix,
|
([ `GET ], prefix,
|
||||||
prefix, unit, unit,
|
prefix, unit, unit,
|
||||||
block_header) RPC_service.t
|
block_metadata) RPC_service.t
|
||||||
|
|
||||||
|
module Header : sig
|
||||||
|
|
||||||
val shell_header:
|
val shell_header:
|
||||||
([ `GET ], prefix,
|
([ `GET ], prefix,
|
||||||
@ -297,99 +246,6 @@ module Make(Proto : PROTO)(Next_proto : PROTO) : sig
|
|||||||
prefix, unit, unit,
|
prefix, unit, unit,
|
||||||
Proto.block_header_data) RPC_service.t
|
Proto.block_header_data) RPC_service.t
|
||||||
|
|
||||||
module Shell : sig
|
|
||||||
|
|
||||||
val level:
|
|
||||||
([ `GET ], prefix,
|
|
||||||
prefix, unit, unit,
|
|
||||||
Int32.t) RPC_service.t
|
|
||||||
|
|
||||||
val protocol_level:
|
|
||||||
([ `GET ], prefix,
|
|
||||||
prefix, unit, unit,
|
|
||||||
int) RPC_service.t
|
|
||||||
|
|
||||||
val predecessor:
|
|
||||||
([ `GET ], prefix,
|
|
||||||
prefix, unit, unit,
|
|
||||||
Block_hash.t) RPC_service.t
|
|
||||||
|
|
||||||
val timestamp:
|
|
||||||
([ `GET ], prefix,
|
|
||||||
prefix, unit, unit,
|
|
||||||
Time.t) RPC_service.t
|
|
||||||
|
|
||||||
val validation_passes:
|
|
||||||
([ `GET ], prefix,
|
|
||||||
prefix, unit, unit,
|
|
||||||
int) RPC_service.t
|
|
||||||
|
|
||||||
val operations_hash:
|
|
||||||
([ `GET ], prefix,
|
|
||||||
prefix, unit, unit,
|
|
||||||
Operation_list_list_hash.t) RPC_service.t
|
|
||||||
|
|
||||||
val fitness:
|
|
||||||
([ `GET ], prefix,
|
|
||||||
prefix, unit, unit,
|
|
||||||
Fitness.t) RPC_service.t
|
|
||||||
|
|
||||||
val context_hash:
|
|
||||||
([ `GET ], prefix,
|
|
||||||
prefix, unit, unit,
|
|
||||||
Context_hash.t) RPC_service.t
|
|
||||||
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
|
||||||
|
|
||||||
module Metadata : sig
|
|
||||||
|
|
||||||
val metadata:
|
|
||||||
([ `GET ], prefix,
|
|
||||||
prefix, unit, unit,
|
|
||||||
block_metadata) RPC_service.t
|
|
||||||
|
|
||||||
val protocol_data:
|
|
||||||
([ `GET ], prefix,
|
|
||||||
prefix, unit, unit,
|
|
||||||
Proto.block_header_metadata) RPC_service.t
|
|
||||||
|
|
||||||
val protocol_hash:
|
|
||||||
([ `GET ], prefix,
|
|
||||||
prefix, unit, unit,
|
|
||||||
Protocol_hash.t) RPC_service.t
|
|
||||||
|
|
||||||
val next_protocol_hash:
|
|
||||||
([ `GET ], prefix,
|
|
||||||
prefix, unit, unit,
|
|
||||||
Protocol_hash.t) RPC_service.t
|
|
||||||
|
|
||||||
val test_chain_status:
|
|
||||||
([ `GET ], prefix,
|
|
||||||
prefix, unit, unit,
|
|
||||||
Test_chain_status.t) RPC_service.t
|
|
||||||
|
|
||||||
val max_operations_ttl:
|
|
||||||
([ `GET ], prefix,
|
|
||||||
prefix, unit, unit,
|
|
||||||
int) RPC_service.t
|
|
||||||
|
|
||||||
val max_operation_data_length:
|
|
||||||
([ `GET ], prefix,
|
|
||||||
prefix, unit, unit,
|
|
||||||
int) RPC_service.t
|
|
||||||
|
|
||||||
val max_block_header_length:
|
|
||||||
([ `GET ], prefix,
|
|
||||||
prefix, unit, unit,
|
|
||||||
int) RPC_service.t
|
|
||||||
|
|
||||||
val operation_list_quota:
|
|
||||||
([ `GET ], prefix,
|
|
||||||
prefix, unit, unit,
|
|
||||||
operation_list_quota list) RPC_service.t
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
module Operation : sig
|
module Operation : sig
|
||||||
@ -482,3 +338,12 @@ end
|
|||||||
|
|
||||||
module Fake_protocol : PROTO
|
module Fake_protocol : PROTO
|
||||||
module Empty : (module type of Make(Fake_protocol)(Fake_protocol))
|
module Empty : (module type of Make(Fake_protocol)(Fake_protocol))
|
||||||
|
|
||||||
|
type protocols = {
|
||||||
|
current_protocol: Protocol_hash.t ;
|
||||||
|
next_protocol: Protocol_hash.t ;
|
||||||
|
}
|
||||||
|
|
||||||
|
val protocols:
|
||||||
|
#RPC_context.simple -> ?chain:chain -> ?block:block ->
|
||||||
|
unit -> protocols tzresult Lwt.t
|
||||||
|
@ -190,6 +190,13 @@ module Blocks = struct
|
|||||||
|
|
||||||
include Block_services.Empty
|
include Block_services.Empty
|
||||||
|
|
||||||
|
type protocols = Block_services.protocols = {
|
||||||
|
current_protocol: Protocol_hash.t ;
|
||||||
|
next_protocol: Protocol_hash.t ;
|
||||||
|
}
|
||||||
|
|
||||||
|
let protocols = Block_services.protocols
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
module Invalid_blocks = struct
|
module Invalid_blocks = struct
|
||||||
|
@ -56,6 +56,15 @@ module Blocks : sig
|
|||||||
|
|
||||||
include (module type of Block_services.Empty)
|
include (module type of Block_services.Empty)
|
||||||
|
|
||||||
|
type protocols = {
|
||||||
|
current_protocol: Protocol_hash.t ;
|
||||||
|
next_protocol: Protocol_hash.t ;
|
||||||
|
}
|
||||||
|
|
||||||
|
val protocols:
|
||||||
|
#RPC_context.simple -> ?chain:chain -> ?block:Block_services.block ->
|
||||||
|
unit -> protocols tzresult Lwt.t
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
module Invalid_blocks : sig
|
module Invalid_blocks : sig
|
||||||
|
@ -25,11 +25,11 @@ let info cctxt ?(chain = `Main) block =
|
|||||||
Shell_services.Chain.chain_id cctxt ~chain () >>=? fun chain_id ->
|
Shell_services.Chain.chain_id cctxt ~chain () >>=? fun chain_id ->
|
||||||
Shell_services.Blocks.hash cctxt ~chain ~block () >>=? fun hash ->
|
Shell_services.Blocks.hash cctxt ~chain ~block () >>=? fun hash ->
|
||||||
Shell_services.Blocks.Header.shell_header cctxt ~chain ~block () >>=? fun header ->
|
Shell_services.Blocks.Header.shell_header cctxt ~chain ~block () >>=? fun header ->
|
||||||
Shell_services.Blocks.Metadata.next_protocol_hash
|
Shell_services.Blocks.protocols
|
||||||
cctxt ~chain ~block () >>=? fun next_protocol ->
|
cctxt ~chain ~block () >>=? fun { current_protocol = protocol ;
|
||||||
Shell_services.Blocks.Metadata.protocol_hash
|
next_protocol } ->
|
||||||
cctxt ~chain ~block () >>=? fun protocol ->
|
Alpha_block_services.metadata cctxt
|
||||||
Alpha_block_services.Metadata.protocol_data cctxt ~chain ~block () >>=? fun { level } ->
|
~chain ~block () >>=? fun { protocol_data = { level } } ->
|
||||||
let { Tezos_base.Block_header.predecessor ; fitness ; timestamp ; _ } = header in
|
let { Tezos_base.Block_header.predecessor ; fitness ; timestamp ; _ } = header in
|
||||||
return { hash ; chain_id ; predecessor ; fitness ;
|
return { hash ; chain_id ; predecessor ; fitness ;
|
||||||
timestamp ; protocol ; next_protocol ; level }
|
timestamp ; protocol ; next_protocol ; level }
|
||||||
@ -50,8 +50,8 @@ let monitor_heads cctxt ?next_protocols chain =
|
|||||||
|
|
||||||
let blocks_from_current_cycle cctxt ?(chain = `Main) block ?(offset = 0l) () =
|
let blocks_from_current_cycle cctxt ?(chain = `Main) block ?(offset = 0l) () =
|
||||||
Shell_services.Blocks.hash cctxt ~chain ~block () >>=? fun hash ->
|
Shell_services.Blocks.hash cctxt ~chain ~block () >>=? fun hash ->
|
||||||
Alpha_block_services.Metadata.protocol_data
|
Alpha_block_services.metadata
|
||||||
cctxt ~chain ~block () >>=? fun { level } ->
|
cctxt ~chain ~block () >>=? fun { protocol_data = { level } } ->
|
||||||
Alpha_services.Helpers.levels_in_current_cycle
|
Alpha_services.Helpers.levels_in_current_cycle
|
||||||
cctxt ~offset (chain, block) >>=? fun (first, last) ->
|
cctxt ~offset (chain, block) >>=? 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
|
||||||
|
@ -130,8 +130,8 @@ let forge_endorsement (cctxt : #Proto_alpha.full)
|
|||||||
?(chain = `Main) block
|
?(chain = `Main) block
|
||||||
~src_sk ?slots src_pk =
|
~src_sk ?slots src_pk =
|
||||||
let src_pkh = Signature.Public_key.hash src_pk in
|
let src_pkh = Signature.Public_key.hash src_pk in
|
||||||
Alpha_block_services.Metadata.protocol_data
|
Alpha_block_services.metadata cctxt
|
||||||
cctxt ~chain ~block () >>=? fun { level = { level } } ->
|
~chain ~block () >>=? fun { protocol_data = { level = { level } } } ->
|
||||||
begin
|
begin
|
||||||
match slots with
|
match slots with
|
||||||
| Some slots -> return slots
|
| Some slots -> return slots
|
||||||
|
@ -410,8 +410,8 @@ let get_unrevealed_nonces
|
|||||||
Client_baking_nonces.find cctxt hash >>=? function
|
Client_baking_nonces.find cctxt hash >>=? function
|
||||||
| None -> return None
|
| None -> return None
|
||||||
| Some nonce ->
|
| Some nonce ->
|
||||||
Alpha_block_services.Metadata.protocol_data
|
Alpha_block_services.metadata
|
||||||
cctxt ~chain ~block:(`Hash (hash, 0)) () >>=? fun { level } ->
|
cctxt ~chain ~block:(`Hash (hash, 0)) () >>=? fun { protocol_data = { level } } ->
|
||||||
if force then
|
if force then
|
||||||
return (Some (hash, (level.level, nonce)))
|
return (Some (hash, (level.level, nonce)))
|
||||||
else
|
else
|
||||||
|
@ -147,8 +147,8 @@ let init ?exe ?vote ?rpc_port () =
|
|||||||
return (pid, hash)
|
return (pid, hash)
|
||||||
|
|
||||||
let level (chain, block) =
|
let level (chain, block) =
|
||||||
Alpha_block_services.Metadata.protocol_data
|
Alpha_block_services.metadata
|
||||||
!rpc_ctxt ~chain ~block () >>=? fun { level } ->
|
!rpc_ctxt ~chain ~block () >>=? fun { protocol_data = { level } } ->
|
||||||
return level
|
return level
|
||||||
|
|
||||||
let rpc_raw_context block path depth =
|
let rpc_raw_context block path depth =
|
||||||
@ -336,8 +336,8 @@ module Protocol = struct
|
|||||||
open Account
|
open Account
|
||||||
|
|
||||||
let voting_period_kind ?(block = `Head 0) () =
|
let voting_period_kind ?(block = `Head 0) () =
|
||||||
Alpha_block_services.Metadata.protocol_data
|
Alpha_block_services.metadata
|
||||||
!rpc_ctxt ~chain:`Main ~block () >>=? fun { voting_period_kind } ->
|
!rpc_ctxt ~chain:`Main ~block () >>=? fun { protocol_data = { voting_period_kind } } ->
|
||||||
return voting_period_kind
|
return voting_period_kind
|
||||||
|
|
||||||
let proposals ?(block = `Head 0) ~src:({ pkh; sk } : Account.t) proposals =
|
let proposals ?(block = `Head 0) ~src:({ pkh; sk } : Account.t) proposals =
|
||||||
@ -488,17 +488,17 @@ module Assert = struct
|
|||||||
end
|
end
|
||||||
|
|
||||||
let check_protocol ?msg ~block h =
|
let check_protocol ?msg ~block h =
|
||||||
Alpha_block_services.Metadata.next_protocol_hash
|
Block_services.protocols
|
||||||
!rpc_ctxt ~block () >>=? fun block_proto ->
|
!rpc_ctxt ~block () >>=? fun { next_protocol } ->
|
||||||
return @@ equal
|
return @@ equal
|
||||||
?msg
|
?msg
|
||||||
~prn:Protocol_hash.to_b58check
|
~prn:Protocol_hash.to_b58check
|
||||||
~eq:Protocol_hash.equal
|
~eq:Protocol_hash.equal
|
||||||
block_proto h
|
next_protocol h
|
||||||
|
|
||||||
let check_voting_period_kind ?msg ~block kind =
|
let check_voting_period_kind ?msg ~block kind =
|
||||||
Alpha_block_services.Metadata.protocol_data
|
Alpha_block_services.metadata
|
||||||
!rpc_ctxt ~chain:`Main ~block () >>=? fun { voting_period_kind } ->
|
!rpc_ctxt ~chain:`Main ~block () >>=? fun { protocol_data = { voting_period_kind } } ->
|
||||||
return @@ equal
|
return @@ equal
|
||||||
?msg
|
?msg
|
||||||
voting_period_kind
|
voting_period_kind
|
||||||
@ -550,8 +550,8 @@ module Endorse = struct
|
|||||||
src_sk
|
src_sk
|
||||||
slot =
|
slot =
|
||||||
Shell_services.Blocks.hash !rpc_ctxt ~block () >>=? fun hash ->
|
Shell_services.Blocks.hash !rpc_ctxt ~block () >>=? fun hash ->
|
||||||
Alpha_block_services.Metadata.protocol_data
|
Alpha_block_services.metadata
|
||||||
!rpc_ctxt ~chain:`Main ~block () >>=? fun { level } ->
|
!rpc_ctxt ~chain:`Main ~block () >>=? fun { protocol_data = { level } } ->
|
||||||
let level = level.level in
|
let level = level.level in
|
||||||
let shell = { Tezos_base.Operation.branch = hash } in
|
let shell = { Tezos_base.Operation.branch = hash } in
|
||||||
let contents =
|
let contents =
|
||||||
@ -572,8 +572,8 @@ module Endorse = struct
|
|||||||
?slot
|
?slot
|
||||||
(contract : Account.t)
|
(contract : Account.t)
|
||||||
block =
|
block =
|
||||||
Alpha_block_services.Metadata.protocol_data
|
Alpha_block_services.metadata
|
||||||
!rpc_ctxt ~chain:`Main ~block () >>=? fun { level } ->
|
!rpc_ctxt ~chain:`Main ~block () >>=? fun { protocol_data = { level } } ->
|
||||||
let level = level.level in
|
let level = level.level in
|
||||||
begin
|
begin
|
||||||
match slot with
|
match slot with
|
||||||
@ -601,8 +601,8 @@ module Endorse = struct
|
|||||||
| _ -> () in
|
| _ -> () in
|
||||||
let { Account.b1 ; b2 ; b3 ; b4 ; b5 } = Account.bootstrap_accounts in
|
let { Account.b1 ; b2 ; b3 ; b4 ; b5 } = Account.bootstrap_accounts in
|
||||||
let result = Array.make 32 b1 in
|
let result = Array.make 32 b1 in
|
||||||
Alpha_block_services.Metadata.protocol_data
|
Alpha_block_services.metadata
|
||||||
!rpc_ctxt ~chain:`Main ~block () >>=? fun { level } ->
|
!rpc_ctxt ~chain:`Main ~block () >>=? fun { protocol_data = { level } } ->
|
||||||
let level = level.level in
|
let level = level.level in
|
||||||
get_endorser_list result b1 level block >>=? fun () ->
|
get_endorser_list result b1 level block >>=? fun () ->
|
||||||
get_endorser_list result b2 level block >>=? fun () ->
|
get_endorser_list result b2 level block >>=? fun () ->
|
||||||
@ -613,8 +613,8 @@ module Endorse = struct
|
|||||||
|
|
||||||
let endorsement_rights
|
let endorsement_rights
|
||||||
(contract : Account.t) block =
|
(contract : Account.t) block =
|
||||||
Alpha_block_services.Metadata.protocol_data
|
Alpha_block_services.metadata
|
||||||
!rpc_ctxt ~chain:`Main ~block () >>=? fun { level } ->
|
!rpc_ctxt ~chain:`Main ~block () >>=? fun { protocol_data = { level } } ->
|
||||||
let level = level.level in
|
let level = level.level in
|
||||||
let delegate = contract.pkh in
|
let delegate = contract.pkh in
|
||||||
Alpha_services.Delegate.Endorsing_rights.get
|
Alpha_services.Delegate.Endorsing_rights.get
|
||||||
@ -628,8 +628,8 @@ module Endorse = struct
|
|||||||
end
|
end
|
||||||
|
|
||||||
let display_level block =
|
let display_level block =
|
||||||
Alpha_block_services.Metadata.protocol_data
|
Alpha_block_services.metadata
|
||||||
!rpc_ctxt ~chain:`Main ~block () >>=? fun { level } ->
|
!rpc_ctxt ~chain:`Main ~block () >>=? fun { protocol_data = { level } } ->
|
||||||
Format.eprintf "Level: %a@." Level.pp_full level ;
|
Format.eprintf "Level: %a@." Level.pp_full level ;
|
||||||
return ()
|
return ()
|
||||||
|
|
||||||
|
@ -56,8 +56,8 @@ let commands () =
|
|||||||
(switch ~doc:"output time in seconds" ~short:'s' ~long:"seconds" ()))
|
(switch ~doc:"output time in seconds" ~short:'s' ~long:"seconds" ()))
|
||||||
(fixed [ "get" ; "timestamp" ])
|
(fixed [ "get" ; "timestamp" ])
|
||||||
begin fun seconds (cctxt : Proto_alpha.full) ->
|
begin fun seconds (cctxt : Proto_alpha.full) ->
|
||||||
Shell_services.Blocks.Header.Shell.timestamp
|
Shell_services.Blocks.Header.shell_header
|
||||||
cctxt ~block:cctxt#block () >>=? fun v ->
|
cctxt ~block:cctxt#block () >>=? fun { timestamp = v } ->
|
||||||
begin
|
begin
|
||||||
if seconds
|
if seconds
|
||||||
then cctxt#message "%Ld" (Time.to_seconds v)
|
then cctxt#message "%Ld" (Time.to_seconds v)
|
||||||
|
Loading…
Reference in New Issue
Block a user