All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.wavesplatform.transaction.validation.impl.InvokeExpressionTxValidator.scala Maven / Gradle / Ivy

The newest version!
package com.wavesplatform.transaction.validation.impl

import cats.syntax.either.*
import com.wavesplatform.lang.v1.ContractLimits
import com.wavesplatform.transaction.TxValidationError.GenericError
import com.wavesplatform.transaction.smart.InvokeExpressionTransaction
import com.wavesplatform.transaction.validation.{TxValidator, ValidatedV}

object InvokeExpressionTxValidator extends TxValidator[InvokeExpressionTransaction] {
  override def validate(tx: InvokeExpressionTransaction): ValidatedV[InvokeExpressionTransaction] = {
    val size  = tx.expressionBytes.size
    val limit = ContractLimits.MaxContractSizeInBytes
    V.seq(tx)(
      Either
        .cond(
          size <= limit,
          (),
          GenericError(s"InvokeExpressionTransaction bytes length = $size exceeds limit = $limit")
        )
        .toValidatedNel
    )
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy