Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug-Fix: ABI encode infer to slice IsNil handler removal #3823

Merged
merged 3 commits into from
Mar 23, 2022

Conversation

ahangsu
Copy link
Contributor

@ahangsu ahangsu commented Mar 23, 2022

Description

On the input of array in golang to function inferToSlice, the previous implementation will try to infer IsNil from interface value, while this will cause panic.

Solution here is to remove following code snippet

	if reflectVal.IsNil() {
		if reflectVal.Kind() == reflect.Slice {
			return nil, nil
		}
		return nil, fmt.Errorf("cannot infer nil value for array kind interface")
	}

since on passing nil slice, we still want to return an empty (len == 0) slice of interface, rather than a nil slice, which will cause trouble in implementation.

This is a fix for algorand/go-algorand-sdk#302

@ahangsu ahangsu requested a review from jasonpaulos March 23, 2022 00:30
@ahangsu ahangsu changed the title ABI encode infer to slice IsNil handler removal Bug-Fix: ABI encode infer to slice IsNil handler removal Mar 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants