JJ: Description from the destination commit:

more module renaming

JJ: Description from source commit:
test binary_formats
This commit is contained in:
swrup 2025-10-07 15:08:35 +02:00
parent e4b9fb473a
commit 1112106eb2
7 changed files with 114 additions and 39 deletions

View file

@ -364,7 +364,7 @@ module BlindingMasterSeed = MK_BASIC_32 ()
(* Format used for to generate the signature on a request to withdraw
coins from a reserve. *)
module WithdrawRequestPs = struct
module WithdrawRequestPS = struct
(* Purpose is #TALER_SIGNATURE_WALLET_RESERVE_WITHDRAW *)
type t = {
(* Amount to withdraw, excluding fees, i.e.
@ -432,7 +432,7 @@ module WithdrawRequestPs = struct
|> sealr
end
module WithdrawConfirmationPs = struct
module WithdrawConfirmationPS = struct
(* Purpose is #TALER_SIGNATURE_EXCHANGE_CONFIRM_WITHDRAW.
Signed by a `struct TALER_ExchangePrivateKeyP` using EdDSA. *)
type t = {
@ -451,15 +451,23 @@ module WithdrawConfirmationPs = struct
noreveal_index: int32;
}
let size = Purpose.size + HashPlanchetsP.size + int32_size
let purpose = Purpose.make ~size Taler_signatures.exchange_confirm_withdraw
(*let size = Purpose.size + HashPlanchetsP.size + int32_size*)
open Bin
let bin =
let open Bin in
record (fun _urpose h_planchets noreveal_index ->
{ h_planchets; noreveal_index })
|+ field Purpose.bin (Fun.const purpose)
|+ field HashPlanchetsP.bin (fun t -> t.h_planchets)
|+ field beint32 (fun t -> t.noreveal_index)
record (fun purpose h_planchets noreveal_index ->
(purpose, { h_planchets; noreveal_index }))
|+ field Purpose.bin (fun (purpose, _t) -> purpose)
|+ field HashPlanchetsP.bin (fun (_p, t) -> t.h_planchets)
|+ field beint32 (fun (_p, t) -> t.noreveal_index)
|> sealr
let size =
match Size.of_value (Size.size_of bin) with
| Dynamic _ | Unknown -> Fmt.failwith "size_of failure: size is not Static"
| Static n -> n
let purpose = Purpose.make ~size Taler_signatures.exchange_confirm_withdraw
let bin = map bin (fun (_p, t) -> t) (fun t -> (purpose, t))
end