Skip to content

Commit

Permalink
Merge branch 'develop' into inphi/chan-in-metrics
Browse files Browse the repository at this point in the history
  • Loading branch information
mergify[bot] authored Apr 7, 2023
2 parents 16c0815 + 3be8b48 commit 06bea64
Show file tree
Hide file tree
Showing 40 changed files with 253 additions and 88 deletions.
5 changes: 0 additions & 5 deletions .changeset/clever-jokes-notice.md

This file was deleted.

5 changes: 0 additions & 5 deletions .changeset/cuddly-turkeys-burn.md

This file was deleted.

5 changes: 0 additions & 5 deletions .changeset/fresh-pots-move.md

This file was deleted.

5 changes: 0 additions & 5 deletions .changeset/good-clocks-relax.md

This file was deleted.

5 changes: 0 additions & 5 deletions .changeset/ninety-schools-work.md

This file was deleted.

5 changes: 0 additions & 5 deletions .changeset/olive-students-love.md

This file was deleted.

5 changes: 0 additions & 5 deletions .changeset/pink-chicken-hear.md

This file was deleted.

5 changes: 0 additions & 5 deletions .changeset/poor-carrots-walk.md

This file was deleted.

6 changes: 0 additions & 6 deletions .changeset/sharp-islands-attend.md

This file was deleted.

9 changes: 0 additions & 9 deletions .changeset/tricky-donkeys-lick.md

This file was deleted.

8 changes: 8 additions & 0 deletions batch-submitter/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# @eth-optimism/batch-submitter-service

## 0.1.16

### Patch Changes

- 32bd79ec9: Allow deposit only batches
- da79ef441: fix flag name for MaxStateRootElements in batch-submitter
fix log package for proposer

## 0.1.15

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion batch-submitter/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@eth-optimism/batch-submitter-service",
"version": "0.1.15",
"version": "0.1.16",
"private": true,
"devDependencies": {}
}
4 changes: 2 additions & 2 deletions integration-tests/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@
"devDependencies": {
"@babel/eslint-parser": "^7.5.4",
"@eth-optimism/contracts": "^0.5.40",
"@eth-optimism/contracts-bedrock": "0.13.1",
"@eth-optimism/contracts-bedrock": "0.13.2",
"@eth-optimism/contracts-periphery": "^1.0.7",
"@eth-optimism/core-utils": "0.12.0",
"@eth-optimism/sdk": "2.0.1",
"@eth-optimism/sdk": "2.0.2",
"@ethersproject/abstract-provider": "^5.7.0",
"@ethersproject/providers": "^5.7.0",
"@ethersproject/transactions": "^5.7.0",
Expand Down
2 changes: 1 addition & 1 deletion op-bindings/bindings/optimismportal.go

Large diffs are not rendered by default.

23 changes: 21 additions & 2 deletions op-program/cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,14 @@ import (
"context"
"errors"
"fmt"
"io"
"os"
"time"

"github.com/ethereum-optimism/optimism/op-node/chaincfg"
"github.com/ethereum-optimism/optimism/op-node/rollup/derive"
"github.com/ethereum-optimism/optimism/op-program/config"
"github.com/ethereum-optimism/optimism/op-program/driver"
"github.com/ethereum-optimism/optimism/op-program/flags"
"github.com/ethereum-optimism/optimism/op-program/l1"
"github.com/ethereum-optimism/optimism/op-program/l2"
Expand Down Expand Up @@ -96,15 +100,30 @@ func FaultProofProgram(logger log.Logger, cfg *config.Config) error {

ctx := context.Background()
logger.Info("Connecting to L1 node", "l1", cfg.L1URL)
_, err := l1.NewFetchingL1(ctx, logger, cfg)
l1Source, err := l1.NewFetchingL1(ctx, logger, cfg)
if err != nil {
return fmt.Errorf("connect l1 oracle: %w", err)
}

logger.Info("Connecting to L2 node", "l2", cfg.L2URL)
_, err = l2.NewFetchingEngine(ctx, logger, cfg)
l2Source, err := l2.NewFetchingEngine(ctx, logger, cfg)
if err != nil {
return fmt.Errorf("connect l2 oracle: %w", err)
}

d := driver.NewDriver(logger, cfg, l1Source, l2Source)
for {
if err = d.Step(ctx); errors.Is(err, io.EOF) {
break
} else if cfg.FetchingEnabled() && errors.Is(err, derive.ErrTemporary) {
// When in fetching mode, recover from temporary errors to allow us to keep fetching data
// TODO(CLI-3780) Ideally the retry would happen in the fetcher so this is not needed
logger.Warn("Temporary error in pipeline", "err", err)
time.Sleep(5 * time.Second)
} else if err != nil {
return err
}
}
logger.Info("Derivation complete", "head", d.SafeHead())
return nil
}
53 changes: 53 additions & 0 deletions op-program/driver/driver.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
package driver

import (
"context"
"errors"
"fmt"
"io"

"github.com/ethereum-optimism/optimism/op-node/eth"
"github.com/ethereum-optimism/optimism/op-node/metrics"
"github.com/ethereum-optimism/optimism/op-node/rollup/derive"
"github.com/ethereum-optimism/optimism/op-program/config"
"github.com/ethereum/go-ethereum/log"
)

type Derivation interface {
Step(ctx context.Context) error
SafeL2Head() eth.L2BlockRef
}

type Driver struct {
logger log.Logger
pipeline Derivation
}

func NewDriver(logger log.Logger, cfg *config.Config, l1Source derive.L1Fetcher, l2Source derive.Engine) *Driver {
pipeline := derive.NewDerivationPipeline(logger, cfg.Rollup, l1Source, l2Source, metrics.NoopMetrics)
pipeline.Reset()
return &Driver{
logger: logger,
pipeline: pipeline,
}
}

// Step runs the next step of the derivation pipeline.
// Returns nil if there are further steps to be performed
// Returns io.EOF if the derivation completed successfully
// Returns a non-EOF error if the derivation failed
func (d *Driver) Step(ctx context.Context) error {
if err := d.pipeline.Step(ctx); errors.Is(err, io.EOF) {
return io.EOF
} else if errors.Is(err, derive.NotEnoughData) {
d.logger.Debug("Data is lacking")
return nil
} else if err != nil {
return fmt.Errorf("pipeline err: %w", err)
}
return nil
}

func (d *Driver) SafeHead() eth.L2BlockRef {
return d.pipeline.SafeL2Head()
}
66 changes: 66 additions & 0 deletions op-program/driver/driver_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
package driver

import (
"context"
"errors"
"fmt"
"io"
"testing"

"github.com/ethereum-optimism/optimism/op-node/eth"
"github.com/ethereum-optimism/optimism/op-node/rollup/derive"
"github.com/ethereum-optimism/optimism/op-node/testlog"
"github.com/ethereum/go-ethereum/log"
"github.com/stretchr/testify/require"
)

func TestDerivationComplete(t *testing.T) {
driver := createDriver(t, fmt.Errorf("derivation complete: %w", io.EOF))
err := driver.Step(context.Background())
require.ErrorIs(t, err, io.EOF)
}

func TestTemporaryError(t *testing.T) {
driver := createDriver(t, fmt.Errorf("whoopsie: %w", derive.ErrTemporary))
err := driver.Step(context.Background())
require.ErrorIs(t, err, derive.ErrTemporary)
}

func TestNotEnoughDataError(t *testing.T) {
driver := createDriver(t, fmt.Errorf("idk: %w", derive.NotEnoughData))
err := driver.Step(context.Background())
require.NoError(t, err)
}

func TestGenericError(t *testing.T) {
expected := errors.New("boom")
driver := createDriver(t, expected)
err := driver.Step(context.Background())
require.ErrorIs(t, err, expected)
}

func TestNoError(t *testing.T) {
driver := createDriver(t, nil)
err := driver.Step(context.Background())
require.NoError(t, err)
}

func createDriver(t *testing.T, derivationResult error) *Driver {
derivation := &stubDerivation{nextErr: derivationResult}
return &Driver{
logger: testlog.Logger(t, log.LvlDebug),
pipeline: derivation,
}
}

type stubDerivation struct {
nextErr error
}

func (s stubDerivation) Step(ctx context.Context) error {
return s.nextErr
}

func (s stubDerivation) SafeL2Head() eth.L2BlockRef {
return eth.L2BlockRef{}
}
11 changes: 11 additions & 0 deletions packages/actor-tests/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
# @eth-optimism/actor-tests

## 0.0.24

### Patch Changes

- Updated dependencies [b16067a9f]
- Updated dependencies [be3315689]
- Updated dependencies [9a02079eb]
- Updated dependencies [98fbe9d22]
- @eth-optimism/contracts-bedrock@0.13.2
- @eth-optimism/sdk@2.0.2

## 0.0.23

### Patch Changes
Expand Down
6 changes: 3 additions & 3 deletions packages/actor-tests/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@eth-optimism/actor-tests",
"version": "0.0.23",
"version": "0.0.24",
"description": "A library and suite of tests to stress test Optimism Bedrock.",
"license": "MIT",
"author": "",
Expand All @@ -18,9 +18,9 @@
"test:coverage": "yarn test"
},
"dependencies": {
"@eth-optimism/contracts-bedrock": "0.13.1",
"@eth-optimism/contracts-bedrock": "0.13.2",
"@eth-optimism/core-utils": "^0.12.0",
"@eth-optimism/sdk": "^2.0.1",
"@eth-optimism/sdk": "^2.0.2",
"@types/chai": "^4.2.18",
"@types/chai-as-promised": "^7.1.4",
"async-mutex": "^0.3.2",
Expand Down
12 changes: 12 additions & 0 deletions packages/chain-mon/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
# @eth-optimism/drippie-mon

## 0.3.0

### Minor Changes

- 1e7897c81: Introduces the balance-mon service to chain-mon.

### Patch Changes

- dbe5eb308: Empty patch release to re-release packages that failed to be released by a bug in the release process.
- Updated dependencies [be3315689]
- @eth-optimism/sdk@2.0.2

## 0.2.1

### Patch Changes
Expand Down
4 changes: 2 additions & 2 deletions packages/chain-mon/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"private": true,
"name": "@eth-optimism/chain-mon",
"version": "0.2.1",
"version": "0.3.0",
"description": "[Optimism] Chain monitoring services",
"main": "dist/index",
"types": "dist/index",
Expand Down Expand Up @@ -36,7 +36,7 @@
"@eth-optimism/common-ts": "0.8.1",
"@eth-optimism/contracts-periphery": "1.0.7",
"@eth-optimism/core-utils": "0.12.0",
"@eth-optimism/sdk": "2.0.1",
"@eth-optimism/sdk": "2.0.2",
"ethers": "^5.7.0",
"@types/dateformat": "^5.0.0",
"chai-as-promised": "^7.1.1",
Expand Down
8 changes: 8 additions & 0 deletions packages/contracts-bedrock/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# @eth-optimism/contracts-bedrock

## 0.13.2

### Patch Changes

- b16067a9f: Reduce the time that the system dictator deploy scripts wait before checking the chain state.
- 9a02079eb: Makes the Proxy contract inheritable by making functions (public virtual).
- 98fbe9d22: Added a contsructor to the System Dictator

## 0.13.1

### Patch Changes
Expand Down
7 changes: 3 additions & 4 deletions packages/contracts-bedrock/contracts/L1/OptimismPortal.sol
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,7 @@ contract OptimismPortal is Initializable, ResourceMetering, Semver {

/**
* @notice Determines if cross domain messaging is paused. When set to true,
* deposits and withdrawals are paused. This may be removed in the
* future.
* withdrawals are paused. This may be removed in the future.
*/
bool public paused;

Expand Down Expand Up @@ -141,7 +140,7 @@ contract OptimismPortal is Initializable, ResourceMetering, Semver {
}

/**
* @custom:semver 1.3.0
* @custom:semver 1.3.1
*
* @param _l2Oracle Address of the L2OutputOracle contract.
* @param _guardian Address that can pause deposits and withdrawals.
Expand All @@ -153,7 +152,7 @@ contract OptimismPortal is Initializable, ResourceMetering, Semver {
address _guardian,
bool _paused,
SystemConfig _config
) Semver(1, 3, 0) {
) Semver(1, 3, 1) {
L2_ORACLE = _l2Oracle;
GUARDIAN = _guardian;
SYSTEM_CONFIG = _config;
Expand Down
Loading

0 comments on commit 06bea64

Please sign in to comment.