Skip to content
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

[Housekeeping] Rename *_nonconsensus libraries to shadow their consensus counterparts #10149

Merged
merged 4 commits into from
Feb 6, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 12 additions & 17 deletions src/app/client_sdk/client_sdk.ml
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,11 @@
[%%endif]

open Js_of_ocaml
open Signature_lib_nonconsensus
open Mina_base_nonconsensus
open Rosetta_lib_nonconsensus
open Rosetta_coding_nonconsensus
open Signature_lib
open Mina_base
open Rosetta_lib
open Rosetta_coding
open Js_util
module String_sign = String_sign_nonconsensus.String_sign

let _ =
Js.export "minaSDK"
Expand Down Expand Up @@ -77,18 +76,14 @@ let _ =
Public_key.Compressed.of_base58_check_exn pk_base58_check
|> Public_key.decompress_exn
in
let dummy_payload =
Mina_base_nonconsensus.Signed_command_payload.dummy
in
let dummy_payload = Mina_base.Signed_command_payload.dummy in
let signature =
Mina_base_nonconsensus.Signed_command.sign_payload sk dummy_payload
in
let message =
Mina_base_nonconsensus.Signed_command.to_input dummy_payload
Mina_base.Signed_command.sign_payload sk dummy_payload
in
let message = Mina_base.Signed_command.to_input dummy_payload in
let verified =
Schnorr.verify signature
(Snark_params_nonconsensus.Inner_curve.of_affine pk)
(Snark_params.Tick.Inner_curve.of_affine pk)
message
in
if verified then Js._true
Expand Down Expand Up @@ -266,8 +261,8 @@ let _ =
let make_signed_transaction command nonce =
let payload_or_err =
command
|> Rosetta_lib_nonconsensus.User_command_info.Partial
.to_user_command_payload ~nonce
|> Rosetta_lib.User_command_info.Partial.to_user_command_payload
~nonce
in
match payload_or_err with
| Ok payload -> (
Expand All @@ -281,9 +276,9 @@ let _ =
let json' = `Assoc [ ("data", json) ] in
Js.string (Yojson.Safe.to_string json')
| Error errs ->
make_error (Rosetta_lib_nonconsensus.Errors.show errs) )
make_error (Rosetta_lib.Errors.show errs) )
| Error errs ->
make_error (Rosetta_lib_nonconsensus.Errors.show errs)
make_error (Rosetta_lib.Errors.show errs)
in
match Transaction.Unsigned.Rendered.of_yojson unsigned_txn_json with
| Ok
Expand Down
9 changes: 3 additions & 6 deletions src/app/client_sdk/js_util.ml
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
(* js_util.ml -- types and transformers for Javascript *)

open Js_of_ocaml
open Snark_params_nonconsensus
open Mina_base_nonconsensus
module Currency = Currency_nonconsensus.Currency
module Mina_numbers = Mina_numbers_nonconsensus.Mina_numbers
module Global_slot = Mina_numbers_nonconsensus.Global_slot
open Snark_params.Tick
open Mina_base
module Global_slot = Mina_numbers.Global_slot
module Memo = Signed_command_memo
module Signature_lib = Signature_lib_nonconsensus

let raise_js_error s = Js.raise_js_error (new%js Js.error_constr (Js.string s))

Expand Down
16 changes: 0 additions & 16 deletions src/app/client_sdk/tests/test_signatures.ml
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,8 @@
for comparison against signatures generated in client SDK
*)

[%%import "/src/config.mlh"]

open Core_kernel

[%%ifdef consensus_mechanism]

open Snark_params.Tick

[%%else]

open Snark_params_nonconsensus
module Mina_base = Mina_base_nonconsensus
module Signature_lib = Signature_lib_nonconsensus
module Currency = Currency_nonconsensus.Currency
module Mina_numbers = Mina_numbers_nonconsensus.Mina_numbers

[%%endif]

open Mina_base
open Signature_lib

Expand Down
7 changes: 1 addition & 6 deletions src/lib/currency/currency.ml
Original file line number Diff line number Diff line change
@@ -1,20 +1,15 @@
[%%import "/src/config.mlh"]

open Core_kernel
open Snark_bits

[%%ifdef consensus_mechanism]

open Snark_bits
open Bitstring_lib
open Snark_params
open Tick
open Let_syntax

