Skip to content

core: restrict the number of allowed SC notifications#3640

Merged
roman-khimov merged 1 commit intomasterfrom
fix-ntf
Mar 7, 2025
Merged

core: restrict the number of allowed SC notifications#3640
roman-khimov merged 1 commit intomasterfrom
fix-ntf

Conversation

@AnnaShaleva
Copy link
Member

@AnnaShaleva AnnaShaleva commented Oct 23, 2024

Close #3490.

@roman-khimov, what do you think? Another option is to cache size for every emitted notification and then check the overall notifications size every time we're going to emit one more notification, it also may be implemented.

I'll add more tests once we agree on solution.

Copy link
Member

@roman-khimov roman-khimov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works for me, but we need some broader discussion, maybe even neo-project/neo#3547

AnnaShaleva added a commit to neo-project/neo that referenced this pull request Oct 23, 2024
Fix the problem described in
nspcc-dev/neo-go#3490. Port the solution from
nspcc-dev/neo-go#3640.

MaxNotificationsCount constraint is chosen based on the Mainnet
statistics of the number of notifications per every transaction, ref.
nspcc-dev/neo-go#3490 (comment).

Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>
@AnnaShaleva
Copy link
Member Author

Ref. neo-project/neo#3548.

@AnnaShaleva AnnaShaleva added the blocked Can't be done because of something label Nov 1, 2024
NGDAdmin added a commit to neo-project/neo that referenced this pull request Mar 5, 2025
* add hardofork HF_Echidna

