Skip to content

fix(runtime): action_delete_account subtracts global id storage#15752

Merged
pugachAG merged 19 commits into
near:masterfrom
vaporif:action_delete_account-subtract-global-id-storage
May 21, 2026
Merged

fix(runtime): action_delete_account subtracts global id storage#15752
pugachAG merged 19 commits into
near:masterfrom
vaporif:action_delete_account-subtract-global-id-storage

Conversation

@vaporif

@vaporif vaporif commented May 18, 2026

Copy link
Copy Markdown
Contributor

Fixes #15431

The check gates whether a DeleteAccount succeeds, so the change is consensus-visible and is gated behind a new nightly protocol feature FixDeleteAccountGlobalContractStorageUsage (v154)

@vaporif vaporif requested a review from a team as a code owner May 18, 2026 17:01
@vaporif vaporif requested a review from Wiezzel May 18, 2026 17:01
@darioush darioush requested a review from pugachAG May 18, 2026 17:21

@Wiezzel Wiezzel left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks okay to me, but @pugachAG should probably take another look.

@pugachAG pugachAG left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

overall LGTM!

Comment thread core/primitives-core/src/version.rs Outdated
Comment thread runtime/runtime/src/actions.rs Outdated
Comment thread CHANGELOG.md Outdated
Comment thread runtime/runtime/src/actions_test_utils.rs Outdated
Comment thread runtime/runtime/src/actions.rs Outdated
Comment thread runtime/runtime/src/actions.rs Outdated
Comment thread runtime/runtime/src/actions.rs Outdated
Comment thread runtime/runtime/src/actions.rs Outdated
@vaporif vaporif requested a review from pugachAG May 19, 2026 18:40
Comment thread runtime/runtime/src/actions.rs Outdated
let account_storage_usage = if ProtocolFeature::FixDeleteAccountGlobalContractStorageUsage
.enabled(current_protocol_version)
{
clear_account_contract_storage_usage(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I've looked into this a bit more and found another issue: clear_account_contract_storage_usage modifies account internally and then on the error path we are going to leave it in a dirty state. This might not be an issues right now, but could be in the future. Could you please update the code here to avoid mutating the account? I suggest splitting out get_contract_storage_usage out of clear_account_contract_storage_usage and using the return value of that instead of account_mut.storage_usage()

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

fixed, added test covering this just in case

Comment thread runtime/runtime/src/actions_test_utils.rs Outdated
@codecov

codecov Bot commented May 20, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 97.39583% with 5 lines in your changes missing coverage. Please review.
✅ Project coverage is 69.84%. Comparing base (5efac0c) to head (2e09d18).

Files with missing lines Patch % Lines
runtime/runtime/src/actions.rs 97.05% 3 Missing and 2 partials ⚠️
Additional details and impacted files
@@           Coverage Diff            @@
##           master   #15752    +/-   ##
========================================
  Coverage   69.83%   69.84%            
========================================
  Files         940      940            
  Lines      199100   199236   +136     
  Branches   199100   199236   +136     
========================================
+ Hits       139038   139152   +114     
- Misses      55413    55433    +20     
- Partials     4649     4651     +2     
Flag Coverage Δ
pytests-nightly 1.13% <0.00%> (-0.01%) ⬇️
unittests 69.22% <97.39%> (+0.01%) ⬆️
unittests-nightly 69.50% <97.39%> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ 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.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@vaporif vaporif requested a review from pugachAG May 20, 2026 15:44

@pugachAG pugachAG left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM, thanks for your contribution to nearcore!
please address the last nit and then I will merge this

Comment thread core/primitives-core/src/version.rs
@vaporif

vaporif commented May 21, 2026

Copy link
Copy Markdown
Contributor Author

@pugachAG done

@pugachAG pugachAG enabled auto-merge May 21, 2026 20:31
@pugachAG pugachAG added this pull request to the merge queue May 21, 2026
Merged via the queue into near:master with commit c07bf90 May 21, 2026
32 checks passed
@vaporif vaporif deleted the action_delete_account-subtract-global-id-storage branch May 21, 2026 21:31
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.

action_delete_account doesn't subtract global contract identifier storage usage

3 participants