Skip to content

Avoid rate limiting by optimizing rpc calls #32

@0xzrf

Description

@0xzrf

Description

The helper function create_accounts in tools-common/src/accounts_creator.rs:create_accounts() creates new accounts <= num_accounts argument provided to the function

The current functionality of the function is that it first gets rpc_client.get_latest_blockhash() on each loop and creates batches of transactions, and sending the txns to the rpc and then adding to the created_accounts vec

But design wise, it's not going to be able to avoid rate limit by the rpc based on the following observations:

  1. Each loop calls the rpc_client.get_latest_blockhash() function, which is fine, but blockhash are valid for 150 slots(which is ~60 sec), more then enough to create all the accounts even if it's called once.
  2. The create_transaction_batch function returns a Vec<Transactions>, each having a single system_program::create_account instruction. which are then sent to the send_transaction_batch function, which concurrently sends all the transactions(separately). imo, we can put up to 7 such instruction per transaction(adhering to 1232 bytes limit in a solana transaction). This will avoid rate limits presented by the rpc calls

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions