im exploring Audit contract in public NeoFS networks. I called list method of the Audit contract to analyze all stored results. As it turned out, there are no results in the contract, but I found out about this in an unexpected way
being a user, i like 1 the most, but this is a change that could break some code which also treats null as an error. 3 will prevent this, but there is a whole family of ArrayOf* functions, and generated code . 4 is the worst to me - unwrap package and generated RPC callers were conceived to avoid this
another challenge is to teach codegen what to do - fail or not on null
im exploring Audit contract in public NeoFS networks. I called
list
method of the Audit contract to analyze all stored results. As it turned out, there are no results in the contract, but I found out about this in an unexpected wayCurrent Behavior
Expected Behavior
no error and
number of results: 0
Possible Solution
i dug down to the result stack: there is 1 element of type
Null
. The error is originated by https://pkg.go.dev/github.com/nspcc-dev/neo-go@v0.106.2/pkg/rpcclient/unwrap#Arrayi see next alternatives:
unwrap.Array
to returnnil, nil
unwrap.Array
to returnErrNull
ArrayOrNull
being a user, i like 1 the most, but this is a change that could break some code which also treats null as an error. 3 will prevent this, but there is a whole family of
ArrayOf*
functions, and generated code . 4 is the worst to me -unwrap
package and generated RPC callers were conceived to avoid thisanother challenge is to teach codegen what to do - fail or not on null
Steps to Reproduce
Context
there are some other contracts and/or methods returning arrays, so same issue is likely related to them
Regression
no
Your Environment
P.S.
i'd add context to the error, who is not an array, of course you can guess, but you can also doubt it