From 6b3517e095fae48b58fd672773cc21050747d980 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9goire=20Henry?= Date: Thu, 22 Nov 2018 02:10:04 +0100 Subject: [PATCH] Alpha/Test: fix voting test --- src/proto_alpha/lib_protocol/test/helpers/context.ml | 9 +++++++-- src/proto_alpha/lib_protocol/test/voting.ml | 6 +----- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/proto_alpha/lib_protocol/test/helpers/context.ml b/src/proto_alpha/lib_protocol/test/helpers/context.ml index af7e6b2f0..d01f032ba 100644 --- a/src/proto_alpha/lib_protocol/test/helpers/context.ml +++ b/src/proto_alpha/lib_protocol/test/helpers/context.ml @@ -120,11 +120,11 @@ module Vote = struct Alpha_services.Voting.ballot_list rpc_ctxt ctxt let get_voting_period ctxt = - Alpha_services.Helpers.current_level rpc_ctxt ctxt >>=? fun l -> + Alpha_services.Helpers.current_level rpc_ctxt ~offset:1l ctxt >>=? fun l -> return l.voting_period let get_voting_period_position ctxt = - Alpha_services.Helpers.current_level rpc_ctxt ctxt >>=? fun l -> + Alpha_services.Helpers.current_level rpc_ctxt ~offset:1l ctxt >>=? fun l -> return l.voting_period_position let get_current_period_kind ctxt = @@ -147,6 +147,11 @@ module Vote = struct | None -> assert false | Some p -> Lwt.return (Protocol_hash.of_bytes_exn p) + let get_protocol (b:Block.t) = + Alpha_environment.Context.get b.context ["protocol"] >>= function + | None -> assert false + | Some p -> Lwt.return (Protocol_hash.of_bytes_exn p) + end module Contract = struct diff --git a/src/proto_alpha/lib_protocol/test/voting.ml b/src/proto_alpha/lib_protocol/test/voting.ml index 6891b2483..bc6212eaf 100644 --- a/src/proto_alpha/lib_protocol/test/voting.ml +++ b/src/proto_alpha/lib_protocol/test/voting.ml @@ -156,11 +156,7 @@ let test_voting () = (* skip to vote_testing period -1 because we already baked one block with the proposal *) - (* TODO BUG -2 causes period_kind to change but not period *) - (* Context.Vote.get_voting_period (B b) >>=? fun p -> - * Context.Vote.get_voting_period_position (B b) >>=? fun pp -> - * let _ = Format.printf "\n%a %ld\n" Alpha_context.Voting_period.pp p pp in *) - Block.bake_n ((Int32.to_int blocks_per_voting_period)-1) b >>=? fun b -> + Block.bake_n ((Int32.to_int blocks_per_voting_period)-2) b >>=? fun b -> (* we moved to a testing_vote period with one proposal *) Context.Vote.get_current_period_kind (B b) >>=? begin function