Skip to content
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

get_program_accounts_with_config fails to deserialize when with_context is true #25869

Closed
mardragon opened this issue Jun 9, 2022 · 0 comments · Fixed by #28772
Closed

get_program_accounts_with_config fails to deserialize when with_context is true #25869

mardragon opened this issue Jun 9, 2022 · 0 comments · Fixed by #28772
Assignees

Comments

@mardragon
Copy link

Problem

solana-client::rpc_client::get_program_accounts_with_config is failing with ClientError { request: Some(GetProgramAccounts), kind: SerdeJson(Error("invalid type: map, expected a sequence", line: 0, column: 0)) } when with_context of RpcProgramAccountsConfig is set to Some(true) because of deserialization bug.

Example usage which fails:

let result = context.rpc_client.get_program_accounts_with_config(
    &context.program_id,
    RpcProgramAccountsConfig {
        filters: None,
        account_config: RpcAccountInfoConfig {
            encoding: Some(UiAccountEncoding::Base64),
            data_slice: None,
            commitment: Some(context.commitment),
            min_context_slot: None
        },
        with_context: Some(true)
    },
);

Tested on version: 1.10.24

Proposed Solution

As context of underlying RPC call is ignored in this method anyway I see following potential solutions:

  1. Fix implementation to handle deserialization correctly when RPC response contains context
  2. Ignore with_context value - override it to false
  3. Return more user friendly error = that this property of RpcProgramAccountsConfig is not supported in this method & state so in method documentation.
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 a pull request may close this issue.

3 participants