Native: properly activate native methods/events#4524
Merged
shargon merged 1 commit intoneo-project:master-n3from Apr 7, 2026
Merged
Native: properly activate native methods/events#4524shargon merged 1 commit intoneo-project:master-n3from
shargon merged 1 commit intoneo-project:master-n3from
Conversation
neo-project#4520 fixes false-positive activation in case if DeprecatedIn hardfork is passed. However, it's not enough for proper ActiveIn work because there's a case of false-positive activation in case if both DeprecatedIn and ActiveIn hardforks are not yet passed. This commit rewrites ActiveIn condition: the method/event IS active if and only if ActiveIn hardfork IS active AND DeprecatedIn hardfork IS NOT active. ActiveIn hardfork IS active if it's null OR it's already passed. DeprecatedIn hardfork IS NOT active if it's null OR it's not yet passed. Signed-off-by: Anna Shaleva <[email protected]>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master-n3 #4524 +/- ##
=============================================
+ Coverage 78.76% 78.84% +0.08%
=============================================
Files 236 236
Lines 16283 16278 -5
Branches 2361 2361
=============================================
+ Hits 12825 12835 +10
+ Misses 2708 2688 -20
- Partials 750 755 +5 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
AnnaShaleva
commented
Apr 7, 2026
Comment on lines
+79
to
+80
| Assert.IsFalse(NativeContract.IsActive(new active() { ActiveIn = Hardfork.HF_Basilisk, DeprecatedIn = Hardfork.HF_Cockatrice }, settings.IsHardforkEnabled, 9)); | ||
| Assert.IsTrue(NativeContract.IsActive(new active() { ActiveIn = Hardfork.HF_Basilisk, DeprecatedIn = Hardfork.HF_Cockatrice }, settings.IsHardforkEnabled, 10)); |
Member
Author
There was a problem hiding this comment.
Just for the record: this test is failing on the current master-n3. It passes with this fix.
Wi1l-B0t
approved these changes
Apr 7, 2026
ajara87
approved these changes
Apr 7, 2026
shargon
approved these changes
Apr 7, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
#4520 fixes false-positive activation in case if DeprecatedIn hardfork is passed. However, it's not enough for proper ActiveIn work because there's a case of false-positive activation in case if both DeprecatedIn and ActiveIn hardforks are not yet passed.
This commit rewrites ActiveIn condition: the method/event IS active if and only if ActiveIn hardfork IS active AND DeprecatedIn hardfork IS NOT active. ActiveIn hardfork IS active if it's null OR it's already passed. DeprecatedIn hardfork IS NOT active if it's null OR it's not yet passed.
For reference, here's the same condition (but in reversed form) in NeoGo:
https://github.com/nspcc-dev/neo-go/blob/60b8cd32a74d033e77b0fa9034f0fa3a999a34c1/pkg/core/interop/context.go#L332-L335
Change Log
Type of change
How Has This Been Tested?
Checklist: