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

RpcClient::simulate_bundle returns error #266

Closed
buffalu opened this issue Feb 28, 2023 · 0 comments · Fixed by #267
Closed

RpcClient::simulate_bundle returns error #266

buffalu opened this issue Feb 28, 2023 · 0 comments · Fixed by #267
Assignees

Comments

@buffalu
Copy link
Contributor

buffalu commented Feb 28, 2023

Problem

let bundle = VersionedBundle {
  transactions: vec![tx.clone()],
  };
 let sim = rpc_client.simulate_bundle(&bundle).await.unwrap();

returns the following error:

ClientError { request: Some(SimulateBundle), kind: RpcError(RpcResponseError { request_id: 1, code: -32602, message: "pre/post_execution_accounts_configs must be equal in length to the number of transactions", data: Empty }) }',

This is because simulate_bundle with no config fills out the default config as:

RpcSimulateBundleConfig {
                simulation_bank: Some(SimulationSlotConfig::Commitment(self.commitment())),
                ..RpcSimulateBundleConfig::default()
            }

and the validator runs the following check:

if !(config.pre_execution_accounts_configs.len()
                == rpc_bundle_request.encoded_transactions.len()
                && config.post_execution_accounts_configs.len()
                    == rpc_bundle_request.encoded_transactions.len())
            {
                return Err(Error::invalid_params(
                    "pre/post_execution_accounts_configs must be equal in length to the number of transactions",
                ));
            }

Proposed Solution

in simulate_bundle, we can have it fill out pre_execution_accounts_configs and post_execution_accounts_configs with vec![None; bundle.transactions.len()] or handle that better in setting the defaults when the simulate_bundle RPC call is made in the validator

@segfaultdoc segfaultdoc self-assigned this Feb 28, 2023
buffalu pushed a commit that referenced this issue Mar 25, 2024
…rts (backport of #266) (#369)

Cli stake-split: adjust transfer amount if recipient has lamports (#266)

* Remove incorrect check

* Move to closure

* Use match statement instead

* Adjust rent_exempt_reserve by existing balance

* Only transfer lamports if rent_exempt_reserve needs are greater than 0

* Rename variable for clarity

* Add minimum-delegation check

* Bump test split amount to meet arbitrary mock minimum-delegation amount

(cherry picked from commit dff99d0)

# Conflicts:
#	cli/src/stake.rs

Co-authored-by: Tyera <[email protected]>
buffalu pushed a commit that referenced this issue Jul 18, 2024
* Remove incorrect check

* Move to closure

* Use match statement instead

* Adjust rent_exempt_reserve by existing balance

* Only transfer lamports if rent_exempt_reserve needs are greater than 0

* Rename variable for clarity

* Add minimum-delegation check

* Bump test split amount to meet arbitrary mock minimum-delegation amount
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.

2 participants