@@ -235,13 +235,13 @@ def check_if_arguments_can_be_encoded(function_abi, args, kwargs):
235235 return False
236236
237237 try :
238- types , arguments = get_abi_inputs (function_abi , arguments )
238+ types , aligned_args = get_aligned_abi_inputs (function_abi , arguments )
239239 except TypeError :
240240 return False
241241
242242 return all (
243243 is_encodable (_type , arg )
244- for _type , arg in zip (types , arguments )
244+ for _type , arg in zip (types , aligned_args )
245245 )
246246
247247
@@ -332,13 +332,13 @@ def get_tuple_type_str_parts(s: str) -> Optional[Tuple[str, Optional[str]]]:
332332 return None
333333
334334
335- def _convert_abi_input (comp , arg ):
335+ def _convert_abi_input (arg_abi , arg ):
336336 """
337- Converts an argument ``arg`` corresponding to an ABI component ``comp ``
337+ Converts an argument ``arg`` corresponding to an ABI component ``arg_abi ``
338338 into a plain value (for non-tuple components) or a properly converted and
339339 ordered sequence (for tuple list components or tuple components).
340340 """
341- tuple_parts = get_tuple_type_str_parts (comp ['type' ])
341+ tuple_parts = get_tuple_type_str_parts (arg_abi ['type' ])
342342
343343 if tuple_parts is None :
344344 # Component is non-tuple. Just return value.
@@ -348,37 +348,37 @@ def _convert_abi_input(comp, arg):
348348 if tuple_dims is None :
349349 # Component is non-list tuple. Each sub component of tuple will be
350350 # applied to each element in `arg`.
351- sub_comps = comp ['components' ]
351+ sub_abis = arg_abi ['components' ]
352352 else :
353353 # Component is list tuple. A non-list version of this component will be
354354 # repeatedly applied to each element in `arg`.
355- new_comp = copy .copy (comp )
356- new_comp ['type' ] = tuple_prefix
355+ new_abi = copy .copy (arg_abi )
356+ new_abi ['type' ] = tuple_prefix
357357
358- sub_comps = itertools .repeat (new_comp )
358+ sub_abis = itertools .repeat (new_abi )
359359
360360 if isinstance (arg , abc .Mapping ):
361361 # Arg is mapping. Convert to properly ordered sequence.
362- arg = tuple (arg [c ['name' ]] for c in sub_comps )
362+ arg = tuple (arg [c ['name' ]] for c in sub_abis )
363363
364364 if not is_list_like (arg ):
365365 raise TypeError (
366366 'Expected non-string sequence for "{}" component type: got {}' .format (
367- comp ['type' ],
367+ arg_abi ['type' ],
368368 arg ,
369369 ),
370370 )
371371
372- return type (arg )(_convert_abi_input (c , a ) for c , a in zip (sub_comps , arg ))
372+ return type (arg )(_convert_abi_input (c , a ) for c , a in zip (sub_abis , arg ))
373373
374374
375- def get_abi_inputs (abi , args ):
375+ def get_aligned_abi_inputs (abi , args ):
376376 """
377- Takes a function ABI (``abi``) and a sequence or mapping of args
378- (``args``). Returns a list of canonical type names for the function's
379- inputs and a list of arguments in corresponding order . The args contained
380- in ``args`` may contain nested mappings or sequences corresponding to
381- tuple-encoded values in ``abi``.
377+ Takes a function ABI (``abi``) and a sequence or mapping of args (``args``).
378+ Returns a list of type strings for the function's inputs and a list of
379+ arguments which have been aligned to the layout of those types . The args
380+ contained in ``args`` may contain nested mappings or sequences corresponding
381+ to tuple-encoded values in ``abi``.
382382 """
383383 inputs = abi .get ('inputs' , [])
384384
0 commit comments