From d8151c0d00d2b850e36f65bb020da9505a5da9e6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9goire=20Henry?= Date: Wed, 31 Jan 2018 17:24:35 +0100 Subject: [PATCH] Proto/alpha: use two operations list (endorsement / others) --- src/proto_alpha/lib_protocol/src/main.ml | 3 ++- .../lib_protocol/src/operation_repr.ml | 15 ++++++++++++++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/src/proto_alpha/lib_protocol/src/main.ml b/src/proto_alpha/lib_protocol/src/main.ml index 1591647d7..191896ed1 100644 --- a/src/proto_alpha/lib_protocol/src/main.ml +++ b/src/proto_alpha/lib_protocol/src/main.ml @@ -18,7 +18,8 @@ let max_block_length = Tezos_context.Block_header.max_header_length let validation_passes = - [ Updater.{ max_size = 1024 * 1024 ; max_op = None } ] (* 1MB *) + Updater.[ { max_size = 32 * 1024 ; max_op = None } ; (* 32kB FIXME *) + { max_size = 1024 * 1024 ; max_op = None } ] (* 1MB *) let rpc_services = Services_registration.rpc_services diff --git a/src/proto_alpha/lib_protocol/src/operation_repr.ml b/src/proto_alpha/lib_protocol/src/operation_repr.ml index 773b935c8..c82762ebd 100644 --- a/src/proto_alpha/lib_protocol/src/operation_repr.ml +++ b/src/proto_alpha/lib_protocol/src/operation_repr.ml @@ -362,7 +362,20 @@ let parse hash (op: Operation.t) = ok { hash ; shell = op.shell ; contents ; signature } | None -> error Cannot_parse_operation -let acceptable_passes _op = [0] +let acceptable_passes op = + match op.contents with + | Anonymous_operations _ + | Sourced_operations (Manager_operations _) -> [1] + | Sourced_operations (Delegate_operations { operations ; _ }) -> + let is_endorsement = function Endorsement _ -> true | _ -> false in + if List.exists is_endorsement operations then + if List.for_all is_endorsement operations then + [0] + else + [] + else + [1] + | Sourced_operations (Dictator_operation _) -> [0] type error += Invalid_signature (* `Permanent *) type error += Missing_signature (* `Permanent *)