algorand / go-algorand-sdk

Algorand Golang SDK

Home Page:https://pkg.go.dev/github.com/algorand/go-algorand-sdk/v2

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

AtomicTransactionComposer fails to add an address (or byte[32]) argument

shaih opened this issue · comments

Subject of the issue

When trying to use AtomicTransactionComposer to prepare an application call with argument of type address or byte[32], it panics with error message panic: reflect: call of reflect.Value.IsNil on array Value when calling comp.AddMethodCall(mcp).

Your environment

WSL on Windows 10, Ubuntu 20.04

% algod -v
12885164034
3.4.2.stable [rel/stable] (commit #54c3c397)
go-algorand is licensed with AGPLv3.0
source code available at https://github.com/algorand/go-algorand

% goal node status
Last committed block: 18662936
Time since last block: 0.0s
Sync Time: 11594.5s
Last consensus protocol: https://github.com/algorandfoundation/specs/tree/bc36005dbd776e6d1eaf0c560619bb183215645c
Next consensus protocol: https://github.com/algorandfoundation/specs/tree/bc36005dbd776e6d1eaf0c560619bb183215645c
Round for next consensus protocol: 18662937
Next consensus protocol supported: true
Last Catchpoint:
Genesis ID: testnet-v1.0
Genesis hash: SGO1GKSzyE7IEPItTxCByw9x8FmnrCDexi9/cOUJOiI=

% uname -a
Linux X1Y-SHAI 4.19.104-microsoft-standard #1 SMP Wed Feb 19 06:37:35 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux

Steps to reproduce

See enclosed Go program (attached as a txt file)

Expected behaviour

Exits successfully

Actual behaviour

panic: reflect: call of reflect.Value.IsNil on array Value

goroutine 1 [running]:
reflect.Value.IsNil(...)
        /usr/lib/go-1.16/src/reflect/value.go:1086
github.com/algorand/go-algorand/data/abi.inferToSlice(0x75d3a0, 0xc0000c60e0, 0x30, 0x8, 0x30, 0xc000090780, 0xc0000aa410)
        /mnt/c/Users/shai/go/pkg/mod/github.com/algorand/go-algorand@v0.0.0-20211020145413-1e5603c2691d/data/abi/abi_encode.go:187 +0x43a
github.com/algorand/go-algorand/data/abi.encodeTuple(0x75d3a0, 0xc0000c60e0, 0xc0000fc000, 0x20, 0x20, 0x7bdd80, 0xc0000aa701, 0x100c0000aa660, 0x7f52cab42958, 0x4e8)
        /mnt/c/Users/shai/go/pkg/mod/github.com/algorand/go-algorand@v0.0.0-20211020145413-1e5603c2691d/data/abi/abi_encode.go:205 +0x6a
github.com/algorand/go-algorand/data/abi.Type.Encode(0x8, 0xc0000fc000, 0x20, 0x20, 0x2000000000, 0x75d3a0, 0xc0000c60e0, 0x0, 0x8, 0xc0000fc000, ...)
        /mnt/c/Users/shai/go/pkg/mod/github.com/algorand/go-algorand@v0.0.0-20211020145413-1e5603c2691d/data/abi/abi_encode.go:130 +0xcce
github.com/algorand/go-algorand/data/abi.Type.Encode(0x4, 0xc0000907b0, 0x1, 0x1, 0x2000000000, 0x75d3a0, 0xc0000c60e0, 0x0, 0x0, 0xc0000ab1d0, ...)
        /mnt/c/Users/shai/go/pkg/mod/github.com/algorand/go-algorand@v0.0.0-20211020145413-1e5603c2691d/data/abi/abi_encode.go:93 +0x836
github.com/algorand/go-algorand-sdk/future.(*AtomicTransactionComposer).AddMethodCall(0xc0000adca0, 0x9fbf1, 0xc000096430, 0x5, 0x0, 0x0, 0xc0000ec000, 0x1, 0x4, 0xc000096440, ...)
        /mnt/c/Users/shai/go/pkg/mod/github.com/algorand/go-algorand-sdk@v1.13.0/future/atomicTransactionComposer.go:344 +0xc85
main.main()
        /mnt/c/Users/shai/go/src/github.com/algorandfoundation/go-playground/main.go:52 +0x37d
exit status 2

main.go.txt

It seems like the same issue affects all fixed-size arrays, any argument of type someType[N] triggers this error

Thanks for reporting this, we're working on a fix now.