Commit 9a954c5d authored by Ethen Pociask's avatar Ethen Pociask

[indexer.docs] Updated Indexer Documentation & Code Comments

parent 77381fe0
...@@ -2,6 +2,15 @@ ...@@ -2,6 +2,15 @@
## Getting started ## Getting started
### Setup env
The `indexer.toml` stores a set of preset environmental variables that can be used to run the indexer with the exception of the network specific `l1-rpc` and `l2-rpc` variables. The `indexer.toml` file can be ran as a default config, otherwise a custom `.toml` config can provided via the `--config` flag when running the application. Additionally, L1 system contract addresses must provided for the specific OP Stack network actively being indexed. Currently the indexer has no way to infer L1 system config addresses provided a L2 chain ID or network enum.
### Testing
All tests can be ran by running `make test` from the `/indexer` directory. This will run all unit and e2e tests.
**NOTE:** Successfully running the E2E tests requires spinning up a local L1 geth node and pre-populating it with necessary bedrock genesis state. This can be done by calling `make devnet-allocs` from the root of the optimism monorepo before running the indexer tests. More information on this can be found in the [op-e2e README](../op-e2e/README.md).
### Run indexer vs goerli ### Run indexer vs goerli
- install docker - install docker
......
...@@ -23,8 +23,12 @@ type Config struct { ...@@ -23,8 +23,12 @@ type Config struct {
// ChainConfig configures of the chain being indexed // ChainConfig configures of the chain being indexed
type ChainConfig struct { type ChainConfig struct {
// Configure known chains with the l2 chain id // Configure known chains with the l2 chain id
// NOTE - This currently performs no lookups to extract known L1 contracts by l2 chain id
Preset int Preset int
L1Contracts processor.L1Contracts L1Contracts processor.L1Contracts `toml:"l1-contracts"`
// L1StartingHeight is the block height to start indexing from
// NOTE - This is currently unimplemented
L1StartingHeight int
} }
// RPCsConfig configures the RPC urls // RPCsConfig configures the RPC urls
......
[chain] [chain]
preset = 420 preset = 420
[chain.l1-contracts]
optimism-portal = ""
l2-output-oracle = ""
l1-cross-domain-messenger = ""
l1-standard-bridge = ""
l1-erc721-bridge = ""
[rpcs] [rpcs]
l1-rpc = "${INDEXER_RPC_URL_L1}" l1-rpc = "${INDEXER_RPC_URL_L1}"
l2-rpc = "${INDEXER_RPC_URL_L2}" l2-rpc = "${INDEXER_RPC_URL_L2}"
......
...@@ -23,14 +23,17 @@ import ( ...@@ -23,14 +23,17 @@ import (
"github.com/ethereum/go-ethereum/log" "github.com/ethereum/go-ethereum/log"
) )
// L1Contracts contains all L1 system contract addresses
// NOTE - There are no active validations to ensure that the
// addresses provided are not nil or duplicated
type L1Contracts struct { type L1Contracts struct {
OptimismPortal common.Address OptimismPortal common.Address `toml:"optimism-portal"`
L2OutputOracle common.Address L2OutputOracle common.Address `toml:"l2-output-oracle"`
L1CrossDomainMessenger common.Address L1CrossDomainMessenger common.Address `toml:"l1-cross-domain-messenger"`
L1StandardBridge common.Address L1StandardBridge common.Address `toml:"l1-standard-bridge"`
L1ERC721Bridge common.Address L1ERC721Bridge common.Address `toml:"l1-erc721-bridge"`
// Some more contracts -- ProxyAdmin, SystemConfig, etcc // Some more contracts -- ProxyAdmin, SystemConfig, etc
// Ignore the auxiliary contracts? // Ignore the auxiliary contracts?
// Legacy contracts? We'll add this in to index the legacy chain. // Legacy contracts? We'll add this in to index the legacy chain.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment