Class NonInitialResponseBuilder<Request extends NonInitialTransactionRequest<Response>,Response extends NonInitialTransactionResponse>

java.lang.Object
io.hotmoka.local.internal.transactions.AbstractResponseBuilder<Request,Response>
io.hotmoka.local.NonInitialResponseBuilder<Request,Response>
All Implemented Interfaces:
ResponseBuilder<Request,Response>

public abstract class NonInitialResponseBuilder<Request extends NonInitialTransactionRequest<Response>,Response extends NonInitialTransactionResponse> extends io.hotmoka.local.internal.transactions.AbstractResponseBuilder<Request,Response>
The creator of the response for a non-initial transaction. Non-initial transactions consume gas, have a payer a nonce and a chain identifier and are signed. The constructor of this class checks the validity of all these elements.
  • Field Details

    • logger

      protected static final Logger logger
    • gasCostModel

      protected final GasCostModel gasCostModel
      The cost model of the node for which the transaction is being built.
  • Constructor Details

    • NonInitialResponseBuilder

      protected NonInitialResponseBuilder(TransactionReference reference, Request request, io.hotmoka.local.internal.NodeInternal node) throws TransactionRejectedException
      Creates a the builder of the response.
      Parameters:
      reference - the reference to the transaction that is building the response
      request - the request of the transaction
      node - the node that is creating the response
      Throws:
      TransactionRejectedException - if the builder cannot be built
    • NonInitialResponseBuilder

      protected NonInitialResponseBuilder(TransactionReference reference, Request request, AbstractLocalNode<?,?> node) throws TransactionRejectedException
      Creates a the builder of the response.
      Parameters:
      reference - the reference to the transaction that is building the response
      request - the request of the transaction
      node - the node that is creating the response
      Throws:
      TransactionRejectedException - if the builder cannot be built
  • Method Details

    • transactionIsSigned

      protected boolean transactionIsSigned()
      Determines if the transaction is signed.
      Returns:
      true if and only if the request is signed and the transaction is not a view transaction
    • mkClassLoader

      Description copied from class: io.hotmoka.local.internal.transactions.AbstractResponseBuilder
      Creates the class loader for computing the response.
      Specified by:
      mkClassLoader in class io.hotmoka.local.internal.transactions.AbstractResponseBuilder<Request extends NonInitialTransactionRequest<Response>,Response extends NonInitialTransactionResponse>
      Returns:
      the class loader
      Throws:
      ClassNotFoundException - if some class of the Takamaka runtime cannot be loaded
      UnsupportedVerificationVersionException - if the verification version is not available
      IOException - if there was an I/O error while accessing some jar
    • minimalGasRequiredForTransaction

      protected BigInteger minimalGasRequiredForTransaction()
      Computes a minimal threshold of gas that is required for the transaction. Below this threshold, the response builder cannot be created.
      Returns:
      the minimal threshold
    • ignoreGasPrice

      protected boolean ignoreGasPrice()
      Determine if the response can be executed without checking if the offered gas price is at least as large as the current gas price. Normally, this only occurs if the consensus specifies to ignore the gas price. But this might also be the case for specific calls, such as those for creating accounts in the account ledger or for minting and burning coins, if the consensus allows it.
      Returns:
      true if the gas price must be ignored
    • getPayerFromRequest

      protected StorageReference getPayerFromRequest()
      Extracts the payer from the request. Normally, this is its caller, but subclasses might redefine.
      Returns:
      the payer
    • gasForStoringFailedResponse

      protected abstract int gasForStoringFailedResponse()
      Yields the cost for storage a failed response for the transaction that is being built.
      Returns:
      the cost