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

ApplicationLogs Plugin: do not replace invalid ApplicationLog's stackitem with Null #3303

Open
AnnaShaleva opened this issue Jun 7, 2024 · 2 comments
Labels
enhancement Type - Changes that may affect performance, usability or add new features to existing modules.

Comments

@AnnaShaleva
Copy link
Member

Summary or problem description
The original issue is described in #3299 (comment). If ApplicationLog has stackitem that fails to be serialized, it's replaced by the Null stackitem:

_snapshot.Put(key, BinarySerializer.Serialize(StackItem.Null, ExecutionEngineLimits.Default with { MaxItemSize = (uint)Settings.Default.MaxStackSize }));

It's not correct from the end-user POW since there's no way to distinguish the "good" original stackitem from the result of invalid seialization.

Do you have any solution you want to propose?
Use a special stackitem stub with InvalidT type which can't be produced by any means other than exception during serialisation. With this special type there's no doubts from the user side whether there was an exception during serialization or not. This approach is implemented in NeoGo, see https://github.com/nspcc-dev/neo-go/blob/cf4d4a2611209d8d085ccec6e1f1b8956006a577/pkg/vm/stackitem/serialization.go#L144.

Where in the software does this update applies to?

  • Plugins
@AnnaShaleva AnnaShaleva added the enhancement Type - Changes that may affect performance, usability or add new features to existing modules. label Jun 7, 2024
@dusmart
Copy link

dusmart commented Jun 7, 2024

I appreciate every effort that makes exception related message clear. Thanks.

@cschuchardt88
Copy link
Member

cschuchardt88 commented Jun 7, 2024

I think null stackitem is appropriate choice for something that error. Seeing how the state can't be saved or there is no state.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Type - Changes that may affect performance, usability or add new features to existing modules.
Projects
None yet
Development

No branches or pull requests

3 participants