HUB
Sign inSign up

ethereumoptimism/rollup-services

By ethereumoptimism

•Updated about 6 years ago

Services used within Optimistic Rollup to keep Ethereum and Optimistic Ethereum nodes in sync

Image
0

1.9K

ethereumoptimism/rollup-services repository overview

⁠Overview

Optimism⁠ is a Public Benefit Corporation dedicated to scaling Ethereum in a way that enshrines fair access to public goods. Optimism is focused on implementing a production-level Optimistic Rollup implementation that integrates with the Optimistic Virtual Machine (OVM) to scale arbitrary Solidity smart contracts.

To get involved, follow us on Twitter⁠, join our Discord⁠, and try out our OVM tutorial⁠!

⁠Image Details

rollup-services is the Optimism docker image that runs all services, other than the Optimistic Ethereum Node, that are required to run the Optimistic Rollup Sequencer. It can also be configured to run the subset of the services that are required to run an Optimistic Ethereum Verifier. Below are the different services that may be configured to run.

  • L1 Chain Data persister [Sequencer, Verifier] - Syncs the Ethereum chain, persisting information relevant to Optimistic Rollup in the configured postgres database for consumption by other services
  • L2 Chain Data persister [Sequencer, Verifier] - Syncs the Optimistic Ethereum node, storing L2 transaction data in the configured postgres database for consumption by other services
  • L2 Geth Submission Queuer [Sequencer, Verifier] - Queues batches of transactions parsed from the Optimistic Rollup Ethereum contracts' events for submission to the Optimistic Ethereum node. This keeps the L2 node in sync with Ethereum state changes that it is not aware of.
  • Queued L2 Geth Submitter [Sequencer, Verifier] - Submits batches of transactions that were queued by the L2 Geth Submission Queuer to the Optimistic Ethereum Geth node.
  • Fraud Detector [Sequencer, Verifier] - Compares the state that is claimed on Ethereum to result from processing Optimistic Ethereum transactions to the state that is computed by the L2 Optimistic Ethereum node, looking for any discrepancies. If the corresponding states do not exactly match, fraud has occurred and must be corrected. The Fraud Detector will alert that there has been fraud and invoke the Fraud Prover to prove and correct it.
  • Canonical Chain Batch Creator [Sequencer only] - Creates batches of transactions processed by the L2 Optimistic Ethereum node that are not yet part of the Canonical Transaction Chain so that they may be submitted to Ethereum to become part of the canonical chain.
  • Canonical Chain Batch Submitter [Sequencer only] - Submits rollup transaction batches created by the Canonical Chain Batch Creator to the Canonical Transaction Chain contract on Ethereum, monitoring the submission until it is final.
  • State Commitment Chain Batch Creator [Sequencer only] - Creates batches of state roots resulting from transactions processed by the L2 Optimistic Ethereum node that are not yet part of the State Commitment Chain so that they may be submitted to Ethereum to become part of the state commitment chain.
  • State Commitment Chain Batch Submitter [Sequencer only] - Submits rollup state root batches created by the State Commitment Chain Batch Creator to the State Commitment Chain contract on Ethereum, monitoring the submission until it is final.

⁠Dependencies

This image, whether configured as a Sequencer or a Verifier, requires the following:

  • Postgres - Must match the schema described in migrations in the rollup services repository⁠. For convenience, a postgres image with the required schema will be maintained here⁠
  • Optimistic Ethereum L2 Node - The L2 node that processes Optimistic Ethereum transactions to sequence / verify Optimistic Ethereum transactions. More information about this image is here⁠

⁠Configuration

All configuration of this image is handled through environment variables. Below is information on all relevant environment variables, grouped by service:

⁠Shared:

