Open AnnaShaleva opened 1 year ago
Interops are inlined and IIRC there is some special code to handle interop data types, but in general your example should work, so it's just a bug in pointer handling.
The workaround from https://github.com/nspcc-dev/neo-go/issues/3580#issuecomment-2341916070 doesn't really work, btw (nothing is copied, NULLs are left in the struct). Field-by-field assignments do work.
Is your feature request related to a problem? Please describe.
Suppose we have a structure declared in the contract:
And suppose we have the following method:
The result of compilation is invalid script:
The wrong line is the conversion of structure got after
std.Deserialize
toAny
(which is the pointer toUserKey
).Describe the solution you'd like
The desired result is to convert the structure got after
std.Deserialize
directly to theUserKey
structure if it's not nil. The case is that this code is very similar to the one that we have in our interop package: https://github.com/nspcc-dev/neo-go/blob/9a270ae30cb889ecbc346efc2efa1d1b6c408abd/pkg/interop/native/ledger/ledger.go#L42-L44 However, the interop API works fine.