From b8e78c42293a895c7bd751bfcbd7fa629be223d2 Mon Sep 17 00:00:00 2001 From: Vincent Botbol Date: Mon, 6 Aug 2018 15:09:08 +0200 Subject: [PATCH] Baker: make anonymous operations applied after endorsements --- src/proto_alpha/lib_delegate/client_baking_forge.ml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/proto_alpha/lib_delegate/client_baking_forge.ml b/src/proto_alpha/lib_delegate/client_baking_forge.ml index 4c432c358..ba8b20d34 100644 --- a/src/proto_alpha/lib_delegate/client_baking_forge.ml +++ b/src/proto_alpha/lib_delegate/client_baking_forge.ml @@ -687,11 +687,13 @@ let filter_and_apply_operations let accepted_managers = List.sort Proto_alpha.compare_operations accepted_managers in (* Make sure we only keep valid operations *) filter_valid_operations initial_inc votes >>=? fun (inc, votes) -> - filter_valid_operations inc anonymous >>=? fun (inc, anonymous) -> filter_valid_operations inc accepted_managers >>=? fun (inc, accepted_managers) -> filter_map_s (is_valid_endorsement inc) endorsements >>=? fun endorsements -> (* Endorsements won't fail now *) - fold_left_s add_operation inc endorsements >>=? fun final_inc -> + fold_left_s add_operation inc endorsements >>=? fun inc -> + (* Endorsement and double baking/endorsement evidence do not commute: + we apply anonymous operations after endorsements. *) + filter_valid_operations inc anonymous >>=? fun (final_inc, anonymous) -> let operations = List.map List.rev [ endorsements ; votes ; anonymous ; accepted_managers ] in finalize_construction final_inc >>=? fun (validation_result, metadata) -> return @@ (final_inc, (validation_result, metadata), operations)