Skip to content

fix(deterministic-account-id): allow account creation by transfers#15007

Merged
Trisfald merged 8 commits into
near:masterfrom
Trisfald:fix-deterministic-account-ids
Feb 5, 2026
Merged

fix(deterministic-account-id): allow account creation by transfers#15007
Trisfald merged 8 commits into
near:masterfrom
Trisfald:fix-deterministic-account-ids

Conversation

@Trisfald

@Trisfald Trisfald commented Feb 5, 2026

Copy link
Copy Markdown
Contributor
  • allows Deterministic AccountIds to be created by any incoming transfer unless it's a refund
  • fixes account_is_implicit() function, so that it returns true only if this type of implicit accounts is enabled
  • introduces dedicated ProtocolFeature since this change is a protocol upgrade

@Trisfald Trisfald requested review from darioush and pugachAG February 5, 2026 18:03
@Trisfald Trisfald requested a review from a team as a code owner February 5, 2026 18:03
@Trisfald Trisfald force-pushed the fix-deterministic-account-ids branch from 5588716 to 2804bb0 Compare February 5, 2026 18:08
Comment on lines +432 to +434
if !ProtocolFeature::FixDeterministicAccountIdCreation.enabled(PROTOCOL_VERSION) {
return;
}

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 guess this check is not needed since PROTOCOL_VERSION is compile constant.
Maybe we can merge the tests or change to assert! if relevant.

Comment thread runtime/runtime/src/lib.rs Outdated
Comment on lines +399 to +402
|| (ProtocolFeature::FixDeterministicAccountIdCreation
.enabled(apply_state.current_protocol_version)
&& apply_state.config.wasm_config.deterministic_account_ids
&& account_id.get_account_type() == AccountType::NearDeterministicAccount));

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.

nit: maybe we can have some named bool here.

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.

In that way, account_id.get_account_type() method will be called and string comparison will be made regardless of whether it was actually needed or not. To save CPU I would suggest calling a function when needed instead of computing it in advance.

Having that said, this tiny optimization would not make any difference given all the other inefficiencies in the current runtime implementation 😅

@darioush darioush 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, some optional suggestions (spice test can be marked disabled with the // TODO(spice-test): ... pattern like other cases.)

Comment on lines +407 to +409
if !ProtocolFeature::DeterministicAccountIds.enabled(version_before_fix) {
return;
}

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.

seems could be assert instead

@codecov

codecov Bot commented Feb 5, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 68.83%. Comparing base (31767e6) to head (94ae10a).

Additional details and impacted files
@@             Coverage Diff             @@
##           master   #15007       +/-   ##
===========================================
+ Coverage    1.30%   68.83%   +67.53%     
===========================================
  Files         726      920      +194     
  Lines      140751   201510    +60759     
  Branches   140751   201510    +60759     
===========================================
+ Hits         1835   138711   +136876     
+ Misses     138863    56830    -82033     
- Partials       53     5969     +5916     
Flag Coverage Δ
pytests-nightly 1.30% <0.00%> (-0.01%) ⬇️
unittests 68.45% <100.00%> (?)
unittests-nightly 68.42% <100.00%> (?)

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.

@pugachAG pugachAG changed the title fix: Deterministic AccountIds creation by transfers + protocol feature fix(deterministic-account-id): account creation by transfers + protocol feature Feb 5, 2026
@pugachAG pugachAG changed the title fix(deterministic-account-id): account creation by transfers + protocol feature fix(deterministic-account-id): allow account creation by transfers Feb 5, 2026

@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, please apply @darioush's suggestions before merging

@Trisfald Trisfald added this pull request to the merge queue Feb 5, 2026
Merged via the queue into near:master with commit 122ef2d Feb 5, 2026
26 checks passed
@Trisfald Trisfald deleted the fix-deterministic-account-ids branch February 5, 2026 21:41
jancionear added a commit to jancionear/nearcore that referenced this pull request Apr 10, 2026
@VanBarbascu VanBarbascu mentioned this pull request Apr 15, 2026
25 tasks
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.

4 participants