From cd5ac0a27d2a0fa0aabc785e88e607b6b1d5bf3f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9goire=20Henry?= Date: Fri, 23 Feb 2018 12:43:53 -0500 Subject: [PATCH] Alpha: add `Constants_storage` --- .../lib_protocol/src/TEZOS_PROTOCOL | 1 + .../lib_protocol/src/alpha_context.ml | 37 +------------- .../lib_protocol/src/constants_storage.ml | 48 +++++++++++++++++++ 3 files changed, 50 insertions(+), 36 deletions(-) create mode 100644 src/proto_alpha/lib_protocol/src/constants_storage.ml diff --git a/src/proto_alpha/lib_protocol/src/TEZOS_PROTOCOL b/src/proto_alpha/lib_protocol/src/TEZOS_PROTOCOL index 1baec2fb7..854619532 100644 --- a/src/proto_alpha/lib_protocol/src/TEZOS_PROTOCOL +++ b/src/proto_alpha/lib_protocol/src/TEZOS_PROTOCOL @@ -34,6 +34,7 @@ "Storage_functors", "Storage", + "Constants_storage", "Level_storage", "Nonce_storage", "Seed_storage", diff --git a/src/proto_alpha/lib_protocol/src/alpha_context.ml b/src/proto_alpha/lib_protocol/src/alpha_context.ml index 17c6cfca5..3386fd80d 100644 --- a/src/proto_alpha/lib_protocol/src/alpha_context.ml +++ b/src/proto_alpha/lib_protocol/src/alpha_context.ml @@ -56,42 +56,7 @@ type signature = Ed25519.Signature.t module Constants = struct include Constants_repr - let cycle_length c = - let constants = Raw_context.constants c in - constants.cycle_length - let voting_period_length c = - let constants = Raw_context.constants c in - constants.voting_period_length - let time_before_reward c = - let constants = Raw_context.constants c in - constants.time_before_reward - let slot_durations c = - let constants = Raw_context.constants c in - constants.slot_durations - let first_free_baking_slot c = - let constants = Raw_context.constants c in - constants.first_free_baking_slot - let max_signing_slot c = - let constants = Raw_context.constants c in - constants.max_signing_slot - let max_gas c = - let constants = Raw_context.constants c in - constants.max_gas - let proof_of_work_threshold c = - let constants = Raw_context.constants c in - constants.proof_of_work_threshold - let dictator_pubkey c = - let constants = Raw_context.constants c in - constants.dictator_pubkey - let max_number_of_operations c = - let constants = Raw_context.constants c in - constants.max_number_of_operations - let max_operation_data_length c = - let constants = Raw_context.constants c in - constants.max_operation_data_length - let michelson_maximum_type_size c = - let constants = Raw_context.constants c in - constants.michelson_maximum_type_size + include Constants_storage end module Voting_period = Voting_period_repr diff --git a/src/proto_alpha/lib_protocol/src/constants_storage.ml b/src/proto_alpha/lib_protocol/src/constants_storage.ml new file mode 100644 index 000000000..a14a229f5 --- /dev/null +++ b/src/proto_alpha/lib_protocol/src/constants_storage.ml @@ -0,0 +1,48 @@ +(**************************************************************************) +(* *) +(* Copyright (c) 2014 - 2018. *) +(* Dynamic Ledger Solutions, Inc. *) +(* *) +(* All rights reserved. No warranty, explicit or implicit, provided. *) +(* *) +(**************************************************************************) + +let preserved_cycles c = + let constants = Raw_context.constants c in + constants.preserved_cycles +let cycle_length c = + let constants = Raw_context.constants c in + constants.cycle_length +let voting_period_length c = + let constants = Raw_context.constants c in + constants.voting_period_length +let time_before_reward c = + let constants = Raw_context.constants c in + constants.time_before_reward +let slot_durations c = + let constants = Raw_context.constants c in + constants.slot_durations +let first_free_baking_slot c = + let constants = Raw_context.constants c in + constants.first_free_baking_slot +let max_signing_slot c = + let constants = Raw_context.constants c in + constants.max_signing_slot +let max_gas c = + let constants = Raw_context.constants c in + constants.max_gas +let proof_of_work_threshold c = + let constants = Raw_context.constants c in + constants.proof_of_work_threshold +let dictator_pubkey c = + let constants = Raw_context.constants c in + constants.dictator_pubkey +let max_number_of_operations c = + let constants = Raw_context.constants c in + constants.max_number_of_operations +let max_operation_data_length c = + let constants = Raw_context.constants c in + constants.max_operation_data_length +let michelson_maximum_type_size c = + let constants = Raw_context.constants c in + constants.michelson_maximum_type_size