Packages

p

sigma

serialization

package serialization

Ordering
  1. Alphabetic
Visibility
  1. Public
  2. Protected

Package Members

  1. package transformers
  2. package trees

Type Members

  1. case class ApplySerializer(cons: (Value[SType], IndexedSeq[Value[SType]]) => Value[SType]) extends ValueSerializer[Apply] with Product with Serializable
  2. case class BlockValueSerializer(cons: (IndexedSeq[BlockItem], Value[SType]) => Value[SType]) extends ValueSerializer[BlockValue] with Product with Serializable
  3. case class BoolToSigmaPropSerializer(cons: (BoolValue) => SigmaPropValue) extends ValueSerializer[BoolToSigmaProp] with Product with Serializable
  4. case class CaseObjectSerialization[V <: Value[SType]](opDesc: ValueCompanion, obj: V) extends ValueSerializer[V] with Product with Serializable
  5. case class ConcreteCollectionBooleanConstantSerializer(cons: (IndexedSeq[Value[SBoolean.type]], SBoolean.type) => Value[SCollection[SBoolean.type]]) extends ValueSerializer[ConcreteCollection[SBoolean.type]] with Product with Serializable
  6. case class ConcreteCollectionSerializer(cons: (IndexedSeq[Value[SType]], SType) => Value[SCollection[SType]]) extends ValueSerializer[ConcreteCollection[_ <: SType]] with Product with Serializable
  7. case class ConstantPlaceholderSerializer(cons: (Int, SType) => Value[SType]) extends ValueSerializer[ConstantPlaceholder[SType]] with Product with Serializable
  8. case class ConstantSerializer(builder: SigmaBuilder) extends ValueSerializer[Constant[SType]] with Product with Serializable

    This works in tandem with DataSerializer, if you change one make sure to check the other.

  9. class ConstantStore extends AnyRef

    HOTSPOT: used in deserialization (don't beautify this code)

  10. class CoreByteReader extends Reader

    Reader used in the concrete implementations of SigmaSerializer.

    Reader used in the concrete implementations of SigmaSerializer. It decorates the given reader, delegates most of the methods to it, but also adds new methods.

  11. class CoreByteWriter extends Writer

    Implementation of Writer provided by sigma-core module.

  12. class CoreDataSerializer extends AnyRef

    This works in tandem with ConstantSerializer, if you change one make sure to check the other.

  13. abstract class CoreSerializer[TFamily, T <: TFamily] extends Serializer[TFamily, T, CoreByteReader, CoreByteWriter]

    Implementation of Serializer provided by sigma-core module.

  14. case class CreateAvlTreeSerializer(cons: (ByteValue, Value[SByteArray], IntValue, Value[SIntOption]) => AvlTreeValue) extends ValueSerializer[CreateAvlTree] with Product with Serializable
  15. case class CreateProveDlogSerializer(cons: (Value[SGroupElement.type]) => SigmaPropValue) extends ValueSerializer[CreateProveDlog] with Product with Serializable
  16. final class DeserializeCallDepthExceeded extends SerializerException

    Thrown when the current depth level > maxDepthLevel which is set in the Reader.

  17. class ErgoTreeSerializer extends AnyRef

    Rationale for soft-forkable ErgoTree serialization.

    Rationale for soft-forkable ErgoTree serialization. There are 2 points:

    1) we can make size bit obligatory, i.e. always save total size of script body (in this case we don't need size bit in the header). This will allow to always skip right number of bytes in case of any exception (including ValidationException) thrown during deserialization and produce UnparsedErgoTree. The decision about soft-fork can be done later. But is looks like this is not necessary if we do as described below.

    2) HeaderVersionCheck: we can also strictly check during deserialization the content of the script against version number in the header. Thus if the header have vS, then script is allowed to have instructions from versions from v1 to vS. On a node vN, N > S, this should also be enforced, i.e. vN node will reject scripts as invalid if the script has vS in header and vS+1 instruction in body.

    Keeping this in mind, if we have a vN node and a script with vS in its header then: During script deserialization: 1) if vN >= vS then the node knows all the instructions and should check that only instructions up to vS are used in the script. It either parses successfully or throws MalformedScriptException. If during the process some unknown instruction is encountered (i.e. ValidationException is thrown), this cannot be a soft-fork, because vN >= vS guarantees that all instructions are known, thus the script is malformed.

    2) if vN < vS then the vN node is expecting unknown instructions. If the script is parsed successfully, then vN subset of the language is used and script is accepted for execution else if ValidationException is thrown then UnparsedErgoTree is created, delaying decision about soft-fork until stateful validation. if bodySize is stored then script body is skipped and whole TX deserialization continues. otherwise we cannot skip the body which leads to whole TX to be rejected (CannotSkipScriptException) else if some other exception is thrown then the whole TX is rejected due to said exception.

    In the stateful context: if vN >= vS then we can execute script, but we do additional check if vS > the current version of protocol (vP) then the script is rejected as invalid because its version exceeds the current consensus version of the protocol else the script can be executed if vN < vS then if we have Right(tree) the script is executed if Left(UnparsedErgoTree()) then check soft fork and either execute or throw

    Proposition: CannotSkipScriptException can only happen on < 10% of the nodes, which is safe for consensus. Proof. If follows from the fact that vN >= vS nodes will reject the script until new vP is upgraded to vS, which means the majority has upgraded to at least vS Thus, before vP is upgraded to vS, majority reject (either because they cannot parse, or because vP is not actualized) after that majority accept (however old nodes still reject but they are < 10%) End of proof.

  18. case class FuncValueSerializer(cons: (IndexedSeq[(Int, SType)], Value[SType]) => Value[SType]) extends ValueSerializer[FuncValue] with Product with Serializable
  19. case class GetVarSerializer(cons: (Byte, SType) => Value[SOption[SType]]) extends ValueSerializer[GetVar[_ <: SType]] with Product with Serializable
  20. final class InvalidOpCode extends SerializerException

    Thrown by org.ergoplatform.validation.ValidationRules.CheckValidOpCode validation rule.

  21. final class InvalidTypePrefix extends SerializerException

    Thrown by TypeSerializer when type prefix <= 0.

  22. case class LogicalNotSerializer(cons: (BoolValue) => BoolValue) extends ValueSerializer[LogicalNot] with Product with Serializable
  23. case class MethodCallSerializer(cons: (Value[SType], SMethod, IndexedSeq[Value[SType]], STypeSubst) => Value[SType]) extends ValueSerializer[MethodCall] with Product with Serializable
  24. case class ModQArithOpSerializer(opDesc: ModQArithOpCompanion, cons: (BigIntValue, BigIntValue) => BigIntValue) extends ValueSerializer[ModQArithOp] with Product with Serializable
  25. case class OneArgumentOperationSerializer[T <: SType](opDesc: OneArgumentOperationCompanion, cons: (Value[T]) => SValue) extends ValueSerializer[OneArgumentOperation[T, SType]] with Product with Serializable
  26. case class OptionGetOrElseSerializer(cons: (Value[SOption[SType]], Value[SType]) => Value[SType]) extends ValueSerializer[OptionGetOrElse[_ <: SType]] with Product with Serializable
  27. case class PropertyCallSerializer(cons: (Value[SType], SMethod, IndexedSeq[Value[SType]], STypeSubst) => Value[SType]) extends ValueSerializer[MethodCall] with Product with Serializable
  28. case class ProveDHTupleSerializer(cons: (EcPointType, EcPointType, EcPointType, EcPointType) => ProveDHTuple) extends CoreSerializer[ProveDHTuple, ProveDHTuple] with Product with Serializable
  29. case class ProveDlogSerializer(cons: (EcPointType) => ProveDlog) extends CoreSerializer[ProveDlog, ProveDlog] with Product with Serializable
  30. final class ReaderPositionLimitExceeded extends SerializerException

    Thrown when the current reader position > positionLimit which is set in the Reader.

    Thrown when the current reader position > positionLimit which is set in the Reader.

    See also

    org.ergoplatform.validation.ValidationRules.CheckPositionLimit

  31. case class SelectFieldSerializer(cons: (Value[STuple], Byte) => Value[SType]) extends ValueSerializer[SelectField] with Product with Serializable
  32. case class SerializerException(message: String, cause: Option[Throwable] = None, args: Seq[Any] = ArraySeq.empty) extends SigmaException with Product with Serializable

    Exception thrown during serialization.

    Exception thrown during serialization.

    message

    the error message

    cause

    an optional cause for the exception

  33. class SigSerializer extends AnyRef

    Contains implementation of signature (aka proof) serialization.

    Contains implementation of signature (aka proof) serialization.

    See also

    toProofBytes, parseAndComputeChallenges

  34. class SigmaByteReader extends CoreByteReader

    Reader used in the concrete implementations of SigmaSerializer.

    Reader used in the concrete implementations of SigmaSerializer. It decorates the given reader, delegates most of the methods to it, but also adds new methods.

  35. class SigmaByteWriter extends CoreByteWriter
  36. abstract class SigmaSerializer[TFamily, T <: TFamily] extends Serializer[TFamily, T, SigmaByteReader, SigmaByteWriter]
  37. trait SigmaSerializerCompanion[TFamily] extends AnyRef
  38. case class TaggedVariableSerializer(cons: (Byte, SType) => Value[SType]) extends ValueSerializer[TaggedVariable[_ <: SType]] with Product with Serializable
  39. case class TupleSerializer(cons: (Seq[Value[SType]]) => Value[SType]) extends ValueSerializer[Tuple] with Product with Serializable
  40. case class TwoArgumentsSerializer[LIV <: SType, RIV <: SType, OV <: Value[SType]](opDesc: TwoArgumentOperationCompanion, constructor: (Value[LIV], Value[RIV]) => Value[SType]) extends ValueSerializer[OV] with Product with Serializable
  41. class TypeSerializer extends AnyRef

    Serialization of types according to specification in TypeSerialization.md.

  42. case class ValDefSerializer(opDesc: ValueCompanion) extends ValueSerializer[ValDef] with Product with Serializable
  43. class ValDefTypeStore extends AnyRef
  44. case class ValUseSerializer(cons: (Int, SType) => Value[SType]) extends ValueSerializer[ValUse[SType]] with Product with Serializable
  45. abstract class ValueSerializer[V <: Value[SType]] extends SigmaSerializer[Value[SType], V]

