serviceability: test atomic user delete+create for the user-PDA migration - #4104
Closed
nikw9944 wants to merge 1 commit into
Closed
serviceability: test atomic user delete+create for the user-PDA migration#4104nikw9944 wants to merge 1 commit into
nikw9944 wants to merge 1 commit into
Conversation
…tion Packs DeleteUser and CreateUser into a single transaction, both at the same V2 (client_ip, user_type) PDA and across the V1 -> V2 addresses, to reproduce what the user-PDA migration does inside one instruction. Both sequences succeed and restore full state. The one failure found is Migrate onto a V2 address that is already occupied by a live user: the system program rejects the allocation with AccountAlreadyInUse (Custom(0)).
Contributor
Author
|
WT% is this??? |
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.
Reproduces the V1 → V2 user-PDA migration as a program test: close one User account and create another inside a single transaction.
get_user_pdaderives the User account from (client_ip, user_type), so a reconnect lands on the same address, andMigratemoves a legacy index-derived account onto its V2 address — both are close-then-create within one transaction.Summary
tests/user_delete_create_same_tx.rscovering DeleteUser + CreateUser packed into one transaction, at the same V2 PDA (reconnect) and across the V1 → V2 addresses (migration), plus a separate-transaction control.Migrateonto a V2 address already occupied by a live user fails with systemAccountAlreadyInUse(Custom(0)). Nothing prevents the duplicate — a Prepaid access pass does not enforce the per-category user cap, so a reconnect that provisions a V2 user while the legacy V1 account is still around leaves two live User accounts for the same (client_ip, user_type). Those users cannot be migrated until the duplicate is deleted.process_migratehas no check for an occupied target and surfaces only the raw system error.Tests only — no production code changed.
Testing Verification
cargo test -p doublezero-serviceability --test user_delete_create_same_tx— 4 tests pass.user_migration,user_tests,user_old_test,user_onchain_allocation_test,delete_user_dynamic_accesspass) — all green.Userstruct equality against the pre-delete snapshot, access-passconnection_count/status, and deviceusers_count/unicast_users_count/reference_count.cargo test-sbfin CI exercises the same tests under BPF, which is the remaining place a runtime-level difference could show up.