* Add entries to `Designation` event (#3397)

* Add entries to Designation event

* Change to HF_Echidna

* Add UT

* Add count

* [Neo Core StdLib] Add Base64url (#3453)

* add base64url

* active in

* update placehold hf height

* fix hf issue and move methods to proper place.

* fix test

* use identifymodel instead.

* add hardofork HF_Echidna

* Add entries to `Designation` event (#3397)

* Add entries to Designation event

* Change to HF_Echidna

* Add UT

* Add count

* [Neo Core StdLib] Add Base64url (#3453)

* add base64url

* active in

* update placehold hf height

* fix hf issue and move methods to proper place.

* fix test

* use identifymodel instead.

* SmartContract: restrict the number of allowed notifications

Fix the problem described in
nspcc-dev/neo-go#3490. Port the solution from
nspcc-dev/neo-go#3640.

MaxNotificationsCount constraint is chosen based on the Mainnet
statistics of the number of notifications per every transaction, ref.
nspcc-dev/neo-go#3490 (comment).

Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>

* SmartContract: fix format

Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>

* Update src/Neo/SmartContract/ApplicationEngine.Runtime.cs

* Avoid notification creation

* add hardofork HF_Echidna

* Add entries to `Designation` event (#3397)

* Add entries to Designation event

* Change to HF_Echidna

* Add UT

* Add count

* [Neo Core StdLib] Add Base64url (#3453)

* add base64url

* active in

* update placehold hf height

* fix hf issue and move methods to proper place.

* fix test

* use identifymodel instead.

* format

* Fixed typo

* Added back #3397

* fix format

* Update src/Neo/SmartContract/Native/RoleManagement.cs

* Neo.CLI: revert configuration changes

Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>

---------

Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>
Co-authored-by: Jimmy <jinghui@wayne.edu>
Co-authored-by: Shargon <shargon@gmail.com>
Co-authored-by: Christopher Schuchardt <cschuchardt88@gmail.com>
Co-authored-by: NGD Admin <154295625+NGDAdmin@users.noreply.github.com>
@AnnaShaleva AnnaShaleva force-pushed the fix-ntf branch 3 times, most recently from e4965cf to d3d1920 Compare March 6, 2025 14:10
@AnnaShaleva AnnaShaleva removed the blocked Can't be done because of something label Mar 6, 2025
@AnnaShaleva AnnaShaleva requested a review from roman-khimov March 6, 2025 14:10
// HFEchidna represents hard-fork introduced in #3554 (ported from
// https://github.com/neo-project/neo/pull/3454).
// https://github.com/neo-project/neo/pull/3454), #3640 (ported from
// https://github.com/neo-project/neo/pull/3548).
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will fix this list in a separate PR, we stil have some Echidna-related changes unmerged, so I'll review it anyway.

@codecov
Copy link

codecov bot commented Mar 6, 2025

Codecov Report

Attention: Patch coverage is 38.09524% with 39 lines in your changes missing coverage. Please review.

Project coverage is 82.74%. Comparing base (e63cbe7) to head (2c8bd05).
Report is 5 commits behind head on master.

Files with missing lines Patch % Lines
pkg/core/native/native_neo.go 25.00% 12 Missing and 6 partials ⚠️
pkg/core/native/management.go 40.00% 5 Missing and 4 partials ⚠️
pkg/core/native/oracle.go 25.00% 4 Missing and 2 partials ⚠️
pkg/core/interop/context.go 62.50% 2 Missing and 1 partial ⚠️
pkg/core/native/native_nep17.go 50.00% 2 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #3640      +/-   ##
==========================================
- Coverage   82.88%   82.74%   -0.14%     
==========================================
  Files         338      338              
  Lines       47448    47484      +36     
==========================================
- Hits        39326    39290      -36     
- Misses       6502     6563      +61     
- Partials     1620     1631      +11     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Close #3490.

Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>
@roman-khimov roman-khimov merged commit d411337 into master Mar 7, 2025
32 of 34 checks passed
@roman-khimov roman-khimov deleted the fix-ntf branch March 7, 2025 09:40
cschuchardt88 added a commit to cschuchardt88/neo that referenced this pull request Jun 8, 2025
…ect#3548)

* add hardofork HF_Echidna

* Add entries to `Designation` event (neo-project#3397)

* Add entries to Designation event

* Change to HF_Echidna

* Add UT

* Add count

* [Neo Core StdLib] Add Base64url (neo-project#3453)

* add base64url

* active in

* update placehold hf height

* fix hf issue and move methods to proper place.

* fix test

* use identifymodel instead.

* add hardofork HF_Echidna

* Add entries to `Designation` event (neo-project#3397)

* Add entries to Designation event

* Change to HF_Echidna

* Add UT

* Add count

* [Neo Core StdLib] Add Base64url (neo-project#3453)

* add base64url

* active in

* update placehold hf height

* fix hf issue and move methods to proper place.

* fix test

* use identifymodel instead.

* SmartContract: restrict the number of allowed notifications

Fix the problem described in
nspcc-dev/neo-go#3490. Port the solution from
nspcc-dev/neo-go#3640.

MaxNotificationsCount constraint is chosen based on the Mainnet
statistics of the number of notifications per every transaction, ref.
nspcc-dev/neo-go#3490 (comment).

Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>

* SmartContract: fix format

Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>

* Update src/Neo/SmartContract/ApplicationEngine.Runtime.cs

* Avoid notification creation

* add hardofork HF_Echidna

* Add entries to `Designation` event (neo-project#3397)

* Add entries to Designation event

* Change to HF_Echidna

* Add UT

* Add count

* [Neo Core StdLib] Add Base64url (neo-project#3453)

* add base64url

* active in

* update placehold hf height

* fix hf issue and move methods to proper place.

* fix test

* use identifymodel instead.

* format

* Fixed typo

* Added back neo-project#3397

* fix format

* Update src/Neo/SmartContract/Native/RoleManagement.cs

* Neo.CLI: revert configuration changes

Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>

---------

Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>
Co-authored-by: Jimmy <jinghui@wayne.edu>
Co-authored-by: Shargon <shargon@gmail.com>
Co-authored-by: Christopher Schuchardt <cschuchardt88@gmail.com>
Co-authored-by: NGD Admin <154295625+NGDAdmin@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Investigate System.Runtime.Notify refcounting

2 participants