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 Modifier and Type Class Description protected classNonInitialResponseBuilder.ResponseCreator
-
Field Summary
Fields Modifier and Type Field Description protected GasCostModelgasCostModelThe cost model of the node for which the transaction is being built.protected static org.slf4j.Loggerlogger
-
Constructor Summary
Constructors Modifier Constructor Description protectedNonInitialResponseBuilder(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
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract BigIntegergasForStoringFailedResponse()Yields the cost for storage a failed response for the transaction that is being built.protected StorageReferencegetPayerFromRequest()Extracts the payer from the request.protected BigIntegerminimalGasRequiredForTransaction()Computes a minimal threshold of gas that is required for the transaction.protected EngineClassLoadermkClassLoader()Creates the class loader for computing the response.protected booleantransactionIsSigned()Determines if the transaction is signed.-
Methods inherited from class io.hotmoka.local.internal.transactions.AbstractResponseBuilder
getClassLoader, getRequest, replaceReverifiedResponses, wrapAsTransactionRejectedException
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface io.hotmoka.local.ResponseBuilder
getResponse
-
-
-
-
Field Detail
-
logger
protected static final org.slf4j.Logger logger
-
gasCostModel
protected final GasCostModel gasCostModel
The cost model of the node for which the transaction is being built.
-
-
Constructor Detail
-
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 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
-
-
Method Detail
-
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()
Description 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
-
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
-
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 BigInteger gasForStoringFailedResponse()
Yields the cost for storage a failed response for the transaction that is being built.- Returns:
- the cost
-
-