Class Call

All Implemented Interfaces:
IValidated, IWriteable

public class Call extends ATransaction
Transaction representing a Call to an Actor. The signer of the transaction will be both the *origin* and *caller* for the Actor code. This is the most efficient way to execute Actor code directly as a client, and is roughly equivalent to invoking (call actor offer (function-name arg1 arg2 .....))
  • Field Details

    • target

      protected final Address target
    • offer

      protected final long offer
    • functionName

      protected final Symbol functionName
    • args

      protected final AVector<ACell> args
  • Constructor Details

  • Method Details

    • create

      public static Call create(Address address, long sequence, Address target, long offer, Symbol functionName, AVector<ACell> args)
    • create

      public static Call create(Address address, long sequence, Address target, Symbol functionName, AVector<ACell> args)
    • print

      public boolean print(BlobBuilder bb, long limit)
      Description copied from class: AObject
      Prints this Object to a readable String Representation. SECURITY: Must halt and return false in O(1) time if limit of printing is exceeded otherwise DoS attacks may be possible.
      Specified by:
      print in class AObject
      Parameters:
      bb - BlobBuilder to append to
      limit - Limit of printing in string bytes
      Returns:
      True if fully printed within limit, false otherwise
    • encode

      public int encode(byte[] bs, int pos)
      Description copied from class: ATransaction
      Writes this transaction to a byte array, including the message tag
      Specified by:
      encode in interface IWriteable
      Specified by:
      encode in class ATransaction
      Parameters:
      bs - A byte array to which to write the encoding
      pos - The offset into the byte array
      Returns:
      New position after writing
    • encodeRaw

      public int encodeRaw(byte[] bs, int pos)
      Description copied from class: ACell
      Writes this Cell's encoding to a byte array, excluding the tag byte.
      Overrides:
      encodeRaw in class ATransaction
      Parameters:
      bs - A byte array to which to write the encoding
      pos - The offset into the byte array
      Returns:
      New position after writing
    • read

      public static ATransaction read(ByteBuffer bb) throws BadFormatException
      Throws:
      BadFormatException
    • estimatedEncodingSize

      public int estimatedEncodingSize()
      Description copied from interface: IWriteable
      Estimate the encoded data size for this Cell. Used for quickly sizing buffers. Implementations should try to return a size that is likely to contain the entire object when represented in binary format, including the tag byte.
      Specified by:
      estimatedEncodingSize in interface IWriteable
      Specified by:
      estimatedEncodingSize in class ATransaction
      Returns:
      The estimated size for the binary representation of this object.
    • apply

      public <T extends ACell> Context<T> apply(Context<?> ctx)
      Description copied from class: ATransaction
      Applies the functional effect of this transaction to the current state. Important points:
      • Assumes all relevant accounting preparation already complete, including juice reservation
      • Performs complete state update (including any rollbacks from errors)
      • Produces result, which may be exceptional
      • Does not finalise memory/juice accounting (will be completed afterwards)
      Specified by:
      apply in class ATransaction
      Parameters:
      ctx - Context for which to apply this Transaction
      Returns:
      The updated chain state
    • getMaxJuice

      public Long getMaxJuice()
      Description copied from class: ATransaction
      Gets the max juice allowed for this transaction
      Specified by:
      getMaxJuice in class ATransaction
      Returns:
      Juice limit
    • validateCell

      public void validateCell() throws InvalidDataException
      Description copied from class: ACell
      Validates the local structure and invariants of this cell. Called by validate() super implementation. Should validate directly contained data, but should not validate all other structure of this cell. In particular, should not traverse potentially missing child Refs.
      Specified by:
      validateCell in class ACell
      Throws:
      InvalidDataException - If the Cell is invalid
    • getRefCount

      public int getRefCount()
      Description copied from class: ACell
      Gets the number of Refs contained within this Cell. This number is final / immutable for any given instance and is defined by the Cell encoding rules. Contained Refs may be either external or embedded.
      Specified by:
      getRefCount in class ACell
      Returns:
      The number of Refs in this Cell
    • getRef

      public <T extends ACell> Ref<T> getRef(int i)
      Description copied from class: ACell
      Gets a numbered child Ref from within this Cell.
      Overrides:
      getRef in class ACell
      Type Parameters:
      T - Type of referenced Cell
      Parameters:
      i - Index of ref to get
      Returns:
      The Ref at the specified index
    • updateRefs

      public ACell updateRefs(IRefFunction func)
      Description copied from class: ACell
      Updates all Refs in this object using the given function. The function *must not* change the hash value of Refs, in order to ensure structural integrity of modified data structures. This is a building block for a very sneaky trick that enables use to do a lot of efficient operations on large trees of smart references. Must return the same object if no Refs are altered.
      Overrides:
      updateRefs in class ACell
      Parameters:
      func - Ref update function
      Returns:
      Cell with updated Refs
    • withSequence

      public Call withSequence(long newSequence)
      Description copied from class: ATransaction
      Updates this transaction with the specified sequence number
      Specified by:
      withSequence in class ATransaction
      Parameters:
      newSequence - New sequence number
      Returns:
      Updated transaction, or this transaction if the sequence number is unchanged.
    • withOrigin

      public Call withOrigin(Address newAddress)
      Description copied from class: ATransaction
      Updates this transaction with the specified origin address
      Specified by:
      withOrigin in class ATransaction
      Parameters:
      newAddress - New address
      Returns:
      Updated transaction, or this transaction if unchanged.
    • getTag

      public byte getTag()
      Description copied from class: ACell
      Gets the tag byte for this cell. The tag byte is always written as the first byte of the Cell's Encoding
      Specified by:
      getTag in class ACell
      Returns:
      Tag byte for this Cell