@@ -13,10 +13,9 @@ use crate::{
13
13
} ;
14
14
use move_binary_format:: {
15
15
check_bounds:: BoundsChecker ,
16
- errors:: { Location , PartialVMError , VMResult } ,
16
+ errors:: { Location , VMResult } ,
17
17
file_format:: { CompiledModule , CompiledScript } ,
18
18
} ;
19
- use move_core_types:: { state:: VMState , vm_status:: StatusCode } ;
20
19
use std:: time:: Instant ;
21
20
22
21
pub const MAX_CONSTANT_VECTOR_LEN : u64 = 1024 * 1024 ;
@@ -88,37 +87,23 @@ pub fn verify_module_with_config_for_test(
88
87
}
89
88
90
89
pub fn verify_module_with_config ( config : & VerifierConfig , module : & CompiledModule ) -> VMResult < ( ) > {
91
- let prev_state = move_core_types:: state:: set_state ( VMState :: VERIFIER ) ;
92
- let result = std:: panic:: catch_unwind ( || {
93
- BoundsChecker :: verify_module ( module) . map_err ( |e| {
94
- // We can't point the error at the module, because if bounds-checking
95
- // failed, we cannot safely index into module's handle to itself.
96
- e. finish ( Location :: Undefined )
97
- } ) ?;
98
- LimitsVerifier :: verify_module ( config, module) ?;
99
- DuplicationChecker :: verify_module ( module) ?;
100
- SignatureChecker :: verify_module ( module) ?;
101
- InstructionConsistency :: verify_module ( module) ?;
102
- constants:: verify_module ( module) ?;
103
- friends:: verify_module ( module) ?;
104
- ability_field_requirements:: verify_module ( module) ?;
105
- RecursiveStructDefChecker :: verify_module ( module) ?;
106
- InstantiationLoopChecker :: verify_module ( module) ?;
107
- CodeUnitVerifier :: verify_module ( config, module) ?;
90
+ BoundsChecker :: verify_module ( module) . map_err ( |e| {
91
+ // We can't point the error at the module, because if bounds-checking
92
+ // failed, we cannot safely index into module's handle to itself.
93
+ e. finish ( Location :: Undefined )
94
+ } ) ?;
95
+ LimitsVerifier :: verify_module ( config, module) ?;
96
+ DuplicationChecker :: verify_module ( module) ?;
97
+ SignatureChecker :: verify_module ( module) ?;
98
+ InstructionConsistency :: verify_module ( module) ?;
99
+ constants:: verify_module ( module) ?;
100
+ friends:: verify_module ( module) ?;
101
+ ability_field_requirements:: verify_module ( module) ?;
102
+ RecursiveStructDefChecker :: verify_module ( module) ?;
103
+ InstantiationLoopChecker :: verify_module ( module) ?;
104
+ CodeUnitVerifier :: verify_module ( config, module) ?;
108
105
109
- // Add the failpoint injection to test the catch_unwind behavior.
110
- fail:: fail_point!( "verifier-failpoint-panic" ) ;
111
-
112
- script_signature:: verify_module ( module, no_additional_script_signature_checks)
113
- } )
114
- . unwrap_or_else ( |_| {
115
- Err (
116
- PartialVMError :: new ( StatusCode :: VERIFIER_INVARIANT_VIOLATION )
117
- . finish ( Location :: Undefined ) ,
118
- )
119
- } ) ;
120
- move_core_types:: state:: set_state ( prev_state) ;
121
- result
106
+ script_signature:: verify_module ( module, no_additional_script_signature_checks)
122
107
}
123
108
124
109
/// Helper for a "canonical" verification of a script.
@@ -136,26 +121,14 @@ pub fn verify_script(script: &CompiledScript) -> VMResult<()> {
136
121
}
137
122
138
123
pub fn verify_script_with_config ( config : & VerifierConfig , script : & CompiledScript ) -> VMResult < ( ) > {
139
- let prev_state = move_core_types:: state:: set_state ( VMState :: VERIFIER ) ;
140
- let result = std:: panic:: catch_unwind ( || {
141
- BoundsChecker :: verify_script ( script) . map_err ( |e| e. finish ( Location :: Script ) ) ?;
142
- LimitsVerifier :: verify_script ( config, script) ?;
143
- DuplicationChecker :: verify_script ( script) ?;
144
- SignatureChecker :: verify_script ( script) ?;
145
- InstructionConsistency :: verify_script ( script) ?;
146
- constants:: verify_script ( script) ?;
147
- CodeUnitVerifier :: verify_script ( config, script) ?;
148
- script_signature:: verify_script ( script, no_additional_script_signature_checks)
149
- } )
150
- . unwrap_or_else ( |_| {
151
- Err (
152
- PartialVMError :: new ( StatusCode :: VERIFIER_INVARIANT_VIOLATION )
153
- . finish ( Location :: Undefined ) ,
154
- )
155
- } ) ;
156
- move_core_types:: state:: set_state ( prev_state) ;
157
-
158
- result
124
+ BoundsChecker :: verify_script ( script) . map_err ( |e| e. finish ( Location :: Script ) ) ?;
125
+ LimitsVerifier :: verify_script ( config, script) ?;
126
+ DuplicationChecker :: verify_script ( script) ?;
127
+ SignatureChecker :: verify_script ( script) ?;
128
+ InstructionConsistency :: verify_script ( script) ?;
129
+ constants:: verify_script ( script) ?;
130
+ CodeUnitVerifier :: verify_script ( config, script) ?;
131
+ script_signature:: verify_script ( script, no_additional_script_signature_checks)
159
132
}
160
133
161
134
impl Default for VerifierConfig {
0 commit comments