⁠General
  • LOG_NEW_LINES (optional) Set this to anything to log new lines instead of the string <\n> in log messages.
  • CLEAR_DATA_KEY (optional) If this value is changed from the last time this image was started, all service data stored on the filesystem will be purged.
  • STARTUP_WAIT_TIMEOUT (optional) The number of seconds to attempt to connect to L2 geth before failing (set to -1 if not to wait for L2 geth).
  • DEBUG (optional) The debug configuration⁠ for log statements. Common options are error*, info*, warn*, and debug*.
⁠Postgres connection:
  • POSTGRES_HOST (required) The host url / IP for the postgres DB to use.
  • POSTGRES_PORT (required) The port of the postgres DB. This will probably be 5432.
  • POSTGRES_USER (required) The username to use to connect to the postgres DB.
  • POSTGRES_PASSWORD (required) The password to use to connect to the postgres DB.
  • POSTGRES_DATABASE (required) The database to connect to. This will almost definitely be rollup.
  • POSTGRES_CONNECTION_POOL_SIZE (optional) The connection pool size for postgres (defaults to 20).
  • POSTGRES_USE_SSL (optional) Set to anything to indicate that SSL should be used in the connection.
⁠L1 Node (Ethereum)

Note: either L1_NODE_WEB3_URL or both L1_NODE_INFURA_NETWORK and L1_NODE_INFURA_PROJECT_ID must be configured

  • L1_NODE_WEB3_URL (optional) The url, including port, of the node used to connect to Ethereum.
  • L1_NODE_INFURA_NETWORK (optional) Used in conjunction with L1_NODE_INFURA_PROJECT_ID to use Infura to connect to Ethereum.
  • L1_NODE_INFURA_PROJECT_ID (optional) Used in conjunction with L1_NODE_INFURA_NETWORK to use Infura to connect to Ethereum.
  • FINALITY_DELAY_IN_BLOCKS (required) The number of block confirmations required to consider a transaction final on Ethereum.
⁠L2 Node
  • L2_NODE_WEB3_URL (required) The Optimistic Ethereum node url, including the port.
⁠L1 Batch Submitters
  • L1_SEQUENCER_PRIVATE_KEY(required) The private key to use to submit Sequencer Transaction Batches
  • L1_STATE_ROOT_SUBMITTER_PRIVATE_KEY (required) The private key to use to submit State Root Batches (will cause nonce issues if the same as the L1_SEQUENCER_PRIVATE_KEY key)
⁠Shared Contracts
  • CANONICAL_TRANSACTION_CHAIN_CONTRACT_ADDRESS (required) The address of the CanonicalTransactionChain contract on Ethereum (L1 node).
  • STATE_COMMITMENT_CHAIN_CONTRACT_ADDRESS (required) The address of the StateCommitmentChain contract on Ethereum (L1 node).
  • L1_TO_L2_TRANSACTION_QUEUE_CONTRACT_ADDRESS (required) The address of the L1ToL2TransactionQueue contract on Ethereum (L1 node).
  • SAFETY_TRANSACTION_QUEUE_CONTRACT_ADDRESS (required) The address of the SafetyTransactionQueue contract on Ethereum (L1 node).

⁠Individual Service Config

⁠L1 Chain Data Persister
  • L1_CHAIN_DATA_PERSISTER_DB_PATH (required) The filepath where to locate (or create) the L1 Chain Data Persister LevelDB database
  • L1_EARLIEST_BLOCK (required) The earliest block to sync on Ethereum (L1 Node) to start persisting data. This should be a block no later than the block in which the first Optimistic Rollup contract was deployed.
⁠L2 Chain Data Persister
  • L2_CHAIN_DATA_PERSISTER_DB_PATH (required) The filepath where to locate (or create) the L2 Chain Data Persister LevelDB database
⁠Geth Submission Queuer
  • IS_SEQUENCER_STACK (optional) Set to anything if this is queueing Geth submissions for a sequencer (and not just a verifier).
  • GETH_SUBMISSION_QUEUER_PERIOD_MILLIS (optional) The period in milliseconds at which the Geth Submission Queuer should attempt to queue an L2 Geth submission (defaults to 10,000).