[%%else]

open Snark_bits_nonconsensus
module Unsigned_extended = Unsigned_extended_nonconsensus.Unsigned_extended

[%%endif]

open Intf
Expand Down
8 changes: 1 addition & 7 deletions src/lib/currency/intf.ml
Original file line number Diff line number Diff line change
@@ -1,18 +1,12 @@
[%%import "/src/config.mlh"]

open Core_kernel
open Snark_bits

[%%ifdef consensus_mechanism]

open Snark_bits
open Snark_params.Tick

[%%else]

open Snark_bits_nonconsensus
module Random_oracle = Random_oracle_nonconsensus.Random_oracle
module Sgn = Sgn_nonconsensus.Sgn

[%%endif]

type uint64 = Unsigned.uint64
Expand Down
7 changes: 1 addition & 6 deletions src/lib/data_hash_lib/data_hash.ml
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,12 @@
[%%import "/src/config.mlh"]

open Core_kernel
open Snark_params.Tick

[%%ifdef consensus_mechanism]

open Snark_params.Tick
open Bitstring_lib

[%%else]

open Snark_params_nonconsensus
module Random_oracle = Random_oracle_nonconsensus.Random_oracle

[%%endif]

module type Full_size = Data_hash_intf.Full_size
Expand Down
7 changes: 1 addition & 6 deletions src/lib/data_hash_lib/data_hash_intf.ml
Original file line number Diff line number Diff line change
@@ -1,17 +1,12 @@
[%%import "/src/config.mlh"]

open Core_kernel
open Snark_params.Tick

[%%ifdef consensus_mechanism]

open Snark_params.Tick
open Snark_bits

[%%else]

open Snark_params_nonconsensus
module Random_oracle = Random_oracle_nonconsensus.Random_oracle

[%%endif]

module type Data_hash_descriptor = sig
Expand Down
13 changes: 1 addition & 12 deletions src/lib/data_hash_lib/state_hash.ml
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,8 @@
[%%import "/src/config.mlh"]

open Core_kernel

[%%ifndef consensus_mechanism]

module Outside_hash_image = Outside_hash_image_nonconsensus.Outside_hash_image
module Random_oracle = Random_oracle_nonconsensus.Random_oracle
open Snark_params_nonconsensus

[%%else]

open Snark_params.Tick

[%%endif]

include Data_hash.Make_full_size (struct
let version_byte = Base58_check.Version_bytes.state_hash

Expand All @@ -33,7 +22,7 @@ let zero = dummy
(* in the nonconsensus world, we don't have the Pedersen machinery available,
so just inline the value for zero
*)
let zero = Snark_params_nonconsensus.Field.of_string "0"
let zero = Field.of_string "0"

[%%endif]

Expand Down
11 changes: 0 additions & 11 deletions src/lib/data_hash_lib/state_hash.mli
Original file line number Diff line number Diff line change
@@ -1,19 +1,8 @@
(* state_hash.mli *)

[%%import "/src/config.mlh"]

open Core_kernel

[%%ifdef consensus_mechanism]

open Snark_params.Tick

[%%else]

open Snark_params_nonconsensus

[%%endif]

include Data_hash.Full_size

include Codable.Base58_check_intf with type t := t
Expand Down
2 changes: 1 addition & 1 deletion src/lib/hash_prefix_states/dune
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@
(libraries snark_params mina_compile_config random_oracle mina_signature_kind)
(preprocessor_deps ../../config.mlh)
(preprocess
(pps ppx_custom_printf ppx_snarky ppx_version ppx_optcomp ppx_inline_test ppx_compare ppx_deriving_yojson))
(pps ppx_custom_printf ppx_snarky ppx_version ppx_inline_test ppx_compare ppx_deriving_yojson))
(instrumentation (backend bisect_ppx))
(synopsis "Values corresponding to the internal state of the Pedersen hash function on the prefixes used in Coda"))
12 changes: 0 additions & 12 deletions src/lib/hash_prefix_states/hash_prefix_states.ml
Original file line number Diff line number Diff line change
@@ -1,15 +1,3 @@
[%%import "/src/config.mlh"]

[%%ifdef consensus_mechanism]

[%%else]

