-
Notifications
You must be signed in to change notification settings - Fork 110
fix: correct airdrop tx pre/post balances using LiteSVM data #487
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
Hi @MicaiahReid , can you please review this and lmk if this approach is correct.. This PR depends on the LiteSVM change from #186 / #238 that added this function so that the method was unresolved until LiteSVM was bumped to a compatible version. Can you please guide me here on how should I proceed with the change. thanks : ) |
There's a PR open(#479) to update litesvm. Maybe building this PR off that branch would do the trick? |
|
I’ve rebased this PR on top of #479 so it picks up the LiteSVM upgrade there, and I’ve kept this PR scoped to just the airdrop transaction metadata fix. The branch now builds cleanly on top of that change. Would appreciate a review when you have a chance @MicaiahReid |
|
@ANISH-SR, I've pushed a fix to this - you were constructing the tx with an invalid signer (based on the pubkeys in the tx), so the airdrop failed. But since we have the signature and we're just reconstructing the tx, there's no need to have it signed in the first place. We'll merge this after #462 As a side note, it's a great practice to build and run your branches as a smoke test whenever you open a PR! This bug was easy to catch - it crashed surfpool right on startup! Thank you for the PR :) |
b2d9793 to
9dfbe62
Compare
Summary of Changes
This change fixes incorrect airdrop transaction metadata by leveraging LiteSVM’s newly exposed airdrop account pubkey.
Previously, Surfpool synthesized a hardcoded airdrop keypair & balance deltas when constructing airdrop transaction meta, because the real airdrop account used by LiteSVM was not accessible. This resulted in inaccurate pre + post Balances.
With LiteSVM now exposing the airdrop pubkey, Surfpool:
tl:dr,
Use svm.airdrop_pubkey() to fetch the airdrop account balance before and after the transaction, and use those values to populate preBalances and postBalances in the airdrop transaction metadata.
Resolves #229