@@ -3,7 +3,6 @@ use ergo_chain_types::Header;
33use sigma_ser:: ScorexSerializable ;
44
55use alloc:: string:: String ;
6- use alloc:: string:: ToString ;
76use alloc:: vec;
87use alloc:: vec:: Vec ;
98use sigma_util:: AsVecU8 ;
@@ -17,12 +16,12 @@ use crate::mir::constant::TryExtractFromError;
1716use crate :: mir:: constant:: TryExtractInto ;
1817use crate :: mir:: value:: CollKind ;
1918use crate :: mir:: value:: NativeColl ;
20- use crate :: serialization:: SigmaSerializationError ;
2119use crate :: serialization:: SigmaSerializeResult ;
2220use crate :: serialization:: {
2321 sigma_byte_reader:: SigmaByteRead , SigmaParsingError , SigmaSerializable ,
2422} ;
2523use crate :: sigma_protocol:: { sigma_boolean:: SigmaBoolean , sigma_boolean:: SigmaProp } ;
24+ use crate :: soft_fork:: SoftForkError ;
2625use crate :: types:: stuple;
2726use crate :: types:: stype:: SType ;
2827use crate :: unsignedbigint256:: UnsignedBigInt ;
@@ -59,9 +58,10 @@ impl DataSerializer {
5958 v. sigma_serialize ( w) ?
6059 }
6160 Literal :: UnsignedBigInt ( _) => {
62- return Err ( SigmaSerializationError :: NotSupported (
63- "Can't serialize UnsignedBigInt with tree version < 3" . into ( ) ,
64- ) )
61+ return Err ( SoftForkError :: NotSerializable (
62+ "Can't serialize UnsignedBigInt with tree version < 3" ,
63+ )
64+ . into ( ) )
6565 }
6666 Literal :: AvlTree ( a) => a. sigma_serialize ( w) ?,
6767 Literal :: CBox ( b) => b. sigma_serialize ( w) ?,
@@ -101,14 +101,16 @@ impl DataSerializer {
101101 // unsupported, see
102102 // https://github.com/ScorexFoundation/sigmastate-interpreter/issues/659
103103 Literal :: Opt ( _) => {
104- return Err ( SigmaSerializationError :: NotSupported (
105- "Option serialization is not supported" . to_string ( ) ,
106- ) ) ;
104+ return Err ( SoftForkError :: NotSerializable (
105+ "Option serialization is not supported" ,
106+ )
107+ . into ( ) ) ;
107108 }
108109 Literal :: Header ( _) => {
109- return Err ( SigmaSerializationError :: NotSupported (
110- "Header serialization is not supported" . to_string ( ) ,
111- ) ) ;
110+ return Err ( SoftForkError :: NotSerializable (
111+ "Header serialization is not supported" ,
112+ )
113+ . into ( ) ) ;
112114 }
113115 } )
114116 }
@@ -187,14 +189,14 @@ impl DataSerializer {
187189 SHeader if r. tree_version ( ) >= ErgoTreeVersion :: V3 => {
188190 Literal :: Header ( Box :: new ( Header :: scorex_parse ( r) ?) )
189191 }
190- STypeVar ( _) => return Err ( SigmaParsingError :: NotSupported ( "TypeVar data" ) ) ,
191- SAny => return Err ( SigmaParsingError :: NotSupported ( "SAny data" ) ) ,
192- SOption ( _) => return Err ( SigmaParsingError :: NotSupported ( "SOption data" ) ) ,
193- SFunc ( _) => return Err ( SigmaParsingError :: NotSupported ( "SFunc data" ) ) ,
194- SContext => return Err ( SigmaParsingError :: NotSupported ( "SContext data" ) ) ,
195- SHeader => return Err ( SigmaParsingError :: NotSupported ( "SHeader data" ) ) ,
196- SPreHeader => return Err ( SigmaParsingError :: NotSupported ( "SPreHeader data" ) ) ,
197- SGlobal => return Err ( SigmaParsingError :: NotSupported ( "SGlobal data" ) ) ,
192+ STypeVar ( _) => return Err ( SoftForkError :: NotSerializable ( "TypeVar data" ) . into ( ) ) ,
193+ SAny => return Err ( SoftForkError :: NotSerializable ( "SAny data" ) . into ( ) ) ,
194+ SOption ( _) => return Err ( SoftForkError :: NotSerializable ( "SOption data" ) . into ( ) ) ,
195+ SFunc ( _) => return Err ( SoftForkError :: NotSerializable ( "SFunc data" ) . into ( ) ) ,
196+ SContext => return Err ( SoftForkError :: NotSerializable ( "SContext data" ) . into ( ) ) ,
197+ SHeader => return Err ( SoftForkError :: NotSerializable ( "SHeader data" ) . into ( ) ) ,
198+ SPreHeader => return Err ( SoftForkError :: NotSerializable ( "SPreHeader data" ) . into ( ) ) ,
199+ SGlobal => return Err ( SoftForkError :: NotSerializable ( "SGlobal data" ) . into ( ) ) ,
198200 } )
199201 }
200202}
0 commit comments