v3.2.1 - Fix Array of Tuples Decoding Bug
Bug Fixes
- Fixed AbiDecoder component reuse bug when decoding arrays of tuples
- Each array element now correctly maintains its own decoded values
- Fixes duplicate key exception when calling ToDictionary() on decoded arrays of tuples
Changes
- Added CloneComponents() helper method to create independent component instances
- Updated DecodeStaticArray() to clone components for each array element
- Updated DecodeDynamicArray() to clone components for each array element
- Added test coverage for arrays of tuples decoding
Technical Details
Previously, when decoding arrays of tuples like ((address,uint256,bytes)[]), the decoder reused the same AbiParam component objects for all array elements. This caused all elements to share the same values (overwritten by the last decoded element) and could lead to duplicate key exceptions when accessing nested components.
The fix ensures each array element gets its own cloned component objects, maintaining correct decoded values for each element.