diff --git a/src/utils/tezos_data.mli b/src/utils/tezos_data.mli index e9fca761a..0fb3998f3 100644 --- a/src/utils/tezos_data.mli +++ b/src/utils/tezos_data.mli @@ -50,6 +50,7 @@ module Operation : sig include HASHABLE_DATA with type t := t and type hash := Operation_hash.t + val of_bytes_exn: MBytes.t -> t end @@ -74,6 +75,7 @@ module Block_header : sig include HASHABLE_DATA with type t := t and type hash := Block_hash.t + val of_bytes_exn: MBytes.t -> t end @@ -91,5 +93,6 @@ module Protocol : sig include HASHABLE_DATA with type t := t and type hash := Protocol_hash.t + val of_bytes_exn: MBytes.t -> t end diff --git a/test/proto_alpha/proto_alpha_helpers.ml b/test/proto_alpha/proto_alpha_helpers.ml index 672c44975..bfa54539e 100644 --- a/test/proto_alpha/proto_alpha_helpers.ml +++ b/test/proto_alpha/proto_alpha_helpers.ml @@ -247,7 +247,7 @@ module Protocol = struct let voting_period_kind ?(block = `Prevalidation) () = Client_proto_rpcs.Context.voting_period_kind rpc_config block - let inject_proposals ?async ?force ?(block = `Prevalidation) ~src:({ pk; sk } : Account.t) proposals = + let proposals ?(block = `Prevalidation) ~src:({ pk; sk } : Account.t) proposals = Client_node_rpcs.Blocks.info rpc_config block >>=? fun block_info -> Client_proto_rpcs.Context.next_level rpc_config block >>=? fun next_level -> Client_proto_rpcs.Helpers.Forge.Delegate.proposals rpc_config block @@ -257,11 +257,9 @@ module Protocol = struct ~proposals () >>=? fun bytes -> let signed_bytes = Environment.Ed25519.Signature.append sk bytes in - Client_node_rpcs.inject_operation - rpc_config ?async ?force signed_bytes >>=? fun oph -> - return oph + return (Tezos_data.Operation.of_bytes_exn signed_bytes) - let inject_ballot ?async ?force ?(block = `Prevalidation) ~src:({ pk; sk } : Account.t) ~proposal ballot = + let ballot ?(block = `Prevalidation) ~src:({ pk; sk } : Account.t) ~proposal ballot = Client_node_rpcs.Blocks.info rpc_config block >>=? fun block_info -> Client_proto_rpcs.Context.next_level rpc_config block >>=? fun next_level -> Client_proto_rpcs.Helpers.Forge.Delegate.ballot rpc_config block @@ -272,9 +270,7 @@ module Protocol = struct ~ballot () >>=? fun bytes -> let signed_bytes = Environment.Ed25519.Signature.append sk bytes in - Client_node_rpcs.inject_operation - rpc_config ?async ?force signed_bytes >>=? fun oph -> - return oph + return (Tezos_data.Operation.of_bytes_exn signed_bytes) end @@ -301,16 +297,16 @@ module Assert = struct let prn = Tez.to_string in Assert.equal ?msg ~prn ~eq tz1 tz2 - let balance_equal ~msg account expected_balance = - Account.balance account >>=? fun actual_balance -> + let balance_equal ?block ~msg account expected_balance = + Account.balance ?block account >>=? fun actual_balance -> match Tez.of_cents expected_balance with | None -> failwith "invalid tez constant" | Some expected_balance -> return (equal_tez ~msg actual_balance expected_balance) - let delegate_equal ~msg contract expected_delegate = - Account.delegate contract >>|? fun actual_delegate -> + let delegate_equal ?block ~msg contract expected_delegate = + Account.delegate ?block contract >>|? fun actual_delegate -> equal_pkh ~msg actual_delegate expected_delegate let ecoproto_error f = function @@ -445,15 +441,16 @@ module Mining = struct ~fitness ~seed_nonce ~src_sk - operation_list = + operations = let block = match block with `Prevalidation -> `Head 0 | block -> block in Client_node_rpcs.Blocks.info rpc_config block >>=? fun bi -> let proto_level = Utils.unopt ~default:bi.proto_level proto_level in let seed_nonce_hash = Nonce.hash seed_nonce in Client_proto_rpcs.Context.next_level rpc_config block >>=? fun level -> + let operation_hashes = List.map Tezos_data.Operation.hash operations in let operations_hash = Operation_list_list_hash.compute - [Operation_list_hash.compute operation_list] in + [Operation_list_hash.compute operation_hashes] in let shell = { Block_header.net_id = bi.net_id ; predecessor = bi.hash ; timestamp ; fitness ; operations_hash ; @@ -476,11 +473,12 @@ module Mining = struct () >>=? fun unsigned_header -> let signed_header = Environment.Ed25519.Signature.append src_sk unsigned_header in Client_node_rpcs.inject_block rpc_config - ?force signed_header [List.map (fun h -> Client_node_rpcs.Hash h) operation_list] >>=? fun block_hash -> + ?force signed_header + [List.map (fun h -> Client_node_rpcs.Blob h) operations] >>=? fun block_hash -> return block_hash let mine - ?(force = false) + ?(force = true) ?(operations = []) ?(fitness_gap = 1) ?proto_level @@ -523,27 +521,21 @@ end module Endorse = struct - let inject_endorsement + let forge_endorsement block - _level - ?async - ?force src_sk source slot = - Client_blocks.get_block_hash rpc_config block >>=? fun block_hash -> - Client_node_rpcs.Blocks.net rpc_config block >>=? fun net -> + Client_blocks.get_block_info rpc_config block >>=? fun { hash ; net_id } -> Client_proto_rpcs.Helpers.Forge.Delegate.endorsement rpc_config block - ~net + ~net:net_id ~source - ~block:block_hash + ~block:hash ~slot:slot () >>=? fun bytes -> let signed_bytes = Environment.Ed25519.Signature.append src_sk bytes in - Client_node_rpcs.inject_operation - rpc_config ?force ?async signed_bytes >>=? fun oph -> - return oph + return (Tezos_data.Operation.of_bytes_exn signed_bytes) let signing_slots ?(max_priority = 1024) @@ -559,12 +551,10 @@ module Endorse = struct return slots let endorse - ?(force = false) ?slot (contract : Account.t) block = - Client_proto_rpcs.Context.level rpc_config block >>=? fun level -> - let level = Raw_level.succ @@ level.level in + Client_proto_rpcs.Context.next_level rpc_config block >>=? fun { level } -> begin match slot with | Some slot -> return slot @@ -577,9 +567,7 @@ module Endorse = struct failwith "No slot found at level %a" Raw_level.pp level end end >>=? fun slot -> - inject_endorsement - block level contract.sk contract.pk slot ~force >>=? fun oph -> - return oph + forge_endorsement block contract.sk contract.pk slot (* FIXME @vb: I don't understand this function, copied from @cago. *) let endorsers_list block { Account.b1 ; b2 ; b3 ; b4 ; b5 } = diff --git a/test/proto_alpha/proto_alpha_helpers.mli b/test/proto_alpha/proto_alpha_helpers.mli index 8a93d1e25..b282b7224 100644 --- a/test/proto_alpha/proto_alpha_helpers.mli +++ b/test/proto_alpha/proto_alpha_helpers.mli @@ -120,11 +120,11 @@ module Mining : sig fitness:Fitness.t -> seed_nonce:Nonce.nonce -> src_sk:secret_key -> - Operation_hash.t list -> Block_hash.t tzresult Lwt.t + Operation.raw list -> Block_hash.t tzresult Lwt.t val mine : ?force:bool -> - ?operations:Operation_hash.t list -> + ?operations:Operation.raw list -> ?fitness_gap:int -> ?proto_level:int -> Account.t -> @@ -140,11 +140,10 @@ end module Endorse : sig val endorse : - ?force:bool -> ?slot:int -> Account.t -> Client_alpha.Client_proto_rpcs.block -> - Operation_hash.t tzresult Lwt.t + Operation.raw tzresult Lwt.t val endorsers_list : Client_alpha.Client_proto_rpcs.block -> @@ -161,22 +160,18 @@ end module Protocol : sig - val inject_proposals : - ?async:bool -> - ?force:bool -> + val proposals : ?block:Client_node_rpcs.Blocks.block -> src:Account.t -> - Hash.Protocol_hash.t list -> - Hash.Operation_list_hash.elt tzresult Lwt.t + Protocol_hash.t list -> + Operation.raw tzresult Lwt.t - val inject_ballot : - ?async:bool -> - ?force:bool -> + val ballot : ?block:Client_node_rpcs.Blocks.block -> src:Account.t -> - proposal:Hash.Protocol_hash.t -> + proposal:Protocol_hash.t -> Vote.ballot -> - Hash.Operation_list_hash.elt tzresult Lwt.t + Operation.raw tzresult Lwt.t end @@ -185,13 +180,15 @@ module Assert : sig include module type of Assert val balance_equal: + ?block:Client_node_rpcs.Blocks.block -> msg:string -> Account.t -> int64 -> unit tzresult Lwt.t val delegate_equal: + ?block:Client_node_rpcs.Blocks.block -> msg:string -> Contract.t -> public_key_hash option -> unit tzresult Lwt.t val ecoproto_error: (Register_client_embedded_proto_alpha.Packed_protocol.error -> bool) -> - Error_monad.error -> bool + error -> bool val generic_economic_error : msg:string -> 'a tzresult -> unit @@ -218,7 +215,7 @@ module Assert : sig val check_protocol : ?msg:string -> block:Client_node_rpcs.Blocks.block -> - Hash.Protocol_hash.t -> unit tzresult Lwt.t + Protocol_hash.t -> unit tzresult Lwt.t val check_voting_period_kind : ?msg:string -> block:Client_node_rpcs.Blocks.block -> diff --git a/test/proto_alpha/test_endorsement.ml b/test/proto_alpha/test_endorsement.ml index f2127d42a..68908f32c 100644 --- a/test/proto_alpha/test_endorsement.ml +++ b/test/proto_alpha/test_endorsement.ml @@ -25,14 +25,14 @@ let test_double_endorsement contract block = Helpers.Mining.mine ~fitness_gap:1 contract (`Hash b1) >>=? fun b2' -> (* branch root *) - Helpers.Endorse.endorse ~force:true contract (`Hash b2) >>=? fun ops -> - Helpers.Mining.mine ~fitness_gap:2 ~operations:[ ops ] contract (`Hash b2) >>=? fun _b3 -> + Helpers.Endorse.endorse contract (`Hash b2) >>=? fun op -> + Helpers.Mining.mine ~fitness_gap:2 ~operations:[ op ] contract (`Hash b2) >>=? fun _b3 -> - Helpers.Endorse.endorse ~force:true contract (`Hash b2') >>=? fun ops -> - Helpers.Mining.mine ~fitness_gap:2 ~operations:[ ops ] contract (`Hash b2') >>=? fun b3' -> + Helpers.Endorse.endorse contract (`Hash b2') >>=? fun op -> + Helpers.Mining.mine ~fitness_gap:2 ~operations:[ op ] contract (`Hash b2') >>=? fun b3' -> - Helpers.Endorse.endorse ~force:true contract (`Hash b3') >>=? fun ops -> - Helpers.Mining.mine ~fitness_gap:2 ~operations:[ ops ] contract (`Hash b3') >>=? fun b4' -> + Helpers.Endorse.endorse contract (`Hash b3') >>=? fun op -> + Helpers.Mining.mine ~fitness_gap:2 ~operations:[ op ] contract (`Hash b3') >>=? fun b4' -> (* TODO: Inject double endorsement op ! *) Helpers.Mining.mine ~fitness_gap:1 contract (`Hash b4') @@ -59,21 +59,38 @@ let contain_tzerror ?(msg="") ~f t = failwith "@[Unexpected error@ %a@]" pp_print_error error | _ -> return () -let test_wrong_delegate contract block = +let test_wrong_delegate ~miner contract head = + let block = `Hash head in contain_tzerror ~msg:__LOC__ ~f:begin Assert.ecoproto_error (function | Mining.Wrong_delegate _ -> true | _ -> false) + end begin + Helpers.Endorse.endorse ~slot:1 contract block >>=? fun op -> + Helpers.Mining.mine + ~fitness_gap:2 ~operations:[ op ] miner block >>=? fun _ -> + Helpers.Endorse.endorse ~slot:2 contract block >>=? fun op -> + Helpers.Mining.mine + ~fitness_gap:2 ~operations:[ op ] miner block >>=? fun _ -> + Helpers.Endorse.endorse ~slot:3 contract block >>=? fun op -> + Helpers.Mining.mine + ~fitness_gap:2 ~operations:[ op ] miner block >>=? fun _ -> + Helpers.Endorse.endorse ~slot:4 contract block >>=? fun op -> + Helpers.Mining.mine + ~fitness_gap:2 ~operations:[ op ] miner block >>=? fun _ -> + Helpers.Endorse.endorse ~slot:5 contract block >>=? fun op -> + Helpers.Mining.mine + ~fitness_gap:2 ~operations:[ op ] miner block >>=? fun _ -> + return () end - (Helpers.Endorse.endorse ~slot:1 ~force:true contract block >>=? fun _ -> - Helpers.Endorse.endorse ~slot:2 ~force:true contract block >>=? fun _ -> - Helpers.Endorse.endorse ~slot:3 ~force:true contract block >>=? fun _ -> - Helpers.Endorse.endorse ~slot:4 ~force:true contract block >>=? fun _ -> - Helpers.Endorse.endorse ~slot:5 ~force:true contract block) let test_invalid_endorsement_slot contract block = - Helpers.Endorse.endorse ~slot:~-1 ~force:true contract block >>= fun res -> + Helpers.Endorse.endorse ~slot:~-1 contract block >>=? fun op -> + Helpers.Mining.mine + ~fitness_gap:2 ~operations:[ op ] contract block >>= fun res -> Assert.invalid_endorsement_slot ~msg:__LOC__ res ; - Helpers.Endorse.endorse ~slot:16 ~force:true contract block >>= fun res -> + Helpers.Endorse.endorse ~slot:16 contract block >>=? fun op -> + Helpers.Mining.mine + ~fitness_gap:2 ~operations:[ op ] contract block >>= fun res -> Assert.invalid_endorsement_slot ~msg:__LOC__ res ; return () @@ -93,11 +110,12 @@ let test_endorsement_rewards (* #1 endorse & inject in a block *) Helpers.Endorse.endorsers_list block baccounts >>=? fun accounts -> get_endorser_except [ b1 ] accounts >>=? fun (account0, slot0) -> - Helpers.Account.balance account0 >>=? fun balance0 -> - Helpers.Endorse.endorse ~slot:slot0 ~force:true account0 block >>=? fun ops -> - Helpers.Mining.mine ~fitness_gap:2 ~operations:[ ops ] b1 block >>=? fun head0 -> + Helpers.Account.balance ~block account0 >>=? fun balance0 -> + Helpers.Endorse.endorse ~slot:slot0 account0 block >>=? fun ops -> + Helpers.Mining.mine + ~fitness_gap:2 ~operations:[ ops ] b1 block >>=? fun head0 -> Helpers.display_level (`Hash head0) >>=? fun () -> - Assert.balance_equal ~msg:__LOC__ account0 + Assert.balance_equal ~block:(`Hash head0) ~msg:__LOC__ account0 (Int64.sub (Tez.to_cents balance0) bond) >>=? fun () -> @@ -105,44 +123,30 @@ let test_endorsement_rewards let block0 = `Hash head0 in Helpers.Endorse.endorsers_list block0 baccounts >>=? fun accounts -> get_endorser_except [ b1 ; account0 ] accounts >>=? fun (account1, slot1) -> - Helpers.Account.balance account1 >>=? fun balance1 -> - Helpers.Endorse.endorse ~slot:slot1 ~force:true account1 block0 >>=? fun ops -> - Helpers.Mining.mine ~fitness_gap:2 ~operations:[ ops ] b1 block0 >>=? fun head1 -> + Helpers.Account.balance ~block:block0 account1 >>=? fun balance1 -> + Helpers.Endorse.endorse ~slot:slot1 account1 block0 >>=? fun ops -> + Helpers.Mining.mine + ~fitness_gap:2 ~operations:[ ops ] b1 block0 >>=? fun head1 -> Helpers.display_level (`Hash head1) >>=? fun () -> - Assert.balance_equal ~msg:__LOC__ account1 + Assert.balance_equal ~block:(`Hash head1) ~msg:__LOC__ account1 (Int64.sub (Tez.to_cents balance1) bond) >>=? fun () -> - - (* #3 endorse but the operation is not included in a block, so no reward *) - let block1 = `Hash head1 in - Helpers.Endorse.endorsers_list block1 baccounts >>=? fun accounts -> - get_endorser_except [ b1 ; account0 ; account1 ] accounts >>=? fun (account2, slot2) -> - Helpers.Account.balance account2 >>=? fun balance2 -> - Helpers.Endorse.endorse ~slot:slot2 ~force:true account2 block1 >>=? fun _ops -> - Assert.balance_equal ~msg:__LOC__ account2 - (Int64.sub (Tez.to_cents balance2) bond) >>=? fun () -> - + (* Check rewards after one cycle for account0 *) Helpers.Mining.mine ~fitness_gap:1 b1 (`Hash head1) >>=? fun head2 -> Helpers.display_level (`Hash head2) >>=? fun () -> Helpers.Mining.mine ~fitness_gap:1 b1 (`Hash head2) >>=? fun head3 -> Helpers.display_level (`Hash head3) >>=? fun () -> Helpers.Mining.mine ~fitness_gap:1 b1 (`Hash head3) >>=? fun head4 -> Helpers.display_level (`Hash head4) >>=? fun () -> - - (* Check rewards after one cycle for account0 *) Helpers.Mining.endorsement_reward b1 block0 >>=? fun rw0 -> - Assert.balance_equal ~msg:__LOC__ account0 + Assert.balance_equal ~block:(`Hash head4) ~msg:__LOC__ account0 (Int64.add (Tez.to_cents balance0) rw0) >>=? fun () -> (* Check rewards after one cycle for account1 *) - Helpers.Mining.endorsement_reward b1 block1 >>=? fun rw1 -> - Assert.balance_equal ~msg:__LOC__ account1 + Helpers.Mining.endorsement_reward b1 (`Hash head1) >>=? fun rw1 -> + Assert.balance_equal ~block:(`Hash head4) ~msg:__LOC__ account1 (Int64.add (Tez.to_cents balance1) rw1) >>=? fun () -> - (* Check no rewards after one cycle for account2 *) - Assert.balance_equal - ~msg:__LOC__ account2 (Tez.to_cents balance2) >>=? fun () -> - (* #2 endorse and check reward only on the good chain *) Helpers.Mining.mine ~fitness_gap:1 b1 (`Hash head4) >>=? fun head -> Helpers.display_level (`Hash head) >>=? fun () -> @@ -152,20 +156,20 @@ let test_endorsement_rewards (* working on head *) Helpers.Endorse.endorsers_list (`Hash head) baccounts >>=? fun accounts -> get_endorser_except [ b1 ] accounts >>=? fun (account3, slot3) -> - Helpers.Account.balance account3 >>=? fun balance3 -> + Helpers.Account.balance ~block:(`Hash head) account3 >>=? fun balance3 -> Helpers.Endorse.endorse - ~slot:slot3 ~force:true account3 (`Hash head) >>=? fun ops -> + ~slot:slot3 account3 (`Hash head) >>=? fun ops -> Helpers.Mining.mine ~fitness_gap:2 ~operations:[ ops ] b1 (`Hash head) >>=? fun new_head -> Helpers.display_level (`Hash new_head) >>=? fun () -> (* working on fork *) Helpers.Endorse.endorsers_list (`Hash fork) baccounts >>=? fun accounts -> get_endorser_except [ b1 ] accounts >>=? fun (account4, slot4) -> - Helpers.Account.balance account4 >>=? fun _balance4 -> - Helpers.Endorse.endorse ~slot:slot4 ~force:true account4 (`Hash fork) >>=? fun ops -> + Helpers.Account.balance ~block:(`Hash new_head) account4 >>=? fun _balance4 -> + Helpers.Endorse.endorse ~slot:slot4 account4 (`Hash fork) >>=? fun ops -> Helpers.Mining.mine ~fitness_gap:2 ~operations:[ ops ] b1 (`Hash fork) >>=? fun _new_fork -> Helpers.display_level (`Hash _new_fork) >>=? fun () -> - Helpers.Account.balance account4 >>=? fun balance4 -> + Helpers.Account.balance ~block:(`Hash new_head) account4 >>=? fun balance4 -> Helpers.Mining.mine ~fitness_gap:1 b1 (`Hash new_head) >>=? fun head -> Helpers.display_level (`Hash head) >>=? fun () -> @@ -174,7 +178,7 @@ let test_endorsement_rewards (* Check rewards after one cycle *) Helpers.Mining.endorsement_reward b1 (`Hash new_head) >>=? fun reward -> - Assert.balance_equal ~msg:__LOC__ account3 + Assert.balance_equal ~block:(`Hash head) ~msg:__LOC__ account3 (Int64.add (Tez.to_cents balance3) reward) >>=? fun () -> (* Check no reward for the fork *) @@ -182,8 +186,9 @@ let test_endorsement_rewards if account3 = account4 then return () (* if account4 is different from account3, we need to check that there is no reward for him since the endorsement was in the fork branch *) - else Assert.balance_equal ~msg:__LOC__ account4 (Tez.to_cents balance4) - end >>=? fun () -> return head + else Assert.balance_equal ~block:(`Hash head) ~msg:__LOC__ account4 (Tez.to_cents balance4) + end >>=? fun () -> + return head let test_endorsement_rights contract block = Helpers.Endorse.endorsement_rights contract block >>|? fun possibilities -> @@ -200,11 +205,11 @@ let run head (({ b1 ; b2 ; b3 ; b4 ; b5 } : Helpers.Account.bootstrap_accounts) test_endorsement_rights b1 head >>=? fun has_right_to_endorse -> Assert.equal_bool ~msg:__LOC__ has_right_to_endorse true ; - Assert.balance_equal ~msg:__LOC__ b1 4_000_000_00L >>=? fun () -> - Assert.balance_equal ~msg:__LOC__ b2 4_000_000_00L >>=? fun () -> - Assert.balance_equal ~msg:__LOC__ b3 4_000_000_00L >>=? fun () -> - Assert.balance_equal ~msg:__LOC__ b4 4_000_000_00L >>=? fun () -> - Assert.balance_equal ~msg:__LOC__ b5 4_000_000_00L >>=? fun () -> + Assert.balance_equal ~block:head ~msg:__LOC__ b1 4_000_000_00L >>=? fun () -> + Assert.balance_equal ~block:head ~msg:__LOC__ b2 4_000_000_00L >>=? fun () -> + Assert.balance_equal ~block:head ~msg:__LOC__ b3 4_000_000_00L >>=? fun () -> + Assert.balance_equal ~block:head ~msg:__LOC__ b4 4_000_000_00L >>=? fun () -> + Assert.balance_equal ~block:head ~msg:__LOC__ b5 4_000_000_00L >>=? fun () -> (* Check Rewards *) test_endorsement_rewards head baccounts >>=? fun head -> @@ -212,8 +217,8 @@ let run head (({ b1 ; b2 ; b3 ; b4 ; b5 } : Helpers.Account.bootstrap_accounts) (* Endorse with a contract with wrong delegate: - contract with no endorsement rights - contract which signs at every available slots *) - test_wrong_delegate default_account (`Hash head) >>=? fun () -> - test_wrong_delegate b5 (`Hash head) >>=? fun () -> + test_wrong_delegate ~miner:b1 default_account head >>=? fun () -> + test_wrong_delegate ~miner:b1 b5 head >>=? fun () -> (* Endorse with a wrong slot : -1 and max (16) *) test_invalid_endorsement_slot b3 (`Hash head) >>=? fun () -> diff --git a/test/proto_alpha/test_vote.ml b/test/proto_alpha/test_vote.ml index 6cd2b3729..f485ec8df 100644 --- a/test/proto_alpha/test_vote.ml +++ b/test/proto_alpha/test_vote.ml @@ -28,14 +28,13 @@ let run_change_to_demo_proto block ({ b1 ; b2 ; b3 ; b4 ; b5 } : Account.bootstr Mining.mine b2 (`Hash head) >>=? fun head -> (* 1. Propose the 'demo' protocol as b1 (during the Proposal period) *) - Protocol.inject_proposals - ~force:true + Protocol.proposals ~block:(`Hash head) ~src:b1 - [demo_protocol] >>=? fun oph -> + [demo_protocol] >>=? fun op -> (* Mine blocks to switch to next vote period (Testing_vote) *) - Mining.mine ~operations:[oph] b3 (`Hash head) >>=? fun head -> + Mining.mine ~operations:[op] b3 (`Hash head) >>=? fun head -> Format.eprintf "Entering `Testing_vote` voting period@."; Mining.mine b4 (`Hash head) >>=? fun head -> Assert.check_voting_period_kind ~msg:__LOC__ ~block:(`Hash head) @@ -44,8 +43,7 @@ let run_change_to_demo_proto block ({ b1 ; b2 ; b3 ; b4 ; b5 } : Account.bootstr (* 2. Vote unanimously for a proposal *) let vote_for_demo ~src ~block ballot = - Protocol.inject_ballot - ~force:true + Protocol.ballot ~block ~src ~proposal:demo_protocol