Alpha/Test: fix voting test

This commit is contained in:
Grégoire Henry 2018-11-22 02:10:04 +01:00 committed by Pierre Boutillier
parent c774a4e75d
commit 6b3517e095
No known key found for this signature in database
GPG Key ID: C2F73508B56A193C
2 changed files with 8 additions and 7 deletions

View File

@ -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

View File

@ -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