-
Notifications
You must be signed in to change notification settings - Fork 16
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
[testsvc] Wrong SCORE Class in the Context callstack #2
Comments
Yes, I could reproduce the issue with the |
Another related issue I'd like to report that is related to the If the same SCORE is deployed twice, the Consequently, if I deploy two IRC2 contracts, |
I'm not sure what you're trying to do, but deploying two same IRC2 contracts is complex enough and beyond the |
I believe there's a bug about in the SCORE callstack in the Context class of
testsvc
.TLDR ; abstract classes mess up with the Context callstack, the caller is set to the abstract class instead of the implementation class.
Here's a test code I'm using :
When executing the following code, I got this error :
Stack trace:
The bug actually occurs when the IRC2Basic instance redirects the execution to the
tokenFallback
method to thepool
from itstransfer
method.When digging into the
call
method of theContext
class of the testsvc package, we can see that thecaller
variable returned by the stackWalker iscom.iconloop.score.token.irc2.IRC2Basic
instead of theUnderlyingToken
class I deployed.It makes sense because the caller is indeed IRC2Basic and not UnderlyingToken.
However, as IRC2Basic is an abstract class and not a SCORE implementation, the ServiceManager.call fails because it can't retrieve the SCORE from the IRC2Basic class:
Alternatively, if I copy the IRC2Basic implementation to my UnderlyingToken class directly (thus not relying on abstract IRC2Basic class at all), the test passes; beucase the caller is effectively "UnderlyingToken" and not IRC2Basic.
The code fails because testsvc should detect the parent class that implements the SCORE logic instead of using the inherited abstract class.
The text was updated successfully, but these errors were encountered: