From e9793137c10189d140ba18ddf3f91f037a26e184 Mon Sep 17 00:00:00 2001 From: dbornside Date: Sat, 14 Jul 2018 18:26:48 -0400 Subject: [PATCH 1/4] change "managerPubkey" to underscores in json field names --- docs/api/rpc_proposal.rst | 32 +++++++++---------- .../lib_protocol/src/operation_repr.ml | 2 +- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/docs/api/rpc_proposal.rst b/docs/api/rpc_proposal.rst index e720208b15ab..68dd20831086 100644 --- a/docs/api/rpc_proposal.rst +++ b/docs/api/rpc_proposal.rst @@ -2990,7 +2990,7 @@ Protocol Alpha || { "kind": "origination", "source": $contract_id, "nonce": integer ∈ [0, 2^16-1], - "managerPubkey": + "manager_pubkey": string /* A Secp256k1 or Ed25519 public key hash (Base58Check-encoded) */, "balance": @@ -3118,7 +3118,7 @@ Protocol Alpha "counter": integer ∈ [-2^31-2, 2^31+2], "gas_limit": $bignum, "storage_limit": integer ∈ [-2^31-2, 2^31+2] || string, - "managerPubkey": + "manager_pubkey": string /* A Secp256k1 or Ed25519 public key hash (Base58Check-encoded) */, "balance": @@ -5187,7 +5187,7 @@ Protocol Alpha "counter": integer ∈ [-2^31-2, 2^31+2], "gas_limit": $bignum, "storage_limit": integer ∈ [-2^31-2, 2^31+2] || string, - "managerPubkey": + "manager_pubkey": string /* A Secp256k1 or Ed25519 public key hash (Base58Check-encoded) */, "balance": @@ -5611,7 +5611,7 @@ Protocol Alpha "counter": integer ∈ [-2^31-2, 2^31+2], "gas_limit": $bignum, "storage_limit": integer ∈ [-2^31-2, 2^31+2] || string, - "managerPubkey": + "manager_pubkey": string /* A Secp256k1 or Ed25519 public key hash (Base58Check-encoded) */, "balance": @@ -5898,7 +5898,7 @@ Protocol Alpha "counter": integer ∈ [-2^31-2, 2^31+2], "gas_limit": $bignum, "storage_limit": integer ∈ [-2^31-2, 2^31+2] || string, - "managerPubkey": + "manager_pubkey": string /* A Secp256k1 or Ed25519 public key hash (Base58Check-encoded) */, "balance": @@ -6243,7 +6243,7 @@ Protocol Alpha "counter": integer ∈ [-2^31-2, 2^31+2], "gas_limit": $bignum, "storage_limit": integer ∈ [-2^31-2, 2^31+2] || string, - "managerPubkey": + "manager_pubkey": string /* A Secp256k1 or Ed25519 public key hash (Base58Check-encoded) */, "balance": @@ -6441,7 +6441,7 @@ Protocol Alpha || { "kind": "origination", "source": $contract_id, "nonce": integer ∈ [0, 2^16-1], - "managerPubkey": + "manager_pubkey": string /* A Secp256k1 or Ed25519 public key hash (Base58Check-encoded) */, "balance": @@ -6569,7 +6569,7 @@ Protocol Alpha "counter": integer ∈ [-2^31-2, 2^31+2], "gas_limit": $bignum, "storage_limit": integer ∈ [-2^31-2, 2^31+2] || string, - "managerPubkey": + "manager_pubkey": string /* A Secp256k1 or Ed25519 public key hash (Base58Check-encoded) */, "balance": @@ -7150,7 +7150,7 @@ Protocol Alpha || { "source": $contract_id, "nonce": integer ∈ [0, 2^16-1], "kind": "origination", - "managerPubkey": + "manager_pubkey": string /* A Secp256k1 or Ed25519 public key hash (Base58Check-encoded) */, "balance": @@ -7471,7 +7471,7 @@ Protocol Alpha || { "source": $contract_id, "nonce": integer ∈ [0, 2^16-1], "kind": "origination", - "managerPubkey": + "manager_pubkey": string /* A Secp256k1 or Ed25519 public key hash (Base58Check-encoded) */, "balance": @@ -8403,7 +8403,7 @@ Protocol Alpha || { "kind": "origination", "source": $contract_id, "nonce": integer ∈ [0, 2^16-1], - "managerPubkey": + "manager_pubkey": string /* A Secp256k1 or Ed25519 public key hash (Base58Check-encoded) */, "balance": @@ -8531,7 +8531,7 @@ Protocol Alpha "counter": integer ∈ [-2^31-2, 2^31+2], "gas_limit": $bignum, "storage_limit": integer ∈ [-2^31-2, 2^31+2] || string, - "managerPubkey": + "manager_pubkey": string /* A Secp256k1 or Ed25519 public key hash (Base58Check-encoded) */, "balance": @@ -8859,7 +8859,7 @@ Protocol Alpha || { "kind": "origination", "source": $contract_id, "nonce": integer ∈ [0, 2^16-1], - "managerPubkey": + "manager_pubkey": string /* A Secp256k1 or Ed25519 public key hash (Base58Check-encoded) */, "balance": @@ -8987,7 +8987,7 @@ Protocol Alpha "counter": integer ∈ [-2^31-2, 2^31+2], "gas_limit": $bignum, "storage_limit": integer ∈ [-2^31-2, 2^31+2] || string, - "managerPubkey": + "manager_pubkey": string /* A Secp256k1 or Ed25519 public key hash (Base58Check-encoded) */, "balance": @@ -9315,7 +9315,7 @@ Protocol Alpha || { "kind": "origination", "source": $contract_id, "nonce": integer ∈ [0, 2^16-1], - "managerPubkey": + "manager_pubkey": string /* A Secp256k1 or Ed25519 public key hash (Base58Check-encoded) */, "balance": @@ -9443,7 +9443,7 @@ Protocol Alpha "counter": integer ∈ [-2^31-2, 2^31+2], "gas_limit": $bignum, "storage_limit": integer ∈ [-2^31-2, 2^31+2] || string, - "managerPubkey": + "manager_pubkey": string /* A Secp256k1 or Ed25519 public key hash (Base58Check-encoded) */, "balance": diff --git a/src/proto_alpha/lib_protocol/src/operation_repr.ml b/src/proto_alpha/lib_protocol/src/operation_repr.ml index f6302e130133..17a62d71c1c6 100644 --- a/src/proto_alpha/lib_protocol/src/operation_repr.ml +++ b/src/proto_alpha/lib_protocol/src/operation_repr.ml @@ -253,7 +253,7 @@ module Encoding = struct name = "origination" ; encoding = (obj6 - (req "managerPubkey" Signature.Public_key_hash.encoding) + (req "manager_pubkey" Signature.Public_key_hash.encoding) (req "balance" Tez_repr.encoding) (dft "spendable" bool true) (dft "delegatable" bool true) -- GitLab From 946f6718525f964f42922f6e08bf5222398f68c0 Mon Sep 17 00:00:00 2001 From: dbornside Date: Sat, 14 Jul 2018 19:01:13 -0400 Subject: [PATCH 2/4] change documented field labels to underscores in json field namesg --- docs/api/rpc_proposal.rst | 4 ++-- .../lib_protocol/src/script_tc_errors_registration.ml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/api/rpc_proposal.rst b/docs/api/rpc_proposal.rst index 68dd20831086..3d0ca93b8faa 100644 --- a/docs/api/rpc_proposal.rst +++ b/docs/api/rpc_proposal.rst @@ -7633,8 +7633,8 @@ Protocol Alpha
     { "type_map":
         [ { "location": $micheline.location,
-            "stackBefore": [ $micheline.michelson_v1.expression ... ],
-            "stackAfter": [ $micheline.michelson_v1.expression ... ] } ... ],
+            "stack_before": [ $micheline.michelson_v1.expression ... ],
+            "stack_after": [ $micheline.michelson_v1.expression ... ] } ... ],
       "gas": $bignum || "unaccounted" }
     $bignum:
       /* Big number
diff --git a/src/proto_alpha/lib_protocol/src/script_tc_errors_registration.ml b/src/proto_alpha/lib_protocol/src/script_tc_errors_registration.ml
index 43f874c98d36..b6285019c2af 100644
--- a/src/proto_alpha/lib_protocol/src/script_tc_errors_registration.ml
+++ b/src/proto_alpha/lib_protocol/src/script_tc_errors_registration.ml
@@ -37,8 +37,8 @@ let type_map_enc =
        (fun (loc, bef, aft) -> (loc, (bef, aft)))
        (obj3
           (req "location" Script.location_encoding)
-          (req "stackBefore" stack_enc)
-          (req "stackAfter" stack_enc)))
+          (req "stack_before" stack_enc)
+          (req "stack_after" stack_enc)))
 
 let stack_ty_enc =
   let open Data_encoding in
-- 
GitLab


From 84f3fb661cfd70736bc690935f69fd8f7963b7a5 Mon Sep 17 00:00:00 2001
From: dbornside 
Date: Sat, 14 Jul 2018 19:09:05 -0400
Subject: [PATCH 3/4] fix michelson interpreter diagnostics field names to have
 underscores

---
 .../src/michelson_v1_primitives.ml            |  4 +-
 .../lib_protocol/src/script_interpreter.ml    |  4 +-
 .../src/script_tc_errors_registration.ml      | 76 +++++++++----------
 3 files changed, 42 insertions(+), 42 deletions(-)

diff --git a/src/proto_alpha/lib_protocol/src/michelson_v1_primitives.ml b/src/proto_alpha/lib_protocol/src/michelson_v1_primitives.ml
index 8c09904eef03..5f83d59b14da 100644
--- a/src/proto_alpha/lib_protocol/src/michelson_v1_primitives.ml
+++ b/src/proto_alpha/lib_protocol/src/michelson_v1_primitives.ml
@@ -553,7 +553,7 @@ let () =
     ~description:
       "In a script or data expression, a primitive was unknown."
     ~pp:(fun ppf n -> Format.fprintf ppf "Unknown primitive %s." n)
-    Data_encoding.(obj1 (req "wrongPrimitiveName" string))
+    Data_encoding.(obj1 (req "wrong_primitive_name" string))
     (function
       | Unknown_primitive_name got -> Some got
       | _ -> None)
@@ -567,7 +567,7 @@ let () =
       "In a script or data expression, a primitive name is \
        neither uppercase, lowercase or capitalized."
     ~pp:(fun ppf n -> Format.fprintf ppf "Primitive %s has invalid case." n)
-    Data_encoding.(obj1 (req "wrongPrimitiveName" string))
+    Data_encoding.(obj1 (req "wrong_primitive_name" string))
     (function
       | Invalid_case name -> Some name
       | _ -> None)
diff --git a/src/proto_alpha/lib_protocol/src/script_interpreter.ml b/src/proto_alpha/lib_protocol/src/script_interpreter.ml
index a8a1bc6725fb..27f02ed781e4 100644
--- a/src/proto_alpha/lib_protocol/src/script_interpreter.ml
+++ b/src/proto_alpha/lib_protocol/src/script_interpreter.ml
@@ -82,8 +82,8 @@ let () =
     ~title: "Script runtime error"
     ~description: "Toplevel error for all runtime script errors"
     (obj2
-       (req "contractHandle" Contract.encoding)
-       (req "contractCode" Script.expr_encoding))
+       (req "contract_handle" Contract.encoding)
+       (req "contract_code" Script.expr_encoding))
     (function
       | Runtime_contract_error (contract, expr) ->
           Some (contract, expr)
diff --git a/src/proto_alpha/lib_protocol/src/script_tc_errors_registration.ml b/src/proto_alpha/lib_protocol/src/script_tc_errors_registration.ml
index b6285019c2af..6dd82bfc77d2 100644
--- a/src/proto_alpha/lib_protocol/src/script_tc_errors_registration.ml
+++ b/src/proto_alpha/lib_protocol/src/script_tc_errors_registration.ml
@@ -86,9 +86,9 @@ let () =
       "In a script or data expression, a primitive was applied \
        to an unsupported number of arguments."
     (located (obj3
-                (req "primitiveName" Script.prim_encoding)
-                (req "expectedArity" arity_enc)
-                (req "wrongArity" arity_enc)))
+                (req "primitive_name" Script.prim_encoding)
+                (req "expected_arity" arity_enc)
+                (req "wrong_arity" arity_enc)))
     (function
       | Invalid_arity (loc, name, exp, got) ->
           Some (loc, (name, exp, got))
@@ -113,8 +113,8 @@ let () =
     ~description:
       "In a script or data expression, a primitive was unknown."
     (located (obj2
-                (dft "expectedPrimitiveNames" (list prim_encoding) [])
-                (req "wrongPrimitiveName" prim_encoding)))
+                (dft "expected_primitive_names" (list prim_encoding) [])
+                (req "wrong_primitive_name" prim_encoding)))
     (function
       | Invalid_primitive (loc, exp, got) -> Some (loc, (exp, got))
       | _ -> None)
@@ -129,8 +129,8 @@ let () =
       "In a script or data expression, an expression was of the wrong kind \
        (for instance a string where only a primitive applications can appear)."
     (located (obj2
-                (req "expectedKinds" (list kind_enc))
-                (req "wrongKind" kind_enc)))
+                (req "expected_kinds" (list kind_enc))
+                (req "wrong_kind" kind_enc)))
     (function
       | Invalid_kind (loc, exp, got) -> Some (loc, (exp, got))
       | _ -> None)
@@ -144,9 +144,9 @@ let () =
     ~description:
       "In a script or data expression, a primitive was of the wrong namespace."
     (located (obj3
-                (req "primitiveName" prim_encoding)
-                (req "expectedNamespace" namespace_enc)
-                (req "wrongNamespace" namespace_enc)))
+                (req "primitive_name" prim_encoding)
+                (req "expected_namespace" namespace_enc)
+                (req "wrong_namespace" namespace_enc)))
     (function
       | Invalid_namespace (loc, name, exp, got) -> Some (loc, (name, exp, got))
       | _ -> None)
@@ -265,9 +265,9 @@ let () =
       "A binary operation is called on operands of types \
        over which it is not defined."
     (located (obj3
-                (req "operatorName" prim_encoding)
-                (req "wrongLeftOperandType" Script.expr_encoding)
-                (req "wrongRightOperandType" Script.expr_encoding)))
+                (req "operator_name" prim_encoding)
+                (req "wrong_left_operand_type" Script.expr_encoding)
+                (req "wrong_right_operand_type" Script.expr_encoding)))
     (function
       | Undefined_binop (loc, n, tyl, tyr) ->
           Some (loc, (n, tyl, tyr))
@@ -283,8 +283,8 @@ let () =
       "A unary operation is called on an operand of type \
        over which it is not defined."
     (located (obj2
-                (req "operatorName" prim_encoding)
-                (req "wrongOperandType" Script.expr_encoding)))
+                (req "operator_name" prim_encoding)
+                (req "wrong_operand_type" Script.expr_encoding)))
     (function
       | Undefined_unop (loc, n, ty) ->
           Some (loc, (n, ty))
@@ -299,8 +299,8 @@ let () =
     ~description:
       "Unexpected stack at the end of a lambda or script."
     (located (obj2
-                (req "expectedReturnType" Script.expr_encoding)
-                (req "wrongStackType" stack_ty_enc)))
+                (req "expected_return_type" Script.expr_encoding)
+                (req "wrong_stack_type" stack_ty_enc)))
     (function
       | Bad_return (loc, sty, ty) -> Some (loc, (ty, sty))
       | _ -> None)
@@ -314,9 +314,9 @@ let () =
     ~description:
       "The stack has an unexpected length or contents."
     (located (obj3
-                (req "primitiveName" prim_encoding)
-                (req "relevantStackPortion" int16)
-                (req "wrongStackType" stack_ty_enc)))
+                (req "primitive_name" prim_encoding)
+                (req "relevant_stack_portion" int16)
+                (req "wrong_stack_type" stack_ty_enc)))
     (function
       | Bad_stack (loc, name, s, sty) -> Some (loc, (name, s, sty))
       | _ -> None)
@@ -388,8 +388,8 @@ let () =
       "At the join point at the end of two code branches \
        the stacks have inconsistent lengths or contents."
     (located (obj2
-                (req "firstStackType" stack_ty_enc)
-                (req "otherStackType" stack_ty_enc)))
+                (req "first_stack_type" stack_ty_enc)
+                (req "other_stack_type" stack_ty_enc)))
     (function
       | Unmatched_branches (loc, stya, styb) ->
           Some (loc, (stya, styb))
@@ -404,7 +404,7 @@ let () =
     ~description:
       "The type of a stack item is unexpected \
        (this error is always accompanied by a more precise one)."
-    (obj1 (req "itemLevel" int16))
+    (obj1 (req "item_level" int16))
     (function
       | Bad_stack_item n -> Some n
       | _ -> None)
@@ -446,8 +446,8 @@ let () =
     ~description:
       "A data expression was invalid for its expected type."
     (located (obj2
-                (req "expectedType" Script.expr_encoding)
-                (req "wrongExpression" Script.expr_encoding)))
+                (req "expected_type" Script.expr_encoding)
+                (req "wrong_expression" Script.expr_encoding)))
     (function
       | Invalid_constant (loc, expr, ty) ->
           Some (loc, (ty, expr))
@@ -477,7 +477,7 @@ let () =
     ~description:
       "A non comparable type was used in a place where \
        only comparable types are accepted."
-    (located (obj1 (req "wrongType" Script.expr_encoding)))
+    (located (obj1 (req "wrong_type" Script.expr_encoding)))
     (function
       | Comparable_type_expected (loc, ty) -> Some (loc, ty)
       | _ -> None)
@@ -494,8 +494,8 @@ let () =
        two types have to be proven, it is always accompanied \
        with another error that provides more context."
     (obj2
-       (req "firstType" Script.expr_encoding)
-       (req "otherType" Script.expr_encoding))
+       (req "first_type" Script.expr_encoding)
+       (req "other_type" Script.expr_encoding))
     (function
       | Inconsistent_types (tya, tyb) -> Some (tya, tyb)
       | _ -> None)
@@ -510,7 +510,7 @@ let () =
       "The body of a map block did not match the expected type"
     (obj2
        (req "loc" Script.location_encoding)
-       (req "bodyType" stack_ty_enc))
+       (req "body_type" stack_ty_enc))
     (function
       | Invalid_map_body (loc, stack) -> Some (loc, stack)
       | _ -> None)
@@ -537,8 +537,8 @@ let () =
                   the ITER."
     (obj3
        (req "loc" Script.location_encoding)
-       (req "befStack" stack_ty_enc)
-       (req "aftStack" stack_ty_enc))
+       (req "bef_stack" stack_ty_enc)
+       (req "aft_stack" stack_ty_enc))
     (function
       | Invalid_iter_body (loc, bef, aft) -> Some (loc, bef, aft)
       | _ -> None)
@@ -551,8 +551,8 @@ let () =
     ~description:"An instruction generated a type larger than the limit."
     (obj3
        (req "loc" Script.location_encoding)
-       (req "typeSize" uint16)
-       (req "maximumTypeSize" uint16))
+       (req "type_size" uint16)
+       (req "maximum_type_size" uint16))
     (function
       | Type_too_large (loc, ts, maxts) -> Some (loc, ts, maxts)
       | _ -> None)
@@ -569,8 +569,8 @@ let () =
        (always followed by more precise errors)."
     (obj3
        (opt "identifier" string)
-       (req "expectedType" Script.expr_encoding)
-       (req "illTypedExpression" Script.expr_encoding))
+       (req "expected_type" Script.expr_encoding)
+       (req "ill_typed_expression" Script.expr_encoding))
     (function
       | Ill_typed_data (name, expr, ty) -> Some (name, ty,  expr)
       | _ -> None)
@@ -585,7 +585,7 @@ let () =
        (always followed by more precise errors)."
     (obj3
        (opt "identifier" string)
-       (req "illFormedExpression" Script.expr_encoding)
+       (req "ill_formed_expression" Script.expr_encoding)
        (req "location" Script.location_encoding))
     (function
       | Ill_formed_type (name, expr, loc) -> Some (name, expr, loc)
@@ -602,8 +602,8 @@ let () =
        a contract code against given input, output and storage types \
        (always followed by more precise errors)."
     (obj2
-       (req "illTypedCode" Script.expr_encoding)
-       (req "typeMap" type_map_enc))
+       (req "ill_typed_code" Script.expr_encoding)
+       (req "type_map" type_map_enc))
     (function
       | Ill_typed_contract (expr, type_map) ->
           Some (expr, type_map)
-- 
GitLab


From 8178cecc1ec2fdd210b309ba3d343c669c9f2a71 Mon Sep 17 00:00:00 2001
From: dbornside 
Date: Sat, 14 Jul 2018 19:11:11 -0400
Subject: [PATCH 4/4] change node config diagnostics json field labels to use
 underscores

---
 src/bin_node/node_data_version.ml | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/bin_node/node_data_version.ml b/src/bin_node/node_data_version.ml
index 621b9ee0262d..17e8889d575c 100644
--- a/src/bin_node/node_data_version.ml
+++ b/src/bin_node/node_data_version.ml
@@ -50,7 +50,7 @@ let () =
         Format.fprintf ppf
           "Invalid data directory '%s'."
           path)
-    Data_encoding.(obj1 (req "datadirPath" string))
+    Data_encoding.(obj1 (req "datadir_path" string))
     (function
       | Invalid_data_dir path ->
           Some path
@@ -66,8 +66,8 @@ let () =
           "Invalid data directory version '%s' (expected '%s')."
           got exp)
     Data_encoding.(obj2
-                     (req "expectedVersion" string)
-                     (req "actualVersion" string))
+                     (req "expected_version" string)
+                     (req "actual_version" string))
     (function
       | Invalid_data_dir_version (expected, actual) ->
           Some (expected, actual)
@@ -78,7 +78,7 @@ let () =
     ~id: "couldNotReadDataDirVersion"
     ~title: "Could not read data directory version file"
     ~description: "Data directory version file was invalid."
-    Data_encoding.(obj1 (req "versionPath" string))
+    Data_encoding.(obj1 (req "version_path" string))
     ~pp:(fun ppf path ->
         Format.fprintf ppf
           "Tried to read version file at '%s', \
@@ -91,7 +91,7 @@ let () =
     ~id: "noDataDirVersionFile"
     ~title: "Data directory version file does not exist"
     ~description: "Data directory version file does not exist"
-    Data_encoding.(obj1 (req "versionPath" string))
+    Data_encoding.(obj1 (req "version_path" string))
     ~pp:(fun ppf path ->
         Format.fprintf ppf
           "Expected to find data directory version file at '%s', \
-- 
GitLab