diff --git a/.gitignore b/.gitignore index 182bddb13f..e194b0dcd2 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,3 @@ -*.pdf *.toc *.aux *.log diff --git a/docs/sigmastate_protocols/sigmastate_protocols.pdf b/docs/sigmastate_protocols/sigmastate_protocols.pdf new file mode 100644 index 0000000000..d4361b87bb Binary files /dev/null and b/docs/sigmastate_protocols/sigmastate_protocols.pdf differ diff --git a/docs/spec/generated/BigInt_methods.tex b/docs/spec/generated/BigInt_methods.tex index c0ac012526..8ca31d6504 100644 --- a/docs/spec/generated/BigInt_methods.tex +++ b/docs/spec/generated/BigInt_methods.tex @@ -23,30 +23,6 @@ \subsubsection{\lst{BigInt.toByte} method (Code 106.1)} -\subsubsection{\lst{BigInt.modQ} method (Code 6.1)} -\label{sec:type:BigInt:modQ} -\noindent -\begin{tabularx}{\textwidth}{| l | X |} - \hline - \bf{Description} & Returns this \lst{mod} Q, i.e. remainder of division by Q, where Q is an order of the cryprographic group. \\ - - \hline - \bf{Parameters} & - \(\begin{array}{l l l} - - \end{array}\) \\ - - \hline - \bf{Result} & \lst{BigInt} \\ - \hline - - \bf{Serialized as} & \hyperref[sec:serialization:operation:ModQ]{\lst{ModQ}} \\ - \hline - -\end{tabularx} - - - \subsubsection{\lst{BigInt.toShort} method (Code 106.2)} \label{sec:type:BigInt:toShort} \noindent @@ -71,30 +47,6 @@ \subsubsection{\lst{BigInt.toShort} method (Code 106.2)} -\subsubsection{\lst{BigInt.plusModQ} method (Code 6.2)} -\label{sec:type:BigInt:plusModQ} -\noindent -\begin{tabularx}{\textwidth}{| l | X |} - \hline - \bf{Description} & Adds this number with \lst{other} by module Q. \\ - - \hline - \bf{Parameters} & - \(\begin{array}{l l l} - \lst{other} & \lst{: BigInt} & \text{// Number to add to this.} \\ - \end{array}\) \\ - - \hline - \bf{Result} & \lst{BigInt} \\ - \hline - - \bf{Serialized as} & \hyperref[sec:serialization:operation:PlusModQ]{\lst{PlusModQ}} \\ - \hline - -\end{tabularx} - - - \subsubsection{\lst{BigInt.toInt} method (Code 106.3)} \label{sec:type:BigInt:toInt} \noindent @@ -119,30 +71,6 @@ \subsubsection{\lst{BigInt.toInt} method (Code 106.3)} -\subsubsection{\lst{BigInt.minusModQ} method (Code 6.3)} -\label{sec:type:BigInt:minusModQ} -\noindent -\begin{tabularx}{\textwidth}{| l | X |} - \hline - \bf{Description} & Subtracts \lst{other} number from this by module Q. \\ - - \hline - \bf{Parameters} & - \(\begin{array}{l l l} - \lst{other} & \lst{: BigInt} & \text{// Number to subtract from this.} \\ - \end{array}\) \\ - - \hline - \bf{Result} & \lst{BigInt} \\ - \hline - - \bf{Serialized as} & \hyperref[sec:serialization:operation:MinusModQ]{\lst{MinusModQ}} \\ - \hline - -\end{tabularx} - - - \subsubsection{\lst{BigInt.toLong} method (Code 106.4)} \label{sec:type:BigInt:toLong} \noindent @@ -167,30 +95,6 @@ \subsubsection{\lst{BigInt.toLong} method (Code 106.4)} -\subsubsection{\lst{BigInt.multModQ} method (Code 6.4)} -\label{sec:type:BigInt:multModQ} -\noindent -\begin{tabularx}{\textwidth}{| l | X |} - \hline - \bf{Description} & Multiply this number with \lst{other} by module Q. \\ - - \hline - \bf{Parameters} & - \(\begin{array}{l l l} - \lst{other} & \lst{: BigInt} & \text{// Number to multiply with this.} \\ - \end{array}\) \\ - - \hline - \bf{Result} & \lst{BigInt} \\ - \hline - - \bf{Serialized as} & \hyperref[sec:serialization:operation:MethodCall]{\lst{MethodCall}} \\ - \hline - -\end{tabularx} - - - \subsubsection{\lst{BigInt.toBigInt} method (Code 106.5)} \label{sec:type:BigInt:toBigInt} \noindent diff --git a/docs/spec/generated/Boolean_methods.tex b/docs/spec/generated/Boolean_methods.tex index 48ce891811..e69de29bb2 100644 --- a/docs/spec/generated/Boolean_methods.tex +++ b/docs/spec/generated/Boolean_methods.tex @@ -1,22 +0,0 @@ - -\subsubsection{\lst{Boolean.toByte} method (Code 1.1)} -\label{sec:type:Boolean:toByte} -\noindent -\begin{tabularx}{\textwidth}{| l | X |} - \hline - \bf{Description} & Convert true to 1 and false to 0 \\ - - \hline - \bf{Parameters} & - \(\begin{array}{l l l} - - \end{array}\) \\ - - \hline - \bf{Result} & \lst{Byte} \\ - \hline - - \bf{Serialized as} & \hyperref[sec:serialization:operation:PropertyCall]{\lst{PropertyCall}} \\ - \hline - -\end{tabularx} diff --git a/docs/spec/generated/GroupElement_methods.tex b/docs/spec/generated/GroupElement_methods.tex index b31e24f30d..dc9922b3dc 100644 --- a/docs/spec/generated/GroupElement_methods.tex +++ b/docs/spec/generated/GroupElement_methods.tex @@ -1,28 +1,4 @@ -\subsubsection{\lst{GroupElement.isIdentity} method (Code 7.1)} -\label{sec:type:GroupElement:isIdentity} -\noindent -\begin{tabularx}{\textwidth}{| l | X |} - \hline - \bf{Description} & Checks if this value is identity element of the eliptic curve group. \\ - - \hline - \bf{Parameters} & - \(\begin{array}{l l l} - - \end{array}\) \\ - - \hline - \bf{Result} & \lst{Boolean} \\ - \hline - - \bf{Serialized as} & \hyperref[sec:serialization:operation:PropertyCall]{\lst{PropertyCall}} \\ - \hline - -\end{tabularx} - - - \subsubsection{\lst{GroupElement.getEncoded} method (Code 7.2)} \label{sec:type:GroupElement:getEncoded} \noindent diff --git a/docs/spec/generated/SCollection_methods.tex b/docs/spec/generated/SCollection_methods.tex index d75b349151..a283a0e03c 100644 --- a/docs/spec/generated/SCollection_methods.tex +++ b/docs/spec/generated/SCollection_methods.tex @@ -9,16 +9,16 @@ \subsubsection{\lst{SCollection.size} method (Code 12.1)} \hline \bf{Parameters} & \(\begin{array}{l l l} - + \end{array}\) \\ - + \hline \bf{Result} & \lst{Int} \\ \hline - + \bf{Serialized as} & \hyperref[sec:serialization:operation:SizeOf]{\lst{SizeOf}} \\ \hline - + \end{tabularx} @@ -40,10 +40,10 @@ \subsubsection{\lst{SCollection.getOrElse} method (Code 12.2)} \hline \bf{Result} & \lst{IV} \\ \hline - + \bf{Serialized as} & \hyperref[sec:serialization:operation:ByIndex]{\lst{ByIndex}} \\ \hline - + \end{tabularx} @@ -67,10 +67,10 @@ \subsubsection{\lst{SCollection.map} method (Code 12.3)} \hline \bf{Result} & \lst{Coll[OV]} \\ \hline - + \bf{Serialized as} & \hyperref[sec:serialization:operation:MapCollection]{\lst{MapCollection}} \\ \hline - + \end{tabularx} @@ -93,10 +93,10 @@ \subsubsection{\lst{SCollection.exists} method (Code 12.4)} \hline \bf{Result} & \lst{Boolean} \\ \hline - + \bf{Serialized as} & \hyperref[sec:serialization:operation:Exists]{\lst{Exists}} \\ \hline - + \end{tabularx} @@ -118,10 +118,10 @@ \subsubsection{\lst{SCollection.fold} method (Code 12.5)} \hline \bf{Result} & \lst{OV} \\ \hline - + \bf{Serialized as} & \hyperref[sec:serialization:operation:Fold]{\lst{Fold}} \\ \hline - + \end{tabularx} @@ -145,10 +145,10 @@ \subsubsection{\lst{SCollection.forall} method (Code 12.6)} \hline \bf{Result} & \lst{Boolean} \\ \hline - + \bf{Serialized as} & \hyperref[sec:serialization:operation:ForAll]{\lst{ForAll}} \\ \hline - + \end{tabularx} @@ -175,10 +175,10 @@ \subsubsection{\lst{SCollection.slice} method (Code 12.7)} \hline \bf{Result} & \lst{Coll[IV]} \\ \hline - + \bf{Serialized as} & \hyperref[sec:serialization:operation:Slice]{\lst{Slice}} \\ \hline - + \end{tabularx} @@ -202,10 +202,10 @@ \subsubsection{\lst{SCollection.filter} method (Code 12.8)} \hline \bf{Result} & \lst{Coll[IV]} \\ \hline - + \bf{Serialized as} & \hyperref[sec:serialization:operation:Filter]{\lst{Filter}} \\ \hline - + \end{tabularx} @@ -226,10 +226,10 @@ \subsubsection{\lst{SCollection.append} method (Code 12.9)} \hline \bf{Result} & \lst{Coll[IV]} \\ \hline - + \bf{Serialized as} & \hyperref[sec:serialization:operation:Append]{\lst{Append}} \\ \hline - + \end{tabularx} @@ -255,76 +255,10 @@ \subsubsection{\lst{SCollection.apply} method (Code 12.10)} \hline \bf{Result} & \lst{IV} \\ \hline - - \bf{Serialized as} & \hyperref[sec:serialization:operation:ByIndex]{\lst{ByIndex}} \\ - \hline - -\end{tabularx} - - - -\subsubsection{\lst{SCollection.<<} method (Code 12.11)} -\label{sec:type:SCollection:<<} -\noindent -\begin{tabularx}{\textwidth}{| l | X |} - \hline - \bf{Description} & \\ - - \hline - \bf{Parameters} & - \(\begin{array}{l l l} - \lst{arg0} & \lst{: Coll[IV]} & \text{// } \\ -\lst{arg1} & \lst{: Int} & \text{// } \\ - \end{array}\) \\ - - \hline - \bf{Result} & \lst{Coll[IV]} \\ - \hline - -\end{tabularx} - - - -\subsubsection{\lst{SCollection.>>} method (Code 12.12)} -\label{sec:type:SCollection:>>} -\noindent -\begin{tabularx}{\textwidth}{| l | X |} - \hline - \bf{Description} & \\ - - \hline - \bf{Parameters} & - \(\begin{array}{l l l} - \lst{arg0} & \lst{: Coll[IV]} & \text{// } \\ -\lst{arg1} & \lst{: Int} & \text{// } \\ - \end{array}\) \\ - - \hline - \bf{Result} & \lst{Coll[IV]} \\ - \hline - -\end{tabularx} - - - -\subsubsection{\lst{SCollection.>>>} method (Code 12.13)} -\label{sec:type:SCollection:>>>} -\noindent -\begin{tabularx}{\textwidth}{| l | X |} - \hline - \bf{Description} & \\ + \bf{Serialized as} & \hyperref[sec:serialization:operation:ByIndex]{\lst{ByIndex}} \\ \hline - \bf{Parameters} & - \(\begin{array}{l l l} - \lst{arg0} & \lst{: Coll[Boolean]} & \text{// } \\ -\lst{arg1} & \lst{: Int} & \text{// } \\ - \end{array}\) \\ - \hline - \bf{Result} & \lst{Coll[Boolean]} \\ - \hline - \end{tabularx} @@ -341,16 +275,16 @@ \subsubsection{\lst{SCollection.indices} method (Code 12.14)} \hline \bf{Parameters} & \(\begin{array}{l l l} - + \end{array}\) \\ - + \hline \bf{Result} & \lst{Coll[Int]} \\ \hline - + \bf{Serialized as} & \hyperref[sec:serialization:operation:PropertyCall]{\lst{PropertyCall}} \\ \hline - + \end{tabularx} @@ -377,10 +311,10 @@ \subsubsection{\lst{SCollection.flatMap} method (Code 12.15)} \hline \bf{Result} & \lst{Coll[OV]} \\ \hline - + \bf{Serialized as} & \hyperref[sec:serialization:operation:MethodCall]{\lst{MethodCall}} \\ \hline - + \end{tabularx} @@ -395,16 +329,16 @@ \subsubsection{\lst{SCollection.patch} method (Code 12.19)} \hline \bf{Parameters} & \(\begin{array}{l l l} - + \end{array}\) \\ \hline \bf{Result} & \lst{Coll[IV]} \\ \hline - + \bf{Serialized as} & \hyperref[sec:serialization:operation:MethodCall]{\lst{MethodCall}} \\ \hline - + \end{tabularx} @@ -419,70 +353,22 @@ \subsubsection{\lst{SCollection.updated} method (Code 12.20)} \hline \bf{Parameters} & \(\begin{array}{l l l} - + \end{array}\) \\ \hline \bf{Result} & \lst{Coll[IV]} \\ \hline - - \bf{Serialized as} & \hyperref[sec:serialization:operation:MethodCall]{\lst{MethodCall}} \\ - \hline - -\end{tabularx} - - - -\subsubsection{\lst{SCollection.updateMany} method (Code 12.21)} -\label{sec:type:SCollection:updateMany} -\noindent -\begin{tabularx}{\textwidth}{| l | X |} - \hline - \bf{Description} & \\ - \hline - \bf{Parameters} & - \(\begin{array}{l l l} - - \end{array}\) \\ - - \hline - \bf{Result} & \lst{Coll[IV]} \\ - \hline - \bf{Serialized as} & \hyperref[sec:serialization:operation:MethodCall]{\lst{MethodCall}} \\ \hline - -\end{tabularx} - - - -\subsubsection{\lst{SCollection.unionSets} method (Code 12.22)} -\label{sec:type:SCollection:unionSets} -\noindent -\begin{tabularx}{\textwidth}{| l | X |} - \hline - \bf{Description} & \\ - - \hline - \bf{Parameters} & - \(\begin{array}{l l l} - - \end{array}\) \\ - \hline - \bf{Result} & \lst{Coll[IV]} \\ - \hline - - \bf{Serialized as} & \hyperref[sec:serialization:operation:MethodCall]{\lst{MethodCall}} \\ - \hline - \end{tabularx} -\subsubsection{\lst{SCollection.diff} method (Code 12.23)} -\label{sec:type:SCollection:diff} +\subsubsection{\lst{SCollection.updateMany} method (Code 12.21)} +\label{sec:type:SCollection:updateMany} \noindent \begin{tabularx}{\textwidth}{| l | X |} \hline @@ -491,64 +377,16 @@ \subsubsection{\lst{SCollection.diff} method (Code 12.23)} \hline \bf{Parameters} & \(\begin{array}{l l l} - + \end{array}\) \\ \hline \bf{Result} & \lst{Coll[IV]} \\ \hline - - \bf{Serialized as} & \hyperref[sec:serialization:operation:MethodCall]{\lst{MethodCall}} \\ - \hline - -\end{tabularx} - - - -\subsubsection{\lst{SCollection.intersect} method (Code 12.24)} -\label{sec:type:SCollection:intersect} -\noindent -\begin{tabularx}{\textwidth}{| l | X |} - \hline - \bf{Description} & \\ - \hline - \bf{Parameters} & - \(\begin{array}{l l l} - - \end{array}\) \\ - - \hline - \bf{Result} & \lst{Coll[IV]} \\ - \hline - \bf{Serialized as} & \hyperref[sec:serialization:operation:MethodCall]{\lst{MethodCall}} \\ \hline - -\end{tabularx} - - - -\subsubsection{\lst{SCollection.prefixLength} method (Code 12.25)} -\label{sec:type:SCollection:prefixLength} -\noindent -\begin{tabularx}{\textwidth}{| l | X |} - \hline - \bf{Description} & \\ - - \hline - \bf{Parameters} & - \(\begin{array}{l l l} - - \end{array}\) \\ - \hline - \bf{Result} & \lst{Int} \\ - \hline - - \bf{Serialized as} & \hyperref[sec:serialization:operation:MethodCall]{\lst{MethodCall}} \\ - \hline - \end{tabularx} @@ -563,64 +401,16 @@ \subsubsection{\lst{SCollection.indexOf} method (Code 12.26)} \hline \bf{Parameters} & \(\begin{array}{l l l} - + \end{array}\) \\ \hline \bf{Result} & \lst{Int} \\ \hline - - \bf{Serialized as} & \hyperref[sec:serialization:operation:MethodCall]{\lst{MethodCall}} \\ - \hline - -\end{tabularx} - - - -\subsubsection{\lst{SCollection.lastIndexOf} method (Code 12.27)} -\label{sec:type:SCollection:lastIndexOf} -\noindent -\begin{tabularx}{\textwidth}{| l | X |} - \hline - \bf{Description} & \\ - \hline - \bf{Parameters} & - \(\begin{array}{l l l} - - \end{array}\) \\ - - \hline - \bf{Result} & \lst{Int} \\ - \hline - \bf{Serialized as} & \hyperref[sec:serialization:operation:MethodCall]{\lst{MethodCall}} \\ \hline - -\end{tabularx} - - - -\subsubsection{\lst{SCollection.find} method (Code 12.28)} -\label{sec:type:SCollection:find} -\noindent -\begin{tabularx}{\textwidth}{| l | X |} - \hline - \bf{Description} & \\ - - \hline - \bf{Parameters} & - \(\begin{array}{l l l} - - \end{array}\) \\ - \hline - \bf{Result} & \lst{Option[IV]} \\ - \hline - - \bf{Serialized as} & \hyperref[sec:serialization:operation:MethodCall]{\lst{MethodCall}} \\ - \hline - \end{tabularx} @@ -635,110 +425,14 @@ \subsubsection{\lst{SCollection.zip} method (Code 12.29)} \hline \bf{Parameters} & \(\begin{array}{l l l} - + \end{array}\) \\ \hline \bf{Result} & \lst{Coll[(IV,OV)]} \\ \hline - - \bf{Serialized as} & \hyperref[sec:serialization:operation:MethodCall]{\lst{MethodCall}} \\ - \hline - -\end{tabularx} - - - -\subsubsection{\lst{SCollection.distinct} method (Code 12.30)} -\label{sec:type:SCollection:distinct} -\noindent -\begin{tabularx}{\textwidth}{| l | X |} - \hline - \bf{Description} & \\ - - \hline - \bf{Parameters} & - \(\begin{array}{l l l} - - \end{array}\) \\ - - \hline - \bf{Result} & \lst{Coll[IV]} \\ - \hline - - \bf{Serialized as} & \hyperref[sec:serialization:operation:PropertyCall]{\lst{PropertyCall}} \\ - \hline - -\end{tabularx} - - - -\subsubsection{\lst{SCollection.startsWith} method (Code 12.31)} -\label{sec:type:SCollection:startsWith} -\noindent -\begin{tabularx}{\textwidth}{| l | X |} - \hline - \bf{Description} & \\ - - \hline - \bf{Parameters} & - \(\begin{array}{l l l} - - \end{array}\) \\ - - \hline - \bf{Result} & \lst{Boolean} \\ - \hline - - \bf{Serialized as} & \hyperref[sec:serialization:operation:MethodCall]{\lst{MethodCall}} \\ - \hline - -\end{tabularx} - - - -\subsubsection{\lst{SCollection.endsWith} method (Code 12.32)} -\label{sec:type:SCollection:endsWith} -\noindent -\begin{tabularx}{\textwidth}{| l | X |} - \hline - \bf{Description} & \\ - \hline - \bf{Parameters} & - \(\begin{array}{l l l} - - \end{array}\) \\ - - \hline - \bf{Result} & \lst{Boolean} \\ - \hline - \bf{Serialized as} & \hyperref[sec:serialization:operation:MethodCall]{\lst{MethodCall}} \\ \hline - -\end{tabularx} - - - -\subsubsection{\lst{SCollection.mapReduce} method (Code 12.34)} -\label{sec:type:SCollection:mapReduce} -\noindent -\begin{tabularx}{\textwidth}{| l | X |} - \hline - \bf{Description} & \\ - - \hline - \bf{Parameters} & - \(\begin{array}{l l l} - - \end{array}\) \\ - \hline - \bf{Result} & \lst{Coll[(K,V)]} \\ - \hline - - \bf{Serialized as} & \hyperref[sec:serialization:operation:MethodCall]{\lst{MethodCall}} \\ - \hline - \end{tabularx} diff --git a/docs/spec/generated/SOption_methods.tex b/docs/spec/generated/SOption_methods.tex index 78419c9a7d..f44550ba58 100644 --- a/docs/spec/generated/SOption_methods.tex +++ b/docs/spec/generated/SOption_methods.tex @@ -1,25 +1,4 @@ -\subsubsection{\lst{SOption.isEmpty} method (Code 36.1)} -\label{sec:type:SOption:isEmpty} -\noindent -\begin{tabularx}{\textwidth}{| l | X |} - \hline - \bf{Description} & \\ - - \hline - \bf{Parameters} & - \(\begin{array}{l l l} - \lst{arg0} & \lst{: Option[T]} & \text{// } \\ - \end{array}\) \\ - - \hline - \bf{Result} & \lst{Boolean} \\ - \hline - -\end{tabularx} - - - \subsubsection{\lst{SOption.isDefined} method (Code 36.2)} \label{sec:type:SOption:isDefined} \noindent @@ -94,59 +73,6 @@ \subsubsection{\lst{SOption.getOrElse} method (Code 36.4)} -\subsubsection{\lst{SOption.fold} method (Code 36.5)} -\label{sec:type:SOption:fold} -\noindent -\begin{tabularx}{\textwidth}{| l | X |} - \hline - \bf{Description} & Returns the result of applying \lst{f} to this option's - value if the option is nonempty. Otherwise, evaluates - expression \lst{ifEmpty}. - This is equivalent to \lst{option map f getOrElse ifEmpty}. - \\ - - \hline - \bf{Parameters} & - \(\begin{array}{l l l} - \lst{ifEmpty} & \lst{: R} & \text{// the expression to evaluate if empty} \\ -\lst{f} & \lst{: (T) => R} & \text{// the function to apply if nonempty} \\ - \end{array}\) \\ - - \hline - \bf{Result} & \lst{R} \\ - \hline - - \bf{Serialized as} & \hyperref[sec:serialization:operation:MethodCall]{\lst{MethodCall}} \\ - \hline - -\end{tabularx} - - - -\subsubsection{\lst{SOption.toColl} method (Code 36.6)} -\label{sec:type:SOption:toColl} -\noindent -\begin{tabularx}{\textwidth}{| l | X |} - \hline - \bf{Description} & Convert this Option to a collection with zero or one element. \\ - - \hline - \bf{Parameters} & - \(\begin{array}{l l l} - - \end{array}\) \\ - - \hline - \bf{Result} & \lst{Coll[T]} \\ - \hline - - \bf{Serialized as} & \hyperref[sec:serialization:operation:PropertyCall]{\lst{PropertyCall}} \\ - \hline - -\end{tabularx} - - - \subsubsection{\lst{SOption.map} method (Code 36.7)} \label{sec:type:SOption:map} \noindent @@ -197,32 +123,3 @@ \subsubsection{\lst{SOption.filter} method (Code 36.8)} \hline \end{tabularx} - - - -\subsubsection{\lst{SOption.flatMap} method (Code 36.9)} -\label{sec:type:SOption:flatMap} -\noindent -\begin{tabularx}{\textwidth}{| l | X |} - \hline - \bf{Description} & Returns the result of applying \lst{f} to this option's value if - this option is nonempty. - Returns \lst{None} if this option is empty. - Slightly different from \lst{map} in that \lst{f} is expected to - return an option (which could be \lst{one}). - \\ - - \hline - \bf{Parameters} & - \(\begin{array}{l l l} - \lst{f} & \lst{: (T) => Option[R]} & \text{// the function to apply} \\ - \end{array}\) \\ - - \hline - \bf{Result} & \lst{Option[R]} \\ - \hline - - \bf{Serialized as} & \hyperref[sec:serialization:operation:MethodCall]{\lst{MethodCall}} \\ - \hline - -\end{tabularx} diff --git a/docs/spec/generated/SigmaDslBuilder_methods.tex b/docs/spec/generated/SigmaDslBuilder_methods.tex index 0232ed2e76..611aeac9a6 100644 --- a/docs/spec/generated/SigmaDslBuilder_methods.tex +++ b/docs/spec/generated/SigmaDslBuilder_methods.tex @@ -20,3 +20,26 @@ \subsubsection{\lst{SigmaDslBuilder.groupGenerator} method (Code 106.1)} \hline \end{tabularx} + + + +\subsubsection{\lst{SigmaDslBuilder.xor} method (Code 106.2)} +\label{sec:type:SigmaDslBuilder:xor} +\noindent +\begin{tabularx}{\textwidth}{| l | X |} + \hline + \bf{Description} & \\ + + \hline + \bf{Parameters} & + \(\begin{array}{l l l} + \lst{arg0} & \lst{: SigmaDslBuilder} & \text{// } \\ +\lst{arg1} & \lst{: Coll[Byte]} & \text{// } \\ +\lst{arg2} & \lst{: Coll[Byte]} & \text{// } \\ + \end{array}\) \\ + + \hline + \bf{Result} & \lst{Coll[Byte]} \\ + \hline + +\end{tabularx} diff --git a/docs/spec/generated/ergotree_serialization1.tex b/docs/spec/generated/ergotree_serialization1.tex index 468756773c..3db72a9d30 100644 --- a/docs/spec/generated/ergotree_serialization1.tex +++ b/docs/spec/generated/ergotree_serialization1.tex @@ -1022,7 +1022,7 @@ \subsubsection{\lst{Apply} operation (OpCode 218)} \subsubsection{\lst{PropertyCall} operation (OpCode 219)} \label{sec:serialization:operation:PropertyCall} -Convert true to 1 and false to 0 + \noindent \(\begin{tabularx}{\textwidth}{| l | l | l | X |} @@ -1031,7 +1031,7 @@ \subsubsection{\lst{PropertyCall} operation (OpCode 219)} \hline $ typeCode $ & \lst{Byte} & 1 & type of the method (see Table~\ref{table:predeftypes}) \\ \hline - $ methodCode $ & \lst{Byte} & 1 & a code of the proprty \\ + $ methodCode $ & \lst{Byte} & 1 & a code of the property \\ \hline $ obj $ & \lst{Expr} & [1, *] & receiver object of this property call \\ \hline @@ -1267,6 +1267,28 @@ \subsubsection{\lst{Negation} operation (OpCode 240)} \end{tabularx}\) +\subsubsection{\lst{BinXor} operation (OpCode 244)} +\label{sec:serialization:operation:BinXor} + +Logical XOR of two operands See~\hyperref[sec:appendix:primops:BinXor]{\lst{^}} + +\noindent +\(\begin{tabularx}{\textwidth}{| l | l | l | X |} + \hline + \bf{Slot} & \bf{Format} & \bf{\#bytes} & \bf{Description} \\ + \hline + \multicolumn{4}{l}{\lst{match}~$ (left, right) $} \\ + + \multicolumn{4}{l}{~~\lst{otherwise} } \\ + \hline + ~~~~ $ left $ & \lst{Expr} & [1, *] & left operand \\ + \hline + ~~~~ $ right $ & \lst{Expr} & [1, *] & right operand \\ + \hline + \multicolumn{4}{l}{\lst{end match}} \\ +\end{tabularx}\) + + \subsubsection{\lst{XorOf} operation (OpCode 255)} \label{sec:serialization:operation:XorOf} diff --git a/docs/spec/generated/predeftypes.tex b/docs/spec/generated/predeftypes.tex index a0d2e76d8f..1d71cdec3f 100644 --- a/docs/spec/generated/predeftypes.tex +++ b/docs/spec/generated/predeftypes.tex @@ -12,11 +12,11 @@ \hline \lst{GroupElement} & $7$ & \lst{true} & \lst{true} & \lst{true} & \lst{false} & $\Set{p \in \lst{SecP256K1Point}}$ \\ \hline -\lst{SigmaProp} & $8$ & \lst{false} & \lst{true} & \lst{true} & \lst{false} & Sec.~\ref{sec:type:SigmaProp} \\ +\lst{SigmaProp} & $8$ & \lst{true} & \lst{true} & \lst{true} & \lst{false} & Sec.~\ref{sec:type:SigmaProp} \\ \hline \lst{Box} & $99$ & \lst{false} & \lst{false} & \lst{false} & \lst{false} & Sec.~\ref{sec:type:Box} \\ \hline -\lst{AvlTree} & $100$ & \lst{false} & \lst{false} & \lst{false} & \lst{false} & Sec.~\ref{sec:type:AvlTree} \\ +\lst{AvlTree} & $100$ & \lst{true} & \lst{false} & \lst{false} & \lst{false} & Sec.~\ref{sec:type:AvlTree} \\ \hline \lst{Context} & $101$ & \lst{false} & \lst{false} & \lst{false} & \lst{false} & Sec.~\ref{sec:type:Context} \\ \hline diff --git a/docs/spec/spec.pdf b/docs/spec/spec.pdf new file mode 100644 index 0000000000..c3ba73e746 Binary files /dev/null and b/docs/spec/spec.pdf differ diff --git a/docs/wpaper/sigma.pdf b/docs/wpaper/sigma.pdf new file mode 100644 index 0000000000..57ae3d40c1 Binary files /dev/null and b/docs/wpaper/sigma.pdf differ diff --git a/src/main/scala/sigmastate/Operations.scala b/src/main/scala/sigmastate/Operations.scala index 3771b722cd..34931e3df0 100644 --- a/src/main/scala/sigmastate/Operations.scala +++ b/src/main/scala/sigmastate/Operations.scala @@ -3,7 +3,7 @@ package sigmastate import sigmastate.lang.SigmaPredef.PredefinedFuncRegistry import sigmastate.lang.StdSigmaBuilder -/** WARNING: This file is generated by GenSerializableOps tool. +/** WARNING: This file is generated by GenInfoObjects tool. * Don't edit it directly, use the tool instead to regenerate. * The operations are alphabetically sorted. */ @@ -383,19 +383,6 @@ object Operations { val argInfos: Seq[ArgInfo] = Seq(leftArg, rightArg) } - object MinusModQInfo extends InfoObject { - private val method = SMethod.fromIds(6, 3) - val thisArg: ArgInfo = method.argInfo("this") - val otherArg: ArgInfo = method.argInfo("other") - val argInfos: Seq[ArgInfo] = Seq(thisArg, otherArg) - } - - object ModQInfo extends InfoObject { - private val method = SMethod.fromIds(6, 1) - val thisArg: ArgInfo = method.argInfo("this") - val argInfos: Seq[ArgInfo] = Seq(thisArg) - } - object ModuloInfo extends InfoObject { private val func = predefinedOps.funcs("%") val leftArg: ArgInfo = func.argInfo("left") @@ -462,19 +449,6 @@ object Operations { val argInfos: Seq[ArgInfo] = Seq(leftArg, rightArg) } - object PlusModQInfo extends InfoObject { - private val method = SMethod.fromIds(6, 2) - val thisArg: ArgInfo = method.argInfo("this") - val otherArg: ArgInfo = method.argInfo("other") - val argInfos: Seq[ArgInfo] = Seq(thisArg, otherArg) - } - - object PropertyCallInfo extends InfoObject { - private val method = SMethod.fromIds(1, 1) - val thisArg: ArgInfo = method.argInfo("this") - val argInfos: Seq[ArgInfo] = Seq(thisArg) - } - object SelectFieldInfo extends InfoObject { private val func = predefinedOps.specialFuncs("selectField") val inputArg: ArgInfo = func.argInfo("input") diff --git a/src/main/scala/sigmastate/serialization/ModQSerializer.scala b/src/main/scala/sigmastate/serialization/ModQSerializer.scala index 6ccb69141c..9017ea23f5 100644 --- a/src/main/scala/sigmastate/serialization/ModQSerializer.scala +++ b/src/main/scala/sigmastate/serialization/ModQSerializer.scala @@ -1,6 +1,6 @@ package sigmastate.serialization -import sigmastate.Operations.ModQInfo +// import sigmastate.Operations.ModQInfo import sigmastate.Values.Value import sigmastate.lang.Terms._ import sigmastate.utils.{SigmaByteReader, SigmaByteWriter} @@ -10,7 +10,9 @@ object ModQSerializer extends ValueSerializer[ModQ] { override def opDesc = ModQ def serialize(obj: ModQ, w: SigmaByteWriter): Unit = { - w.putValue(obj.input, ModQInfo.thisArg) + // TODO soft-fork: + // w.putValue(obj.input, ModQInfo.thisArg) + w.putValue(obj.input, "this") } def parse(r: SigmaByteReader): Value[SType] = { diff --git a/src/main/scala/sigmastate/trees.scala b/src/main/scala/sigmastate/trees.scala index cbf2405069..758d0a5010 100644 --- a/src/main/scala/sigmastate/trees.scala +++ b/src/main/scala/sigmastate/trees.scala @@ -610,10 +610,14 @@ trait OpGroup[C <: ValueCompanion] { object ModQArithOp extends OpGroup[ModQArithOpCompanion] { import OpCodes._ object PlusModQ extends ModQArithOpCompanion(PlusModQCode, "PlusModQ") { - override def argInfos: Seq[ArgInfo] = PlusModQInfo.argInfos + // TODO soft-fork: + // override def argInfos: Seq[ArgInfo] = PlusModQInfo.argInfos + override def argInfos: Seq[ArgInfo] = Seq(ArgInfo("this", ""), ArgInfo("other", "")) } object MinusModQ extends ModQArithOpCompanion(MinusModQCode, "MinusModQ") { - override def argInfos: Seq[ArgInfo] = PlusModQInfo.argInfos + // TODO soft-fork: + // override def argInfos: Seq[ArgInfo] = MinusModQInfo.argInfos + override def argInfos: Seq[ArgInfo] = Seq(ArgInfo("this", ""), ArgInfo("other", "")) } val operations: Map[Byte, ModQArithOpCompanion] = Seq(PlusModQ, MinusModQ).map(o => (o.opCode, o)).toMap diff --git a/src/test/scala/sigmastate/serialization/PDHTSerializerSpecification.scala b/src/test/scala/sigmastate/serialization/PDHTSerializerSpecification.scala index b8eaea97e9..03f859320f 100644 --- a/src/test/scala/sigmastate/serialization/PDHTSerializerSpecification.scala +++ b/src/test/scala/sigmastate/serialization/PDHTSerializerSpecification.scala @@ -10,11 +10,18 @@ class PDHTSerializerSpecification extends SerializationSpecification { forAll { i: ProveDHTuple => roundTripTest(i.toSigmaProp) } + // In IntelliJ IDEA this test is executed last, at this point all statistics has been collected - // We output it here in the console -// println(CostTableStat.costTableString) -// println(ValueSerializer.printSerInfo()) -// GenSerializers.generateSerSpec() + // uncomment to output it in the console + // println(CostTableStat.costTableString) + + // uncomment to output info about serializers + // println(ValueSerializer.printSerInfo()) + + // ValueSerializer.serializerInfo is ready to be printed after all serializers are executed + // at least once during test execution. + // uncomment to save serialization info to the file + // GenSerializers.generateSerSpec() } } diff --git a/src/test/scala/sigmastate/utils/GenSerializers.scala b/src/test/scala/sigmastate/utils/GenSerializers.scala index a695d309f2..c9fc0a5f5e 100644 --- a/src/test/scala/sigmastate/utils/GenSerializers.scala +++ b/src/test/scala/sigmastate/utils/GenSerializers.scala @@ -7,6 +7,12 @@ import sigma.util.Extensions.ByteOps import sigmastate.lang.Terms.{PropertyCall, MethodCall} /** Generate contents of ErgoTree serializer format specification. + * To generate serialization formats, it is necessary that all branches of serializers + * are executed at least once. Those executions are then traced and the structure + * of the serialized formats is recorded in `ValueSerializer.serializerInfo` map, + * which lives in memory and is not stored anywhere. + * NOTE: you need to set `ValueSerializer.collectSerInfo = true`, + * don't forget to to set it back to `false` before release. */ object GenSerializers extends SpecGen { diff --git a/src/test/scala/sigmastate/utils/SpecGen.scala b/src/test/scala/sigmastate/utils/SpecGen.scala index bbcc71fd5c..32fc81e2d3 100644 --- a/src/test/scala/sigmastate/utils/SpecGen.scala +++ b/src/test/scala/sigmastate/utils/SpecGen.scala @@ -9,7 +9,7 @@ import scalan.util.PrintExtensions._ import sigmastate.Values.{FalseLeaf, Constant, TrueLeaf, BlockValue, ConstantPlaceholder, Tuple, ValDef, FunDef, ValUse, ValueCompanion, TaggedVariable, ConcreteCollection, ConcreteCollectionBooleanConstant} import sigmastate.lang.SigmaPredef.{PredefinedFuncRegistry, PredefinedFunc} import sigmastate.lang.StdSigmaBuilder -import sigmastate.lang.Terms.MethodCall +import sigmastate.lang.Terms.{MethodCall, PropertyCall} import sigmastate.serialization.OpCodes.OpCode import sigmastate.serialization.{ValueSerializer, OpCodes} import sigmastate.utxo.{SigmaPropIsProven, SelectField} @@ -57,7 +57,7 @@ trait SpecGen { } protected val predefFuncRegistry = new PredefinedFuncRegistry(StdSigmaBuilder) - val noFuncs: Set[ValueCompanion] = Set(Constant, MethodCall) + val noFuncs: Set[ValueCompanion] = Set(Constant, MethodCall, PropertyCall) val predefFuncs: Seq[PredefinedFunc] = predefFuncRegistry.funcs.values .filterNot { f => noFuncs.contains(f.docInfo.opDesc) }.toSeq val specialFuncs: Seq[PredefinedFunc] = predefFuncRegistry.specialFuncs.values.toSeq @@ -262,7 +262,10 @@ object GenPrimOpsApp extends SpecGen { // join collection of all operations with all methods by optional opCode val primOps = CollectionUtil.outerJoinSeqs(ops, methods)( - o => Some(o._1), m => m.docInfo.map(_.opDesc.opCode) + o => Some(o._1), m => m.docInfo.map(info => if (info.isFrontendOnly) { + System.err.println(s"WARNING: Operation is frontend only: $info") + None + } else info.opDesc.opCode) )( (k, o) => Some(o), // left without right (k,i) => None, // right without left