|
21 | 21 | // limitations under the License.
|
22 | 22 |
|
23 | 23 | use std::cmp::Ordering;
|
24 |
| -use std::io; |
25 | 24 | use std::str::FromStr;
|
26 | 25 |
|
27 | 26 | use amplify::confinement::{MediumVec, TinyOrdMap, TinyOrdSet};
|
28 |
| -use amplify::flags::FlagVec; |
29 | 27 | use amplify::{Bytes32, RawArray};
|
30 | 28 | use baid58::{Baid58ParseError, FromBaid58, ToBaid58};
|
31 | 29 | use commit_verify::{CommitStrategy, CommitmentId};
|
32 |
| -use strict_encoding::{ |
33 |
| - DecodeError, ReadTuple, StrictDecode, StrictEncode, StrictProduct, StrictTuple, StrictType, |
34 |
| - TypeName, TypedRead, TypedWrite, WriteTuple, |
35 |
| -}; |
| 30 | +use strict_encoding::{StrictDecode, StrictEncode, StrictType}; |
36 | 31 | use strict_types::SemId;
|
37 | 32 |
|
38 | 33 | use super::{
|
39 | 34 | ExtensionSchema, GenesisSchema, OwnedStateType, Script, StateSchema, TransitionSchema,
|
40 | 35 | ValencyType,
|
41 | 36 | };
|
42 |
| -use crate::LIB_NAME_RGB; |
| 37 | +use crate::{Ffv, LIB_NAME_RGB}; |
43 | 38 |
|
44 | 39 | pub type GlobalStateType = u16;
|
45 | 40 | pub type ExtensionType = u16;
|
@@ -80,18 +75,7 @@ impl FromStr for SchemaId {
|
80 | 75 | #[strict_type(lib = LIB_NAME_RGB)]
|
81 | 76 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize), serde(crate = "serde_crate"))]
|
82 | 77 | pub struct Schema {
|
83 |
| - /// Feature flags control which of the available RGB features are allowed |
84 |
| - /// for smart contracts created under this schema. |
85 |
| - /// |
86 |
| - /// NB: This is not the same as RGB protocol versioning: feature flag set |
87 |
| - /// is specific to a particular RGB protocol version. The only currently |
88 |
| - /// defined RGB version is RGBv1; future versions may change the whole |
89 |
| - /// structure of Schema data, use of feature flags, re-define their meaning |
90 |
| - /// or do other backward-incompatible changes (RGB protocol versions are |
91 |
| - /// not interoperable and backward-incompatible by definitions and the |
92 |
| - /// nature of client-side-validation which does not allow upgrades). |
93 |
| - #[cfg_attr(feature = "serde", serde(skip))] |
94 |
| - pub rgb_features: SchemaFlags, |
| 78 | + pub ffv: Ffv, |
95 | 79 | pub subset_of: Option<SchemaId>,
|
96 | 80 |
|
97 | 81 | pub global_types: TinyOrdMap<GlobalStateType, SemId>,
|
@@ -133,39 +117,6 @@ impl Schema {
|
133 | 117 | pub fn schema_id(&self) -> SchemaId { self.commitment_id() }
|
134 | 118 | }
|
135 | 119 |
|
136 |
| -#[derive(Clone, Eq, PartialEq, Hash, Debug, Display, Default)] |
137 |
| -#[display(inner)] |
138 |
| -pub struct SchemaFlags(FlagVec); |
139 |
| - |
140 |
| -impl StrictType for SchemaFlags { |
141 |
| - const STRICT_LIB_NAME: &'static str = LIB_NAME_RGB; |
142 |
| - fn strict_name() -> Option<TypeName> { Some(tn!("SchemaFlags")) } |
143 |
| -} |
144 |
| -impl StrictProduct for SchemaFlags {} |
145 |
| -impl StrictTuple for SchemaFlags { |
146 |
| - const FIELD_COUNT: u8 = 1; |
147 |
| -} |
148 |
| -impl StrictEncode for SchemaFlags { |
149 |
| - fn strict_encode<W: TypedWrite>(&self, writer: W) -> io::Result<W> { |
150 |
| - writer.write_tuple::<Self>(|w| Ok(w.write_field(&self.0.shrunk().into_inner())?.complete())) |
151 |
| - } |
152 |
| -} |
153 |
| -impl StrictDecode for SchemaFlags { |
154 |
| - fn strict_decode(reader: &mut impl TypedRead) -> Result<Self, DecodeError> { |
155 |
| - let flags = |
156 |
| - reader.read_tuple(|r| r.read_field().map(|vec| Self(FlagVec::from_inner(vec))))?; |
157 |
| - if !flags.0.is_empty() { |
158 |
| - Err(DecodeError::DataIntegrityError(format!( |
159 |
| - "unsupported schema flags potentially belonging to a future RGB version. Please \ |
160 |
| - update your software, or, if the problem persists, contact your vendor providing \ |
161 |
| - the following flag information: {flags}" |
162 |
| - ))) |
163 |
| - } else { |
164 |
| - Ok(flags) |
165 |
| - } |
166 |
| - } |
167 |
| -} |
168 |
| - |
169 | 120 | #[cfg(test)]
|
170 | 121 | mod test {
|
171 | 122 | use strict_encoding::StrictDumb;
|
|
0 commit comments