Skip to content

Conversation

@vict0rcarvalh0
Copy link
Contributor

@vict0rcarvalh0 vict0rcarvalh0 commented Oct 15, 2025

LiteSVM got merged to update set_account to remove 0 lamports accounts. So get_account_local and get_multiple_accounts_local were reverted to the previous implementation. Re-ran surfpool-core integration tests that validate reset behavior:

  • tests::integration::test_reset_account
  • tests::integration::test_reset_account_cascade

Both passed successfully.

LiteSVM reference: LiteSVM/litesvm#218

Fixes #332

@vict0rcarvalh0 vict0rcarvalh0 changed the title fix: treat zero-lamports accounts as deleted in SurfnetSvmLocker feat(core): revert get_account_local and get_multiple_accounts_local Oct 15, 2025
@vict0rcarvalh0 vict0rcarvalh0 changed the title feat(core): revert get_account_local and get_multiple_accounts_local feat(core): revert get_account_local and get_multiple_accounts_local https://github.com/txtx/surfpool/issues/332 Oct 15, 2025
@vict0rcarvalh0 vict0rcarvalh0 changed the title feat(core): revert get_account_local and get_multiple_accounts_local https://github.com/txtx/surfpool/issues/332 feat(core): revert get_account_local and get_multiple_accounts_local Oct 15, 2025
@vict0rcarvalh0 vict0rcarvalh0 marked this pull request as ready for review October 15, 2025 19:55
@BretasArthur1
Copy link
Contributor

BretasArthur1 commented Oct 15, 2025

Nice start @vict0rcarvalh0! You did a great job finding this patch...

Here some considerations

false,
),
Some(account) => {
if account.eq(&Account::default()) || account.lamports == 0 {
Copy link
Contributor

Choose a reason for hiding this comment

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

A default instance would look like:

lamports: 0

data: Vec::new()

owner: Pubkey::default() (all zeros)

executable: false

rent_epoch: 0

So checking it's redundant looking for both since looking for a Account::default(), already haves account.lamports == 0, and in the case where a account have lamports == 0 it means that the account does not exist. And after the fix of LiteSVM where accounts with 0 lamports are excluded from the accounts_db

You should be able to just

 Some(account) => GetAccountResult::FoundAccount(
                    *pubkey, account,
                    
                    false,
                ),

Because LiteSVM now handles the deleting of accounts with 0 lamports we should just try to find it and it will returns the account or false since it does not exists.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Makes sense Arthur! Just made a new commit refactoring that

false,
),
Some(account) => {
if account.eq(&Account::default()) || account.lamports == 0 {
Copy link
Contributor

Choose a reason for hiding this comment

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

Same as above here :)

@BretasArthur1
Copy link
Contributor

What do you think @MicaiahReid ?

Copy link
Member

@MicaiahReid MicaiahReid left a comment

Choose a reason for hiding this comment

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

Perfect, thanks @vict0rcarvalh0!

@BretasArthur1
Copy link
Contributor

LGTM

@lgalabru lgalabru merged commit 47a3da0 into txtx:main Oct 16, 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.

Revert get_account_local and get_multiple_accounts_local

4 participants