From af2f365741e7be81fc4cb28e977393e3a29cc9f6 Mon Sep 17 00:00:00 2001 From: swrup Date: Thu, 26 Feb 2026 20:12:35 +0100 Subject: [PATCH] --- src/http_info.ml | 3 ++ src/http_management.ml | 83 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 86 insertions(+) diff --git a/src/http_info.ml b/src/http_info.ml index a8793388..ed01f380 100644 --- a/src/http_info.ml +++ b/src/http_info.ml @@ -114,6 +114,9 @@ let mk_keys ~db_conn (module Keys : Keys.S) ~last_issue_date = let* global_fees = Pg.get_global_fees db_conn ~start_date:Timestamp.zero |> unwrap_err_caqti in + let () = + List.iter Http_management.Global_fees.print_global_fees global_fees + in let* auditors = (* /auditors/$AUDITOR_PUB/$H_DENOM_PUB *) Pg.get_auditor_keys db_conn diff --git a/src/http_management.ml b/src/http_management.ml index f1ef75b6..7c1bd4e5 100644 --- a/src/http_management.ml +++ b/src/http_management.ml @@ -292,6 +292,88 @@ module Wire_fee = struct end module Global_fees = struct + let to_hex s = + let hex = Hex.of_string s in + let hex = Hex.hexdump_s ~print_row_numbers:false ~print_chars:false hex in + hex + + (* + let print_global_fees + GlobalFees. + { + start_date; + end_date; + purse_timeout; + history_expiration; + history_fee; + account_fee; + purse_fee; + purse_account_limit; + master_sig; + } = + let pp_timestamp ppf ts = + let s = Bin.to_string Timestamp.bin ts |> to_hex in + Fmt.pf ppf "%s" s + in + let pp_duration ppf d = + let s = Bin.to_string Time.TimeRelative.bin d |> to_hex in + Fmt.pf ppf "%s" s + in + let pp_amount ppf amount = + let s = Bin.to_string Amount.bin amount |> to_hex in + Fmt.pf ppf "%s" s + in + Fmt.epr + {| + { + start_date = %a; + end_date = %a; + purse_timeout = %a; + history_expiration = %a; + history_fee = %a; + account_fee = %a; + purse_fee = %a; + purse_account_limit = %lu; + master_sig = %S; + } + |} + pp_timestamp start_date pp_timestamp end_date pp_duration purse_timeout + pp_duration history_expiration pp_amount history_fee pp_amount account_fee + pp_amount purse_fee purse_account_limit + (Signatures.GlobalFees.to_octets master_sig |> to_hex); + () + *) + + let print_global_fees + GlobalFees. + { + start_date; + end_date; + history_fee; + account_fee; + purse_fee; + history_expiration; + purse_account_limit; + purse_timeout; + master_sig= _; + } = + let open Signatures.GlobalFees in + let r = + { + R.start_date; + end_date; + purse_timeout; + history_expiration; + history_fee; + account_fee; + purse_fee; + purse_account_limit; + } + in + let s = Bin.to_string R.bin r in + Fmt.epr "@.%s@." (to_hex s); + () + let verify (module Keys : Keys.S) GlobalFees. { @@ -337,6 +419,7 @@ module Global_fees = struct "a different global-fees was already setup for this time frame" | true -> Logs.info (fun m -> m "an identical global-fees was already setup"); + let () = print_global_fees vv in Ok ()) | _ -> Error