ethereum-optimism / mocktimism

[WIP!] Coordinates two anvil process (L1 and L2) for testing / forking op-stack chains (mocktimism placeholder name)
MIT License
20 stars 7 forks source link

Implement all anvil options #28

Closed roninjin10 closed 8 months ago

roninjin10 commented 10 months ago

Summary

Many of the mocktimism options are simply forwarding config to anvil. This ticket covers wiring this up from the cli/config to anvil

This does not include wiring up state dumps which is in a seperate issue #7

Tasks

Anvil options

A fast local Ethereum development node

Usage: anvil [OPTIONS] [COMMAND]

Commands:
  completions
          Generate shell completions script. [aliases: com]
  generate-fig-spec
          Generate Fig autocompletion spec. [aliases: fig]
  help
          Print this message or the help of the given subcommand(s)

Options:
  -h, --help
          Print help (see a summary with '-h')

  -V, --version
          Print version

Fork config:
      --compute-units-per-second <CUPS>
          Sets the number of assumed available compute units per second for this provider

          default value: 330

          See --fork-url. See also,
          https://github.com/alchemyplatform/alchemy-docs/blob/master/documentation/compute-units.md#rate-limits-cups

  -f, --fork-url <URL>
          Fetch state over a remote endpoint instead of starting from an empty state.

          If you want to fetch state from a specific block number, add a block number like
          `http://localhost:8545@1400000` or use the `--fork-block-number` argument.

          [aliases: rpc-url]

      --fork-block-number <BLOCK>
          Fetch state from a specific block number over a remote endpoint.

          See --fork-url.

      --fork-chain-id <CHAIN>
          Specify chain id to skip fetching it from remote endpoint. This enables offline-start
          mode.

          You still must pass both `--fork-url` and `--fork-block-number`, and already have your
          required state cached on disk, anything missing locally would be fetched from the remote.

      --fork-retry-backoff <BACKOFF>
          Initial retry backoff on encountering errors.

          See --fork-url.

      --no-rate-limit
          Disables rate limiting for this node's provider.

          default value: false

          See --fork-url. See also,
          https://github.com/alchemyplatform/alchemy-docs/blob/master/documentation/compute-units.md#rate-limits-cups

          [aliases: no-rpc-rate-limit]

      --no-storage-caching
          Explicitly disables the use of RPC caching.

          All storage slots are read entirely from the endpoint.

          This flag overrides the project's configuration file.

          See --fork-url.

      --retries <retries>
          Number of retry requests for spurious networks (timed out requests)

          Default value 5

      --timeout <timeout>
          Timeout in ms for requests sent to remote JSON-RPC server in forking mode.

          Default value 45000

Environment config:
      --block-base-fee-per-gas <FEE>
          The base fee in a block

          [aliases: base-fee]

      --chain-id <CHAIN_ID>
          The chain ID

      --code-size-limit <CODE_SIZE>
          EIP-170: Contract code size limit in bytes. Useful to increase this because of tests. By
          default, it is 0x6000 (~25kb)

      --disable-block-gas-limit
          Disable the `call.gas_limit <= block.gas_limit` constraint

      --gas-limit <GAS_LIMIT>
          The block gas limit

      --gas-price <GAS_PRICE>
          The gas price

EVM options:
  -a, --accounts <NUM>
          Number of dev accounts to generate and configure.

          [default: 10]

      --balance <NUM>
          The balance of every dev account in Ether.

          [default: 10000]

      --derivation-path <DERIVATION_PATH>
          Sets the derivation path of the child key to be derived. [default: m/44'/60'/0'/0/]

  -m, --mnemonic <MNEMONIC>
          BIP39 mnemonic phrase used for generating accounts

  -p, --port <NUM>
          Port number to listen on.

          [default: 8545]

      --steps-tracing
          Enable steps tracing used for debug calls returning geth-style traces

          [aliases: tracing]

      --timestamp <NUM>
          The timestamp of the genesis block

Server options:
      --allow-origin <ALLOW_ORIGIN>
          Set the CORS allow_origin

          [default: *]

  -b, --block-time <SECONDS>
          Block time in seconds for interval mining.

          [aliases: blockTime]

      --config-out <OUT_FILE>
          Writes output of `anvil` as json to user-specified file

      --dump-state <PATH>
          Dump the state of chain on exit to the given file. If the value is a directory, the state
          will be written to `<VALUE>/state.json`.

      --hardfork <HARDFORK>
          The EVM hardfork to use.

      --host <IP_ADDR>
          The host the server will listen on

          [env: ANVIL_IP_ADDR=]

      --init <PATH>
          Initialize the genesis block with the given `genesis.json` file.

      --ipc [<PATH>]
          Launch an ipc server at the given path or default path = `/tmp/anvil.ipc`

          [aliases: ipcpath]

      --load-state <PATH>
          Initialize the chain from a previously saved state snapshot.

      --no-cors
          Disable CORS

      --no-mining
          Disable auto and interval mining, and mine on demand instead.

          [aliases: no-mine]

      --order <ORDER>
          How transactions are sorted in the mempool

          [default: fees]

      --prune-history [<PRUNE_HISTORY>]
          Don't keep full chain history. If a number argument is specified, at most this number of
          states is kept in memory.

  -s, --state-interval <SECONDS>
          Interval in seconds at which the status is to be dumped to disk. See --state and
          --dump-state

      --silent
          Don't print anything on startup and don't print logs

      --state <PATH>
          This is an alias for bot --load-state and --dump-state. It initializes the chain with the
          state stored at the file, if it exists, and dumps the chain's state on exit

      --transaction-block-keeper <TRANSACTION_BLOCK_KEEPER>
          Number of blocks with transactions to keep in memory.