73
73
}
74
74
75
75
if func. parameters . len ( ) != serialized_args. len ( ) {
76
- println ! (
77
- "************************** func.parameters.len() {:?} serialized_args.len() {:?}" ,
78
- func. parameters. len( ) ,
79
- serialized_args. len( )
80
- ) ;
81
76
return Err (
82
77
PartialVMError :: new ( StatusCode :: NUMBER_OF_ARGUMENTS_MISMATCH )
83
78
. with_message ( format ! (
@@ -189,9 +184,13 @@ where
189
184
Ok ( new_arg)
190
185
}
191
186
Bool | U8 | U16 | U32 | U64 | U128 | U256 | Address => Ok ( arg) ,
192
- Signer => Ok ( MoveValue :: Signer ( self . tx_context ( ) . sender )
187
+ Signer => MoveValue :: Signer ( self . tx_context ( ) . sender )
193
188
. simple_serialize ( )
194
- . expect ( " serialization tx_context().sender failed" ) ) ,
189
+ . ok_or_else ( || {
190
+ PartialVMError :: new ( StatusCode :: FAILED_TO_DESERIALIZE_ARGUMENT )
191
+ . with_message ( "failed to deserialize signer argument" . to_string ( ) )
192
+ . finish ( Location :: Undefined )
193
+ } ) ,
195
194
Reference ( ..) | MutableReference ( ..) => {
196
195
let initial_cursor_len = arg. len ( ) ;
197
196
let mut cursor = Cursor :: new ( & arg[ ..] ) ;
@@ -207,7 +206,7 @@ where
207
206
Ok ( new_arg)
208
207
}
209
208
TyParam ( _) => Err ( PartialVMError :: new ( StatusCode :: INVALID_SIGNATURE )
210
- . with_message ( "construct_arg invalid signature " . to_string ( ) )
209
+ . with_message ( "invalid type argument " . to_string ( ) )
211
210
. finish ( Location :: Undefined ) ) ,
212
211
}
213
212
}
@@ -224,19 +223,25 @@ where
224
223
use Type :: * ;
225
224
226
225
if is_signer ( ty) {
227
- let mut v = MoveValue :: Signer ( self . tx_context ( ) . sender )
228
- . simple_serialize ( )
229
- . expect ( "serialize tx_context().sender failed" ) ;
230
- arg. append ( & mut v) ;
231
- return Ok ( ( ) ) ;
226
+ return match MoveValue :: Signer ( self . tx_context ( ) . sender ) . simple_serialize ( ) {
227
+ Some ( mut val) => {
228
+ arg. append ( & mut val) ;
229
+ Ok ( ( ) )
230
+ }
231
+ None => Err (
232
+ PartialVMError :: new ( StatusCode :: FAILED_TO_DESERIALIZE_ARGUMENT )
233
+ . with_message ( "failed to deserialize signer argument" . to_string ( ) )
234
+ . finish ( Location :: Undefined ) ,
235
+ ) ,
236
+ } ;
232
237
}
233
238
234
239
if let Vector ( v) = ty {
235
240
let inner_type = v. deref ( ) ;
236
241
237
242
let mut len = get_len ( cursor) . map_err ( |_| {
238
243
PartialVMError :: new ( StatusCode :: FAILED_TO_DESERIALIZE_ARGUMENT )
239
- . with_message ( "get_len failed" . to_string ( ) )
244
+ . with_message ( "get length from vector data failed" . to_string ( ) )
240
245
. finish ( location. clone ( ) )
241
246
} ) ?;
242
247
@@ -257,7 +262,7 @@ where
257
262
if is_object ( & struct_arg_type) {
258
263
let mut len = get_len ( cursor) . map_err ( |_| {
259
264
PartialVMError :: new ( StatusCode :: FAILED_TO_DESERIALIZE_ARGUMENT )
260
- . with_message ( "get_len failed" . to_string ( ) )
265
+ . with_message ( "get length from vector data failed" . to_string ( ) )
261
266
. finish ( location. clone ( ) )
262
267
} ) ?;
263
268
@@ -355,7 +360,7 @@ where
355
360
let mut object_runtime = self . object_runtime . write ( ) ;
356
361
object_runtime
357
362
. load_object_argument ( object. id ( ) , ty, self )
358
- . expect ( "load_arguments_new failed" ) ;
363
+ . expect ( "load object argument from runtime failed" ) ;
359
364
}
360
365
Ok ( ( ) )
361
366
} else if self . read_only || is_allowed_argument_struct ( & struct_arg_type) {
0 commit comments