module Random_oracle = Random_oracle_nonconsensus.Random_oracle
module Mina_compile_config =
Mina_compile_config_nonconsensus.Mina_compile_config

[%%endif]

open Core_kernel
open Hash_prefixes

Expand Down
12 changes: 0 additions & 12 deletions src/lib/hash_prefix_states/hash_prefix_states.mli
Original file line number Diff line number Diff line change
@@ -1,17 +1,5 @@
[%%import "/src/config.mlh"]

[%%ifdef consensus_mechanism]

open Snark_params
open Tick

[%%else]

open Snark_params_nonconsensus
module Random_oracle = Random_oracle_nonconsensus.Random_oracle

[%%endif]

open Random_oracle

val signature : Field.t State.t
Expand Down
8 changes: 0 additions & 8 deletions src/lib/mina_base/account.ml
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,6 @@ open Core_kernel
open Snark_params
open Tick

[%%else]

module Currency = Currency_nonconsensus.Currency
module Mina_numbers = Mina_numbers_nonconsensus.Mina_numbers
module Random_oracle = Random_oracle_nonconsensus.Random_oracle
module Mina_compile_config =
Mina_compile_config_nonconsensus.Mina_compile_config

[%%endif]

open Currency
Expand Down
9 changes: 0 additions & 9 deletions src/lib/mina_base/account_id.mli
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,8 @@

open Core_kernel
open Import

[%%ifdef consensus_mechanism]

open Snark_params.Tick

[%%else]

open Snark_params_nonconsensus

[%%endif]

[%%versioned:
module Stable : sig
module V1 : sig
Expand Down
8 changes: 0 additions & 8 deletions src/lib/mina_base/account_timing.ml
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,6 @@ open Core_kernel
open Snark_params
open Tick

[%%else]

module Currency = Currency_nonconsensus.Currency
module Mina_numbers = Mina_numbers_nonconsensus.Mina_numbers
module Random_oracle = Random_oracle_nonconsensus.Random_oracle
module Mina_compile_config =
Mina_compile_config_nonconsensus.Mina_compile_config

[%%endif]

open Currency
Expand Down
10 changes: 0 additions & 10 deletions src/lib/mina_base/data_hash.ml
Original file line number Diff line number Diff line change
@@ -1,13 +1,3 @@
(* data_hash.ml *)

[%%import "/src/config.mlh"]

[%%ifdef consensus_mechanism]

include Data_hash_lib.Data_hash

[%%else]

include Data_hash_lib_nonconsensus.Data_hash

[%%endif]
10 changes: 0 additions & 10 deletions src/lib/mina_base/hash_prefix.ml
Original file line number Diff line number Diff line change
@@ -1,13 +1,3 @@
(* hash_prefix.ml *)

[%%import "/src/config.mlh"]

[%%ifdef consensus_mechanism]

include Hash_prefix_states

[%%else]

include Hash_prefix_states_nonconsensus.Hash_prefix_states

[%%endif]
14 changes: 0 additions & 14 deletions src/lib/mina_base/import.ml
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,6 @@

[%%import "/src/config.mlh"]

[%%ifndef consensus_mechanism]

module Signature_lib = Signature_lib_nonconsensus
module Mina_compile_config =
Mina_compile_config_nonconsensus.Mina_compile_config
module Sgn = Sgn_nonconsensus.Sgn
module Currency = Currency_nonconsensus.Currency
module Random_oracle = Random_oracle_nonconsensus.Random_oracle
module Mina_numbers = Mina_numbers_nonconsensus
module Unsigned_extended = Unsigned_extended_nonconsensus.Unsigned_extended
module Hash_prefix_states = Hash_prefix_states_nonconsensus.Hash_prefix_states

[%%endif]

module Public_key = Signature_lib.Public_key
module Private_key = Signature_lib.Private_key
module Signature_keypair = Signature_lib.Keypair
11 changes: 0 additions & 11 deletions src/lib/mina_base/ledger_hash0.ml
Original file line number Diff line number Diff line change
@@ -1,17 +1,6 @@
[%%import "/src/config.mlh"]

open Core_kernel

[%%ifdef consensus_mechanism]

open Snark_params.Tick

[%%else]

open Snark_params_nonconsensus

[%%endif]

include Data_hash.Make_full_size (struct
let description = "Ledger hash"

Expand Down
Loading