aionnetwork / AVM

Enabling Java code to run in a blockchain environment
https://theoan.com/
MIT License
49 stars 25 forks source link

[CLOSED] Threshold the call depth and stack size limit #241

Closed aionbot closed 5 years ago

aionbot commented 5 years ago

Issue created by yulongaion (on Tuesday Sep 04, 2018 at 20:59 GMT)

aionbot commented 5 years ago

Comment by jeff-aion (on Friday Oct 05, 2018 at 18:27 GMT)

I suspect that this was meant to refer to a limit on recursive calls to BlockchainRuntime.call. Currently, we impose a stack depth limit within a call, but each new call to a DApp address starts counting for itself. This means that we may be able to reach a point where stack overflow occurs if the invocation can afford it, as there is no concrete limit.

Instead, we need to define a limit on the depth of these nested invocations. and fail in the cases where an attempt is made to overflow it. We probably want to come up with a new failure reason for this case.

aionbot commented 5 years ago

Comment by nancyaion (on Thursday Oct 18, 2018 at 21:20 GMT)

Verified with AvmImplTest testReentrantRecursiveNested that the depth value is set correctly.

aionbot commented 5 years ago

Comment by nancyaion (on Friday Oct 19, 2018 at 14:02 GMT)

Also verified that CallDepthLimitExceededException is thrown if I change the recursive internal call to 10 times in the AvmImplTest testReentrantRecursiveNested.