Alpha/Test: fix voting test
This commit is contained in:
parent
c774a4e75d
commit
6b3517e095
@ -120,11 +120,11 @@ module Vote = struct
|
|||||||
Alpha_services.Voting.ballot_list rpc_ctxt ctxt
|
Alpha_services.Voting.ballot_list rpc_ctxt ctxt
|
||||||
|
|
||||||
let get_voting_period 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
|
return l.voting_period
|
||||||
|
|
||||||
let get_voting_period_position ctxt =
|
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
|
return l.voting_period_position
|
||||||
|
|
||||||
let get_current_period_kind ctxt =
|
let get_current_period_kind ctxt =
|
||||||
@ -147,6 +147,11 @@ module Vote = struct
|
|||||||
| None -> assert false
|
| None -> assert false
|
||||||
| Some p -> Lwt.return (Protocol_hash.of_bytes_exn p)
|
| 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
|
end
|
||||||
|
|
||||||
module Contract = struct
|
module Contract = struct
|
||||||
|
@ -156,11 +156,7 @@ let test_voting () =
|
|||||||
|
|
||||||
(* skip to vote_testing period
|
(* skip to vote_testing period
|
||||||
-1 because we already baked one block with the proposal *)
|
-1 because we already baked one block with the proposal *)
|
||||||
(* TODO BUG -2 causes period_kind to change but not period *)
|
Block.bake_n ((Int32.to_int blocks_per_voting_period)-2) b >>=? fun b ->
|
||||||
(* 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 ->
|
|
||||||
|
|
||||||
(* we moved to a testing_vote period with one proposal *)
|
(* we moved to a testing_vote period with one proposal *)
|
||||||
Context.Vote.get_current_period_kind (B b) >>=? begin function
|
Context.Vote.get_current_period_kind (B b) >>=? begin function
|
||||||
|
Loading…
Reference in New Issue
Block a user