⁠Queued Geth Submitter
  • SUBMIT_TO_L2_PRIVATE_KEY (required) The private key to use to sign batches to send to L2 Geth (deprecated). Must match the key configured in Geth.
  • QUEUED_GETH_SUBMITTER_PERIOD_MILLIS (optional) The period in milliseconds at which the Queued Geth Submitter should attempt to send L2 Geth submissions (defaults to 10,000)
⁠Canonical Transaction Chain Batch Creator
  • CANONICAL_CHAIN_BATCH_MIN_CALLDATA_BYTES (optional) The minimum number of rollup transaction calldata bytes required to build a rollup batch -- if there aren't enough bytes of calldata ready (from txs to rollup), a batch will not be created (defaults to 0).
  • CANONICAL_CHAIN_BATCH_MAX_CALLDATA_BYTES (optional) The maximum number of rollup transaction calldata bytes to be included in a rollup batch -- if there are more than this number of bytes of calldata ready (from txs to rollup), they will be split into multiple batches of at most this size (defaults to 125_000).
  • CANONICAL_CHAIN_BATCH_CREATOR_PERIOD_MILLIS (optional) The period in milliseconds at which the Canonical Chain Batch Creator should attempt to create Canonical Chain Batches (defaults to 10,000).
⁠Canonical Transaction Chain Batch Submitter
  • CANONICAL_CHAIN_BATCH_SUBMITTER_PERIOD_MILLIS (optional) The period in milliseconds at which the Canonical Chain Batch Creator should attempt to create Canonical Chain Batches (defaults to 10,000).
⁠State Commitment Chain Batch Creator
  • STATE_COMMITMENT_CHAIN_MIN_BATCH_SIZE (optional) The minimum state root batch size to build -- if fewer than this number of transaction state roots are ready, a batch will not be created (defaults to 10).
  • STATE_COMMITMENT_CHAIN_MAX_BATCH_SIZE (optional) The maximum state root batch size to build -- if more than this number of transaction state roots are ready, they will be split into multiple batches of at most this size (defaults to 100).
  • STATE_COMMITMENT_CHAIN_BATCH_CREATOR_PERIOD_MILLIS (optional) The period in milliseconds at which the State Commitment Chain Batch Creator should attempt to create StateCommitmentChain Batches (defaults to 10,000).
⁠State Commitment Chain Batch Submitter
  • STATE_COMMITMENT_CHAIN_BATCH_SUBMITTER_PERIOD_MILLIS (optional) The period in milliseconds at which the State Commitment Chain Batch Submitter should attempt to submit pending StateCommitmentChain Batches (defaults to 10,000).
⁠Fraud Detector
  • FRAUD_DETECTOR_PERIOD_MILLIS (optional) The period in milliseconds at which the Fraud Detector should run (defaults to 10,000).
  • REALERT_ON_UNRESOLVED_FRAUD_EVERY_N_FRAUD_DETECTOR_RUNS (optional) The number of runs after which a detected fraud, if still present, should re-alert (via error logs) (defaults to 10).

⁠Service Configuration

Set the following environment variables to any truthy value to configure the associated service to run:

  • RUN_L1_CHAIN_DATA_PERSISTER
  • RUN_L2_CHAIN_DATA_PERSISTER
  • RUN_GETH_SUBMISSION_QUEUER
  • RUN_QUEUED_GETH_SUBMITTER
  • RUN_CANONICAL_CHAIN_BATCH_CREATOR
  • RUN_CANONICAL_CHAIN_BATCH_SUBMITTER
  • RUN_STATE_COMMITMENT_CHAIN_BATCH_CREATOR
  • RUN_STATE_COMMITMENT_CHAIN_BATCH_SUBMITTER
  • RUN_FRAUD_DETECTOR
Tag summary
Recent tags
Content type
Image
Digest
Size
857.9 MB
Last updated
about 6 years ago
docker pull ethereumoptimism/rollup-services:latest