-
Notifications
You must be signed in to change notification settings - Fork 529
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
consolidate ppx-optcomp usage to single module #15837
Conversation
!ci-build-me |
!ci-build-me |
!ci-build-me |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some comments to help the reviewers
@@ -18,7 +18,6 @@ let commands = | |||
[ Cmd.run "./scripts/lint_codeowners.sh" | |||
, Cmd.run "./scripts/lint_rfcs.sh" | |||
, Cmd.run "make check-snarky-submodule" | |||
, Cmd.run "./scripts/lint_preprocessor_deps.sh" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The only library which uses ppx_optcomp
is now mina_node_config
. It turns out that this script doesn't work when there is only one lib to check, and it also doesn't seem relevant anymore.
@@ -20,13 +20,6 @@ inputs: pkgs: { | |||
touch $out | |||
''; | |||
# todo: ./scripts/check-snarky-submodule.sh # submodule issue | |||
lint-preprocessor-deps = pkgs.runCommand "lint-preprocessor-deps" { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
see note above about lint check script
@@ -1662,79 +1653,11 @@ let audit_type_shapes : Command.t = | |||
Core.printf "good shapes:\n\t%d\nbad shapes:\n\t%d\n%!" !good !bad ; | |||
if !bad > 0 then Core.exit 1 ) ) | |||
|
|||
[%%if force_updates] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
force_updates
is set to false
in every profile, so this code is dead. It no longer compiled, rather than update it I just deleted it.
@@ -39,8 +37,6 @@ module Make_str (_ : Wire_types.Concrete) = struct | |||
let zero = UInt64.zero | |||
|
|||
module Controller = struct | |||
[%%if time_offsets] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
time_offsets
is set to true
for every profile
@@ -1621,25 +1619,6 @@ module Make_str (A : Wire_types.Concrete) = struct | |||
end ) | |||
end | |||
|
|||
[%%else] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
dead code
[%%endif] | ||
|
||
[%%inject "supercharged_coinbase_factor", supercharged_coinbase_factor] | ||
match |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
implicitly in the config it seems like you have one of two disjoint cases:
scan_state_with_tps_goal &&
is_some scan_state_tps_goal_x10 &&
is_none scan_state_transaction_capacity_log_2
or
not scan_state_with_tps_goal &&
is_none scan_state_tps_goal_x10 &&
is_some scan_state_transaction_capacity_log_2
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what if we remove scan_state_with_tps_goal
, scan_state_tps_goal_x10
and retain only scan_state_transaction_capacity_log_2
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you probably could, but my goal here was to do the smallest transformation and keep any config values code paths that were being used. IMO it would be easier to simplify the config which is being used in a follow up -- i.e. taking a look at what is in node config and seeing if we still care about each field.
For example, there are some fields which only act as a flag to log a simple statement, and other kind of "do nothing" fields we can likely remove.
|
||
let fork = None | ||
|
||
[%%else] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
dead code
@@ -67,44 +55,14 @@ let max_event_elements = 100 | |||
|
|||
let max_action_elements = 100 | |||
|
|||
[%%inject "network_id", network] | |||
|
|||
[%%ifndef zkapp_cmd_limit] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These kinds of conditional assignments are all pushed into the Node_config
module
@@ -0,0 +1,49 @@ | |||
val curve_size : int |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I felt it was better to explicitly give the Mina_compile_config
interface because there are several values in here which are hard coded and seem like they should be considered as configuration
|
||
let directory = `Ephemeral | ||
|
||
let depth = Genesis_constants.Constraint_constants.compiled.ledger_depth | ||
end) | ||
|
||
[%%else] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
dead code
!ci-build-me |
!ci-build-me |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approving this PR with acknowledgment that in follow-up PRs we'll get rid of a few unused options completely.
|
||
[%%else] | ||
|
||
(*NOTE A previous version of this function included compile time ppx that didn't compile, and was never |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's remove ensure_testnet_id_still_good
function and its only callsite
Great job! |
High level
I consolidated all uses of
ppx_optcomp
to a single moduleNode_config
and removed the dependency onppx_optcomp
andconfig.mlh
from every other library.This will allow us to easily replace the compile time configuration with loading a configuration file -- simply replace the implementation of
Node_config
to do this.related to #15538
Changes
The vast majority of changes are due to
[%%import "/src/config.mlh"]
wherever possibleppx_optcomp
wherever possiblepreprocessor_deps <path_to_config.mlh>
wherever possibleI tried to keep other changes minimal, just to recover from what happens when you do the above. This manifests mostly as:
%%inject
directive, use theNode_config
module values%%ifdef
is used, just use simple if-then-else statements in the code.