Skip to content

Conversation

@LucasSte
Copy link

Problem

We want to remove fn create from trait WritableAccount, since program-runtime has adopted an account interface that contains references and cannot be created with owned types like those of fn create's signature.

Following the discussion in anza-xyz/solana-sdk#456 (review), we will replace WritableAccount::create by AccountSharedData::create_from_existing_shared_data for AccountSharedData, and Account instances will be initialized directly since all its members are public.

Summary of Changes

  1. Replace WritableAccount::create by AccountSharedData::create_from_existing_shared_data for AccountSharedData.
  2. Initialize Account directly.

@mergify
Copy link

mergify bot commented Nov 25, 2025

If this PR represents a change to the public RPC API:

  1. Make sure it includes a complementary update to rpc-client/ (example)
  2. Open a follow-up PR to update the JavaScript client @solana/kit (example)

Thank you for keeping the RPC clients in sync with the server API @LucasSte.

@codecov-commenter
Copy link

Codecov Report

❌ Patch coverage is 95.10490% with 7 lines in your changes missing coverage. Please review.
✅ Project coverage is 82.6%. Comparing base (32ba627) to head (63efe12).
⚠️ Report is 16 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff            @@
##           master    #9279     +/-   ##
=========================================
- Coverage    82.6%    82.6%   -0.1%     
=========================================
  Files         890      890             
  Lines      320722   320797     +75     
=========================================
- Hits       265085   265064     -21     
- Misses      55637    55733     +96     
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@LucasSte LucasSte marked this pull request as ready for review November 25, 2025 17:40
@LucasSte LucasSte requested a review from a team as a code owner November 25, 2025 17:40
Copy link

@buffalojoec buffalojoec left a comment

Choose a reason for hiding this comment

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

Lgtm!

let decoded_account = encoded_account.to_account_shared_data().unwrap();
assert_eq!(decoded_account.data(), &vec![0; 1024]);
let decoded_account = encoded_account.decode::<AccountSharedData>().unwrap();
let decoded_account = encoded_account.to_account().unwrap();

Choose a reason for hiding this comment

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

It doesn't really matter, but these are flipped.

Copy link

@brooksprumo brooksprumo left a comment

Choose a reason for hiding this comment

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

:shipit:

@brooksprumo
Copy link

Reference back to related first PR: #8668

@LucasSte LucasSte added this pull request to the merge queue Nov 26, 2025
Merged via the queue into anza-xyz:master with commit 4890ca5 Nov 26, 2025
47 checks passed
@LucasSte LucasSte deleted the deprecate-create branch November 26, 2025 20:19
AvhiMaz pushed a commit to AvhiMaz/agave that referenced this pull request Nov 28, 2025
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.

5 participants