Revert protocol Alpha to 003-PsddFKi3

This commit is contained in:
Benjamin Canou 2019-01-07 14:46:04 -05:00
parent fd6ce36a7d
commit 6f07a25a3c
No known key found for this signature in database
GPG Key ID: 73607948459DC5F8
8 changed files with 123 additions and 123 deletions

View File

@ -212,7 +212,7 @@ let rec longer_than l n =
let record_proposals ctxt delegate proposals = let record_proposals ctxt delegate proposals =
begin match proposals with begin match proposals with
| [] -> fail Empty_proposal | [] -> fail Empty_proposal
| _ :: _ -> return_unit | _ :: _ -> return ()
end >>=? fun () -> end >>=? fun () ->
Vote.get_current_period_kind ctxt >>=? function Vote.get_current_period_kind ctxt >>=? function
| Proposal -> | Proposal ->

View File

@ -554,12 +554,12 @@ let prim_encoding =
let () = let () =
register_error_kind register_error_kind
`Permanent `Permanent
~id:"michelson_v1.unknown_primitive_name" ~id:"unknownPrimitiveNameTypeError"
~title: "Unknown primitive name" ~title: "Unknown primitive name (typechecking error)"
~description: ~description:
"In a script or data expression, a primitive was unknown." "In a script or data expression, a primitive was unknown."
~pp:(fun ppf n -> Format.fprintf ppf "Unknown primitive %s." n) ~pp:(fun ppf n -> Format.fprintf ppf "Unknown primitive %s." n)
Data_encoding.(obj1 (req "wrong_primitive_name" string)) Data_encoding.(obj1 (req "wrongPrimitiveName" string))
(function (function
| Unknown_primitive_name got -> Some got | Unknown_primitive_name got -> Some got
| _ -> None) | _ -> None)
@ -567,13 +567,13 @@ let () =
Unknown_primitive_name got) ; Unknown_primitive_name got) ;
register_error_kind register_error_kind
`Permanent `Permanent
~id:"michelson_v1.invalid_primitive_name_case" ~id:"invalidPrimitiveNameCaseTypeError"
~title: "Invalid primitive name case" ~title: "Invalid primitive name case (typechecking error)"
~description: ~description:
"In a script or data expression, a primitive name is \ "In a script or data expression, a primitive name is \
neither uppercase, lowercase or capitalized." neither uppercase, lowercase or capitalized."
~pp:(fun ppf n -> Format.fprintf ppf "Primitive %s has invalid case." n) ~pp:(fun ppf n -> Format.fprintf ppf "Primitive %s has invalid case." n)
Data_encoding.(obj1 (req "wrong_primitive_name" string)) Data_encoding.(obj1 (req "wrongPrimitiveName" string))
(function (function
| Invalid_case name -> Some name | Invalid_case name -> Some name
| _ -> None) | _ -> None)
@ -581,8 +581,8 @@ let () =
Invalid_case name) ; Invalid_case name) ;
register_error_kind register_error_kind
`Permanent `Permanent
~id:"michelson_v1.invalid_primitive_name" ~id:"invalidPrimitiveNameTypeErro"
~title: "Invalid primitive name" ~title: "Invalid primitive name (typechecking error)"
~description: ~description:
"In a script or data expression, a primitive name is \ "In a script or data expression, a primitive name is \
unknown or has a wrong case." unknown or has a wrong case."

View File