Value Members

  1. object CoreByteWriter
  2. object CoreDataSerializer extends CoreDataSerializer
  3. object CoreSerializer
  4. object DataSerializer extends CoreDataSerializer

    This works in tandem with ConstantSerializer, if you change one make sure to check the other.

  5. object ErgoTreeSerializer
  6. object GroupElementSerializer extends CoreSerializer[EcPointType, EcPointType]

    A serializer which encodes group elements, so elliptic curve points in our case, to bytes, and decodes points from bytes.

    A serializer which encodes group elements, so elliptic curve points in our case, to bytes, and decodes points from bytes. Every point is encoded in compressed form (so only X coordinate and sign of Y are stored). Thus for secp256k1 point, 33 bytes are needed. The first bytes is whether equals 2 or 3 depending on the sign of Y coordinate(==2 is Y is positive, ==3, if Y is negative). Other 32 bytes are containing the X coordinate. Special case is infinity point, which is encoded by 33 zeroes. Thus elliptic curve point is always encoded with 33 bytes.

  7. object ModQSerializer extends ValueSerializer[ModQ]
  8. object OpCodes

    The set of all possible IR graph nodes can be split in two subsets: 1) operations which may appear in ErgoTree (these are defined by OpCodes below) 2) operations which are not valid to be in ErgoTree, but serve special purposes.

    The set of all possible IR graph nodes can be split in two subsets: 1) operations which may appear in ErgoTree (these are defined by OpCodes below) 2) operations which are not valid to be in ErgoTree, but serve special purposes. (these are defined by OpCodesExtra) We can assume they are both Byte-sized codes, and store as a single byte, but as long as we can differentiate them from context (and where we cannot, we should use special encoding).

    The general extended encoding is like the following: 0-255 - range of OpCodes 256-511 - range of OpCodesExtra Thus, any code in an extended code range of 0-511 can be saved using putUShort. We use Byte to represent OpCodes and OpCodesExtra. We use Short to represent any op code from extended code range. And we use VLQ to serialize Short values of extended codes.

    Examples: 1) For validation rule CheckValidOpCode we use OpCodes range, so we use single byte encoding. 2) For CheckCostFuncOperation we use 1-511 range and extended encoding (see docs)

  9. object SigSerializer extends SigSerializer
  10. object SigmaByteWriter
  11. object SigmaPropBytesSerializer extends ValueSerializer[SigmaPropBytes]
  12. object SigmaPropIsProvenSerializer extends ValueSerializer[SigmaPropIsProven]
  13. object SigmaSerializer
  14. object SubstConstantsSerializer extends ValueSerializer[SubstConstants[SType]]
  15. object TypeSerializer extends TypeSerializer
  16. object ValueCodes

    Encoding of values for serialization.

  17. object ValueSerializer extends SigmaSerializerCompanion[Value[SType]]

    Implements serialization of ErgoTree expressions.

    Implements serialization of ErgoTree expressions. Contains global collection of serializers for each ErgoTree operation (see serializers field).

    It also implements optional (see collectSerInfo flag) metadata collection during serialization to generate serializer specification tables in LaTeX.

    See also

    GenSerializers

Ungrouped