@@ -116,6 +116,24 @@ pub trait ContractVerify<SealDef: RgbSealDef>: ContractApi<SealDef> {
116
116
closed_seals. push ( seal) ;
117
117
}
118
118
119
+ // We need to check that all seal definitions strictly match operation-defined destructible cells
120
+ let defined = header
121
+ . operation
122
+ . destructible
123
+ . iter ( )
124
+ . map ( |cell| cell. auth . to_byte_array ( ) )
125
+ . collect :: < BTreeSet < _ > > ( ) ;
126
+ let sealed = header
127
+ . defined_seals
128
+ . values ( )
129
+ . map ( |seal| seal. auth_token ( ) . to_byte_array ( ) )
130
+ . collect :: < BTreeSet < _ > > ( ) ;
131
+ // It is a subset and not equal set since some of the seals might be unknown to us: we know their
132
+ // commitment auth token, but do not know definition.
133
+ if !sealed. is_subset ( & defined) {
134
+ return Err ( VerificationError :: SealsDefinitionMismatch ( opid) ) ;
135
+ }
136
+
119
137
// This convoluted logic happens since we use a state machine which ensures the client can't lie to
120
138
// the verifier
121
139
let mut witness_count = 0usize ;
@@ -148,24 +166,6 @@ pub trait ContractVerify<SealDef: RgbSealDef>: ContractApi<SealDef> {
148
166
witness_count += 1 ;
149
167
}
150
168
151
- // We need to check that all seal definitions strictly match operation-defined destructible cells
152
- let defined = header
153
- . operation
154
- . destructible
155
- . iter ( )
156
- . map ( |cell| cell. auth . to_byte_array ( ) )
157
- . collect :: < BTreeSet < _ > > ( ) ;
158
- let sealed = header
159
- . defined_seals
160
- . values ( )
161
- . map ( |seal| seal. auth_token ( ) . to_byte_array ( ) )
162
- . collect :: < BTreeSet < _ > > ( ) ;
163
- // It is a subset and not equal set since some of the seals might be unknown to us: we know their
164
- // commitment auth token, but do not know definition.
165
- if !sealed. is_subset ( & defined) {
166
- return Err ( VerificationError :: SealsDefinitionMismatch ( opid) ) ;
167
- }
168
-
169
169
if !closed_seals. is_empty ( ) && witness_count == 0 {
170
170
return Err ( VerificationError :: NoWitness ( opid) ) ;
171
171
}
0 commit comments