package tezos-alpha-test-helpers

  1. Overview
  2. Docs

The tables are precomputed using this the following formulas:

let max_endos = 32 let max_reward = 80

let r = 0.5 let a = 6. let b = 1.5

let ( -- ) i j = List.init (j - i + 1) (fun x -> x + i)

let baking_rewards = let reward p e = let r_aux = if p = 0 then r *. (float_of_int max_reward) else a in let r = r_aux *. (float_of_int e) /. (float_of_int max_endos) in let r = 1_000_000. *. r in Float.to_int (floor r) in

let ps = 0 -- 2 in let es = 0 -- 32 in

List.map (fun p -> List.map (fun e -> reward p e ) es |> Array.of_list ) ps |> Array.of_list

let endorsing_rewards = let reward p e = let r_aux = (1. -. r) *. (float_of_int max_reward) /. (float_of_int max_endos) in let r = if p = 0 then r_aux else r_aux /. b in let r = 1_000_000. *. r in Float.to_int ((float_of_int e) *. (floor r)) in

let ps = 0 -- 2 in let es = 0 -- 32 in

List.map (fun p -> List.map (fun e -> reward p e ) es |> Array.of_list ) ps |> Array.of_list

val baking_rewards : int array array
val endorsing_rewards : int array array
OCaml

Innovation. Community. Security.