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

Handle nil arrays in autogenerated RPC wrappers #3768

Open
fyfyrchik opened this issue Dec 18, 2024 · 0 comments
Open

Handle nil arrays in autogenerated RPC wrappers #3768

fyfyrchik opened this issue Dec 18, 2024 · 0 comments
Labels
enhancement Improving existing functionality I3 Minimal impact S3 Minimally significant U3 Regular
Milestone

Comments

@fyfyrchik
Copy link
Contributor

fyfyrchik commented Dec 18, 2024

Is your feature request related to a problem? Please describe.

RPC binding generator doesn't expect nil when handling a slice

arr, ok := item.Value().([]stackitem.Item)

But, compiler emits NULL by default for slice fields in struct

case *types.Struct:

This is inconsistent and prevents me from using autogenerated named types.
The problem may also not be immediately obvious, as it is hard to guess when sth in contract is Null and when an empty array.

Describe the solution you'd like

Allow to have nils in struct slice fields parsed with FromStackItem().

Describe alternatives you've considered

  1. Have a configuration option (nullable slice) for this.
  2. Change compiler to respect the declared ABI (may be done separately).
@fyfyrchik fyfyrchik added feature Completely new functionality I2 Regular impact labels Dec 18, 2024
@roman-khimov roman-khimov added this to the v0.108.0 milestone Dec 18, 2024
@roman-khimov roman-khimov added I3 Minimal impact U3 Regular enhancement Improving existing functionality S3 Minimally significant and removed feature Completely new functionality I2 Regular impact labels Dec 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Improving existing functionality I3 Minimal impact S3 Minimally significant U3 Regular
Projects
None yet
Development

No branches or pull requests

2 participants