-
Notifications
You must be signed in to change notification settings - Fork 146
ReferenceCounter can become negative #447
Comments
Yes correct |
@erikzhang I can't say because the new code throws an exception at The TX now fails with a FAULT, where it previously succeeded. |
fwiw; the
|
I don't know. I don't think this is theoretically possible. What version of node are you using? |
When this happens, a |
@ixje Can you dump all the items in the |
I will send patch files for the neo-vm and neo projects once i get back near my machine. I think it is important that you can debug it yourself instead of me being a middle man. I tried a couple of node versions (3.2.1, 3.2.0) but they can’t sync up to the block due to #2673. So the latets i’ve used is 3.1.0. I can give exact commit hashes if you want
… On 9 May 2022, at 14:55, Erik Zhang ***@***.***> wrote:
@ixje Can you dump all the items in the EvaluationStack before the exception is thrown?
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you were mentioned.
|
patches.zip The above patches were made on
I didn't think it would be possible either, but here is a screenshot running the TX with
|
fwiw; branch |
NeoGo execution trace for this tx (opcode, parameter, reference counter before instruction processing):
|
Same thing with the stack contents (but slots are also actively used here, so stack alone probably isn't sufficient): https://gist.github.com/roman-khimov/31ab0daa131c98371d3b66754c209272 |
Not sure if neo-project/neo#2731 fixes this. But that fixed a similar bug. |
I applied those changes and it still fails. |
The way I see it is:
Native NEO is being called to
So the stack is technically absolutely empty. Then GAS contract kicks in an invokes
Or
It ends and then it's time for
With appropriate
Which I think is the way it should be, the array is pushed onto the empty stack, so we properly add all of its child elements to the counter. If C# node has a counter of 3 at this point then it's likely treating this array as already existing on the stack. |
@erikzhang it does not fail, but not sure if it is correct either. Previously the reference count between
now the reference counter in C# is 3 higher than |
Fixed in neo-project/neo#2732 |
TestNet block
805344
has 1 transaction that near the end of its execution will have aReferenceCounter
with a negative count. I don't think this should be possible. I have not looked further into the implications, but per definition it sounds wrong.To be more specific. The script ends with 3
RET
instructions. After executing the first of those 3RET
s the reference count will be-1
. If you'd add an instruction counter like sothen it will be
-1
after instruction237
.The text was updated successfully, but these errors were encountered: