package octez-protocol-018-Proxford-libs

  1. Overview
  2. Docs
Octez protocol 018-Proxford libraries

Install

Dune Dependency

Authors

Maintainers

Sources

tezos-18.1.tar.gz
sha256=aa2f5bc99cc4ca2217c52a1af2a2cdfd3b383208cb859ca2e79ca0903396ca1d
sha512=d68bb3eb615e3dcccc845fddfc9901c95b3c6dc8e105e39522ce97637b1308a7fa7aa1d271351d5933febd7476b2819e1694f31198f1f0919681f1f9cc97cb3a

doc/octez-protocol-018-Proxford-libs.test-helpers/Tezos_018_Proxford_test_helpers/Rewards/index.html

Module Tezos_018_Proxford_test_helpers.RewardsSource

The tables are precomputed using this the following formulas:

let max_attestations = 256 let max_reward = 40

let r = 0.5 let a = 3. 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 max_attestations) in let r = 1_000_000. *. r in Float.to_int ((float_of_int e) *. (ceil r)) in

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

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

let attesting_rewards = let reward p e = let r_aux = (1. -. r) *. (float_of_int max_reward) /. (float_of_int max_attestations) 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 -- max_attestations in

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

Sourceval baking_rewards : int array array
Sourceval attesting_rewards : int array array
OCaml

Innovation. Community. Security.