@@ -28,7 +28,7 @@ use alloc::vec::Vec;
28
28
use amplify:: confinement:: SmallOrdMap ;
29
29
use amplify:: ByteArray ;
30
30
use single_use_seals:: { PublishedWitness , SealError , SealWitness } ;
31
- use ultrasonic:: { CallError , CellAddr , Codex , ContractId , LibRepo , Memory , Operation , Opid } ;
31
+ use ultrasonic:: { AuthToken , CallError , CellAddr , Codex , ContractId , LibRepo , Memory , Operation , Opid } ;
32
32
33
33
use crate :: { RgbSealDef , RgbSealSrc , LIB_NAME_RGB_CORE } ;
34
34
@@ -110,17 +110,22 @@ pub trait ContractVerify<SealDef: RgbSealDef>: ContractApi<SealDef> {
110
110
. operation
111
111
. destructible
112
112
. iter ( )
113
- . map ( |cell| cell. auth . to_byte_array ( ) )
113
+ . map ( |cell| cell. auth )
114
114
. collect :: < BTreeSet < _ > > ( ) ;
115
- let sealed = header
115
+ let reported = header
116
116
. defined_seals
117
117
. values ( )
118
- . map ( |seal| seal. auth_token ( ) . to_byte_array ( ) )
118
+ . map ( |seal| seal. auth_token ( ) )
119
119
. collect :: < BTreeSet < _ > > ( ) ;
120
120
// It is a subset and not equal set since some of the seals might be unknown to us: we know their
121
121
// commitment auth token, but do not know definition.
122
- if !sealed. is_subset ( & defined) {
123
- return Err ( VerificationError :: SealsDefinitionMismatch ( opid) ) ;
122
+ if !reported. is_subset ( & defined) {
123
+ let sources = header
124
+ . defined_seals
125
+ . iter ( )
126
+ . map ( |( pos, seal) | ( * pos, seal. to_string ( ) ) )
127
+ . collect ( ) ;
128
+ return Err ( VerificationError :: SealsDefinitionMismatch { opid, reported, defined, sources } ) ;
124
129
}
125
130
126
131
// If the operation was validated before, we need to skip its validation, since its inputs are not a
@@ -217,9 +222,20 @@ pub enum VerificationError<SealSrc: RgbSealSrc> {
217
222
/// unknown seal definition for cell address {0}.
218
223
SealUnknown ( CellAddr ) ,
219
224
220
- /// seals, reported to be defined by the operation {0 }, do match the assignments in the
225
+ /// seals, reported to be defined by the operation {opid }, do match the assignments in the
221
226
/// operation.
222
- SealsDefinitionMismatch ( Opid ) ,
227
+ ///
228
+ /// Actual operation seals from the assignments: {defined:#?}
229
+ ///
230
+ /// Reported seals: {reported:#?}
231
+ ///
232
+ /// Sources for the reported seals: {sources:#?}
233
+ SealsDefinitionMismatch {
234
+ opid : Opid ,
235
+ reported : BTreeSet < AuthToken > ,
236
+ defined : BTreeSet < AuthToken > ,
237
+ sources : BTreeMap < u16 , String > ,
238
+ } ,
223
239
224
240
#[ from]
225
241
#[ display( inner) ]
0 commit comments