@ -253,7 +253,7 @@ module Encoding = struct
name = "origination" ; name = "origination" ;
encoding = encoding =
(obj6 (obj6
(req "manager_pubkey" Signature.Public_key_hash.encoding) (req "managerPubkey" Signature.Public_key_hash.encoding)
(req "balance" Tez_repr.encoding) (req "balance" Tez_repr.encoding)
(dft "spendable" bool true) (dft "spendable" bool true)
(dft "delegatable" bool true) (dft "delegatable" bool true)

View File

@ -297,7 +297,7 @@ module Delegate = struct
| None -> | None ->
(* This case is only when called from `set_active`, when creating (* This case is only when called from `set_active`, when creating
a contract. *) a contract. *)
return_false return false
let add_amount c delegate amount = let add_amount c delegate amount =
ensure_inited c delegate >>=? fun c -> ensure_inited c delegate >>=? fun c ->

View File

@ -55,8 +55,8 @@ let () =
(* Reject *) (* Reject *)
register_error_kind register_error_kind
`Temporary `Temporary
~id:"michelson_v1.script_rejected" ~id:"scriptRejectedRuntimeError"
~title: "Script failed" ~title: "Script failed (runtime script error)"
~description: "A FAILWITH instruction was reached" ~description: "A FAILWITH instruction was reached"
(obj3 (obj3
(req "location" Script.location_encoding) (req "location" Script.location_encoding)
@ -67,7 +67,7 @@ let () =
(* Overflow *) (* Overflow *)
register_error_kind register_error_kind
`Temporary `Temporary
~id:"michelson_v1.script_overflow" ~id:"scriptOverflowRuntimeError"
~title: "Script failed (overflow error)" ~title: "Script failed (overflow error)"
~description: "A FAIL instruction was reached due to the detection of an overflow" ~description: "A FAIL instruction was reached due to the detection of an overflow"
(obj2 (obj2
@ -78,12 +78,12 @@ let () =
(* Runtime contract error *) (* Runtime contract error *)
register_error_kind register_error_kind
`Temporary `Temporary
~id:"michelson_v1.runtime_error" ~id:"scriptRuntimeError"
~title: "Script runtime error" ~title: "Script runtime error"
~description: "Toplevel error for all runtime script errors" ~description: "Toplevel error for all runtime script errors"
(obj2 (obj2
(req "contract_handle" Contract.encoding) (req "contractHandle" Contract.encoding)
(req "contract_code" Script.expr_encoding)) (req "contractCode" Script.expr_encoding))
(function (function
| Runtime_contract_error (contract, expr) -> | Runtime_contract_error (contract, expr) ->
Some (contract, expr) Some (contract, expr)
@ -93,7 +93,7 @@ let () =
(* Bad contract parameter *) (* Bad contract parameter *)
register_error_kind register_error_kind
`Permanent `Permanent
~id:"michelson_v1.bad_contract_parameter" ~id:"badContractParameter"
~title:"Contract supplied an invalid parameter" ~title:"Contract supplied an invalid parameter"
~description:"Either no parameter was supplied to a contract with \ ~description:"Either no parameter was supplied to a contract with \
a non-unit parameter type, a non-unit parameter was \ a non-unit parameter type, a non-unit parameter was \
@ -105,7 +105,7 @@ let () =
(* Cannot serialize log *) (* Cannot serialize log *)
register_error_kind register_error_kind
`Temporary `Temporary
~id:"michelson_v1.cannot_serialize_log" ~id:"cannotSerializeLog"
~title:"Not enough gas to serialize execution trace" ~title:"Not enough gas to serialize execution trace"
~description:"Execution trace with stacks was to big to be serialized with \ ~description:"Execution trace with stacks was to big to be serialized with \
the provided gas" the provided gas"
@ -115,7 +115,7 @@ let () =
(* Cannot serialize failure *) (* Cannot serialize failure *)
register_error_kind register_error_kind
`Temporary `Temporary
~id:"michelson_v1.cannot_serialize_failure" ~id:"cannotSerializeFailure"
~title:"Not enough gas to serialize argument of FAILWITH" ~title:"Not enough gas to serialize argument of FAILWITH"
~description:"Argument of FAILWITH was too big to be serialized with \ ~description:"Argument of FAILWITH was too big to be serialized with \
the provided gas" the provided gas"
@ -125,7 +125,7 @@ let () =
(* Cannot serialize storage *) (* Cannot serialize storage *)
register_error_kind register_error_kind
`Temporary `Temporary
~id:"michelson_v1.cannot_serialize_storage" ~id:"cannotSerializeStorage"
~title:"Not enough gas to serialize execution storage" ~title:"Not enough gas to serialize execution storage"
~description:"The returned storage was too big to be serialized with \ ~description:"The returned storage was too big to be serialized with \
the provided gas" the provided gas"

View File

@ -1617,7 +1617,7 @@ and parse_instr
let log_stack ctxt loc stack_ty aft = let log_stack ctxt loc stack_ty aft =
match type_logger, script_instr with match type_logger, script_instr with
| None, _ | None, _
| Some _, (Seq (-1, _) | Int _ | String _ | Bytes _) -> return_unit | Some _, (Seq (-1, _) | Int _ | String _ | Bytes _) -> return ()
| Some log, (Prim _ | Seq _) -> | Some log, (Prim _ | Seq _) ->
(* Unparsing for logging done in an unlimited context as this (* Unparsing for logging done in an unlimited context as this
is used only by the client and not the protocol *) is used only by the client and not the protocol *)
@ -1625,7 +1625,7 @@ and parse_instr
unparse_stack ctxt stack_ty >>=? fun (stack_ty, _) -> unparse_stack ctxt stack_ty >>=? fun (stack_ty, _) ->
unparse_stack ctxt aft >>=? fun (aft, _) -> unparse_stack ctxt aft >>=? fun (aft, _) ->
log loc stack_ty aft; log loc stack_ty aft;
return_unit return ()
in in
let return : let return :
context -> bef judgement -> (bef judgement * context) tzresult Lwt.t = fun ctxt judgement -> context -> bef judgement -> (bef judgement * context) tzresult Lwt.t = fun ctxt judgement ->

View File

@ -37,8 +37,8 @@ let type_map_enc =
(fun (loc, bef, aft) -> (loc, (bef, aft))) (fun (loc, bef, aft) -> (loc, (bef, aft)))
(obj3 (obj3
(req "location" Script.location_encoding) (req "location" Script.location_encoding)
(req "stack_before" stack_enc) (req "stackBefore" stack_enc)
(req "stack_after" stack_enc))) (req "stackAfter" stack_enc)))
let stack_ty_enc = let stack_ty_enc =
let open Data_encoding in let open Data_encoding in
@ -80,15 +80,15 @@ let () =
(* Invalid arity *) (* Invalid arity *)
register_error_kind register_error_kind
`Permanent `Permanent
~id:"michelson_v1.invalid_arity" ~id:"invalidArityTypeError"
~title: "Invalid arity" ~title: "Invalid arity (typechecking error)"
~description: ~description:
"In a script or data expression, a primitive was applied \ "In a script or data expression, a primitive was applied \
to an unsupported number of arguments." to an unsupported number of arguments."
(located (obj3 (located (obj3
(req "primitive_name" Script.prim_encoding) (req "primitiveName" Script.prim_encoding)
(req "expected_arity" arity_enc) (req "expectedArity" arity_enc)
(req "wrong_arity" arity_enc))) (req "wrongArity" arity_enc)))
(function (function
| Invalid_arity (loc, name, exp, got) -> | Invalid_arity (loc, name, exp, got) ->
Some (loc, (name, exp, got)) Some (loc, (name, exp, got))
@ -98,7 +98,7 @@ let () =
(* Missing field *) (* Missing field *)
register_error_kind register_error_kind
`Permanent `Permanent
~id:"michelson_v1.missing_script_field" ~id:"missingScriptField"
~title:"Script is missing a field (parse error)" ~title:"Script is missing a field (parse error)"
~description: ~description:
"When parsing script, a field was expected, but not provided" "When parsing script, a field was expected, but not provided"
@ -108,13 +108,13 @@ let () =
(* Invalid primitive *) (* Invalid primitive *)
register_error_kind register_error_kind
`Permanent `Permanent
~id:"michelson_v1.invalid_primitive" ~id:"invalidPrimitiveTypeError"
~title: "Invalid primitive" ~title: "Invalid primitive (typechecking error)"
~description: ~description:
"In a script or data expression, a primitive was unknown." "In a script or data expression, a primitive was unknown."
(located (obj2 (located (obj2
(dft "expected_primitive_names" (list prim_encoding) []) (dft "expectedPrimitiveNames" (list prim_encoding) [])
(req "wrong_primitive_name" prim_encoding))) (req "wrongPrimitiveName" prim_encoding)))
(function (function
| Invalid_primitive (loc, exp, got) -> Some (loc, (exp, got)) | Invalid_primitive (loc, exp, got) -> Some (loc, (exp, got))
| _ -> None) | _ -> None)
@ -123,14 +123,14 @@ let () =
(* Invalid kind *) (* Invalid kind *)
register_error_kind register_error_kind
`Permanent `Permanent
~id:"michelson_v1.invalid_expression_kind" ~id:"invalidExpressionKindTypeError"
~title: "Invalid expression kind" ~title: "Invalid expression kind (typechecking error)"
~description: ~description:
"In a script or data expression, an expression was of the wrong kind \ "In a script or data expression, an expression was of the wrong kind \
(for instance a string where only a primitive applications can appear)." (for instance a string where only a primitive applications can appear)."
(located (obj2 (located (obj2
(req "expected_kinds" (list kind_enc)) (req "expectedKinds" (list kind_enc))
(req "wrong_kind" kind_enc))) (req "wrongKind" kind_enc)))
(function (function
| Invalid_kind (loc, exp, got) -> Some (loc, (exp, got)) | Invalid_kind (loc, exp, got) -> Some (loc, (exp, got))
| _ -> None) | _ -> None)
@ -139,14 +139,14 @@ let () =
(* Invalid namespace *) (* Invalid namespace *)
register_error_kind register_error_kind
`Permanent `Permanent
~id:"michelson_v1.invalid_primitive_namespace" ~id:"invalidPrimitiveNamespaceTypeError"
~title: "Invalid primitive namespace" ~title: "Invalid primitive namespace (typechecking error)"
~description: ~description:
"In a script or data expression, a primitive was of the wrong namespace." "In a script or data expression, a primitive was of the wrong namespace."
(located (obj3 (located (obj3
(req "primitive_name" prim_encoding) (req "primitiveName" prim_encoding)
(req "expected_namespace" namespace_enc) (req "expectedNamespace" namespace_enc)
(req "wrong_namespace" namespace_enc))) (req "wrongNamespace" namespace_enc)))
(function (function
| Invalid_namespace (loc, name, exp, got) -> Some (loc, (name, exp, got)) | Invalid_namespace (loc, name, exp, got) -> Some (loc, (name, exp, got))
| _ -> None) | _ -> None)
@ -155,7 +155,7 @@ let () =
(* Duplicate field *) (* Duplicate field *)
register_error_kind register_error_kind
`Permanent `Permanent
~id:"michelson_v1.duplicate_script_field" ~id:"duplicateScriptField"
~title: "Script has a duplicated field (parse error)" ~title: "Script has a duplicated field (parse error)"
~description: ~description:
"When parsing script, a field was found more than once" "When parsing script, a field was found more than once"
@ -167,7 +167,7 @@ let () =
(* Unexpected big_map *) (* Unexpected big_map *)
register_error_kind register_error_kind
`Permanent `Permanent
~id:"michelson_v1.unexpected_bigmap" ~id:"unexpectedBigMap"
~title: "Big map in unauthorized position (type error)" ~title: "Big map in unauthorized position (type error)"
~description: ~description:
"When parsing script, a big_map type was found somewhere else \ "When parsing script, a big_map type was found somewhere else \
@ -179,7 +179,7 @@ let () =
(* Unexpected operation *) (* Unexpected operation *)
register_error_kind register_error_kind
`Permanent `Permanent
~id:"michelson_v1.unexpected_operation" ~id:"unexpectedOperation"
~title: "Big map in unauthorized position (type error)" ~title: "Big map in unauthorized position (type error)"
~description: ~description:
"When parsing script, a operation type was found \ "When parsing script, a operation type was found \
@ -192,7 +192,7 @@ let () =
(* Unordered map keys *) (* Unordered map keys *)
register_error_kind register_error_kind
`Permanent `Permanent
~id:"michelson_v1.unordered_map_literal" ~id:"unorderedMapLiteral"
~title:"Invalid map key order" ~title:"Invalid map key order"
~description:"Map keys must be in strictly increasing order" ~description:"Map keys must be in strictly increasing order"
(obj2 (obj2
@ -205,7 +205,7 @@ let () =
(* Duplicate map keys *) (* Duplicate map keys *)
register_error_kind register_error_kind
`Permanent `Permanent
~id:"michelson_v1.duplicate_map_keys" ~id:"duplicateMapKeys"
~title:"Duplicate map keys" ~title:"Duplicate map keys"
~description:"Map literals cannot contain duplicated keys" ~description:"Map literals cannot contain duplicated keys"
(obj2 (obj2
@ -218,7 +218,7 @@ let () =
(* Unordered set values *) (* Unordered set values *)
register_error_kind register_error_kind
`Permanent `Permanent
~id:"michelson_v1.unordered_set_literal" ~id:"unorderedSetLiteral"
~title:"Invalid set value order" ~title:"Invalid set value order"
~description:"Set values must be in strictly increasing order" ~description:"Set values must be in strictly increasing order"
(obj2 (obj2
@ -231,7 +231,7 @@ let () =
(* Duplicate set values *) (* Duplicate set values *)
register_error_kind register_error_kind
`Permanent `Permanent
~id:"michelson_v1.duplicate_set_values_in_literal" ~id:"duplicateSetValuesInLiteral"
~title:"Sets literals cannot contain duplicate elements" ~title:"Sets literals cannot contain duplicate elements"
~description:"Set literals cannot contain duplicate elements, \ ~description:"Set literals cannot contain duplicate elements, \
but a duplicae was found while parsing." but a duplicae was found while parsing."
@ -246,8 +246,8 @@ let () =
(* Fail not in tail position *) (* Fail not in tail position *)
register_error_kind register_error_kind
`Permanent `Permanent
~id:"michelson_v1.fail_not_in_tail_position" ~id:"failNotInTailPositionTypeError"
~title: "FAIL not in tail position" ~title: "FAIL not in tail position (typechecking error)"
~description: ~description:
"There is non trivial garbage code after a FAIL instruction." "There is non trivial garbage code after a FAIL instruction."
(located empty) (located empty)
@ -259,15 +259,15 @@ let () =
(* Undefined binary operation *) (* Undefined binary operation *)
register_error_kind register_error_kind
`Permanent `Permanent
~id:"michelson_v1.undefined_binop" ~id:"undefinedBinopTypeError"
~title: "Undefined binop" ~title: "Undefined binop (typechecking error)"
~description: ~description:
"A binary operation is called on operands of types \ "A binary operation is called on operands of types \
over which it is not defined." over which it is not defined."
(located (obj3 (located (obj3
(req "operator_name" prim_encoding) (req "operatorName" prim_encoding)
(req "wrong_left_operand_type" Script.expr_encoding) (req "wrongLeftOperandType" Script.expr_encoding)
(req "wrong_right_operand_type" Script.expr_encoding))) (req "wrongRightOperandType" Script.expr_encoding)))
(function (function
| Undefined_binop (loc, n, tyl, tyr) -> | Undefined_binop (loc, n, tyl, tyr) ->
Some (loc, (n, tyl, tyr)) Some (loc, (n, tyl, tyr))
@ -277,14 +277,14 @@ let () =
(* Undefined unary operation *) (* Undefined unary operation *)
register_error_kind register_error_kind
`Permanent `Permanent
~id:"michelson_v1.undefined_unop" ~id:"undefinedUnopTypeError"
~title: "Undefined unop" ~title: "Undefined unop (typechecking error)"
~description: ~description:
"A unary operation is called on an operand of type \ "A unary operation is called on an operand of type \
over which it is not defined." over which it is not defined."
(located (obj2 (located (obj2
(req "operator_name" prim_encoding) (req "operatorName" prim_encoding)
(req "wrong_operand_type" Script.expr_encoding))) (req "wrongOperandType" Script.expr_encoding)))
(function (function
| Undefined_unop (loc, n, ty) -> | Undefined_unop (loc, n, ty) ->
Some (loc, (n, ty)) Some (loc, (n, ty))
@ -294,13 +294,13 @@ let () =
(* Bad return *) (* Bad return *)
register_error_kind register_error_kind
`Permanent `Permanent
~id:"michelson_v1.bad_return" ~id:"badReturnTypeError"
~title: "Bad return" ~title: "Bad return (typechecking error)"
~description: ~description:
"Unexpected stack at the end of a lambda or script." "Unexpected stack at the end of a lambda or script."
(located (obj2 (located (obj2
(req "expected_return_type" Script.expr_encoding) (req "expectedReturnType" Script.expr_encoding)
(req "wrong_stack_type" stack_ty_enc))) (req "wrongStackType" stack_ty_enc)))
(function (function
| Bad_return (loc, sty, ty) -> Some (loc, (ty, sty)) | Bad_return (loc, sty, ty) -> Some (loc, (ty, sty))
| _ -> None) | _ -> None)
@ -309,14 +309,14 @@ let () =
(* Bad stack *) (* Bad stack *)
register_error_kind register_error_kind
`Permanent `Permanent
~id:"michelson_v1.bad_stack" ~id:"badStackTypeError"
~title: "Bad stack" ~title: "Bad stack (typechecking error)"
~description: ~description:
"The stack has an unexpected length or contents." "The stack has an unexpected length or contents."
(located (obj3 (located (obj3
(req "primitive_name" prim_encoding) (req "primitiveName" prim_encoding)
(req "relevant_stack_portion" int16) (req "relevantStackPortion" int16)
(req "wrong_stack_type" stack_ty_enc))) (req "wrongStackType" stack_ty_enc)))
(function (function
| Bad_stack (loc, name, s, sty) -> Some (loc, (name, s, sty)) | Bad_stack (loc, name, s, sty) -> Some (loc, (name, s, sty))
| _ -> None) | _ -> None)
@ -325,7 +325,7 @@ let () =
(* Inconsistent annotations *) (* Inconsistent annotations *)
register_error_kind register_error_kind
`Permanent `Permanent
~id:"michelson_v1.inconsistent_annotations" ~id:"inconsistentAnnotations"
~title:"Annotations inconsistent between branches" ~title:"Annotations inconsistent between branches"
~description:"The annotations on two types could not be merged" ~description:"The annotations on two types could not be merged"
(obj2 (obj2
@ -337,7 +337,7 @@ let () =
(* Inconsistent field annotations *) (* Inconsistent field annotations *)
register_error_kind register_error_kind
`Permanent `Permanent
~id:"michelson_v1.inconsistent_field_annotations" ~id:"inconsistentFieldAnnotations"
~title:"Annotations for field accesses is inconsistent" ~title:"Annotations for field accesses is inconsistent"
~description:"The specified field does not match the field annotation in the type" ~description:"The specified field does not match the field annotation in the type"
(obj2 (obj2
@ -349,7 +349,7 @@ let () =
(* Inconsistent type annotations *) (* Inconsistent type annotations *)
register_error_kind register_error_kind
`Permanent `Permanent
~id:"michelson_v1.inconsistent_type_annotations" ~id:"inconsistentTypeAnnotations"
~title:"Types contain inconsistent annotations" ~title:"Types contain inconsistent annotations"
~description:"The two types contain annotations that do not match" ~description:"The two types contain annotations that do not match"
(located (obj2 (located (obj2
@ -362,7 +362,7 @@ let () =
(* Unexpected annotation *) (* Unexpected annotation *)
register_error_kind register_error_kind
`Permanent `Permanent
~id:"michelson_v1.unexpected_annotation" ~id:"unexpectedAnnotation"
~title:"An annotation was encountered where no annotation is expected" ~title:"An annotation was encountered where no annotation is expected"
~description:"A node in the syntax tree was impropperly annotated" ~description:"A node in the syntax tree was impropperly annotated"
(located empty) (located empty)
@ -372,7 +372,7 @@ let () =
(* Ungrouped annotations *) (* Ungrouped annotations *)
register_error_kind register_error_kind
`Permanent `Permanent
~id:"michelson_v1.ungrouped_annotations" ~id:"ungroupedAnnotations"
~title:"Annotations of the same kind were found spread apart" ~title:"Annotations of the same kind were found spread apart"
~description:"Annotations of the same kind must be grouped" ~description:"Annotations of the same kind must be grouped"
(located empty) (located empty)
@ -382,14 +382,14 @@ let () =
(* Unmatched branches *) (* Unmatched branches *)
register_error_kind register_error_kind
`Permanent `Permanent
~id:"michelson_v1.unmatched_branches" ~id:"unmatchedBranchesTypeError"
~title: "Unmatched branches" ~title: "Unmatched branches (typechecking error)"
~description: ~description:
"At the join point at the end of two code branches \ "At the join point at the end of two code branches \
the stacks have inconsistent lengths or contents." the stacks have inconsistent lengths or contents."
(located (obj2 (located (obj2
(req "first_stack_type" stack_ty_enc) (req "firstStackType" stack_ty_enc)
(req "other_stack_type" stack_ty_enc))) (req "otherStackType" stack_ty_enc)))
(function (function
| Unmatched_branches (loc, stya, styb) -> | Unmatched_branches (loc, stya, styb) ->
Some (loc, (stya, styb)) Some (loc, (stya, styb))
@ -399,12 +399,12 @@ let () =
(* Bad stack item *) (* Bad stack item *)
register_error_kind register_error_kind
`Permanent `Permanent
~id:"michelson_v1.bad_stack_item" ~id:"badStackItemTypeError"
~title: "Bad stack item" ~title: "Bad stack item (typechecking error)"
~description: ~description:
"The type of a stack item is unexpected \ "The type of a stack item is unexpected \
(this error is always accompanied by a more precise one)." (this error is always accompanied by a more precise one)."
(obj1 (req "item_level" int16)) (obj1 (req "itemLevel" int16))
(function (function
| Bad_stack_item n -> Some n | Bad_stack_item n -> Some n
| _ -> None) | _ -> None)
@ -413,8 +413,8 @@ let () =
(* SELF in lambda *) (* SELF in lambda *)
register_error_kind register_error_kind
`Permanent `Permanent
~id:"michelson_v1.self_in_lambda" ~id:"selfInLambda"
~title: "SELF instruction in lambda" ~title: "SELF instruction in lambda (typechecking error)"
~description: ~description:
"A SELF instruction was encountered in a lambda expression." "A SELF instruction was encountered in a lambda expression."
(located empty) (located empty)
@ -426,8 +426,8 @@ let () =
(* Bad stack length *) (* Bad stack length *)
register_error_kind register_error_kind
`Permanent `Permanent
~id:"michelson_v1.inconsistent_stack_lengths" ~id:"inconsistentStackLengthsTypeError"
~title: "Inconsistent stack lengths" ~title: "Inconsistent stack lengths (typechecking error)"
~description: ~description:
"A stack was of an unexpected length \ "A stack was of an unexpected length \
(this error is always in the context of a located error)." (this error is always in the context of a located error)."
@ -441,13 +441,13 @@ let () =
(* Invalid constant *) (* Invalid constant *)
register_error_kind register_error_kind
`Permanent `Permanent
~id:"michelson_v1.invalid_constant" ~id:"invalidConstantTypeError"
~title: "Invalid constant" ~title: "Invalid constant (typechecking error)"
~description: ~description:
"A data expression was invalid for its expected type." "A data expression was invalid for its expected type."
(located (obj2 (located (obj2
(req "expected_type" Script.expr_encoding) (req "expectedType" Script.expr_encoding)
(req "wrong_expression" Script.expr_encoding))) (req "wrongExpression" Script.expr_encoding)))
(function (function
| Invalid_constant (loc, expr, ty) -> | Invalid_constant (loc, expr, ty) ->
Some (loc, (ty, expr)) Some (loc, (ty, expr))
@ -457,8 +457,8 @@ let () =
(* Invalid contract *) (* Invalid contract *)
register_error_kind register_error_kind
`Permanent `Permanent
~id:"michelson_v1.invalid_contract" ~id:"invalidContractTypeError"
~title: "Invalid contract" ~title: "Invalid contract (typechecking error)"
~description: ~description:
"A script or data expression references a contract that does not \ "A script or data expression references a contract that does not \
exist or assumes a wrong type for an existing contract." exist or assumes a wrong type for an existing contract."
@ -472,12 +472,12 @@ let () =
(* Comparable type expected *) (* Comparable type expected *)
register_error_kind register_error_kind
`Permanent `Permanent
~id:"michelson_v1.comparable_type_expected" ~id:"comparableTypeExpectedTypeError"
~title: "Comparable type expected" ~title: "Comparable type expected (typechecking error)"
~description: ~description:
"A non comparable type was used in a place where \ "A non comparable type was used in a place where \
only comparable types are accepted." only comparable types are accepted."
(located (obj1 (req "wrong_type" Script.expr_encoding))) (located (obj1 (req "wrongType" Script.expr_encoding)))
(function (function
| Comparable_type_expected (loc, ty) -> Some (loc, ty) | Comparable_type_expected (loc, ty) -> Some (loc, ty)
| _ -> None) | _ -> None)
@ -486,16 +486,16 @@ let () =
(* Inconsistent types *) (* Inconsistent types *)
register_error_kind register_error_kind
`Permanent `Permanent
~id:"michelson_v1.inconsistent_types" ~id:"InconsistentTypesTypeError"
~title: "Inconsistent types" ~title: "Inconsistent types (typechecking error)"
~description: ~description:
"This is the basic type clash error, \ "This is the basic type clash error, \
that appears in several places where the equality of \ that appears in several places where the equality of \
two types have to be proven, it is always accompanied \ two types have to be proven, it is always accompanied \
with another error that provides more context." with another error that provides more context."
(obj2 (obj2
(req "first_type" Script.expr_encoding) (req "firstType" Script.expr_encoding)
(req "other_type" Script.expr_encoding)) (req "otherType" Script.expr_encoding))
(function (function
| Inconsistent_types (tya, tyb) -> Some (tya, tyb) | Inconsistent_types (tya, tyb) -> Some (tya, tyb)
| _ -> None) | _ -> None)
@ -504,13 +504,13 @@ let () =
(* Invalid map body *) (* Invalid map body *)
register_error_kind register_error_kind
`Permanent `Permanent
~id:"michelson_v1.invalid_map_body" ~id:"invalidMapBody"
~title: "Invalid map body" ~title: "Invalid map body"
~description: ~description:
"The body of a map block did not match the expected type" "The body of a map block did not match the expected type"
(obj2 (obj2
(req "loc" Script.location_encoding) (req "loc" Script.location_encoding)
(req "body_type" stack_ty_enc)) (req "bodyType" stack_ty_enc))
(function (function
| Invalid_map_body (loc, stack) -> Some (loc, stack) | Invalid_map_body (loc, stack) -> Some (loc, stack)
| _ -> None) | _ -> None)
@ -518,7 +518,7 @@ let () =
(* Invalid map block FAIL *) (* Invalid map block FAIL *)
register_error_kind register_error_kind
`Permanent `Permanent
~id:"michelson_v1.invalid_map_block_fail" ~id:"invalidMapBlockFail"
~title:"FAIL instruction occurred as body of map block" ~title:"FAIL instruction occurred as body of map block"
~description:"FAIL cannot be the only instruction in the body. \ ~description:"FAIL cannot be the only instruction in the body. \
The propper type of the return list cannot be inferred." The propper type of the return list cannot be inferred."
@ -530,15 +530,15 @@ let () =
(* Invalid ITER body *) (* Invalid ITER body *)
register_error_kind register_error_kind
`Permanent `Permanent
~id:"michelson_v1.invalid_iter_body" ~id:"invalidIterBody"
~title:"ITER body returned wrong stack type" ~title:"ITER body returned wrong stack type"
~description:"The body of an ITER instruction \ ~description:"The body of an ITER instruction \
must result in the same stack type as before \ must result in the same stack type as before \
the ITER." the ITER."
(obj3 (obj3
(req "loc" Script.location_encoding) (req "loc" Script.location_encoding)
(req "bef_stack" stack_ty_enc) (req "befStack" stack_ty_enc)
(req "aft_stack" stack_ty_enc)) (req "aftStack" stack_ty_enc))
(function (function
| Invalid_iter_body (loc, bef, aft) -> Some (loc, bef, aft) | Invalid_iter_body (loc, bef, aft) -> Some (loc, bef, aft)
| _ -> None) | _ -> None)
@ -546,13 +546,13 @@ let () =
(* Type too large *) (* Type too large *)
register_error_kind register_error_kind
`Permanent `Permanent
~id:"michelson_v1.type_too_large" ~id:"typeTooLarge"
~title:"Stack item type too large" ~title:"Stack item type too large"
~description:"An instruction generated a type larger than the limit." ~description:"An instruction generated a type larger than the limit."
(obj3 (obj3
(req "loc" Script.location_encoding) (req "loc" Script.location_encoding)
(req "type_size" uint16) (req "typeSize" uint16)
(req "maximum_type_size" uint16)) (req "maximumTypeSize" uint16))
(function (function
| Type_too_large (loc, ts, maxts) -> Some (loc, ts, maxts) | Type_too_large (loc, ts, maxts) -> Some (loc, ts, maxts)
| _ -> None) | _ -> None)
@ -561,16 +561,16 @@ let () =
(* Ill typed data *) (* Ill typed data *)
register_error_kind register_error_kind
`Permanent `Permanent
~id:"michelson_v1.ill_typed_data" ~id:"illTypedDataTypeError"
~title: "Ill typed data" ~title: "Ill typed data (typechecking error)"
~description: ~description:
"The toplevel error thrown when trying to typecheck \ "The toplevel error thrown when trying to typecheck \
a data expression against a given type \ a data expression against a given type \
(always followed by more precise errors)." (always followed by more precise errors)."
(obj3 (obj3
(opt "identifier" string) (opt "identifier" string)
(req "expected_type" Script.expr_encoding) (req "expectedType" Script.expr_encoding)
(req "ill_typed_expression" Script.expr_encoding)) (req "illTypedExpression" Script.expr_encoding))
(function (function
| Ill_typed_data (name, expr, ty) -> Some (name, ty, expr) | Ill_typed_data (name, expr, ty) -> Some (name, ty, expr)
| _ -> None) | _ -> None)
@ -578,14 +578,14 @@ let () =
(* Ill formed type *) (* Ill formed type *)
register_error_kind register_error_kind
`Permanent `Permanent
~id:"michelson_v1.ill_formed_type" ~id:"illFormedTypeTypeError"
~title: "Ill formed type" ~title: "Ill formed type (typechecking error)"
~description: ~description:
"The toplevel error thrown when trying to parse a type expression \ "The toplevel error thrown when trying to parse a type expression \
(always followed by more precise errors)." (always followed by more precise errors)."
(obj3 (obj3
(opt "identifier" string) (opt "identifier" string)
(req "ill_formed_expression" Script.expr_encoding) (req "illFormedExpression" Script.expr_encoding)
(req "location" Script.location_encoding)) (req "location" Script.location_encoding))
(function (function
| Ill_formed_type (name, expr, loc) -> Some (name, expr, loc) | Ill_formed_type (name, expr, loc) -> Some (name, expr, loc)
@ -595,15 +595,15 @@ let () =
(* Ill typed contract *) (* Ill typed contract *)
register_error_kind register_error_kind
`Permanent `Permanent
~id:"michelson_v1.ill_typed_contract" ~id:"illTypedContractTypeError"
~title: "Ill typed contract" ~title: "Ill typed contract (typechecking error)"
~description: ~description:
"The toplevel error thrown when trying to typecheck \ "The toplevel error thrown when trying to typecheck \
a contract code against given input, output and storage types \ a contract code against given input, output and storage types \
(always followed by more precise errors)." (always followed by more precise errors)."
(obj2 (obj2
(req "ill_typed_code" Script.expr_encoding) (req "illTypedCode" Script.expr_encoding)
(req "type_map" type_map_enc)) (req "typeMap" type_map_enc))
(function (function
| Ill_typed_contract (expr, type_map) -> | Ill_typed_contract (expr, type_map) ->
Some (expr, type_map) Some (expr, type_map)
@ -613,7 +613,7 @@ let () =
(* Cannot serialize error *) (* Cannot serialize error *)
register_error_kind register_error_kind
`Temporary `Temporary
~id:"michelson_v1.cannot_serialize_error" ~id:"cannotSerializeError"
~title:"Not enough gas to serialize error" ~title:"Not enough gas to serialize error"
~description:"The error was too big to be serialized with \ ~description:"The error was too big to be serialized with \
the provided gas" the provided gas"

View File

@ -111,8 +111,8 @@ let register () =
register0 S.current_proposal begin fun ctxt () () -> register0 S.current_proposal begin fun ctxt () () ->
(* this would be better implemented using get_option in get_current_proposal *) (* this would be better implemented using get_option in get_current_proposal *)
Vote.get_current_proposal ctxt >>= function Vote.get_current_proposal ctxt >>= function
| Ok p -> return_some p | Ok p -> return (Some p)
| Error [Raw_context.Storage_error (Missing_key _)] -> return_none | Error [Raw_context.Storage_error (Missing_key _)] -> return None
| (Error _ as e) -> Lwt.return e | (Error _ as e) -> Lwt.return e
end end