Skip to content

Commit

Permalink
📝 fix batcher intradoc links
Browse files Browse the repository at this point in the history
📝 batcher doc-links

indexer: Fix startup errors

- The block locator was being initialized with a zero hash, which caused `Update` return `nil` and crash the process.
- Adds an L2 conf depth parameter, since L2 can now reorg.

update changesets to latest version

op-node: Turn down log level of enode filtering

This was spamming ~12 log lines every 2 seconds, so I turned down the log level.

deletes old changeset patches

check-changed: Add additional patterns to force total rebuild

Adds a bunch of patterns that should trigger a rebuild of all dependencies. Mostly related to build stuff.

fix(bmon): Fix balance monitor name

Version Packages

indexer: changeset

Version Packages

creates indexer docker build cci configs

feat(ctb): commit prod Goerli config

Commits the production Goerli configuration for Bedrock.

Add vault recipients

Remove coinbase

feat(ctb): Goerli deployment artifacts

Commits deployment artifacts for Goerli

✨ typo fix

📝 update specs link for bedrock 🔨

fix: batcher doc line lengths

fix: batcher doc aliasing?

nit: remove doc link alias hyphen
  • Loading branch information
refcell committed Jan 13, 2023
1 parent e8c5eac commit 7f8b74d
Show file tree
Hide file tree
Showing 41 changed files with 9,543 additions and 449 deletions.
14 changes: 14 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1045,6 +1045,20 @@ workflows:
- oplabs-gcr
requires:
- op-heartbeat-docker-build
- docker-build:
name: indexer-docker-build
docker_file: indexer/Dockerfile
docker_name: indexer
docker_tags: <<pipeline.git.revision>>,<<pipeline.git.branch>>
docker_context: .
- docker-publish:
name: indexer-docker-publish
docker_name: indexer
docker_tags: <<pipeline.git.revision>>,<<pipeline.git.branch>>
context:
- oplabs-gcr
requires:
- indexer-docker-build
- hive-test:
name: hive-test-rpc
version: <<pipeline.git.revision>>
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ There are plenty of ways to contribute, in particular we appreciate support in t
- Fixing and responding to existing issues. You can start off with those tagged ["good first issue"](https://github.com/ethereum-optimism/optimism/contribute) which are meant as introductory issues for external contributors.
- Improving the [community site](https://community.optimism.io/), [documentation](https://github.com/ethereum-optimism/community-hub) and [tutorials](https://github.com/ethereum-optimism/optimism-tutorial).
- Become an "Optimizer" and answer questions in the [Optimism Discord](https://discord.optimism.io).
- Get involved in the protocol design process by proposing changes or new features or write parts of the spec yourself in the [optimistic-specs repo](https://github.com/ethereum-optimism/optimistic-specs).
- Get involved in the protocol design process by proposing changes or new features or write parts of the spec yourself in the [specs subdirectory](./specs/).

Note that we have a [Code of Conduct](https://github.com/ethereum-optimism/.github/blob/master/CODE_OF_CONDUCT.md), please follow it in all your interactions with the project.

Expand Down
12 changes: 12 additions & 0 deletions indexer/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
# @eth-optimism/indexer

## 0.7.0

### Minor Changes

- ed50bd5b4: Bump indexer

## 0.6.0

### Minor Changes

- ecf0cc59b: Fix startup issues, add L2 conf depth

## 0.5.0

### Minor Changes
Expand Down
13 changes: 9 additions & 4 deletions indexer/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,13 @@ type Config struct {
// L1StartBlockNumber is the block number to start indexing L1 from.
L1StartBlockNumber uint64

// ConfDepth is the number of confirmations after which headers are
// considered confirmed.
ConfDepth uint64
// L1ConfDepth is the number of confirmations after which headers are
// considered confirmed on L1.
L1ConfDepth uint64

// L2ConfDepth is the number of confirmations after which headers are
// considered confirmed on L2.
L2ConfDepth uint64

// MaxHeaderBatchSize is the maximum number of headers to request as a
// batch.
Expand Down Expand Up @@ -122,7 +126,8 @@ func NewConfig(ctx *cli.Context) (Config, error) {
LogLevel: ctx.GlobalString(flags.LogLevelFlag.Name),
LogTerminal: ctx.GlobalBool(flags.LogTerminalFlag.Name),
L1StartBlockNumber: ctx.GlobalUint64(flags.L1StartBlockNumberFlag.Name),
ConfDepth: ctx.GlobalUint64(flags.ConfDepthFlag.Name),
L1ConfDepth: ctx.GlobalUint64(flags.L1ConfDepthFlag.Name),
L2ConfDepth: ctx.GlobalUint64(flags.L2ConfDepthFlag.Name),
MaxHeaderBatchSize: ctx.GlobalUint64(flags.MaxHeaderBatchSizeFlag.Name),
MetricsServerEnable: ctx.GlobalBool(flags.MetricsServerEnableFlag.Name),
RESTHostname: ctx.GlobalString(flags.RESTHostnameFlag.Name),
Expand Down
17 changes: 12 additions & 5 deletions indexer/flags/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,11 +137,17 @@ var (
Value: 0,
EnvVar: prefixEnvVar("START_BLOCK_NUMBER"),
}
ConfDepthFlag = cli.Uint64Flag{
Name: "conf-depth",
Usage: "The number of confirmations after which headers are considered confirmed",
L1ConfDepthFlag = cli.Uint64Flag{
Name: "l1-conf-depth",
Usage: "The number of confirmations after which headers are considered confirmed on L1",
Value: 20,
EnvVar: prefixEnvVar("CONF_DEPTH"),
EnvVar: prefixEnvVar("L1_CONF_DEPTH"),
}
L2ConfDepthFlag = cli.Uint64Flag{
Name: "l2-conf-depth",
Usage: "The number of confirmations after which headers are considered confirmed on L1",
Value: 24,
EnvVar: prefixEnvVar("L2_CONF_DEPTH"),
}
MaxHeaderBatchSizeFlag = cli.Uint64Flag{
Name: "max-header-batch-size",
Expand Down Expand Up @@ -203,7 +209,8 @@ var optionalFlags = []cli.Flag{
SentryEnableFlag,
SentryDsnFlag,
SentryTraceRateFlag,
ConfDepthFlag,
L1ConfDepthFlag,
L2ConfDepthFlag,
MaxHeaderBatchSizeFlag,
L1StartBlockNumberFlag,
RESTHostnameFlag,
Expand Down
4 changes: 2 additions & 2 deletions indexer/indexer.go
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ func NewIndexer(cfg Config) (*Indexer, error) {
ChainID: new(big.Int).SetUint64(cfg.ChainID),
AddressManager: addrManager,
DB: db,
ConfDepth: cfg.ConfDepth,
ConfDepth: cfg.L1ConfDepth,
MaxHeaderBatchSize: cfg.MaxHeaderBatchSize,
StartBlockNumber: cfg.L1StartBlockNumber,
Bedrock: cfg.Bedrock,
Expand All @@ -179,7 +179,7 @@ func NewIndexer(cfg Config) (*Indexer, error) {
L2RPC: l2RPC,
L2Client: l2Client,
DB: db,
ConfDepth: cfg.ConfDepth,
ConfDepth: cfg.L2ConfDepth,
MaxHeaderBatchSize: cfg.MaxHeaderBatchSize,
StartBlockNumber: uint64(0),
Bedrock: cfg.Bedrock,
Expand Down
3 changes: 2 additions & 1 deletion indexer/integration_tests/bedrock_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,8 @@ func TestBedrockIndexer(t *testing.T) {
LogLevel: "info",
LogTerminal: true,
L1StartBlockNumber: 0,
ConfDepth: 1,
L1ConfDepth: 1,
L2ConfDepth: 1,
MaxHeaderBatchSize: 2,
RESTHostname: "127.0.0.1",
RESTPort: 7980,
Expand Down
2 changes: 1 addition & 1 deletion indexer/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@eth-optimism/indexer",
"version": "0.5.0",
"version": "0.7.0",
"private": true,
"license": "MIT"
}
56 changes: 35 additions & 21 deletions indexer/services/l1/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ type Service struct {
batchScanner *scc.StateCommitmentChainFilterer
latestHeader uint64
headerSelector *ConfirmedHeaderSelector
l1Client *ethclient.Client

metrics *metrics.Metrics
tokenCache map[common.Address]*db.Token
Expand Down Expand Up @@ -143,6 +144,7 @@ func NewService(cfg ServiceConfig) (*Service, error) {
ZeroAddress: db.ETHL1Token,
},
isBedrock: cfg.Bedrock,
l1Client: cfg.L1Client,
}
service.wg.Add(1)
return service, nil
Expand Down Expand Up @@ -202,16 +204,22 @@ func (s *Service) loop() {
}

func (s *Service) Update(newHeader *types.Header) error {
var lowest = db.BlockLocator{
Number: s.cfg.StartBlockNumber,
}
var lowest db.BlockLocator
highestConfirmed, err := s.cfg.DB.GetHighestL1Block()
if err != nil {
return err
}
if highestConfirmed != nil {
lowest = *highestConfirmed
if highestConfirmed == nil {
startHeader, err := s.l1Client.HeaderByNumber(s.ctx, new(big.Int).SetUint64(s.cfg.StartBlockNumber))
if err != nil {
return fmt.Errorf("error fetching header by number: %w", err)
}
highestConfirmed = &db.BlockLocator{
Number: s.cfg.StartBlockNumber,
Hash: startHeader.Hash(),
}
}
lowest = *highestConfirmed

headers, err := s.headerSelector.NewHead(s.ctx, lowest.Number, newHeader, s.cfg.RawL1Client)
if err != nil {
Expand Down Expand Up @@ -260,22 +268,28 @@ func (s *Service) Update(newHeader *types.Header) error {
bridgeDepositsCh <- deposits
}(bridgeImpl)
}
go func() {
provenWithdrawals, err := s.portal.GetProvenWithdrawalsByBlockRange(s.ctx, startHeight, endHeight)
if err != nil {
errCh <- err
return
}
provenWithdrawalsCh <- provenWithdrawals
}()
go func() {
finalizedWithdrawals, err := s.portal.GetFinalizedWithdrawalsByBlockRange(s.ctx, startHeight, endHeight)
if err != nil {
errCh <- err
return
}
finalizedWithdrawalsCh <- finalizedWithdrawals
}()

if s.isBedrock {
go func() {
provenWithdrawals, err := s.portal.GetProvenWithdrawalsByBlockRange(s.ctx, startHeight, endHeight)
if err != nil {
errCh <- err
return
}
provenWithdrawalsCh <- provenWithdrawals
}()
go func() {
finalizedWithdrawals, err := s.portal.GetFinalizedWithdrawalsByBlockRange(s.ctx, startHeight, endHeight)
if err != nil {
errCh <- err
return
}
finalizedWithdrawalsCh <- finalizedWithdrawals
}()
} else {
provenWithdrawalsCh <- make(bridge.ProvenWithdrawalsMap)
finalizedWithdrawalsCh <- make(bridge.FinalizedWithdrawalsMap)
}

var receives int
for {
Expand Down
6 changes: 3 additions & 3 deletions op-node/p2p/discovery.go
Original file line number Diff line number Diff line change
Expand Up @@ -216,17 +216,17 @@ func FilterEnodes(log log.Logger, cfg *rollup.Config) func(node *enode.Node) boo
err := node.Load(&dat)
// if the entry does not exist, or if it is invalid, then ignore the node
if err != nil {
log.Debug("discovered node record has no opstack info", "node", node.ID(), "err", err)
log.Trace("discovered node record has no opstack info", "node", node.ID(), "err", err)
return false
}
// check chain ID matches
if cfg.L2ChainID.Uint64() != dat.chainID {
log.Debug("discovered node record has no matching chain ID", "node", node.ID(), "got", dat.chainID, "expected", cfg.L2ChainID.Uint64())
log.Trace("discovered node record has no matching chain ID", "node", node.ID(), "got", dat.chainID, "expected", cfg.L2ChainID.Uint64())
return false
}
// check version matches
if dat.version != 0 {
log.Debug("discovered node record has no matching version", "node", node.ID(), "got", dat.version, "expected", 0)
log.Trace("discovered node record has no matching version", "node", node.ID(), "got", dat.version, "expected", 0)
return false
}
return true
Expand Down
10 changes: 9 additions & 1 deletion ops/check-changed/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,14 @@

from github import Github

REBUILD_ALL_PATTERNS = [
r'^\.circleci/\.*',
r'^\.github/\.*',
r'^package\.json',
r'^yarn\.lock',
r'ops/check-changed/.*'
]

WHITELISTED_BRANCHES = {
'master',
'develop'
Expand Down Expand Up @@ -42,7 +50,7 @@

def main():
patterns = sys.argv[1].split(',')
patterns.append(r'^\.circleci/\.*')
patterns = patterns + REBUILD_ALL_PATTERNS

fp = os.path.realpath(__file__)
monorepo_path = os.path.realpath(os.path.join(fp, '..', '..'))
Expand Down
28 changes: 14 additions & 14 deletions ops/docker/Dockerfile.packages
Original file line number Diff line number Diff line change
Expand Up @@ -6,25 +6,25 @@ FROM ethereumoptimism/foundry:latest as foundry
FROM node:16-alpine3.14 as base

RUN apk --no-cache add curl \
jq \
python3 \
ca-certificates \
git \
make \
gcc \
musl-dev \
linux-headers \
bash \
build-base \
gcompat
jq \
python3 \
ca-certificates \
git \
make \
gcc \
musl-dev \
linux-headers \
bash \
build-base \
gcompat

ENV GLIBC_KEY=https://alpine-pkgs.sgerrand.com/sgerrand.rsa.pub
ENV GLIBC_KEY_FILE=/etc/apk/keys/sgerrand.rsa.pub
ENV GLIBC_RELEASE=https://github.com/sgerrand/alpine-pkg-glibc/releases/download/2.35-r0/glibc-2.35-r0.apk

RUN wget -q -O ${GLIBC_KEY_FILE} ${GLIBC_KEY} \
&& wget -O glibc.apk ${GLIBC_RELEASE} \
&& apk add glibc.apk --force
&& wget -O glibc.apk ${GLIBC_RELEASE} \
&& apk add glibc.apk --force

COPY --from=foundry /usr/local/bin/forge /usr/local/bin/forge
COPY --from=foundry /usr/local/bin/cast /usr/local/bin/cast
Expand Down Expand Up @@ -108,6 +108,6 @@ FROM base as drippie-mon
WORKDIR /opt/optimism/packages/drippie-mon
ENTRYPOINT ["npm", "run", "start"]

FROM base as drippie-mon
FROM base as balance-monitor
WORKDIR /opt/optimism/packages/balance-monitor
ENTRYPOINT ["yarn", "run", "start:prod"]
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@
"typescript": "^4.9.3"
},
"dependencies": {
"@changesets/cli": "^2.16.0",
"@changesets/cli": "^2.26.0",
"@codechecks/client": "^0.1.11",
"@ethersproject/abstract-provider": "^5.7.0"
}
Expand Down
6 changes: 6 additions & 0 deletions packages/balance-monitor/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# @eth-optimism/balance-monitor

## 0.0.4

### Patch Changes

- 013bd456f: Fixed the name in Dockerfile.packages

## 0.0.3

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/balance-monitor/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@eth-optimism/balance-monitor",
"version": "0.0.3",
"version": "0.0.4",
"description": "[Optimism] Forta Agent that reports whether certain accounts have fallen below some balance",
"main": "dist/index",
"types": "dist/index",
Expand Down
Loading

0 comments on commit 7f8b74d

Please sign in to comment.