Skip to content

Commit

Permalink
use block_window_duration_ms from genesis_constants
Browse files Browse the repository at this point in the history
  • Loading branch information
martyall committed Oct 28, 2024
1 parent 0f0c37d commit 2cc25bd
Show file tree
Hide file tree
Showing 11 changed files with 32 additions and 24 deletions.
6 changes: 5 additions & 1 deletion src/lib/mina_lib/mina_lib.ml
Original file line number Diff line number Diff line change
Expand Up @@ -1500,7 +1500,11 @@ let create ~commit_id ?wallets (config : Config.t) =
let constraint_constants = config.precomputed_values.constraint_constants in
let consensus_constants = config.precomputed_values.consensus_constants in
let compile_config = config.precomputed_values.compile_config in
let block_window_duration = config.compile_config.block_window_duration in
let block_window_duration =
Float.of_int
config.precomputed_values.constraint_constants.block_window_duration_ms
|> Time.Span.of_ms
in
let monitor = Option.value ~default:(Monitor.create ()) config.monitor in
Async.Scheduler.within' ~monitor (fun () ->
let set_itn_data (type t) (module M : Itn_settable with type t = t) (t : t)
Expand Down
11 changes: 9 additions & 2 deletions src/lib/mina_lib/tests/tests.ml
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,10 @@ let%test_module "Epoch ledger sync tests" =
~consensus_constants ~time_controller ~logger
~frontier_broadcast_pipe:frontier_broadcast_pipe_r ~on_remote_push
~log_gossip_heard:false
~block_window_duration:compile_config.block_window_duration
~block_window_duration:
( Float.of_int
precomputed_values.constraint_constants.block_window_duration_ms
|> Time.Span.of_ms )
in
let snark_remote_sink =
let config =
Expand All @@ -211,7 +214,11 @@ let%test_module "Epoch ledger sync tests" =
~consensus_constants ~time_controller ~logger
~frontier_broadcast_pipe:frontier_broadcast_pipe_r ~on_remote_push
~log_gossip_heard:false
~block_window_duration:compile_config.block_window_duration
~block_window_duration:
( Float.of_int
precomputed_values.constraint_constants
.block_window_duration_ms
|> Time.Span.of_ms )
in
snark_remote_sink
in
Expand Down
5 changes: 4 additions & 1 deletion src/lib/network_pool/snark_pool.ml
Original file line number Diff line number Diff line change
Expand Up @@ -568,7 +568,10 @@ let%test_module "random set test" =
let precomputed_values = Lazy.force Precomputed_values.for_unit_tests

let block_window_duration =
Mina_compile_config.For_unit_tests.t.block_window_duration
Float.of_int
Genesis_constants.For_unit_tests.Constraint_constants.t
.block_window_duration_ms
|> Time.Span.of_ms

(* SNARK work is rejected if the prover doesn't have an account and the fee
is below the account creation fee. So, just to make generating valid SNARK
Expand Down
5 changes: 4 additions & 1 deletion src/lib/network_pool/test.ml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,10 @@ let%test_module "network pool test" =
let time_controller = Block_time.Controller.basic ~logger

let block_window_duration =
Mina_compile_config.For_unit_tests.t.block_window_duration
Float.of_int
Genesis_constants.For_unit_tests.Constraint_constants.t
.block_window_duration_ms
|> Time.Span.of_ms

let verifier =
Async.Thread_safe.block_on_async_exn (fun () ->
Expand Down
5 changes: 4 additions & 1 deletion src/lib/network_pool/transaction_pool.ml
Original file line number Diff line number Diff line change
Expand Up @@ -1643,7 +1643,10 @@ let%test_module _ =
let num_extra_keys = 30

let block_window_duration =
Mina_compile_config.For_unit_tests.t.block_window_duration
Float.of_int
Genesis_constants.For_unit_tests.Constraint_constants.t
.block_window_duration_ms
|> Time.Span.of_ms

(* keys that can be used when generating new accounts *)
let extra_keys =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ include Node_config_version

let (ledger_depth : int) = (10 : int)

let (curve_size : int) = (255 : int)

let (coinbase : string) = ("20" : string)

let (k : int) = (24 : int)
Expand Down
2 changes: 0 additions & 2 deletions src/lib/node_config/intf/node_config_intf.mli
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ module type S = sig

val ledger_depth : int

val curve_size : int

val coinbase : string

val k : int
Expand Down
2 changes: 0 additions & 2 deletions src/lib/node_config/node_config.ml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ include Node_config_version

[%%inject "ledger_depth", ledger_depth]

[%%inject "curve_size", curve_size]

[%%inject "coinbase", coinbase]

[%%inject "k", k]
Expand Down
5 changes: 1 addition & 4 deletions src/lib/runtime_config/runtime_config.ml
Original file line number Diff line number Diff line change
Expand Up @@ -1949,10 +1949,7 @@ module Constants : Constants_intf = struct
in
let compile_config =
{ a.compile_config with
block_window_duration =
constraint_constants.block_window_duration_ms |> Float.of_int
|> Time.Span.of_ms
; network_id =
network_id =
Option.value ~default:a.compile_config.network_id
Option.(b.daemon >>= fun d -> d.network_id)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,10 @@ let%test_module "transaction_status" =
let pool_max_size = precomputed_values.genesis_constants.txpool_max_size

let block_window_duration =
Mina_compile_config.For_unit_tests.t.block_window_duration
Float.of_int
Genesis_constants.For_unit_tests.Constraint_constants.t
.block_window_duration_ms
|> Time.Span.of_ms

let verifier =
Async.Thread_safe.block_on_async_exn (fun () ->
Expand Down
8 changes: 1 addition & 7 deletions src/lib/transition_handler/processor.ml
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,7 @@ let cached_transform_deferred_result ~transform_cached ~transform_result cached
(* add a breadcrumb and perform post processing *)
let add_and_finalize ~logger ~frontier ~catchup_scheduler
~processed_transition_writer ~only_if_present ~time_controller ~source
~valid_cb cached_breadcrumb ~(precomputed_values : Precomputed_values.t)
~block_window_duration:_ (*TODO remove unused var*) =
~valid_cb cached_breadcrumb ~(precomputed_values : Precomputed_values.t) =
let module Inclusion_time = Mina_metrics.Block_latency.Inclusion_time in
let breadcrumb =
if Cached.is_pure cached_breadcrumb then Cached.peek cached_breadcrumb
Expand Down Expand Up @@ -284,7 +283,6 @@ let process_transition ~context:(module Context : CONTEXT) ~trust_system
add_and_finalize ~logger ~frontier ~catchup_scheduler
~processed_transition_writer ~only_if_present:false ~time_controller
~source:`Gossip breadcrumb ~precomputed_values ~valid_cb
~block_window_duration:compile_config.block_window_duration
in
( match result with
| Ok () ->
Expand Down Expand Up @@ -378,8 +376,6 @@ let run ~context:(module Context : CONTEXT) ~verifier ~trust_system
let%map result =
add_and_finalize ~logger ~only_if_present:true
~source:`Catchup ~valid_cb b
~block_window_duration:
compile_config.block_window_duration
in
Internal_tracing.with_state_hash state_hash
@@ fun () ->
Expand Down Expand Up @@ -443,8 +439,6 @@ let run ~context:(module Context : CONTEXT) ~verifier ~trust_system
match%map
add_and_finalize ~logger ~only_if_present:false
~source:`Internal breadcrumb ~valid_cb:None
~block_window_duration:
compile_config.block_window_duration
with
| Ok () ->
[%log internal] "Breadcrumb_integrated" ;
Expand Down

0 comments on commit 2cc25bd

Please sign in to comment.