Alpha: fix typo in error registration.
This commit is contained in:
parent
24b5290a74
commit
02a67a7976
@ -12,7 +12,6 @@
|
|||||||
open Tezos_context
|
open Tezos_context
|
||||||
|
|
||||||
type error += Bad_endorsement (* TODO: doc *)
|
type error += Bad_endorsement (* TODO: doc *)
|
||||||
type error += Contract_not_delegatable (* TODO: doc *)
|
|
||||||
type error += Unimplemented
|
type error += Unimplemented
|
||||||
type error += Invalid_voting_period
|
type error += Invalid_voting_period
|
||||||
|
|
||||||
@ -99,8 +98,6 @@ let apply_manager_operation_content ctxt origination_nonce accept_failing_script
|
|||||||
return (ctxt, origination_nonce)
|
return (ctxt, origination_nonce)
|
||||||
(* TODO: pay for the storage diff *)
|
(* TODO: pay for the storage diff *)
|
||||||
| Delegation delegate ->
|
| Delegation delegate ->
|
||||||
Contract.is_delegatable ctxt source >>=? fun delegatable ->
|
|
||||||
fail_unless delegatable Contract_not_delegatable >>=? fun () ->
|
|
||||||
Contract.set_delegate ctxt source delegate >>=? fun ctxt ->
|
Contract.set_delegate ctxt source delegate >>=? fun ctxt ->
|
||||||
return (ctxt, origination_nonce)
|
return (ctxt, origination_nonce)
|
||||||
|
|
||||||
|
@ -15,7 +15,7 @@ type error +=
|
|||||||
| Counter_in_the_future of Contract_repr.contract * int32 * int32 (* `Temporary *)
|
| Counter_in_the_future of Contract_repr.contract * int32 * int32 (* `Temporary *)
|
||||||
| Unspendable_contract of Contract_repr.contract (* `Permanent *)
|
| Unspendable_contract of Contract_repr.contract (* `Permanent *)
|
||||||
| Non_existing_contract of Contract_repr.contract (* `Temporary *)
|
| Non_existing_contract of Contract_repr.contract (* `Temporary *)
|
||||||
| Undelagatable_contract of Contract_repr.contract (* `Permanent *)
|
| Non_delegatable_contract of Contract_repr.contract (* `Permanent *)
|
||||||
| Failure of string (* `Permanent *)
|
| Failure of string (* `Permanent *)
|
||||||
|
|
||||||
let () =
|
let () =
|
||||||
@ -127,8 +127,8 @@ let () =
|
|||||||
Format.fprintf ppf "Contract %a is not delegatable"
|
Format.fprintf ppf "Contract %a is not delegatable"
|
||||||
Contract_repr.pp contract)
|
Contract_repr.pp contract)
|
||||||
Data_encoding.(obj1 (req "contract" Contract_repr.encoding))
|
Data_encoding.(obj1 (req "contract" Contract_repr.encoding))
|
||||||
(function Non_existing_contract c -> Some c | _ -> None)
|
(function Non_delegatable_contract c -> Some c | _ -> None)
|
||||||
(fun c -> Non_existing_contract c) ;
|
(fun c -> Non_delegatable_contract c) ;
|
||||||
register_error_kind
|
register_error_kind
|
||||||
`Permanent
|
`Permanent
|
||||||
~id:"contract.failure"
|
~id:"contract.failure"
|
||||||
@ -295,16 +295,15 @@ let is_spendable c contract =
|
|||||||
|
|
||||||
let set_delegate c contract delegate =
|
let set_delegate c contract delegate =
|
||||||
(* A contract delegate can be set only if the contract is delegatable *)
|
(* A contract delegate can be set only if the contract is delegatable *)
|
||||||
Storage.Contract.Delegatable.get c contract >>=? fun delegatable ->
|
is_delegatable c contract >>=? function
|
||||||
if not delegatable
|
| false -> fail (Non_delegatable_contract contract)
|
||||||
then fail (Undelagatable_contract contract)
|
| true ->
|
||||||
else
|
match delegate with
|
||||||
match delegate with
|
| None ->
|
||||||
| None ->
|
Storage.Contract.Delegate.remove c contract >>= fun c ->
|
||||||
Storage.Contract.Delegate.remove c contract >>= fun c ->
|
return c
|
||||||
return c
|
| Some delegate ->
|
||||||
| Some delegate ->
|
Storage.Contract.Delegate.init_set c contract delegate
|
||||||
Storage.Contract.Delegate.init_set c contract delegate
|
|
||||||
|
|
||||||
let contract_fee c contract =
|
let contract_fee c contract =
|
||||||
Storage.Contract.Code_fees.get_option c contract >>=? fun code_fees ->
|
Storage.Contract.Code_fees.get_option c contract >>=? fun code_fees ->
|
||||||
|
@ -15,7 +15,7 @@ type error +=
|
|||||||
| Counter_in_the_future of Contract_repr.contract * int32 * int32 (* `Temporary *)
|
| Counter_in_the_future of Contract_repr.contract * int32 * int32 (* `Temporary *)
|
||||||
| Unspendable_contract of Contract_repr.contract (* `Permanent *)
|
| Unspendable_contract of Contract_repr.contract (* `Permanent *)
|
||||||
| Non_existing_contract of Contract_repr.contract (* `Temporary *)
|
| Non_existing_contract of Contract_repr.contract (* `Temporary *)
|
||||||
| Undelagatable_contract of Contract_repr.contract (* `Permanent *)
|
| Non_delegatable_contract of Contract_repr.contract (* `Permanent *)
|
||||||
| Failure of string (* `Permanent *)
|
| Failure of string (* `Permanent *)
|
||||||
|
|
||||||
val delete : Storage.t -> Contract_repr.t -> Storage.t tzresult Lwt.t
|
val delete : Storage.t -> Contract_repr.t -> Storage.t tzresult Lwt.t
|
||||||
|
Loading…
Reference in New Issue
Block a user