Module io.hotmoka.local
Package io.hotmoka.local
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.
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final GasCostModelThe cost model of the node for which the transaction is being built.protected static final LoggerFields inherited from class io.hotmoka.local.internal.transactions.AbstractResponseBuilder
classLoader, consensus, node, reference, request, storageTypeToClass -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedNonInitialResponseBuilder(TransactionReference reference, Request request, AbstractLocalNode<?, ?> node) Creates a the builder of the response.protectedNonInitialResponseBuilder(TransactionReference reference, Request request, io.hotmoka.local.internal.NodeInternal node) Creates a the builder of the response. -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract intYields the cost for storage a failed response for the transaction that is being built.protected StorageReferenceExtracts the payer from the request.protected booleanDetermine if the response can be executed without checking if the offered gas price is at least as large as the current gas price.protected BigIntegerComputes a minimal threshold of gas that is required for the transaction.protected EngineClassLoaderCreates the class loader for computing the response.protected booleanDetermines if the transaction is signed.Methods inherited from class io.hotmoka.local.internal.transactions.AbstractResponseBuilder
getClassLoader, getRequest, replaceReverifiedResponses, wrapAsTransactionRejectedExceptionMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface io.hotmoka.local.ResponseBuilder
getResponse
-
Field Details
-
logger
-
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 responserequest- the request of the transactionnode- 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 TransactionRejectedExceptionCreates a the builder of the response.- Parameters:
reference- the reference to the transaction that is building the responserequest- the request of the transactionnode- 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
protected EngineClassLoader mkClassLoader() throws ClassNotFoundException, UnsupportedVerificationVersionException, IOExceptionDescription copied from class:io.hotmoka.local.internal.transactions.AbstractResponseBuilderCreates the class loader for computing the response.- Specified by:
mkClassLoaderin classio.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 loadedUnsupportedVerificationVersionException- if the verification version is not availableIOException- if there was an I/O error while accessing some jar
-
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
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
-