-
Notifications
You must be signed in to change notification settings - Fork 59
feat: Add surfnet_exportSnapshot RPC endpoint with slot tracking and IDL decoding #364
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
base: main
Are you sure you want to change the base?
Conversation
/// A cheat code to export all accounts as fixtures for testing. | ||
/// | ||
/// ## Parameters | ||
/// - `meta`: Metadata passed with the request, such as the client's request context. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Apologies, this param meta
being here is a copy-pasta in the first place, could you please get rid of it?
This docstring is meant to be documenting the RPC endpoint, not the rust method.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Love it, thank you @Shradhesh71 !
Some small feedback!
@lgalabru Pushed updates addressing all feedback |
Thanks @Shradhesh71 ! Could you run the command
on your machine? that should fix the CI! I just added this button in the studio, looking forward to get this new cheat code in the next release :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks so much for your contribution @Shradhesh71, the code looks good to me!
hey @Shradhesh71! I talked with @MicaiahReid and it looks like your approach could be missing something. If a transaction is updating the state of an account, it looks like the current approach would not capture that. |
yep, I’ll look into why transactions that update account state aren’t being captured, reproduce the case, and push a follow up here |
Changes
Flat Key/Value Dump with Slot Tracking
account_update_slots: HashMap<Pubkey, Slot>
field to SurfnetSvm to track when each account was last modified.set_account()
method to record the modification slot for each account update.export_accounts_as_fixtures()
method that exports all accounts as a flat map with slot information.AccountFixture
struct with the following fields:JsonParsed
encoding)RPC Method
surfnet_exportSnapshot
RPC method to SurfnetCheatcodes trait.encoding
parameter (defaults toBase64
).HashMap<String, AccountFixture>
with all accounts.Test Coverage
test_export_accounts_as_fixtures
— Basic export with Base64 encodingtest_export_accounts_as_fixtures_with_json_parsed
— Export with JsonParsed encoding for token accountstest_export_accounts_at_different_slots
— Verify slot tracking across multiple slot updates