Alpha: rename apply_operation_result to apply_results

This commit is contained in:
Marco Stronati 2018-06-26 11:24:14 +02:00 committed by Benjamin Canou
parent 3d88707eb8
commit 91d497fd4a
15 changed files with 33 additions and 33 deletions

View File

@ -70,8 +70,8 @@ let reveal cctxt
Injection.inject_operation cctxt ~chain ~block ?confirmations
?dry_run
?branch ~src_sk contents >>=? fun (oph, op, result) ->
match Apply_operation_result.pack_contents_list op result with
| Apply_operation_result.Single_and_result
match Apply_results.pack_contents_list op result with
| Apply_results.Single_and_result
(Manager_operation _ as op, result) ->
return (oph, op, result)
end
@ -320,8 +320,8 @@ let inject_activate_operation
Tez.pp balance >>= fun () ->
return_unit
end >>=? fun () ->
match Apply_operation_result.pack_contents_list op result with
| Apply_operation_result.Single_and_result
match Apply_results.pack_contents_list op result with
| Apply_results.Single_and_result
(Activate_account _ as op, result) ->
return (oph, op, result)

View File

@ -9,7 +9,7 @@
open Proto_alpha
open Alpha_context
open Apply_operation_result
open Apply_results
let get_branch (rpc_config: #Proto_alpha.full)
~chain ~(block : Block_services.block) branch =
@ -64,8 +64,8 @@ let preapply (type t)
| [(Operation_data op', Operation_metadata result)] -> begin
match Operation.equal
op { shell = { branch } ; protocol_data = op' },
Apply_operation_result.kind_equal_list contents result.contents with
| Some Operation.Eq, Some Apply_operation_result.Eq ->
Apply_results.kind_equal_list contents result.contents with
| Some Operation.Eq, Some Apply_results.Eq ->
return ((oph, op, result) : t preapply_result)
| _ -> failwith "Unexpected result"
end
@ -84,8 +84,8 @@ let simulate (type t)
| (Operation_data op', Operation_metadata result) -> begin
match Operation.equal
op { shell = { branch } ; protocol_data = op' },
Apply_operation_result.kind_equal_list contents result.contents with
| Some Operation.Eq, Some Apply_operation_result.Eq ->
Apply_results.kind_equal_list contents result.contents with
| Some Operation.Eq, Some Apply_results.Eq ->
return ((oph, op, result) : t preapply_result)
| _ -> failwith "Unexpected result"
end
@ -388,9 +388,9 @@ let inject_operation
| No_operation_metadata ->
failwith "Internal error: unexpected receipt."
| Operation_metadata receipt ->
match Apply_operation_result.kind_equal_list contents receipt.contents
match Apply_results.kind_equal_list contents receipt.contents
with
| Some Apply_operation_result.Eq ->
| Some Apply_results.Eq ->
return (receipt : kind operation_metadata)
| None -> failwith "Internal error: unexpected receipt."
end >>=? fun result ->

View File

@ -9,7 +9,7 @@
open Proto_alpha
open Alpha_context
open Apply_operation_result
open Apply_results
type 'kind preapply_result =
Operation_hash.t * 'kind operation * 'kind operation_metadata

View File

@ -9,7 +9,7 @@
open Proto_alpha
open Alpha_context
open Apply_operation_result
open Apply_results
let pp_manager_operation_content
(type kind) source internal pp_result
@ -391,7 +391,7 @@ let pp_operation_result ppf
(op, res : 'kind contents_list * 'kind contents_result_list) =
Format.fprintf ppf "@[<v 0>" ;
let contents_and_result_list =
Apply_operation_result.pack_contents_list op res in
Apply_results.pack_contents_list op res in
pp_contents_and_result_list ppf contents_and_result_list ;
Format.fprintf ppf "@]@."

View File

@ -15,4 +15,4 @@ val pp_internal_operation:
val pp_operation_result:
Format.formatter ->
('kind contents_list * 'kind Apply_operation_result.contents_result_list) -> unit
('kind contents_list * 'kind Apply_results.contents_result_list) -> unit

View File

@ -63,7 +63,7 @@ let process_endorsements (cctxt : #Proto_alpha.full) state ~chain
iter_s (fun { Alpha_block_services.shell ; receipt ; hash ; protocol_data ; _ } ->
match protocol_data, receipt with
| (Operation_data ({ contents = Single (Endorsement _) ; _ } as protocol_data)),
Apply_operation_result.(
Apply_results.(
Operation_metadata { contents = Single_result (Endorsement_result { delegate ; _ }) }) ->
let new_endorsement : Kind.endorsement Alpha_context.operation = { shell ; protocol_data } in
let map = match HLevel.find_opt state.endorsements_table level with

View File

@ -65,7 +65,7 @@
"Baking",
"Amendment",
"Apply_operation_result",
"Apply_results",
"Apply",
"Services_registration",

View File

@ -320,7 +320,7 @@ let () =
(function Multiple_revelation -> Some () | _ -> None)
(fun () -> Multiple_revelation)
open Apply_operation_result
open Apply_results
let apply_manager_operation_content :
type kind.

View File

@ -130,7 +130,7 @@ module Scripts = struct
"Run an operation without signature checks"
~query: RPC_query.empty
~input: Operation.encoding
~output: Apply_operation_result.operation_data_and_metadata_encoding
~output: Apply_results.operation_data_and_metadata_encoding
RPC_path.(path / "run_operation")
end
@ -238,7 +238,7 @@ module Scripts = struct
partial_precheck_manager_contents_list ctxt rest in
let return contents =
return (Operation_data protocol_data,
Apply_operation_result.Operation_metadata { contents }) in
Apply_results.Operation_metadata { contents }) in
let operation : _ operation = { shell ; protocol_data } in
let hash = Operation.hash { shell ; protocol_data } in
let ctxt = Contract.init_origination_nonce ctxt hash in

View File

@ -53,7 +53,7 @@ module Scripts : sig
val run_operation:
'a #RPC_context.simple ->
'a -> packed_operation ->
(packed_protocol_data * Apply_operation_result.packed_operation_metadata) shell_tzresult Lwt.t
(packed_protocol_data * Apply_results.packed_operation_metadata) shell_tzresult Lwt.t
end

View File

@ -24,14 +24,14 @@ type operation_data = Alpha_context.packed_protocol_data =
| Operation_data : 'kind Alpha_context.Operation.protocol_data -> operation_data
let operation_data_encoding = Alpha_context.Operation.protocol_data_encoding
type operation_receipt = Apply_operation_result.packed_operation_metadata =
| Operation_metadata : 'kind Apply_operation_result.operation_metadata -> operation_receipt
type operation_receipt = Apply_results.packed_operation_metadata =
| Operation_metadata : 'kind Apply_results.operation_metadata -> operation_receipt
| No_operation_metadata: operation_receipt
let operation_receipt_encoding =
Apply_operation_result.operation_metadata_encoding
Apply_results.operation_metadata_encoding
let operation_data_and_receipt_encoding =
Apply_operation_result.operation_data_and_metadata_encoding
Apply_results.operation_data_and_metadata_encoding
type operation = Alpha_context.packed_operation = {
shell: Operation.shell_header ;

View File

@ -46,6 +46,6 @@ include Updater.PROTOCOL
and type block_header_metadata = Alpha_context.Block_header.metadata
and type block_header = Alpha_context.Block_header.t
and type operation_data := operation_data
and type operation_receipt = Apply_operation_result.packed_operation_metadata
and type operation_receipt = Apply_results.packed_operation_metadata
and type operation := operation
and type validation_state := validation_state

View File

@ -82,15 +82,15 @@ let begin_construction ?(priority=0) ?timestamp (predecessor : Block.t) =
}
let detect_script_failure :
type kind. kind Apply_operation_result.operation_metadata -> _ =
type kind. kind Apply_results.operation_metadata -> _ =
let rec detect_script_failure :
type kind. kind Apply_operation_result.contents_result_list -> _ =
let open Apply_operation_result in
type kind. kind Apply_results.contents_result_list -> _ =
let open Apply_results in
let detect_script_failure_single
(type kind)
(Manager_operation_result { operation_result ;
internal_operation_results }
: kind Kind.manager Apply_operation_result.contents_result) =
: kind Kind.manager Apply_results.contents_result) =
let detect_script_failure (type kind) (result : kind manager_operation_result) =
match result with
| Applied _ -> Ok ()
@ -119,7 +119,7 @@ let detect_script_failure :
fun { contents } -> detect_script_failure contents
let add_operation ?expect_failure st op =
let open Apply_operation_result in
let open Apply_results in
M.apply_operation st.state op >>=? function
| state, Operation_metadata result ->
Lwt.return @@ detect_script_failure result >>= fun result ->