neo icon indicating copy to clipboard operation
neo copied to clipboard

[Neo VM Bug]Fix negative counter issue

Open Jim8y opened this issue 1 year ago • 7 comments

Description

This pr fixes the negative reference counter issue.

Fixes # https://github.com/neo-project/neo/pull/3301#discussion_r1631306729

Type of change

  • [ ] Optimization (the change is only an optimization)
  • [ ] Style (the change is only a code style for better maintenance or standard purpose)
  • [x] Bug fix (non-breaking change which fixes an issue)
  • [ ] New feature (non-breaking change which adds functionality)
  • [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • [ ] This change requires a documentation update

How Has This Been Tested?

  • [x] TestNegativeReferenceCounter

Test Configuration:

Checklist:

  • [x] My code follows the style guidelines of this project
  • [x] I have performed a self-review of my code
  • [x] I have commented my code, particularly in hard-to-understand areas
  • [ ] I have made corresponding changes to the documentation
  • [x] My changes generate no new warnings
  • [x] I have added tests that prove my fix is effective or that my feature works
  • [x] New and existing unit tests pass locally with my changes
  • [ ] Any dependent changes have been merged and published in downstream modules

Jim8y avatar Jun 07 '24 16:06 Jim8y

I prefer an exception instead of a denial of service, but this will be solved using memory instead of reference counter https://github.com/neo-project/neo-vm/issues/202

@shargon is a good point, should we catch this exception in vm and fault the execution?

Jim8y avatar Jun 08 '24 09:06 Jim8y

I prefer an exception instead of a denial of service, but this will be solved using memory instead of reference counter https://github.com/neo-project/neo-vm/issues/202

@shargon is a good point, should we catch this exception in vm and fault the execution?

With this patch it will fault, isn't it?

shargon avatar Jun 08 '24 10:06 shargon

I prefer an exception instead of a denial of service, but this will be solved using memory instead of reference counter neo-project/neo-vm#202

@shargon is a good point, should we catch this exception in vm and fault the execution?

With this patch it will fault, isn't it?

Surely it will, checked, its captured and faulted.

Jim8y avatar Jun 08 '24 10:06 Jim8y

I agree with @AnnaShaleva

We should fix the root of the problem, not the consequence of it. To me, it should be a denial of service in case of negative reference counter, not the FAULTed transaction.

vang1ong7ang avatar Jun 11 '24 06:06 vang1ong7ang

I agree with @AnnaShaleva

@vang1ong7ang, do you think we need to stop the node explicitly in case of negative reference counter?

AnnaShaleva avatar Jun 11 '24 06:06 AnnaShaleva

do you think we need to stop the node explicitly in case of negative reference counter?

OK, I see, Jimmy has created another PR for that.

AnnaShaleva avatar Jun 11 '24 06:06 AnnaShaleva

@vang1ong7ang, do you think we need to stop the node explicitly in case of negative reference counter?

@AnnaShaleva yes if it happens i suggest to killall

vang1ong7ang avatar Jun 12 '24 02:06 vang1ong7ang