Skip to content

Commit

Permalink
Merge branch 'develop' into dependabot/npm_and_yarn/tsup-7.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
mergify[bot] authored Aug 17, 2023
2 parents 08eba24 + a1f5a0a commit c3dbf77
Show file tree
Hide file tree
Showing 6 changed files with 135 additions and 240 deletions.
9 changes: 9 additions & 0 deletions indexer/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,15 @@

## 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

- install docker
Expand Down
19 changes: 11 additions & 8 deletions indexer/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ type Config struct {

// fetch this via onchain config from RPCsConfig and remove from config in future
type L1Contracts struct {
OptimismPortal common.Address
L2OutputOracle common.Address
L1CrossDomainMessenger common.Address
L1StandardBridge common.Address
L1ERC721Bridge common.Address
OptimismPortal common.Address `toml:"optimism-portal"`
L2OutputOracle common.Address `toml:"l2-output-oracle"`
L1CrossDomainMessenger common.Address `toml:"l1-cross-domain-messenger"`
L1StandardBridge common.Address `toml:"l1-standard-bridge"`
L1ERC721Bridge common.Address `toml:"l1-erc721-bridge"`

// Some more contracts -- ProxyAdmin, SystemConfig, etcc
// Ignore the auxiliary contracts?
Expand All @@ -52,9 +52,12 @@ func (c L1Contracts) ToSlice() []common.Address {
// ChainConfig configures of the chain being indexed
type ChainConfig struct {
// Configure known chains with the l2 chain id
Preset int
// Configure custom chains via providing the L1Contract addresses
L1Contracts L1Contracts
// NOTE - This currently performs no lookups to extract known L1 contracts by l2 chain id
Preset int
L1Contracts 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
Expand Down
7 changes: 6 additions & 1 deletion indexer/config/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,12 @@ func TestLoadConfig_WithoutPreset(t *testing.T) {

testData := `
[chain]
l1contracts = { OptimismPortal = "0x4205Fc579115071764c7423A4f12eDde41f106Ed", L2OutputOracle = "0x42097868233d1aa22e815a266982f2cf17685a27", L1CrossDomainMessenger = "0x420ce71c97B33Cc4729CF772ae268934F7ab5fA1", L1StandardBridge = "0x4209fc46f92E8a1c0deC1b1747d010903E884bE1", L1ERC721Bridge ="0x420749f83b81B301cAb5f48EB8516B986DAef23D" }
[chain.l1-contracts]
optimism-portal = "0x4205Fc579115071764c7423A4f12eDde41f106Ed"
l2-output-oracle = "0x42097868233d1aa22e815a266982f2cf17685a27"
l1-cross-domain-messenger = "0x420ce71c97B33Cc4729CF772ae268934F7ab5fA1"
l1-standard-bridge = "0x4209fc46f92E8a1c0deC1b1747d010903E884bE1"
l1-erc721-bridge = "0x420749f83b81B301cAb5f48EB8516B986DAef23D"
[rpcs]
l1-rpc = "https://l1.example.com"
Expand Down
1 change: 1 addition & 0 deletions indexer/indexer.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
[chain]
# OP Goerli
preset = 420

[rpcs]
l1-rpc = "${INDEXER_RPC_URL_L1}"
l2-rpc = "${INDEXER_RPC_URL_L2}"
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
"markdownlint-cli2": "0.4.0",
"mkdirp": "^1.0.4",
"mocha": "^10.2.0",
"nx": "16.6.0",
"nx": "16.7.1",
"nyc": "^15.1.0",
"patch-package": "^6.4.7",
"prettier": "^2.8.0",
Expand Down
Loading

0 comments on commit c3dbf77

Please sign in to comment.