Skip to content

Commit

Permalink
fix make_compile_config
Browse files Browse the repository at this point in the history
  • Loading branch information
martyall committed Sep 25, 2024
1 parent 9a0ac1b commit 24ab32f
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 43 deletions.
66 changes: 39 additions & 27 deletions src/lib/genesis_ledger_helper/lib/genesis_ledger_helper_lib.ml
Original file line number Diff line number Diff line change
Expand Up @@ -415,33 +415,45 @@ module Accounts = struct
end

let make_compile_config ~(default : Mina_compile_config.t)
(config : Runtime_config.Daemon.t) : Mina_compile_config.t =
{ default with
zkapp_proof_update_cost =
Option.value ~default:default.zkapp_proof_update_cost
config.zkapp_proof_update_cost
; zkapp_signed_single_update_cost =
Option.value ~default:default.zkapp_signed_single_update_cost
config.zkapp_signed_single_update_cost
; zkapp_signed_pair_update_cost =
Option.value ~default:default.zkapp_signed_pair_update_cost
config.zkapp_signed_pair_update_cost
; zkapp_transaction_cost_limit =
Option.value ~default:default.zkapp_transaction_cost_limit
config.zkapp_transaction_cost_limit
; max_event_elements =
Option.value ~default:default.max_event_elements config.max_event_elements
; max_action_elements =
Option.value ~default:default.max_action_elements
config.max_action_elements
; zkapp_cmd_limit_hardcap =
Option.value ~default:default.zkapp_cmd_limit_hardcap
config.zkapp_cmd_limit_hardcap
; minimum_user_command_fee =
Option.value ~default:default.minimum_user_command_fee
config.minimum_user_command_fee
; network_id = Option.value ~default:default.network_id config.network_id
}
(runtime_config : Runtime_config.t) : Mina_compile_config.t =
match runtime_config.daemon with
| None ->
default
| Some config ->
{ default with
zkapp_proof_update_cost =
Option.value ~default:default.zkapp_proof_update_cost
config.zkapp_proof_update_cost
; zkapp_signed_single_update_cost =
Option.value ~default:default.zkapp_signed_single_update_cost
config.zkapp_signed_single_update_cost
; zkapp_signed_pair_update_cost =
Option.value ~default:default.zkapp_signed_pair_update_cost
config.zkapp_signed_pair_update_cost
; zkapp_transaction_cost_limit =
Option.value ~default:default.zkapp_transaction_cost_limit
config.zkapp_transaction_cost_limit
; max_event_elements =
Option.value ~default:default.max_event_elements
config.max_event_elements
; max_action_elements =
Option.value ~default:default.max_action_elements
config.max_action_elements
; zkapp_cmd_limit_hardcap =
Option.value ~default:default.zkapp_cmd_limit_hardcap
config.zkapp_cmd_limit_hardcap
; minimum_user_command_fee =
Option.value ~default:default.minimum_user_command_fee
config.minimum_user_command_fee
; network_id = Option.value ~default:default.network_id config.network_id
; block_window_duration =
Option.value ~default:default.block_window_duration
Option.(
runtime_config.proof
>>= fun a ->
a.block_window_duration_ms
>>| fun a -> Float.of_int a |> Time.Span.of_ms)
}

let make_constraint_constants
~(default : Genesis_constants.Constraint_constants.t)
Expand Down
7 changes: 2 additions & 5 deletions src/lib/integration_test_cloud_engine/mina_automation.ml
Original file line number Diff line number Diff line change
Expand Up @@ -243,10 +243,7 @@ module Network_config = struct
; slot_tx_end
; slot_chain_end
; minimum_user_command_fee = None
; network_id =
Some
(Option.value ~default:constants.compile_config.network_id
network_id )
; network_id
}
; genesis =
Some
Expand All @@ -262,7 +259,7 @@ module Network_config = struct
Some
{ level = (None : Runtime_config.Proof_keys.Level.t option)
; sub_windows_per_window = None
; ledger_depth = Some constants.constraint_constants.ledger_depth
; ledger_depth = None
; work_delay = Some work_delay
; block_window_duration_ms = Some block_window_duration_ms
; transaction_capacity =
Expand Down
17 changes: 10 additions & 7 deletions src/lib/integration_test_lib/test_config.ml
Original file line number Diff line number Diff line change
Expand Up @@ -150,18 +150,21 @@ let apply_runtime_config ~logger runtime_config constants =
~default:constants.constraint_constants)
in
let compile_config =
Option.value ~default:constants.compile_config
Option.(
runtime_config.daemon
>>| Genesis_ledger_helper.make_compile_config
~default:constants.compile_config)
Genesis_ledger_helper.make_compile_config runtime_config
~default:constants.compile_config
in
{ genesis_constants; constraint_constants; compile_config }

let transaction_capacity config = Int.pow 2 config.transaction_capacity_log_2
let transaction_capacity_log_2 (config : t) = config.transaction_capacity_log_2

let transaction_capacity config =
let i = transaction_capacity_log_2 config in
Int.pow 2 i

let blocks_for_first_ledger_proof (config : t) =
((config.work_delay + 1) * (config.transaction_capacity_log_2 + 1)) + 1
let work_delay = config.work_delay in
let transaction_capacity_log_2 = transaction_capacity_log_2 config in
((work_delay + 1) * (transaction_capacity_log_2 + 1)) + 1

let slots_for_blocks blocks =
(*Given 0.75 slots are filled*)
Expand Down
5 changes: 1 addition & 4 deletions src/lib/integration_test_local_engine/mina_docker.ml
Original file line number Diff line number Diff line change
Expand Up @@ -167,10 +167,7 @@ module Network_config = struct
; slot_tx_end
; slot_chain_end
; minimum_user_command_fee = None
; network_id =
Some
(Option.value ~default:constants.compile_config.network_id
network_id )
; network_id
}
; genesis =
Some
Expand Down

0 comments on commit 24ab32f

Please sign in to comment.