TMP remove dictator

This commit is contained in:
Grégoire Henry 2018-05-31 23:47:46 +02:00 committed by Benjamin Canou
parent 420986b45b
commit ceddb09ea7
16 changed files with 6 additions and 370 deletions

View File

@ -217,16 +217,6 @@ test:inject.sh:
script:
- jbuilder build @src/bin_client/runtest_injection.sh
test:inject_alpha.sh:
<<: *test_definition
script:
- jbuilder build @src/bin_client/runtest_injection_alpha.sh
test:fork.sh:
<<: *test_definition
script:
- jbuilder build @src/bin_client/runtest_fork.sh
test:proto:sandbox:
<<: *test_definition
script:

View File

@ -70,38 +70,6 @@
${bin:tezos-admin-client}
))))
(alias
((name runtest_fork.sh)
(locks (/tcp-port/18731
/tcp-port/19731))
(deps (sandbox.json
test_lib.inc.sh
(glob_files demo/*)
))
(action (run bash ${path:test_fork.sh}
${bin:tezos-sandboxed-node.sh}
${bin:tezos-node}
${bin:tezos-init-sandboxed-client.sh}
${bin:tezos-client}
${bin:tezos-admin-client}
))))
(alias
((name runtest_injection_alpha.sh)
(locks (/tcp-port/18731
/tcp-port/19731))
(deps (sandbox.json
test_lib.inc.sh
(glob_files demo/*)
))
(action (run bash ${path:test_injection_alpha.sh}
${bin:tezos-sandboxed-node.sh}
${bin:tezos-node}
${bin:tezos-init-sandboxed-client.sh}
${bin:tezos-client}
${bin:tezos-admin-client}
))))
(alias
((name runtest_tls.sh)
(locks (/tcp-port/18731
@ -141,7 +109,5 @@
(alias runtest_contracts.sh)
(alias runtest_multinode.sh)
(alias runtest_injection.sh)
(alias runtest_injection_alpha.sh)
(alias runtest_fork.sh)
(alias runtest_tls.sh)
(alias runtest_cors.sh)))))

View File

@ -1,45 +0,0 @@
#! /usr/bin/env bash
## from alpha to demo
set -e
test_dir="$(cd "$(dirname "$0")" && echo "$(pwd -P)")"
source $test_dir/test_lib.inc.sh "$@"
start_node 1
$client list understood protocols
activate_alpha
show_logs="no"
sleep 2
dictator_secret="unencrypted:edsk31vznjHSSpGExDMHYASz45VZqXN4DPxvsa4hAyY8dHM28cZzp6"
# autogenerated from the demo source
protocol_version="PsbyjqSF59ENfaQxUcRqVa4DXjzUG8gP2NVEGiXpN3GntcXrV8Q"
protocol_short="PsbyjqSF59ENfa"
bake
$client list understood protocols
$admin_client inject protocol "$test_dir/demo"
$admin_client list protocols
$client fork test protocol $protocol_version with key $dictator_secret
$admin_client list protocols
#these commands cannot be used in this case because the client does not
#know about the new protocol
#$client --protocol $protocol_short bake for bootstrap1 -max-priority 512
#$client --protocol $protocol_version rpc get /chains/main/blocks/head
echo
echo End of test
echo

View File

@ -1,45 +0,0 @@
#! /usr/bin/env bash
## from alpha to demo
set -e
test_dir="$(cd "$(dirname "$0")" && echo "$(pwd -P)")"
source $test_dir/test_lib.inc.sh "$@"
start_node 1
$client list understood protocols
activate_alpha
show_logs="no"
sleep 2
dictator_secret="unencrypted:edsk31vznjHSSpGExDMHYASz45VZqXN4DPxvsa4hAyY8dHM28cZzp6"
# autogenerated from the demo source
protocol_version="PsbyjqSF59ENfaQxUcRqVa4DXjzUG8gP2NVEGiXpN3GntcXrV8Q"
protocol_short="PsbyjqSF59ENfa"
bake
$client list understood protocols
$admin_client inject protocol "$test_dir/demo"
$admin_client list protocols
$client activate protocol $protocol_version with key $dictator_secret
$admin_client list protocols
#these commands cannot be used in this case because the client does not
#know about the new protocol
#$client --protocol $protocol_short bake for bootstrap1 -max-priority 512
#$client --protocol $protocol_version rpc get /chains/main/blocks/head
echo
echo End of test
echo

View File

@ -151,27 +151,7 @@ let get_manager
Client_keys.get_key cctxt src_pkh >>=? fun (src_name, src_pk, src_sk) ->
return (src_name, src_pkh, src_pk, src_sk)
let activate_protocol rpc_config ~chain ~block ?confirmations hash src_sk =
Injection.inject_operation
rpc_config ~chain ~block ?confirmations
~src_sk (Single (Activate_protocol hash)) >>=? fun (oph, op, result) ->
match Apply_operation_result.pack_contents_list op result with
| Apply_operation_result.Single_and_result
(Activate_protocol _ as op, result) ->
return (oph, op, result)
| _ -> .
let activate_test_protocol rpc_config ~chain ~block ?confirmations hash src_sk =
Injection.inject_operation
rpc_config ~chain ~block ?confirmations
~src_sk (Single (Activate_test_protocol hash)) >>=? fun (oph, op, result) ->
match Apply_operation_result.pack_contents_list op result with
| Apply_operation_result.Single_and_result
(Activate_test_protocol _ as op, result) ->
return (oph, op, result)
| _ -> .
let set_delegate
let set_delegate
cctxt ~chain ~block ?confirmations
~fee contract ~src_pk ~manager_sk opt_delegate =
delegate_contract

View File

@ -141,24 +141,6 @@ val reveal :
fee:Tez.t ->
unit -> Kind.reveal Kind.manager Injection.result tzresult Lwt.t
val activate_protocol :
#Proto_alpha.full ->
chain:Shell_services.chain ->
block:Shell_services.block ->
?confirmations:int ->
Protocol_hash.t ->
Client_keys.sk_uri ->
Kind.activate_protocol Injection.result tzresult Lwt.t
val activate_test_protocol :
#Proto_alpha.full ->
chain:Shell_services.chain ->
block:Shell_services.block ->
?confirmations:int ->
Protocol_hash.t ->
Client_keys.sk_uri ->
Kind.activate_test_protocol Injection.result tzresult Lwt.t
type activation_key =
{ pkh : Ed25519.Public_key_hash.t ;
amount : Tez.t ;

View File

@ -340,20 +340,6 @@ let rec pp_contents_and_result_list :
Voting_period.pp period
Protocol_hash.pp proposal
(match ballot with Yay -> "YAY" | Pass -> "PASS" | Nay -> "NAY")
| Single_and_result
(Activate_protocol protocol,
Activate_protocol_result) ->
Format.fprintf ppf
"@[<v 2>Dictator protocol activation:@,\
Protocol: %a@]"
Protocol_hash.pp protocol
| Single_and_result
(Activate_test_protocol protocol,
Activate_test_protocol_result) ->
Format.fprintf ppf
"@[<v 2>Dictator test protocol activation:@,\
Protocol: %a@]"
Protocol_hash.pp protocol
| Single_and_result (Manager_operation _ as op,
(Manager_operation_result _ as res))->
Format.fprintf ppf "%a"

View File

@ -329,22 +329,6 @@ let commands () =
return ()
);
command ~group:alphanet ~desc: "Activate a protocol (Alphanet dictator only)."
no_options
(prefixes [ "activate" ; "protocol" ]
@@ Protocol_hash.param ~name:"version"
~desc:"protocol version (b58check)"
@@ prefixes [ "with" ; "key" ]
@@ Client_keys.Secret_key.source_param
~name:"password" ~desc:"dictator's key"
@@ stop)
begin fun () hash seckey cctxt ->
activate_protocol cctxt
~chain:`Main ~block:cctxt#block
hash seckey >>=? fun _ ->
return ()
end ;
command ~desc:"Wait until an operation is included in a block"
(let int_param =
parameter
@ -385,20 +369,4 @@ let commands () =
return ()
end ;
command ~group:alphanet ~desc: "Fork a test protocol (Alphanet dictator only)."
no_options
(prefixes [ "fork" ; "test" ; "protocol" ]
@@ Protocol_hash.param ~name:"version"
~desc:"protocol version (b58check)"
@@ prefixes [ "with" ; "key" ]
@@ Client_keys.Secret_key.source_param
~name:"password" ~desc:"dictator's key"
@@ stop)
begin fun () hash seckey cctxt ->
activate_test_protocol cctxt
~chain:`Main ~block:cctxt#block
hash seckey >>=? fun _res ->
return ()
end ;
]

View File

@ -775,8 +775,6 @@ module Kind : sig
| Transaction_manager_kind : transaction manager
| Origination_manager_kind : origination manager
| Delegation_manager_kind : delegation manager
type activate_protocol = Activate_protocol_kind
type activate_test_protocol = Activate_test_protocol_kind
end
type 'kind operation = {
@ -835,10 +833,6 @@ and _ contents =
gas_limit: Z.t;
storage_limit: Int64.t;
} -> 'kind Kind.manager contents
| Activate_protocol :
Protocol_hash.t -> Kind.activate_protocol contents
| Activate_test_protocol :
Protocol_hash.t -> Kind.activate_test_protocol contents
and _ manager_operation =
| Reveal : Signature.Public_key.t -> Kind.reveal manager_operation
@ -953,8 +947,6 @@ module Operation : sig
val transaction_case: Kind.transaction Kind.manager case
val origination_case: Kind.origination Kind.manager case
val delegation_case: Kind.delegation Kind.manager case
val activate_protocol_case: Kind.activate_protocol case
val activate_test_protocol_case: Kind.activate_test_protocol case
module Manager_operations : sig

View File

@ -743,18 +743,6 @@ let apply_contents_list
| Cons (Manager_operation _, _) as op ->
apply_manager_contents_list ctxt mode operation op >>= fun (ctxt, result) ->
return (ctxt, result)
| Single (Activate_protocol hash) ->
let dictator_pubkey = Constants.dictator_pubkey ctxt in
Operation.check_signature dictator_pubkey operation >>=? fun () ->
activate ctxt hash >>= fun ctxt ->
return (ctxt, Single_result Activate_protocol_result)
| Single (Activate_test_protocol hash) ->
let dictator_pubkey = Constants.dictator_pubkey ctxt in
Operation.check_signature dictator_pubkey operation >>=? fun () ->
let expiration = (* in two days maximum... *)
Time.add (Timestamp.current ctxt) (Int64.mul 48L 3600L) in
fork_test_chain ctxt hash expiration >>= fun ctxt ->
return (ctxt, Single_result Activate_test_protocol_result)
let apply_operation ctxt mode pred_block hash operation =
let ctxt = Contract.init_origination_nonce ctxt hash in
@ -876,14 +864,6 @@ let compare_operations op1 op2 =
| _, Single (Ballot _) -> 1
| Single (Ballot _), _ -> -1
| Single (Activate_protocol _), Single (Activate_protocol _) -> 0
| _, Single (Activate_protocol _) -> 1
| Single (Activate_protocol _), _ -> -1
| Single (Activate_test_protocol _), Single (Activate_test_protocol _) -> 0
| _, Single (Activate_test_protocol _) -> 1
| Single (Activate_test_protocol _), _ -> -1
(* Manager operations with smaller counter are pre-validated first. *)
| Single (Manager_operation op1), Single (Manager_operation op2) ->
Int32.compare op1.counter op2.counter

View File

@ -327,10 +327,6 @@ type 'kind contents_result =
operation_result : 'kind manager_operation_result ;
internal_operation_results : packed_internal_operation_result list ;
} -> 'kind Kind.manager contents_result
| Activate_protocol_result :
Kind.activate_protocol contents_result
| Activate_test_protocol_result :
Kind.activate_test_protocol contents_result
type packed_contents_result =
| Contents_result : 'kind contents_result -> packed_contents_result
@ -569,38 +565,6 @@ module Encoding = struct
Some (op, res)
| _ -> None)
let activate_protocol_case =
Case {
op_case = Operation.Encoding.activate_protocol_case ;
encoding = Data_encoding.empty ;
select =
(function
| Contents_result (Activate_protocol_result as op) -> Some op
| _ -> None) ;
mselect =
(function
| Contents_and_result (Activate_protocol _ as op, res) -> Some (op, res)
| _ -> None) ;
proj = (fun Activate_protocol_result -> ()) ;
inj = (fun () -> Activate_protocol_result) ;
}
let activate_test_protocol_case =
Case {
op_case = Operation.Encoding.activate_test_protocol_case ;
encoding = Data_encoding.empty ;
select =
(function
| Contents_result (Activate_test_protocol_result as op) -> Some op
| _ -> None) ;
mselect =
(function
| Contents_and_result (Activate_test_protocol _ as op, res) -> Some (op, res)
| _ -> None) ;
proj = (fun Activate_test_protocol_result -> ()) ;
inj = (fun () -> Activate_test_protocol_result) ;
}
end
let contents_result_encoding =
@ -626,8 +590,6 @@ let contents_result_encoding =
make transaction_case ;
make origination_case ;
make delegation_case ;
make activate_protocol_case ;
make activate_test_protocol_case ;
]
let contents_and_result_encoding =
@ -659,8 +621,6 @@ let contents_and_result_encoding =
make transaction_case ;
make origination_case ;
make delegation_case ;
make activate_protocol_case ;
make activate_test_protocol_case ;
]
type 'kind contents_result_list =
@ -753,10 +713,6 @@ let kind_equal
| Proposals _, _ -> None
| Ballot _, Ballot_result -> Some Eq
| Ballot _, _ -> None
| Activate_protocol _, Activate_protocol_result -> Some Eq
| Activate_protocol _, _ -> None
| Activate_test_protocol _, Activate_test_protocol_result -> Some Eq
| Activate_test_protocol _, _ -> None
| Manager_operation
{ operation = Reveal _ ; _ },
Manager_operation_result

View File

@ -66,10 +66,6 @@ and 'kind contents_result =
operation_result : 'kind manager_operation_result ;
internal_operation_results : packed_internal_operation_result list ;
} -> 'kind Kind.manager contents_result
| Activate_protocol_result :
Kind.activate_protocol contents_result
| Activate_test_protocol_result :
Kind.activate_test_protocol contents_result
and packed_contents_result =
| Contents_result : 'kind contents_result -> packed_contents_result

View File

@ -335,14 +335,6 @@ module Forge = struct
operation ctxt b ~branch
(Ballot { source ; period ; proposal ; ballot })
let activate_protocol ctxt
b ~branch hash =
operation ctxt b ~branch (Activate_protocol hash)
let activate_test_protocol ctxt
b ~branch hash =
operation ctxt b ~branch (Activate_test_protocol hash)
let seed_nonce_revelation ctxt
block ~branch ~level ~nonce () =
operation ctxt block ~branch (Seed_nonce_revelation { level ; nonce })

View File

@ -122,16 +122,6 @@ module Forge : sig
end
val activate_protocol:
'a #RPC_context.simple -> 'a ->
branch:Block_hash.t ->
Protocol_hash.t -> MBytes.t shell_tzresult Lwt.t
val activate_test_protocol:
'a #RPC_context.simple -> 'a ->
branch:Block_hash.t ->
Protocol_hash.t -> MBytes.t shell_tzresult Lwt.t
val endorsement:
'a #RPC_context.simple -> 'a ->
branch:Block_hash.t ->

View File

@ -26,8 +26,6 @@ module Kind = struct
| Transaction_manager_kind : transaction manager
| Origination_manager_kind : origination manager
| Delegation_manager_kind : delegation manager
type activate_protocol = Activate_protocol_kind
type activate_test_protocol = Activate_test_protocol_kind
end
type raw = Operation.t = {
@ -93,10 +91,6 @@ and _ contents =
gas_limit: Z.t;
storage_limit: Int64.t;
} -> 'kind Kind.manager contents
| Activate_protocol :
Protocol_hash.t -> Kind.activate_protocol contents
| Activate_test_protocol :
Protocol_hash.t -> Kind.activate_test_protocol contents
and _ manager_operation =
| Reveal : Signature.Public_key.t -> Kind.reveal manager_operation
@ -526,36 +520,6 @@ module Encoding = struct
let origination_case = make_manager_case 9 Manager_operations.origination_case
let delegation_case = make_manager_case 10 Manager_operations.delegation_case
let activate_protocol_case =
Case {
tag = 11 ;
name = "activate_protocol" ;
encoding =
(obj1
(req "hash" Protocol_hash.encoding)) ;
select =
(function
| Contents (Activate_protocol _ as op) -> Some op
| _ -> None) ;
proj = (fun (Activate_protocol hash) -> hash) ;
inj = (fun hash -> Activate_protocol hash) ;
}
let activate_test_protocol_case =
Case {
tag = 12 ;
name = "activate_test_protocol" ;
encoding =
(obj1
(req "hash" Protocol_hash.encoding)) ;
select =
(function
| Contents (Activate_test_protocol _ as op) -> Some op
| _ -> None) ;
proj = (fun (Activate_test_protocol hash) -> hash) ;
inj = (fun hash -> Activate_test_protocol hash) ;
}
let contents_encoding =
let make (Case { tag ; name ; encoding ; select ; proj ; inj }) =
case (Tag tag) name encoding
@ -574,8 +538,6 @@ module Encoding = struct
make transaction_case ;
make origination_case ;
make delegation_case ;
make activate_protocol_case ;
make activate_test_protocol_case ;
]
let contents_list_encoding =
@ -644,8 +606,6 @@ let acceptable_passes (op : packed_operation) =
| Single (Proposals _ ) -> [1]
| Single (Ballot _ ) -> [1]
| Single (Activate_protocol _ ) -> [1]
| Single (Activate_test_protocol _ ) -> [1]
| Single (Seed_nonce_revelation _) -> [2]
| Single (Double_endorsement_evidence _) -> [2]
@ -750,10 +710,6 @@ let equal_contents_kind
| Some Eq -> Some Eq
end
| Manager_operation _, _ -> None
| Activate_protocol _, Activate_protocol _ -> Some Eq
| Activate_protocol _, _ -> None
| Activate_test_protocol _, Activate_test_protocol _ -> Some Eq
| Activate_test_protocol _, _ -> None
let rec equal_contents_kind_list
: type a b. a contents_list -> b contents_list -> (a, b) eq option

View File

@ -26,8 +26,6 @@ module Kind : sig
| Transaction_manager_kind : transaction manager
| Origination_manager_kind : origination manager
| Delegation_manager_kind : delegation manager
type activate_protocol = Activate_protocol_kind
type activate_test_protocol = Activate_test_protocol_kind
end
@ -94,10 +92,6 @@ and _ contents =
gas_limit: Z.t;
storage_limit: Int64.t;
} -> 'kind Kind.manager contents
| Activate_protocol :
Protocol_hash.t -> Kind.activate_protocol contents
| Activate_test_protocol :
Protocol_hash.t -> Kind.activate_test_protocol contents
and _ manager_operation =
| Reveal : Signature.Public_key.t -> Kind.reveal manager_operation
@ -198,8 +192,6 @@ module Encoding : sig
val transaction_case: Kind.transaction Kind.manager case
val origination_case: Kind.origination Kind.manager case
val delegation_case: Kind.delegation Kind.manager case
val activate_protocol_case: Kind.activate_protocol case
val activate_test_protocol_case: Kind.activate_test_protocol case
module Manager_operations : sig