Skip to content

Commit

Permalink
Merge branch 'develop' into fix/deploy-cleanup-docs
Browse files Browse the repository at this point in the history
  • Loading branch information
mergify[bot] authored Aug 16, 2023
2 parents 2c0122b + 75904fc commit e0b2396
Show file tree
Hide file tree
Showing 20 changed files with 488 additions and 4,127 deletions.
5 changes: 5 additions & 0 deletions .changeset/quick-poets-heal.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@eth-optimism/core-utils': patch
---

Upgraded npm dependencies to latest
5 changes: 5 additions & 0 deletions .changeset/tall-shirts-wonder.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@eth-optimism/chain-mon': patch
---

Upgraded npm dependencies to latest
98 changes: 31 additions & 67 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -115,20 +115,23 @@ jobs:
name: Restore PNPM Package Cache
keys:
- pnpm-packages-v2-{{ checksum "pnpm-lock.yaml" }}
- run:
name: Install dependencies
command: pnpm install --frozen-lockfile
# Fetch node_modules into the pnpm store
# This will cache node_modules based on pnpm-lock so other steps can instantly install them with `pnpm install --prefer-offline`
# --prefer-offline installs node_modules instantly by just reading from cache if it exists rather than fetching from network
# when installing node_modules pnpm simply adds symlinks instead of copying the files which is why it is pretty much instant to run --prefer-offline
# this allows a caching strategy of only checking pnpm-lockfile so we don't have to keep it in sync with our packages
# For more information see https://pnpm.io/cli/fetch
- run:
name: Fetch dependencies
command: pnpm fetch --frozen-lockfile --prefer-offline
- save_cache:
name: Save PNPM Package Cache
key: pnpm-packages-v2-{{ checksum "pnpm-lock.yaml" }}
paths:
- "node_modules"
- "packages/chain-mon/node_modules"
- "packages/common-ts/node_modules"
- "packages/contracts-bedrock/node_modules"
- "packages/core-utils/node_modules"
- "packages/sdk/node_modules"
- "packages/contracts-ts/node_modules"
- run:
name: Install dependencies
command: pnpm install --frozen-lockfile --offline
- run:
name: print forge version
command: forge --version
Expand Down Expand Up @@ -469,58 +472,17 @@ jobs:
name: Restore PNPM Package Cache
keys:
- pnpm-packages-v2-{{ checksum "pnpm-lock.yaml" }}
# populate node modules from the cache
- run:
name: Install dependencies
command: pnpm install --frozen-lockfile --prefer-offline
- check-changed:
patterns: contracts-bedrock
- run:
name: validate spacers
command: pnpm validate-spacers
working_directory: packages/contracts-bedrock

bedrock-echidna-build:
docker:
- image: us-docker.pkg.dev/oplabs-tools-artifacts/images/ci-builder:latest
steps:
- checkout
- attach_workspace: { at: "." }
- check-changed:
patterns: contracts-bedrock
- run:
name: Compile with metadata hash
command: pnpm clean && pnpm build:with-metadata
working_directory: packages/contracts-bedrock
- persist_to_workspace:
root: .
paths:
- "node_modules"
- packages/contracts-bedrock

bedrock-echidna-run:
docker:
- image: us-docker.pkg.dev/oplabs-tools-artifacts/images/ci-builder:latest
parameters:
echidna_target:
description: Which echidna fuzz contract to run
type: string
size:
description: Custom resource class size for the run
type: string
default: large
resource_class: <<parameters.size>>
steps:
- checkout
- attach_workspace: { at: "." }
- restore_cache:
name: Restore PNPM Package Cache
keys:
- pnpm-packages-v2-{{ checksum "pnpm-lock.yaml" }}
- check-changed:
patterns: contracts-bedrock
- run:
name: Echidna Fuzz <<parameters.echidna_target>>
command: pnpm echidna:<<parameters.echidna_target>>
working_directory: packages/contracts-bedrock
no_output_timeout: 15m

op-bindings-build:
docker:
- image: us-docker.pkg.dev/oplabs-tools-artifacts/images/ci-builder:latest
Expand Down Expand Up @@ -556,6 +518,10 @@ jobs:
- pnpm-packages-v2-{{ checksum "pnpm-lock.yaml" }}
- check-changed:
patterns: <<parameters.package_name>>,<<parameters.dependencies>>
# populate node modules from the cache
- run:
name: Install dependencies
command: pnpm install --frozen-lockfile --prefer-offline
- run:
name: Lint
command: pnpm lint && git diff --exit-code
Expand All @@ -581,6 +547,10 @@ jobs:
- pnpm-packages-v2-{{ checksum "pnpm.lock.yaml" }}
- check-changed:
patterns: sdk,contracts-bedrock,contracts
# populate node modules from the cache
- run:
name: Install dependencies
command: pnpm install --frozen-lockfile --prefer-offline
- run:
name: Check generated and build
command: pnpm generate:check
Expand All @@ -599,6 +569,10 @@ jobs:
- pnpm-packages-v2-{{ checksum "pnpm.lock.yaml" }}
- check-changed:
patterns: sdk,contracts-bedrock,contracts
# populate node modules from the cache
- run:
name: Install dependencies
command: pnpm install --frozen-lockfile --prefer-offline
- run:
name: anvil-l1
background: true
Expand Down Expand Up @@ -643,22 +617,13 @@ jobs:
- checkout
- check-changed:
patterns: specs/(.*)\.md$
# TODO remove me after ci builder updated
- run:
name: Install pnpm package manager
command: |
npm i pnpm --global
# TODO remove me after ci builder updated
# A github dep clones-with-immutable-args is installed via github
# packages installed via npm via github automatically run postpack scripts
# their postpack script happens to use yarn so we need it here
- run:
name: Install yarn package manager
command: |
npm i yarn@1 --global
- run:
name: pnpm dev deps
command: pnpm install
command: pnpm install --frozen-lockfile --prefer-offline
- run:
name: specs toc
command: pnpm lint:specs:toc && git diff --exit-code ./specs
Expand All @@ -671,15 +636,14 @@ jobs:
image: ubuntu-2204:2022.07.1
steps:
- checkout
# TODO remove me after ci builder updated
- run:
name: Install pnpm package manager
command: |
npm i pnpm --global
- run:
name: Install node_modules
command: |
pnpm install
pnpm install --frozen-lockfile --prefer-offline
- run:
name: Lint check
command: |
Expand Down Expand Up @@ -981,7 +945,7 @@ jobs:
- run:
name: Install and build
command: |
pnpm install && pnpm build
pnpm install --frozen-lockfile --prefer-offline && pnpm build
- run:
name: generate cannon prestate
command: make cannon-prestate
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/tag-service.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ jobs:
steps:
- uses: actions/checkout@v2
- name: Fetch tags
run: git fetch --tags origin
run: git fetch --tags origin --force
- name: Setup Python 3.10
uses: actions/setup-python@v4
with:
Expand Down
1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ require (
github.com/ethereum/go-ethereum v1.12.0
github.com/fsnotify/fsnotify v1.6.0
github.com/go-chi/chi/v5 v5.0.10
github.com/go-chi/docgen v1.2.0
github.com/golang/snappy v0.0.5-0.20220116011046-fa5810519dcb
github.com/google/go-cmp v0.5.9
github.com/google/gofuzz v1.2.1-0.20220503160820-4a35382e8fc8
Expand Down
4 changes: 4 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -192,8 +192,12 @@ github.com/gin-gonic/gin v1.8.1 h1:4+fr/el88TOO3ewCmQr8cx/CtZ/umlIRIs5M4NTNjf8=
github.com/gliderlabs/ssh v0.1.1/go.mod h1:U7qILu1NlMHj9FlMhZLlkCdDnU1DBEAqr0aevW3Awn0=
github.com/go-check/check v0.0.0-20180628173108-788fd7840127/go.mod h1:9ES+weclKsC9YodN5RgxqK/VD9HM9JsCSh7rNhMZE98=
github.com/go-chi/chi/v5 v5.0.0/go.mod h1:BBug9lr0cqtdAhsu6R4AAdvufI0/XBzAQSsUqJpoZOs=
github.com/go-chi/chi/v5 v5.0.1/go.mod h1:DslCQbL2OYiznFReuXYUmQ2hGd1aDpCnlMNITLSKoi8=
github.com/go-chi/chi/v5 v5.0.10 h1:rLz5avzKpjqxrYwXNfmjkrYYXOyLJd37pz53UFHC6vk=
github.com/go-chi/chi/v5 v5.0.10/go.mod h1:DslCQbL2OYiznFReuXYUmQ2hGd1aDpCnlMNITLSKoi8=
github.com/go-chi/docgen v1.2.0 h1:da0Nq2PKU9W9pSOTUfVrKI1vIgTGpauo9cfh4Iwivek=
github.com/go-chi/docgen v1.2.0/go.mod h1:G9W0G551cs2BFMSn/cnGwX+JBHEloAgo17MBhyrnhPI=
github.com/go-chi/render v1.0.1/go.mod h1:pq4Rr7HbnsdaeHagklXub+p6Wd16Af5l9koip1OvJns=
github.com/go-errors/errors v1.0.1/go.mod h1:f4zRHt4oKfwPJE5k8C9vpYG+aDHdBFUsgrm6/TyX73Q=
github.com/go-errors/errors v1.4.2 h1:J6MZopCL4uSllY1OfXM374weqZFFItUbrImctkmUxIA=
github.com/go-kit/log v0.1.0/go.mod h1:zbhenjAZHb184qTLMA9ZjW7ThYL0H2mk7Q6pNt4vbaY=
Expand Down
2 changes: 1 addition & 1 deletion indexer/api/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ func NewApi(bv database.BridgeTransfersView, logger log.Logger) *Api {

r := chi.NewRouter()

h := routes.NewRoutes(logger, bv)
h := routes.NewRoutes(logger, bv, r)

api := &Api{Router: r}

Expand Down
22 changes: 22 additions & 0 deletions indexer/api/routes/docs.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package routes

import (
"net/http"

"github.com/go-chi/docgen"
)

func (h Routes) DocsHandler(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Content-Type", "text/plain")
w.WriteHeader(http.StatusOK)
docs := docgen.MarkdownRoutesDoc(h.Router, docgen.MarkdownOpts{
ProjectPath: "github.com/ethereum-optimism/optimism/indexer",
// Intro text included at the top of the generated markdown file.
Intro: "Generated documentation for Optimism indexer",
})
_, err := w.Write([]byte(docs))
if err != nil {
h.Logger.Error("error writing docs", "err", err)
http.Error(w, "Internal server error fetching docs", http.StatusInternalServerError)
}
}
5 changes: 4 additions & 1 deletion indexer/api/routes/routes.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,19 @@ package routes
import (
"github.com/ethereum-optimism/optimism/indexer/database"
"github.com/ethereum/go-ethereum/log"
"github.com/go-chi/chi/v5"
)

type Routes struct {
Logger log.Logger
BridgeTransfersView database.BridgeTransfersView
Router *chi.Mux
}

func NewRoutes(logger log.Logger, bv database.BridgeTransfersView) Routes {
func NewRoutes(logger log.Logger, bv database.BridgeTransfersView, r *chi.Mux) Routes {
return Routes{
Logger: logger,
BridgeTransfersView: bv,
Router: r,
}
}
8 changes: 1 addition & 7 deletions indexer/cli/cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,7 @@ type Cli struct {
}

func runIndexer(ctx *cli.Context) error {
logger := log.NewLogger(log.CLIConfig{
Level: "warn",
Color: false,
Format: "terminal",
})
logger := log.NewLogger(log.ReadCLIConfig(ctx))

configPath := ctx.String(ConfigFlag.Name)
cfg, err := config.LoadConfig(logger, configPath)
Expand All @@ -38,8 +34,6 @@ func runIndexer(ctx *cli.Context) error {
return err
}

logger = log.NewLogger(cfg.Logger)

db, err := database.NewDB(cfg.DB)

if err != nil {
Expand Down
3 changes: 0 additions & 3 deletions indexer/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ import (
"reflect"

"github.com/BurntSushi/toml"

"github.com/ethereum-optimism/optimism/op-service/log"
"github.com/ethereum/go-ethereum/common"
geth_log "github.com/ethereum/go-ethereum/log"
"github.com/joho/godotenv"
Expand All @@ -22,7 +20,6 @@ type Config struct {
DB DBConfig
API APIConfig
Metrics MetricsConfig
Logger log.CLIConfig
}

// fetch this via onchain config from RPCsConfig and remove from config in future
Expand Down
2 changes: 1 addition & 1 deletion indexer/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ services:
gateway-frontend:
command: pnpm nx start @gateway/frontend --host 0.0.0.0 --port 5173
# Change tag to `latest` after https://github.com/ethereum-optimism/gateway/pull/2541 merges
image: ethereumoptimism/gateway-frontend:0687c408e4f85cbe81acf7a197e861df8c7282df
image: ethereumoptimism/gateway-frontend:latest
ports:
- 5173:5173
healthcheck:
Expand Down
4 changes: 0 additions & 4 deletions indexer/e2e_tests/setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import (

op_e2e "github.com/ethereum-optimism/optimism/op-e2e"
"github.com/ethereum-optimism/optimism/op-node/testlog"
op_log "github.com/ethereum-optimism/optimism/op-service/log"
"github.com/ethereum/go-ethereum/ethclient"
"github.com/ethereum/go-ethereum/log"

Expand Down Expand Up @@ -60,9 +59,6 @@ func createE2ETestSuite(t *testing.T) E2ETestSuite {
// Indexer Configuration and Start
indexerCfg := config.Config{

Logger: op_log.CLIConfig{
Level: "warn",
},
DB: config.DBConfig{
Host: "127.0.0.1",
Port: 5432,
Expand Down
8 changes: 0 additions & 8 deletions indexer/indexer.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,3 @@ port = 8080
host = "127.0.0.1"
port = 7300

[logger]
# Log level: trace, debug, info, warn, error, crit. Capitals are accepted too.
level = "info"
# Color the log output. Defaults to true if terminal is detected.
color = true
# Format the log output. Supported formats: 'text', 'terminal', 'logfmt', 'json', 'json-pretty'
format = "terminal"

14 changes: 7 additions & 7 deletions packages/chain-mon/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,21 +38,21 @@
"url": "https://github.com/ethereum-optimism/optimism.git"
},
"dependencies": {
"@eth-optimism/common-ts": "0.8.3",
"@eth-optimism/contracts-bedrock": "0.16.0",
"@eth-optimism/common-ts": "workspace:*",
"@eth-optimism/contracts-bedrock": "workspace:*",
"@eth-optimism/contracts-periphery": "1.0.8",
"@eth-optimism/core-utils": "0.12.2",
"@eth-optimism/sdk": "3.1.0",
"@eth-optimism/core-utils": "workspace:*",
"@eth-optimism/sdk": "workspace:*",
"@types/dateformat": "^5.0.0",
"chai-as-promised": "^7.1.1",
"dateformat": "^4.5.1",
"dotenv": "^16.1.4",
"ethers": "^5.7.0"
"dotenv": "^16.3.1",
"ethers": "^5.7.2"
},
"devDependencies": {
"@ethersproject/abstract-provider": "^5.7.0",
"@nomiclabs/hardhat-ethers": "^2.0.6",
"@nomiclabs/hardhat-waffle": "^2.0.3",
"@nomiclabs/hardhat-waffle": "^2.0.6",
"hardhat": "^2.9.6",
"ts-node": "^10.9.1",
"tsx": "^3.12.7"
Expand Down
3 changes: 2 additions & 1 deletion packages/chain-mon/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"outDir": "./dist"
"outDir": "./dist",
"skipLibCheck": true
},
"include": [
"package.json",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,5 +52,7 @@
"l2GenesisRegolithTimeOffset": "0x0",

"eip1559Denominator": 50,
"eip1559Elasticity": 10
"eip1559Elasticity": 10,

"systemConfigStartBlock": 0
}
Loading

0 comments on commit e0b2396

Please sign in to comment.