1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177
use crate::UtxoId;
use fuel_types::{
AssetId,
ContractId,
MessageId,
};
/// The error returned during the checking of the transaction's validity rules.
#[derive(Debug, Clone, PartialEq, Eq, Hash, derive_more::Display)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[non_exhaustive]
pub enum ValidityError {
/// The actual and calculated metadata of the transaction mismatch.
TransactionMetadataMismatch,
/// Transaction doesn't have spendable input message or coin.
NoSpendableInput,
InputWitnessIndexBounds {
index: usize,
},
InputPredicateEmpty {
index: usize,
},
InputPredicateLength {
index: usize,
},
InputPredicateDataLength {
index: usize,
},
InputPredicateOwner {
index: usize,
},
InputInvalidSignature {
index: usize,
},
InputContractAssociatedOutputContract {
index: usize,
},
InputMessageDataLength {
index: usize,
},
DuplicateInputUtxoId {
utxo_id: UtxoId,
},
DuplicateMessageInputId {
message_id: MessageId,
},
DuplicateInputContractId {
contract_id: ContractId,
},
OutputContractInputIndex {
index: usize,
},
/// One of inputs' `AssetId` is not base asset id.
TransactionInputContainsNonBaseAssetId {
index: usize,
},
/// One of inputs is a `Input::Contract` when it is not allowed.
TransactionInputContainsContract {
index: usize,
},
/// One of inputs contains retryable message when it is not allowed.
TransactionInputContainsMessageData {
index: usize,
},
/// One of outputs is a `Output::Contract` when it is not allowed.
TransactionOutputContainsContract {
index: usize,
},
/// One of outputs is a `Output::Variable` when it is not allowed.
TransactionOutputContainsVariable {
index: usize,
},
/// One of `Output::Change` outputs uses a non-base asset id.
TransactionChangeChangeUsesNotBaseAsset {
index: usize,
},
TransactionCreateOutputContractCreatedDoesntMatch {
index: usize,
},
TransactionCreateOutputContractCreatedMultiple {
index: usize,
},
TransactionCreateBytecodeLen,
TransactionCreateBytecodeWitnessIndex,
TransactionCreateStorageSlotMax,
TransactionCreateStorageSlotOrder,
TransactionScriptLength,
TransactionScriptDataLength,
/// The output contains a `Output::ContractCreated` which is not allowed.
TransactionOutputContainsContractCreated {
index: usize,
},
/// The block height of the checking doesn't match the transaction's block height.
/// `Mint` transaction only exists in the scope of the block.
TransactionMintIncorrectBlockHeight,
/// The `Output.input_index` is not zero.
TransactionMintIncorrectOutputIndex,
/// The `Output.mint_base_asset` is not base asset.
TransactionMintNonBaseAsset,
/// The `Upgrade` transaction doesn't have the privileged address as the input
/// owner.
TransactionUpgradeNoPrivilegedAddress,
/// The `Upgrade` transaction's checksum doesn't match the consensus parameters from
/// witness.
TransactionUpgradeConsensusParametersChecksumMismatch,
/// The `Upgrade` transaction's consensus parameters serialization failed.
TransactionUpgradeConsensusParametersSerialization,
/// The `Upgrade` transaction's consensus parameters deserialization failed.
TransactionUpgradeConsensusParametersDeserialization,
/// The verification of the bytecode root of the `Upload` transaction failed.
TransactionUploadRootVerificationFailed,
/// The total number of bytecode subsections in the `Upload` transaction exceeds the
/// limit.
TransactionUploadTooManyBytecodeSubsections,
/// The transaction exceeded the size limit.
TransactionSizeLimitExceeded,
/// Max gas per tx exceeded
TransactionMaxGasExceeded,
TransactionWitnessLimitExceeded,
TransactionPoliciesAreInvalid,
TransactionNoGasPricePolicy,
TransactionMaturity,
TransactionMaxFeeNotSet,
TransactionInputsMax,
TransactionOutputsMax,
TransactionWitnessesMax,
TransactionOutputChangeAssetIdDuplicated(AssetId),
TransactionOutputChangeAssetIdNotFound(AssetId),
/// This error happens when a transaction attempts to create a coin output for an
/// asset type that doesn't exist in the coin inputs.
TransactionOutputCoinAssetIdNotFound(AssetId),
/// The transaction doesn't provide enough input amount of the native chain asset to
/// cover all potential execution fees
#[display(
fmt = "Insufficient fee amount: expected {}, provided {}",
expected,
provided
)]
InsufficientFeeAmount {
/// The expected amount of fees required to cover the transaction
expected: u64,
/// The fee amount actually provided for spending
provided: u64,
},
/// The transaction doesn't provide enough input amount of the given asset to cover
/// the amounts used in the outputs.
#[display(
fmt = "Insufficient input amount: asset {}, expected {}, provided {}",
asset,
expected,
provided
)]
InsufficientInputAmount {
/// The asset id being spent
asset: AssetId,
/// The amount expected by a coin output
expected: u64,
/// The total amount provided by coin inputs
provided: u64,
},
/// The given coins is too large
BalanceOverflow,
/// The given gas costs is are too large
GasCostsCoinsOverflow,
/// Serialized input length is too large.
SerializedInputTooLarge {
index: usize,
},
/// Serialized output length is too large.
SerializedOutputTooLarge {
index: usize,
},
/// Serialized witness length is too large.
SerializedWitnessTooLarge {
index: usize,
},
}