package tezos-protocol-012-Psithaca
Install
Dune Dependency
Authors
Maintainers
Sources
sha256=43723d096307603703a1a89ed1b2eb202b365f5e7824b96b0cbf813b343a6cf7
sha512=b2a637f2e965000d3d49ad85277ca24d6cb07a1a7cf2bc69d296d8b03ad78c3eaa8e21e94b9162e62c2e11649cd03bc845b2a3dafe623b91065df69d47dc8e4f
doc/tezos-protocol-012-Psithaca.raw/Tezos_raw_protocol_012_Psithaca/Apply/index.html
Module Tezos_raw_protocol_012_Psithaca.Apply
Source
This module supports advancing the ledger state by applying operation
s.
Each operation application takes and returns an Alpha_context.t
, representing the old and new state, respectively.
The Main
module provides wrappers for the functionality in this module, satisfying the Protocol signature.
type Tezos_protocol_environment_012_Psithaca.Error_monad.error +=
| Wrong_consensus_operation_branch of Tezos_protocol_environment_012_Psithaca.Block_hash.t * Tezos_protocol_environment_012_Psithaca.Block_hash.t
type Tezos_protocol_environment_012_Psithaca.Error_monad.error +=
| Wrong_level_for_consensus_operation of {
expected : Alpha_context.Raw_level.t;
provided : Alpha_context.Raw_level.t;
}
| Wrong_round_for_consensus_operation of {
expected : Alpha_context.Round.t;
provided : Alpha_context.Round.t;
}
| Preendorsement_round_too_high of {
block_round : Alpha_context.Round.t;
provided : Alpha_context.Round.t;
}
type Tezos_protocol_environment_012_Psithaca.Error_monad.error +=
| Internal_operation_replay of Alpha_context.packed_internal_operation
type Tezos_protocol_environment_012_Psithaca.Error_monad.error +=
| Invalid_denunciation of denunciation_kind
type Tezos_protocol_environment_012_Psithaca.Error_monad.error +=
| Inconsistent_denunciation of {
kind : denunciation_kind;
delegate1 : Tezos_protocol_environment_012_Psithaca.Signature.Public_key_hash.t;
delegate2 : Tezos_protocol_environment_012_Psithaca.Signature.Public_key_hash.t;
}
type Tezos_protocol_environment_012_Psithaca.Error_monad.error +=
| Too_early_denunciation of {
kind : denunciation_kind;
level : Alpha_context.Raw_level.t;
current : Alpha_context.Raw_level.t;
}
type Tezos_protocol_environment_012_Psithaca.Error_monad.error +=
| Outdated_denunciation of {
kind : denunciation_kind;
level : Alpha_context.Raw_level.t;
last_cycle : Alpha_context.Cycle.t;
}
type Tezos_protocol_environment_012_Psithaca.Error_monad.error +=
| Invalid_double_baking_evidence of {
hash1 : Tezos_protocol_environment_012_Psithaca.Block_hash.t;
level1 : Alpha_context.Raw_level.t;
round1 : Alpha_context.Round.t;
hash2 : Tezos_protocol_environment_012_Psithaca.Block_hash.t;
level2 : Alpha_context.Raw_level.t;
round2 : Alpha_context.Round.t;
}
type Tezos_protocol_environment_012_Psithaca.Error_monad.error +=
| Empty_transaction of Alpha_context.Contract.t
val begin_partial_construction :
Alpha_context.t ->
predecessor_level:Alpha_context.Level.t ->
escape_vote:bool ->
(Alpha_context.t
* Apply_results.packed_successful_manager_operation_result list
* Alpha_context.Liquidity_baking.escape_ema,
Tezos_protocol_environment_012_Psithaca.Error_monad.error
Tezos_protocol_environment_012_Psithaca.Error_monad.trace)
Tezos_protocol_environment_012_Psithaca.Pervasives.result
Tezos_protocol_environment_012_Psithaca.Lwt.t
type 'a full_construction = {
ctxt : Alpha_context.t;
protocol_data : 'a;
payload_producer : Tezos_protocol_environment_012_Psithaca.Signature.public_key_hash;
block_producer : Tezos_protocol_environment_012_Psithaca.Signature.public_key_hash;
round : Alpha_context.Round.t;
implicit_operations_results : Apply_results.packed_successful_manager_operation_result list;
liquidity_baking_escape_ema : Alpha_context.Liquidity_baking.escape_ema;
}
val begin_full_construction :
Alpha_context.t ->
predecessor_timestamp:Tezos_protocol_environment_012_Psithaca.Time.t ->
predecessor_level:Alpha_context.Level.t ->
predecessor_round:Alpha_context.Round.t ->
round:Alpha_context.Round.t ->
Alpha_context.Block_header.contents ->
Alpha_context.Block_header.contents full_construction
Tezos_protocol_environment_012_Psithaca.Error_monad.tzresult
Tezos_protocol_environment_012_Psithaca.Lwt.t
val begin_application :
Alpha_context.t ->
Tezos_protocol_environment_012_Psithaca.Chain_id.t ->
Alpha_context.Block_header.t ->
Alpha_context.Fitness.t ->
predecessor_timestamp:Tezos_protocol_environment_012_Psithaca.Time.t ->
predecessor_level:Alpha_context.Level.t ->
predecessor_round:Alpha_context.Round.t ->
(Alpha_context.t
* Tezos_protocol_environment_012_Psithaca.Signature.public_key
* Tezos_protocol_environment_012_Psithaca.Signature.public_key_hash
* Apply_results.packed_successful_manager_operation_result list
* Alpha_context.Liquidity_baking.escape_ema)
Tezos_protocol_environment_012_Psithaca.Error_monad.tzresult
Tezos_protocol_environment_012_Psithaca.Lwt.t
type apply_mode =
| Application of {
predecessor_block : Tezos_protocol_environment_012_Psithaca.Block_hash.t;
payload_hash : Block_payload_hash.t;
locked_round : Alpha_context.Round.t option;
predecessor_level : Alpha_context.Level.t;
predecessor_round : Alpha_context.Round.t;
round : Alpha_context.Round.t;
}
| Full_construction of {
predecessor_block : Tezos_protocol_environment_012_Psithaca.Block_hash.t;
payload_hash : Block_payload_hash.t;
predecessor_level : Alpha_context.Level.t;
predecessor_round : Alpha_context.Round.t;
round : Alpha_context.Round.t;
}
| Partial_construction of {
predecessor_level : Alpha_context.Level.t;
predecessor_round : Alpha_context.Round.t;
grand_parent_round : Alpha_context.Round.t;
}
val apply_operation :
Alpha_context.t ->
Tezos_protocol_environment_012_Psithaca.Chain_id.t ->
apply_mode ->
Script_ir_translator.unparsing_mode ->
payload_producer:Alpha_context.public_key_hash ->
Tezos_protocol_environment_012_Psithaca.Operation_list_hash.elt ->
'a Alpha_context.operation ->
(Alpha_context.t * 'a Apply_results.operation_metadata,
Tezos_protocol_environment_012_Psithaca.Error_monad.error
Tezos_protocol_environment_012_Psithaca.Error_monad.trace)
Tezos_protocol_environment_012_Psithaca.Pervasives.result
Tezos_protocol_environment_012_Psithaca.Lwt.t
type finalize_application_mode =
| Finalize_full_construction of {
level : Alpha_context.Raw_level.t;
predecessor_round : Alpha_context.Round.t;
}
| Finalize_application of Alpha_context.Fitness.t
val finalize_application :
Alpha_context.t ->
finalize_application_mode ->
Alpha_context.Block_header.contents ->
payload_producer:Alpha_context.public_key_hash ->
block_producer:Alpha_context.public_key_hash ->
Alpha_context.Liquidity_baking.escape_ema ->
Apply_results.packed_successful_manager_operation_result list ->
round:Alpha_context.Round.t ->
predecessor:Tezos_protocol_environment_012_Psithaca.Block_hash.t ->
migration_balance_updates:Alpha_context.Receipt.balance_updates ->
(Alpha_context.t * Alpha_context.Fitness.t * Apply_results.block_metadata,
Tezos_protocol_environment_012_Psithaca.Error_monad.error
Tezos_protocol_environment_012_Psithaca.Error_monad.trace)
Tezos_protocol_environment_012_Psithaca.Pervasives.result
Tezos_protocol_environment_012_Psithaca.Lwt.t
val apply_manager_contents_list :
Alpha_context.t ->
Script_ir_translator.unparsing_mode ->
payload_producer:Alpha_context.public_key_hash ->
Tezos_protocol_environment_012_Psithaca.Chain_id.t ->
'a Alpha_context.Kind.manager Apply_results.prechecked_contents_list ->
(Alpha_context.t
* 'a Alpha_context.Kind.manager Apply_results.contents_result_list)
Tezos_protocol_environment_012_Psithaca.Lwt.t
val apply_contents_list :
Alpha_context.t ->
Tezos_protocol_environment_012_Psithaca.Chain_id.t ->
apply_mode ->
Script_ir_translator.unparsing_mode ->
payload_producer:Alpha_context.public_key_hash ->
'kind Alpha_context.operation ->
'kind Alpha_context.contents_list ->
(Alpha_context.t * 'kind Apply_results.contents_result_list)
Tezos_protocol_environment_012_Psithaca.Error_monad.tzresult
Tezos_protocol_environment_012_Psithaca.Lwt.t
val precheck_manager_contents_list :
Alpha_context.t ->
'kind Alpha_context.Kind.manager Alpha_context.contents_list ->
mempool_mode:bool ->
(Alpha_context.context
* 'kind Alpha_context.Kind.manager Apply_results.prechecked_contents_list)
Tezos_protocol_environment_012_Psithaca.Error_monad.tzresult
Tezos_protocol_environment_012_Psithaca.Lwt.t
precheck_manager_contents_list validation_state contents_list
Returns an updated context, and a list of prechecked contents containing balance updates for fees related to each manager operation in contents_list
If mempool_mode
, the function checks whether the total gas limit of this batch of operation is below the gas_limit
of a block and fails with a permanent error when above. Otherwise, the gas limit of the batch is removed from the one of the block (when possible) before moving on.
val value_of_key :
Alpha_context.t ->
Tezos_protocol_environment_012_Psithaca.Context.Cache.key ->
Tezos_protocol_environment_012_Psithaca.Context.Cache.value
Tezos_protocol_environment_012_Psithaca.Error_monad.tzresult
Tezos_protocol_environment_012_Psithaca.Lwt.t
value_of_key ctxt k
builds a value identified by key k
so that it can be put into the cache.
cache_layout
describes how the caches needed by the protocol. The length of the list defines the number of caches while each element of this list corresponds to the size limit of each cache.
val are_endorsements_required :
Alpha_context.t ->
level:Alpha_context.Raw_level.t ->
bool Tezos_protocol_environment_012_Psithaca.Error_monad.tzresult
Tezos_protocol_environment_012_Psithaca.Lwt.t
Check if endorsements are required for a given level.
val check_minimum_endorsements :
endorsing_power:int ->
minimum:int ->
unit Tezos_protocol_environment_012_Psithaca.Error_monad.tzresult
Tezos_protocol_environment_012_Psithaca.Lwt.t
Check if a block's endorsing power is at least the minim required.
val check_manager_signature :
Alpha_context.t ->
Tezos_protocol_environment_012_Psithaca.Chain_id.t ->
'a Alpha_context.Kind.manager Alpha_context.contents_list ->
'b Alpha_context.operation ->
(unit,
Tezos_protocol_environment_012_Psithaca.Error_monad.error
Tezos_protocol_environment_012_Psithaca.Error_monad.trace)
Tezos_protocol_environment_012_Psithaca.Pervasives.result
Tezos_protocol_environment_012_Psithaca.Lwt.t
check_manager_signature validation_state op raw_operation
The function starts by retrieving the public key hash pkh
of the manager operation. In case the operation is batched, the function also checks that the sources are all the same. Once the pkh
is retrieved, the function looks for its associated public key. For that, the manager operation is inspected to check if it contains a public key revelation. If not, the public key is searched in the context.