Skip to content

vm: reduce maximum stckitem size#3185

Merged
roman-khimov merged 1 commit intomasterfrom
fix-stackitem-limits
Nov 13, 2023
Merged

vm: reduce maximum stckitem size#3185
roman-khimov merged 1 commit intomasterfrom
fix-stackitem-limits

Conversation

@AnnaShaleva
Copy link
Member

To prevent possible DoS. Port the neo-project/neo-vm#514, close #3170.

Draft until some proximity to 0.104.0.

@codecov
Copy link

codecov bot commented Nov 2, 2023

Codecov Report

Merging #3185 (b8a72c8) into master (dbd647e) will decrease coverage by 0.07%.
The diff coverage is n/a.

❗ Current head b8a72c8 differs from pull request most recent head b0cdae4. Consider uploading reports for the commit b0cdae4 to get more accurate results

@@            Coverage Diff             @@
##           master    #3185      +/-   ##
==========================================
- Coverage   85.38%   85.31%   -0.07%     
==========================================
  Files         326      326              
  Lines       43785    43775      -10     
==========================================
- Hits        37384    37345      -39     
- Misses       4927     4959      +32     
+ Partials     1474     1471       -3     
Files Coverage Δ
pkg/vm/stackitem/item.go 89.69% <ø> (ø)

... and 9 files with indirect coverage changes

📣 Codecov offers a browser extension for seamless coverage viewing on GitHub. Try it in Chrome or Firefox today!

To prevent possible DoS. Port the neo-project/neo-vm#514,
close #3170.

Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>
@AnnaShaleva AnnaShaleva marked this pull request as ready for review November 13, 2023 17:40
@roman-khimov roman-khimov merged commit de2a445 into master Nov 13, 2023
@roman-khimov roman-khimov deleted the fix-stackitem-limits branch November 13, 2023 19:53
roman-khimov added a commit to nspcc-dev/neofs-node that referenced this pull request Sep 4, 2025
An attempt to list 2K+ containers ended up this way:

    error	handler/util.go:34	call method	{"status": 500, "request_id": "0cedec2b-935d-4575-a0c2-94ed4650c978", "method": "ListBuckets", "bucket": "", "object": "", "description": "something went wrong", "error": "list user containers via connection pool: status: code = 1024 message = json error: too big: size"}

We're trying to get 2K items from the iterator in a single call, each item is
base64 of CID, so it's 42 bytes, but then it's wrapped into VM type/value
struct like this:

    {"value":"","type":"ByteString"}

which adds another 32 bytes. For 2K elements this yields 144K JSON (not
including other data which is also present) which NeoGo refuses to return
given that the maximum size is 128K (nspcc-dev/neo-go#3185).
Fetching in smaller chunks should fix the problem (for other iterator-based
methods as well).

Signed-off-by: Roman Khimov <roman@nspcc.ru>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Reduce stackitem limits

2 participants