Skip to content

Commit

Permalink
qena
Browse files Browse the repository at this point in the history
  • Loading branch information
cryi committed Sep 11, 2024
1 parent f106158 commit b0cb24d
Show file tree
Hide file tree
Showing 1,143 changed files with 67 additions and 21 deletions.
25 changes: 25 additions & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Use an official OCaml image based on Alpine Linux
FROM docker.io/ocaml/opam:alpine-3.20-ocaml-4.14

# Set up working directory
WORKDIR /workspace

# Update Alpine packages and install required dependencies
RUN sudo apk update && sudo apk add --no-cache \
build-base \
m4 \
dune \
gmp-dev \
opam \
bash \
git \
git-lfs

# Initialize opam and install OCaml dependencies
RUN opam init --disable-sandboxing --auto-setup && \
opam install dune

# Copy the project into the container
COPY . .

CMD ["bash"]
27 changes: 27 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"name": "OCaml Dune Dev Container",
"build": {
"dockerfile": "./Dockerfile" // Update the path to point to the new location of the Dockerfile
},
"workspaceFolder": "/workspace",
"forwardPorts": [
8080
],
"mounts": [
"source=${localWorkspaceFolder},target=/workspace,type=bind"
],
"remoteUser": "root",
"runArgs": [
"--privileged"
],
"customizations": {
"vscode": {
"settings": {
"terminal.integrated.shell.linux": "/bin/bash"
},
"extensions": [
"ocamllabs.ocaml-platform"
]
}
}
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"expected_env_version": 13,
"hash": "PsquebeCaYyvBEESCaXL8B8Tn8BcEhps2Zke1xMVtyr7X4qMfxT",
"hash": "PsqenaVwjhUUm1JJXbrZTB1T5RVyQHBGDricbLPXjcZkxogDeTJ",
"modules": [
"Misc",
"Non_empty_string",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ let compute_min
~initial:issuance_ratio_initial_min
~final:issuance_ratio_final_min

let dyn_max ~stake_ratio =
(* let dyn_max ~stake_ratio =
let r =
if Compare.Q.(stake_ratio <= Q.(5 // 100)) then Q.(10 // 100)
else if Compare.Q.(stake_ratio >= Q.(50 // 100)) then Q.(1 // 100)
Expand All @@ -166,11 +166,11 @@ let dyn_max ~stake_ratio =
in
if Compare.Q.(r <= Q.(1 // 100)) then Q.(1 // 100)
else if Compare.Q.(r >= Q.(10 // 100)) then Q.(10 // 100)
else r
else r *)

let compute_max ~issuance_ratio_min
~(reward_params : Constants_parametric_repr.adaptive_rewards_params)
~launch_cycle ~new_cycle ~stake_ratio =
~launch_cycle ~new_cycle =
let Constants_parametric_repr.
{
initial_period;
Expand All @@ -190,10 +190,8 @@ let compute_max ~issuance_ratio_min
~launch_cycle
~new_cycle
in
let dyn_max = dyn_max ~stake_ratio in
let true_max = Compare.Q.min max_max dyn_max in
(* If max < min, we set the max to the min *)
Compare.Q.max true_max issuance_ratio_min
Compare.Q.max max_max issuance_ratio_min

let compute_reward_coeff_ratio_without_bonus =
let q_1600 = Q.of_int 1600 in
Expand Down Expand Up @@ -311,7 +309,7 @@ let compute_and_store_reward_coeff_at_cycle_end ctxt ~new_cycle =
let issuance_ratio_max =
compute_max
~issuance_ratio_min
~stake_ratio
(* ~stake_ratio *)
~launch_cycle
~new_cycle
~reward_params
Expand Down Expand Up @@ -439,8 +437,8 @@ module Internal_for_tests = struct
let compute_coeff = compute_coeff

let compute_min = compute_min

let dyn_max = dyn_max
(* let dyn_max = dyn_max *)

let compute_max = compute_max
end
Original file line number Diff line number Diff line change
Expand Up @@ -126,13 +126,11 @@ module Internal_for_tests : sig
new_cycle:Cycle_repr.t ->
Q.t

val dyn_max : stake_ratio:Q.t -> Q.t

val compute_max :
issuance_ratio_min:Q.t ->
reward_params:Constants_parametric_repr.adaptive_rewards_params ->
launch_cycle:Cycle_repr.t option ->
new_cycle:Cycle_repr.t ->
stake_ratio:Q.t ->
(* stake_ratio:Q.t -> *)
Q.t
end
Original file line number Diff line number Diff line change
Expand Up @@ -2430,14 +2430,12 @@ module Delegate : sig
new_cycle:Cycle_repr.t ->
Q.t

val dyn_max : stake_ratio:Q.t -> Q.t

val compute_max :
issuance_ratio_min:Q.t ->
reward_params:Constants.Parametric.adaptive_rewards_params ->
launch_cycle:Cycle_repr.t option ->
new_cycle:Cycle_repr.t ->
stake_ratio:Q.t ->
(* stake_ratio:Q.t -> *)
Q.t
end
end
Expand Down
Loading

0 comments on commit b0cb24d

Please sign in to comment.