Skip to content
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

core: prohibit reentry to Notary withdraw #3357

Merged
merged 1 commit into from
Mar 19, 2024
Merged

core: prohibit reentry to Notary withdraw #3357

merged 1 commit into from
Mar 19, 2024

Conversation

AnnaShaleva
Copy link
Member

If we're withdrawing funds to contract that has onNEP17Payment method, then it may call Notary's withdraw one more time, but the account's state is not yet updated by this moment.

The problem is similar to neo-project/neo#2734.

@roman-khimov, if I'm not mistaken and the problem exists, then you'll be glad to see this fix. I'll create test for it.

@AnnaShaleva AnnaShaleva added the bug Something isn't working label Mar 15, 2024
@AnnaShaleva AnnaShaleva added this to the v0.106.0 milestone Mar 15, 2024
Copy link

codecov bot commented Mar 15, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 84.79%. Comparing base (bfc3aa6) to head (a6f52a7).

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #3357      +/-   ##
==========================================
+ Coverage   84.68%   84.79%   +0.11%     
==========================================
  Files         331      331              
  Lines       44935    44936       +1     
==========================================
+ Hits        38053    38105      +52     
+ Misses       5370     5318      -52     
- Partials     1512     1513       +1     

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

@roman-khimov
Copy link
Member

We don't filter accounts that deposit to notary, so even though usually we assume them to be simple single-signature accounts technically contracts can deposit some GAS and play this game. Yeah, this must be fixed.

If we're withdrawing funds to contract that has onNEP17Payment method,
then it may call Notary's withdraw one more time, but the account's
state is not yet updated by this moment.

The problem is similar to neo-project/neo#2734.

Signed-off-by: Anna Shaleva <[email protected]>
@AnnaShaleva
Copy link
Member Author

AnnaShaleva commented Mar 19, 2024

@roman-khimov, the problem is confirmed by test, it's ready to review&merge.

@roman-khimov roman-khimov merged commit da4e80e into master Mar 19, 2024
18 of 20 checks passed
@roman-khimov roman-khimov deleted the fix-notary branch March 19, 2024 19:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants