Skip to content

rpc command #462

@zeroXbrock

Description

@zeroXbrock

Is your feature request related to a problem? Please describe.

Sometimes we just want to spam an RPC method, not necessarily transactions.

Describe the solution you'd like

add a new command to the CLI: contender rpc

  • take three args: requests_per_second (optional; default 1), duration (optional; default 1), and a subcommand (the RPC method)
    • send these requests using the same core technique as Spammer but don't use the actual spammer -- it's purpose-built for transactions.
    • All we need is a scheduled loop.
  • enumerate all of these RPC methods in subcommands, so that we can use strongly-typed, serde'd inputs for the params of each method
    • a macro might be appropriate here

Each param in the JSON-RPC method call becomes a flag if optional, or a positional arg if not.

For example, the call to eth_sendTransaction only requires from, to, and input.

This call:

params: [
  {
    from: "0xb60e8dd61c5d32be8058bb8eb970870f07233155",
    to: "0xd46e8dd67c5d32be8058bb8eb970870f07244567",
    gas: "0x76c0", // 30400
    input:
      "0xd46e8dd67c5d32be8d46e8dd67c5d32be8058bb8eb970870f072445675058bb8eb970870f072445675",
  },
]

would be represented as follows:

# contender rpc <CONTENDER_ARGS...> eth_sendTransaction <FROM> <TO> <INPUT> [--gas | --gas-price | --value | --nonce]...
contender rpc --rps 100 -d 10 eth_sendTransaction \
0xb60e8dd61c5d32be8058bb8eb970870f07233155 # FROM \
0xd46e8dd67c5d32be8058bb8eb970870f07244567 # TO \
0xd46e8dd67c5d32be8d46e8dd67c5d32be8058bb8eb970870f072445675058bb8eb970870f072445675 #INPUT \
--gas 30400

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions