diff --git a/pallas-applying/docs/alonzo.md b/pallas-applying/docs/alonzo.md
index 8f31ccf14..2150ac99f 100644
--- a/pallas-applying/docs/alonzo.md
+++ b/pallas-applying/docs/alonzo.md
@@ -39,8 +39,8 @@ This document covers the Alonzo era. This document covers the concepts, notation
- ***txExUnits(txBody) ∈ ExUnits*** is the total execution units of the transaction.
- ***minted(txBody)*** is the multi-asset value minted (or burned) in the transaction.
- ***PolicyID*** is the set of all possible policy IDs associated to multi-asset values. In particular, ***adaID ∈ Policy*** is the policy of lovelaces.
- - ***consumed(pps, utxo, txBody) ∈ ℤ*** is the *consumed value* of the transaction, which equals the sum of all multi-asset values in the inputs of the transaction.
- - ***produced(pps, txBody) ∈ ℤ*** is the *produced value* of the transaction, which equals the sum of all multi-asset values in the outputs of the transaction, plus the transaction fee, plus the minted value.
+ - ***consumed(utxo, txBody) ∈ ℤ*** is the *consumed value* of the transaction, which equals the sum of all multi-asset values in the inputs of the transaction.
+ - ***produced(txBody) ∈ ℤ*** is the *produced value* of the transaction, which equals the sum of all multi-asset values in the outputs of the transaction, plus the transaction fee, plus the minted value.
- ***txNetId(txBody) ∈ NetworkID*** gives the network ID of a transaction (not to be confused with the network ID of addresses of unspent transaction outputs).
- ***txWits(tx)*** is the transaction witness set. When clear, we will write ***txWits*** to refer to the transaction witness set of the current transaction.
- ***txMD(tx)*** is the metadata of the transaction.
@@ -77,11 +77,10 @@ This document covers the Alonzo era. This document covers the concepts, notation
- ***minFees(pps, txBody) ∈ ℕ*** gives the minimum number of lovelace that must be paid bys the transaction as fee.
- ***maxCollateralInputs(pps) ∈ ℕ*** gives the maximum number of collateral inputs allowed per transaction.
- ***maxTxSize(pps) ∈ ℕ*** gives the maximum size any transaction can have.
- - ***minUTxOValue(pps) ∈ ℕ*** gives the global minimum number of lovelace every UTxO must lock.
- ***maxValSize(pps) ∈ ℕ*** gives the maximum size in bytes allowed for values, when serialized.
- ***collateralPercent(pps) ∈ {0,...,100}*** gives the fee percentage (multiplied by 100) that all lovelace in collateral inputs should add up to.
- - ***coinsPerUTxOWord(pps) ∈ ℕ*** is the number of lovelace a UTxO should contain per byte (when serialized).
- - ***costModels : PParams -> Languages -> CostModel*** takes the protocol parameters and returns a map mapping languages to their cost models.
+ - ***coinsPerUTxOWord(pps) ∈ ℕ*** is the number of lovelace a UTxO should contain per byte (when serialized). This is used to assess the minimum number of lovelace that an unspent transaction output should lock.
+ - ***costModels : PParams -> (Languages -> CostModel)*** takes the protocol parameters and returns a map associating languages to their cost models.
- ***Languages := {PlutusV1, PlutusV2}*** is the set of Alonzo languages.
- ***CostModel*** is the set of cost models.
- ***Witnesses***:
@@ -151,7 +150,7 @@ Let ***tx ∈ Tx*** be one of its Alonzo transactions, with transaction body ***
balance(collateral(txBody) ◁ utxo)) >= fee(txBody) * collateralPercent(pps)
- **The preservation of value property holds**: Assuming no staking or delegation actions are involved, it should be that
- consumed(pps, utxo, txBody) = produced(pps, txBody) + fee(txBody) + minted(txBody)
+ consumed(utxo, txBody) = produced(txBody) + fee(txBody) + minted(txBody)
- **All transaction outputs should contain at least the minimum lovelace**:
∀ txOut ∈ txOuts(txBody): adaValueOf(coinsPerUTxOWord(pps) * utxoEntrySize(txOut)) ≤ getValue(txOut)
@@ -192,7 +191,7 @@ Let ***tx ∈ Tx*** be one of its Alonzo transactions, with transaction body ***
- keyHash(vk) = key_hash
- **The required script languages are included in the protocol parameters**:
- languages(txWits) ⊆ costModels(pps)
+ languages(txWits) ⊆ {l : (l -> _) ∈ costModels(pps, language)}
- **The metadata of the transaction is valid**:
txMDHash(tx) = hashMD(txMD(tx))
diff --git a/pallas-applying/src/types/environment.rs b/pallas-applying/src/types/environment.rs
index 2ead6f3cb..70a609c8e 100644
--- a/pallas-applying/src/types/environment.rs
+++ b/pallas-applying/src/types/environment.rs
@@ -1,5 +1,7 @@
//! Types used for representing the environment required for validation in each era.
+use std::vec::Vec;
+
#[derive(Debug)]
pub struct Environment {
pub prot_params: MultiEraProtParams,
@@ -37,7 +39,26 @@ pub struct FeePolicy {
}
#[derive(Debug, Clone)]
-pub struct AlonzoProtParams;
+pub struct AlonzoProtParams {
+ pub fee_policy: FeePolicy,
+ pub max_tx_size: u64,
+ pub languages: Vec,
+ pub max_block_ex_mem: u64,
+ pub max_block_ex_steps: u64,
+ pub max_tx_ex_mem: u64,
+ pub max_tx_ex_steps: u64,
+ pub max_val_size: u64,
+ pub collateral_percent: u64,
+ pub max_collateral_inputs: u64,
+ pub coints_per_utxo_word: u64,
+}
+
+#[derive(Debug, Clone)]
+#[non_exhaustive]
+pub enum Language {
+ PlutusV1,
+ PlutusV2,
+}
impl Environment {
pub fn prot_params(&self) -> &MultiEraProtParams {