packages feed

ppad-bolt4-0.1.0: bench/Weight.hs

module Main where

import Fixtures
import Lightning.Protocol.BOLT4
import Weigh

main :: IO ()
main = do
  fx <- fixtures
  mainWith $ do
    wgroup "construct" $ do
      func "1 hop" (construct (fx_session fx) (fx_route_1 fx)) (fx_ad fx)
      func "5 hops" (construct (fx_session fx) (fx_route_5 fx)) (fx_ad fx)
      func "20 hops" (construct (fx_session fx) (fx_route_20 fx)) (fx_ad fx)
    wgroup "process" $ do
      func "forward"
        (process (fx_first_node fx) (fx_onion_5 fx) (fx_ad fx)) Nothing
      func "receive"
        (process (fx_first_node fx) (fx_onion_1 fx) (fx_ad fx)) Nothing
      func "forward (blinded)"
        (process (fx_blinded_node fx) (fx_blinded_onion fx) (fx_ad fx))
        (Just (fx_path_key fx))
    wgroup "returning errors" $ do
      func "construct_error" (construct_error (fx_secret fx)) (fx_failure fx)
      func "wrap_error" (wrap_error (fx_secret fx)) (fx_error fx)
      func "unwrap_error (hop 4 of 5)"
        (unwrap_error (fx_secrets_5 fx)) (fx_returned fx)
    wgroup "route blinding" $ do
      func "create_blinded_path (3 hops)"
        (create_blinded_path (fx_path_seed fx)) (fx_path_nodes fx)
      func "decrypt_recipient_data"
        (decrypt_recipient_data (fx_blinded_node fx) (fx_path_key fx))
        (fx_encrypted fx)
    wgroup "codecs" $ do
      func "encode_onion_packet" encode_onion_packet (fx_onion_5 fx)
      func "decode_onion_packet" decode_onion_packet (fx_onion_bytes fx)
      func "encode_hop_payload" encode_hop_payload (fx_payload fx)
      func "decode_hop_payload" decode_hop_payload (fx_payload_bytes fx)