Alpha: use Apply_operation_result as operation metadata

This commit is contained in:
Grégoire Henry 2018-04-21 11:31:16 +02:00 committed by Benjamin Canou
parent b6207bb14d
commit f02972bb8a
2 changed files with 6 additions and 4 deletions

View File

@ -28,8 +28,9 @@ type operation = Alpha_context.Operation.t = {
let operation_data_encoding = Alpha_context.Operation.protocol_data_encoding let operation_data_encoding = Alpha_context.Operation.protocol_data_encoding
type operation_metadata = unit type operation_metadata = Apply_operation_result.operation_result
let operation_metadata_encoding = Data_encoding.unit let operation_metadata_encoding =
Data_encoding.(obj1 (req "metadata" Apply_operation_result.encoding))
let acceptable_passes = Alpha_context.Operation.acceptable_passes let acceptable_passes = Alpha_context.Operation.acceptable_passes
@ -128,9 +129,9 @@ let apply_operation ({ mode ; ctxt ; op_count ; _ } as data) operation =
| Full_construction { predecessor ; _ } -> | Full_construction { predecessor ; _ } ->
predecessor in predecessor in
Apply.apply_operation ctxt Optimized predecessor Apply.apply_operation ctxt Optimized predecessor
(Alpha_context.Operation.hash operation) operation >>=? fun (ctxt, _) -> (Alpha_context.Operation.hash operation) operation >>=? fun (ctxt, result) ->
let op_count = op_count + 1 in let op_count = op_count + 1 in
return ({ data with ctxt ; op_count }, ()) return ({ data with ctxt ; op_count }, result)
let finalize_block { mode ; ctxt ; op_count ; deposit = _ } = let finalize_block { mode ; ctxt ; op_count ; deposit = _ } =
match mode with match mode with

View File

@ -34,5 +34,6 @@ include Updater.PROTOCOL with type block_header_data = Alpha_context.Block_heade
and type block_header_metadata = Alpha_context.Block_header.metadata and type block_header_metadata = Alpha_context.Block_header.metadata
and type block_header = Alpha_context.Block_header.t and type block_header = Alpha_context.Block_header.t
and type operation_data = Alpha_context.Operation.protocol_data and type operation_data = Alpha_context.Operation.protocol_data
and type operation_metadata = Apply_operation_result.operation_result
and type operation = Alpha_context.operation and type operation = Alpha_context.operation
and type validation_state := validation_state and type validation_state := validation_state