@@ -11,7 +11,7 @@ use crate::{
11
11
dynamic_typing:: DynamicallyTypedData ,
12
12
ensure,
13
13
inherents:: PARENT_INHERENT_IDENTIFIER ,
14
- types:: { DispatchResult , OutputRef , Transaction , UtxoError } ,
14
+ types:: { DispatchResult , OutputRef , RedemptionStrategy , Transaction , UtxoError } ,
15
15
utxo_set:: TransparentUtxoSet ,
16
16
verifier:: Verifier ,
17
17
EXTRINSIC_KEY , HEADER_KEY , LOG_TARGET ,
@@ -69,26 +69,34 @@ where
69
69
// This will be passed to the verifiers
70
70
let mut stripped = transaction. clone ( ) ;
71
71
for input in stripped. inputs . iter_mut ( ) {
72
- input. redeemer = Vec :: new ( ) ;
72
+ input. redeemer = Default :: default ( ) ;
73
73
}
74
74
let stripped_encoded = stripped. encode ( ) ;
75
75
76
76
// Check that the verifiers of all inputs are satisfied
77
77
// Keep a Vec of the input data for passing to the constraint checker
78
78
// Keep track of any missing inputs for use in the tagged transaction pool
79
79
let mut input_data = Vec :: new ( ) ;
80
+ let mut evicted_input_data = Vec :: new ( ) ;
80
81
let mut missing_inputs = Vec :: new ( ) ;
81
82
for input in transaction. inputs . iter ( ) {
82
83
if let Some ( input_utxo) = TransparentUtxoSet :: < V > :: peek_utxo ( & input. output_ref ) {
83
- let redeemer = V :: Redeemer :: decode ( & mut & input. redeemer [ ..] )
84
- . map_err ( |_| UtxoError :: VerifierError ) ?;
85
- ensure ! (
86
- input_utxo
87
- . verifier
88
- . verify( & stripped_encoded, Self :: block_height( ) , & redeemer) ,
89
- UtxoError :: VerifierError
90
- ) ;
91
- input_data. push ( input_utxo. payload ) ;
84
+ match input. redeemer {
85
+ RedemptionStrategy :: Redemption ( ref redeemer) => {
86
+ let redeemer = V :: Redeemer :: decode ( & mut & redeemer[ ..] )
87
+ . map_err ( |_| UtxoError :: VerifierError ) ?;
88
+ ensure ! (
89
+ input_utxo. verifier. verify(
90
+ & stripped_encoded,
91
+ Self :: block_height( ) ,
92
+ & redeemer
93
+ ) ,
94
+ UtxoError :: VerifierError
95
+ ) ;
96
+ input_data. push ( input_utxo. payload ) ;
97
+ }
98
+ RedemptionStrategy :: Eviction => evicted_input_data. push ( input_utxo. payload ) ,
99
+ }
92
100
} else {
93
101
missing_inputs. push ( input. output_ref . clone ( ) . encode ( ) ) ;
94
102
}
@@ -163,7 +171,7 @@ where
163
171
// Call the constraint checker
164
172
transaction
165
173
. checker
166
- . check ( & input_data, & peek_data, & output_data)
174
+ . check ( & input_data, & evicted_input_data , & peek_data, & output_data)
167
175
. map_err ( UtxoError :: ConstraintCheckerError ) ?;
168
176
169
177
// Return the valid transaction
@@ -671,7 +679,7 @@ mod tests {
671
679
. execute_with ( || {
672
680
let input = Input {
673
681
output_ref,
674
- redeemer : Vec :: new ( ) ,
682
+ redeemer : Default :: default ( ) ,
675
683
} ;
676
684
677
685
let tx = TestTransactionBuilder :: default ( )
@@ -737,7 +745,7 @@ mod tests {
737
745
let output_ref = mock_output_ref ( 0 , 0 ) ;
738
746
let input = Input {
739
747
output_ref : output_ref. clone ( ) ,
740
- redeemer : Vec :: new ( ) ,
748
+ redeemer : Default :: default ( ) ,
741
749
} ;
742
750
743
751
let tx = TestTransactionBuilder :: default ( )
@@ -783,7 +791,7 @@ mod tests {
783
791
. execute_with ( || {
784
792
let input = Input {
785
793
output_ref,
786
- redeemer : Vec :: new ( ) ,
794
+ redeemer : Default :: default ( ) ,
787
795
} ;
788
796
789
797
let tx = TestTransactionBuilder :: default ( )
@@ -831,7 +839,7 @@ mod tests {
831
839
. execute_with ( || {
832
840
let input = Input {
833
841
output_ref,
834
- redeemer : Vec :: new ( ) ,
842
+ redeemer : Default :: default ( ) ,
835
843
} ;
836
844
837
845
let tx = TestTransactionBuilder :: default ( )
@@ -901,7 +909,7 @@ mod tests {
901
909
let output_ref = mock_output_ref ( 0 , 0 ) ;
902
910
let input = Input {
903
911
output_ref : output_ref. clone ( ) ,
904
- redeemer : Vec :: new ( ) ,
912
+ redeemer : Default :: default ( ) ,
905
913
} ;
906
914
907
915
let tx = TestTransactionBuilder :: default ( )
@@ -939,7 +947,7 @@ mod tests {
939
947
. execute_with ( || {
940
948
let input = Input {
941
949
output_ref : output_ref. clone ( ) ,
942
- redeemer : Vec :: new ( ) ,
950
+ redeemer : Default :: default ( ) ,
943
951
} ;
944
952
945
953
let tx = TestTransactionBuilder :: default ( )
0 commit comments