Fixup: englishify error names

parent 82e40b95
Pipeline #130081155 passed with stages
in 27 minutes and 12 seconds
......@@ -167,7 +167,7 @@ Michelson: verify update
We introduce two new Michelson types `sapling_state` and
`sapling_transaction`, and an instruction called
`sapling_verify_update`.
`SAPLING_VERIFY_UPDATE`.
The instruction takes a transaction and a state and returns an updated
state and a balance (unless it fails).
A transaction has a list of inputs, outputs, a signature, a balance,
......@@ -362,7 +362,7 @@ changes is kept by the interpreter and applied at the end of each
smart contract call.
In the Michelson interpreter two new types are added, `sapling_state` and
`sapling_transaction`, and the instruction `sapling_verify_update`.
`sapling_transaction`, and the instruction `SAPLING_VERIFY_UPDATE`.
Client
^^^^^^
......
......@@ -1890,15 +1890,15 @@ comprehensive description of the Sapling protocol.
> SAPLING_VERIFY_UPDATE / t : s : S => Left (Pair b s') : S
iff the transaction t successfully applied on state s resulting
in balance b and an updated state s'
> SAPLING_VERIFY_UPDATE / t : s : S => Right (Pair "ROOT_INVALID" d) : S
> SAPLING_VERIFY_UPDATE / t : s : S => Right (Pair "INVALID_ROOT" d) : S
iff the transaction t is based on a root d invalid for s, or too old
> SAPLING_VERIFY_UPDATE / t : s : S => Right (Pair "INPUT_SPENT" d) : S
> SAPLING_VERIFY_UPDATE / t : s : S => Right (Pair "ALREADY_SPENT_INPUT" d) : S
iff the input d of transaction t has already been spent in state s
> SAPLING_VERIFY_UPDATE / t : s : S => Right (Pair "OUTPUT_INCORRECT" d) : S
> SAPLING_VERIFY_UPDATE / t : s : S => Right (Pair "INCORRECT_OUTPUT" d) : S
iff the output d of transaction t has incorrect ZK proofs in state s
> SAPLING_VERIFY_UPDATE / t : s : S => Right (Pair "INPUT_INCORRECT" d) : S
> SAPLING_VERIFY_UPDATE / t : s : S => Right (Pair "INCORRECT_INPUT" d) : S
iff the input d of transaction t has incorrect ZK proofs or signature in state s
> SAPLING_VERIFY_UPDATE / t : s : S => Right (Pair "BINDING_SIG_INCORRECT" d) : S
> SAPLING_VERIFY_UPDATE / t : s : S => Right (Pair "INCORRECT_BINDING_SIG" d) : S
iff the signature d of transaction t is incorrect in state s
......
......@@ -25,10 +25,10 @@ open Error_monad
type sapling_verify_error =
| Too_old_root of C.Hash.t
| Input_spent of C.UTXO.input
| Output_incorrect of C.UTXO.output
| Input_incorrect of C.UTXO.input
| Binding_sig_incorrect of C.UTXO.binding_sig
| Already_spent_input of C.UTXO.input
| Incorrect_output of C.UTXO.output
| Incorrect_input of C.UTXO.input
| Incorrect_binding_sig of C.UTXO.binding_sig
type 'a sapling_result = ('a, sapling_verify_error) result
......@@ -41,18 +41,18 @@ let ( >? ) :
let error_data err =
match err with
| Too_old_root root ->
("ROOT_INVALID", Data_encoding.Binary.to_bytes_exn C.Hash.encoding root)
| Input_spent input ->
( "INPUT_SPENT",
("INVALID_ROOT", Data_encoding.Binary.to_bytes_exn C.Hash.encoding root)
| Already_spent_input input ->
( "ALREADY_SPENT_INPUT",
Data_encoding.Binary.to_bytes_exn C.UTXO.input_encoding input )
| Output_incorrect output ->
( "OUTPUT_INCORRECT",
| Incorrect_output output ->
( "INCORRECT_OUTPUT",
Data_encoding.Binary.to_bytes_exn C.UTXO.output_encoding output )
| Input_incorrect input ->
( "INPUT_INCORRECT",
| Incorrect_input input ->
( "INCORRECT_INPUT",
Data_encoding.Binary.to_bytes_exn C.UTXO.input_encoding input )
| Binding_sig_incorrect binding_sig ->
( "BINDING_SIG_INCORRECT",
| Incorrect_binding_sig binding_sig ->
( "INCORRECT_BINDING_SIG",
Data_encoding.Binary.to_bytes_exn
C.UTXO.binding_sig_encoding
binding_sig )
......@@ -65,7 +65,7 @@ let rec check_nullifiers ctxt state inputs =
Sapling_storage.nullifiers_mem ctxt state C.UTXO.(input.nf)
>>=? function
| (ctxt, true) ->
return (ctxt, Error (Input_spent input))
return (ctxt, Error (Already_spent_input input))
| (ctxt, false) ->
check_nullifiers ctxt state inputs )
......@@ -76,7 +76,7 @@ let rec check_outputs ctxt vctx outputs =
| output :: outputs ->
if C.Verification.check_output vctx output then
check_outputs ctxt vctx outputs
else (ctxt, Error (Output_incorrect output))
else (ctxt, Error (Incorrect_output output))
let rec check_inputs ctxt vctx root key inputs =
match inputs with
......@@ -85,7 +85,7 @@ let rec check_inputs ctxt vctx root key inputs =
| input :: inputs ->
if C.Verification.check_spend vctx input root key then
check_inputs ctxt vctx root key inputs
else (ctxt, Error (Input_incorrect input))
else (ctxt, Error (Incorrect_input input))
let verify_update :
Raw_context.t ->
......@@ -122,7 +122,7 @@ let verify_update :
>? fun ctxt () ->
(* Check the signature and balance of the whole transaction *)
if C.Verification.final_check vctx transaction key then (ctxt, Ok ())
else (ctxt, Error (Binding_sig_incorrect transaction.binding_sig))
else (ctxt, Error (Incorrect_binding_sig transaction.binding_sig))
in
(* Free the verification context *)
C.Verification.free vctx ;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment