feat: add Babbage phase-1 validations (#405)

This commit is contained in:
Maico Leberle 2024-02-20 20:30:09 -03:00 committed by GitHub
parent 7a67453b58
commit eade9eca82
32 changed files with 4584 additions and 143 deletions

View file

@ -16,6 +16,7 @@ pub enum MultiEraProtParams {
Byron(ByronProtParams),
Shelley(ShelleyProtParams),
Alonzo(AlonzoProtParams),
Babbage(BabbageProtParams),
}
#[derive(Debug, Clone)]
@ -51,6 +52,20 @@ pub struct AlonzoProtParams {
pub coins_per_utxo_word: u64,
}
#[derive(Debug, Clone)]
pub struct BabbageProtParams {
pub fee_policy: FeePolicy,
pub max_tx_size: u64,
pub max_block_ex_mem: u64,
pub max_block_ex_steps: u64,
pub max_tx_ex_mem: u32,
pub max_tx_ex_steps: u64,
pub max_val_size: u64,
pub collateral_percent: u64,
pub max_collateral_inputs: u64,
pub coins_per_utxo_word: u64,
}
impl Environment {
pub fn prot_params(&self) -> &MultiEraProtParams {
&self.prot_params

View file

@ -7,6 +7,7 @@ pub enum ValidationError {
Byron(ByronError),
ShelleyMA(ShelleyMAError),
Alonzo(AlonzoError),
Babbage(BabbageError),
}
#[derive(Debug, Clone)]
@ -91,4 +92,51 @@ pub enum AlonzoError {
ScriptIntegrityHash,
}
#[derive(Debug, Clone)]
#[non_exhaustive]
pub enum BabbageError {
UnknownTxSize,
TxInsEmpty,
InputNotInUTxO,
CollateralNotInUTxO,
ReferenceInputNotInUTxO,
RefInputNotInUTxO,
BlockPrecedesValInt,
BlockExceedsValInt,
FeeBelowMin,
CollateralMissing,
TooManyCollaterals,
InputDecoding,
CollateralNotVKeyLocked,
CollateralMinLovelace,
NonLovelaceCollateral,
CollateralWrongAssets,
NegativeValue,
CollateralAnnotation,
PreservationOfValue,
MinLovelaceUnreached,
MaxValSizeExceeded,
AddressDecoding,
OutputWrongNetworkID,
TxWrongNetworkID,
TxExUnitsExceeded,
RedeemerMissing,
UnneededRedeemer,
MaxTxSizeExceeded,
MintingLacksPolicy,
MetadataHash,
DatumMissing,
UnneededDatum,
ScriptWitnessMissing,
UnneededNativeScript,
UnneededPlutusV1Script,
UnneededPlutusV2Script,
ReqSignerMissing,
ReqSignerWrongSig,
VKWitnessMissing,
VKWrongSignature,
UnsupportedPlutusLanguage,
ScriptIntegrityHash,
}
pub type ValidationResult = Result<(), ValidationError>;