Skip to content

Commit

Permalink
fix: merge upstream v1.7.2
Browse files Browse the repository at this point in the history
  • Loading branch information
bnoieh committed Apr 24, 2024
1 parent e720f6e commit 5799648
Show file tree
Hide file tree
Showing 10 changed files with 30 additions and 24 deletions.
4 changes: 2 additions & 2 deletions op-batcher/batcher/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ type BatcherService struct {
L1Client client.Client

EndpointProvider dial.L2EndpointProvider
TxManager txmgr.TxManager
TxManager txmgr.TxManager
PlasmaDA *plasma.DAClient

BatcherConfig
Expand Down Expand Up @@ -143,7 +143,7 @@ func (bs *BatcherService) initRPCClients(ctx context.Context, cfg *CLIConfig) er
ethUrls := strings.Split(cfg.L2EthRpc, ",")
endpointProvider, err = dial.NewActiveL2EndpointProvider(ctx, ethUrls, rollupUrls, cfg.ActiveSequencerCheckDuration, dial.DefaultDialTimeout, bs.Log)
} else {
endpointProvider, err = dial.NewStaticL2EndpointProvider(ctx, bs.Log, cfg.L2EthRpc, cfg.RollupRpc)
endpointProvider, err = dial.NewStaticL2EndpointProvider(ctx, bs.Log, cfg.L2EthRpc, cfg.RollupRpc, bs.Metrics)
}
if err != nil {
return fmt.Errorf("failed to build L2 endpoint provider: %w", err)
Expand Down
9 changes: 5 additions & 4 deletions op-batcher/metrics/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,15 @@ import (

"github.com/prometheus/client_golang/prometheus"

"github.com/ethereum-optimism/optimism/op-node/rollup/derive"
"github.com/ethereum-optimism/optimism/op-service/eth"
opmetrics "github.com/ethereum-optimism/optimism/op-service/metrics"
txmetrics "github.com/ethereum-optimism/optimism/op-service/txmgr/metrics"
"github.com/ethereum/go-ethereum"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/log"

"github.com/ethereum-optimism/optimism/op-node/rollup/derive"
"github.com/ethereum-optimism/optimism/op-service/eth"
opmetrics "github.com/ethereum-optimism/optimism/op-service/metrics"
txmetrics "github.com/ethereum-optimism/optimism/op-service/txmgr/metrics"
)

const Namespace = "op_batcher"
Expand Down
7 changes: 7 additions & 0 deletions op-e2e/actions/l1_miner.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,13 @@ func NewL1Miner(t Testing, log log.Logger, genesis *core.Genesis) *L1Miner {
}
}

func NewL1MinerWithPort(t Testing, log log.Logger, genesis *core.Genesis, port int) *L1Miner {
rep := NewL1ReplicaWithPort(t, log, genesis, port)
return &L1Miner{
L1Replica: *rep,
}
}

func (s *L1Miner) BlobStore() derive.L1BlobsFetcher {
return s.blobStore
}
Expand Down
6 changes: 2 additions & 4 deletions op-proposer/metrics/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,7 @@ type Metricer interface {
// Record Tx metrics
txmetrics.TxMetricer

opmetrics.RPCMetricer

StartBalanceMetrics(l log.Logger, client *ethclient.Client, account common.Address) io.Closer
StartBalanceMetrics(l log.Logger, client ethereum.ChainStateReader, account common.Address) io.Closer

RecordL2BlocksProposed(l2ref eth.L2BlockRef)
}
Expand Down Expand Up @@ -86,7 +84,7 @@ func (m *Metrics) Registry() *prometheus.Registry {
return m.registry
}

func (m *Metrics) StartBalanceMetrics(l log.Logger, client *ethclient.Client, account common.Address) io.Closer {
func (m *Metrics) StartBalanceMetrics(l log.Logger, client ethereum.ChainStateReader, account common.Address) io.Closer {
return opmetrics.LaunchBalanceMetrics(l, m.registry, m.ns, client, account)
}

Expand Down
5 changes: 2 additions & 3 deletions op-proposer/metrics/noop.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package metrics
import (
"io"

"github.com/ethereum/go-ethereum"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/ethclient"
"github.com/ethereum/go-ethereum/log"

"github.com/ethereum-optimism/optimism/op-service/eth"
Expand All @@ -15,7 +15,6 @@ import (
type noopMetrics struct {
opmetrics.NoopRefMetrics
txmetrics.NoopTxMetrics
opmetrics.NoopRPCMetrics
}

var NoopMetrics Metricer = new(noopMetrics)
Expand All @@ -25,7 +24,7 @@ func (*noopMetrics) RecordUp() {}

func (*noopMetrics) RecordL2BlocksProposed(l2ref eth.L2BlockRef) {}

func (*noopMetrics) StartBalanceMetrics(log.Logger, *ethclient.Client, common.Address) io.Closer {
func (*noopMetrics) StartBalanceMetrics(log.Logger, ethereum.ChainStateReader, common.Address) io.Closer {
return nil
}

Expand Down
5 changes: 5 additions & 0 deletions op-proposer/proposer/l2_output_submitter.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (

"github.com/urfave/cli/v2"

opaws "github.com/ethereum-optimism/optimism/op-aws-sdk"
"github.com/ethereum-optimism/optimism/op-proposer/flags"
opservice "github.com/ethereum-optimism/optimism/op-service"
"github.com/ethereum-optimism/optimism/op-service/cliapp"
Expand All @@ -16,6 +17,10 @@ import (
// This method returns a cliapp.LifecycleAction, to create an op-service CLI-lifecycle-managed L2Output-submitter
func Main(version string) cliapp.LifecycleAction {
return func(cliCtx *cli.Context, _ context.CancelCauseFunc) (cliapp.Lifecycle, error) {
if err := opaws.KeyManager(context.Background(), ctx, opaws.OP_PROPOSER_SIGN_KEY); err != nil {
return nil, err
}

if err := flags.CheckRequired(cliCtx); err != nil {
return nil, err
}
Expand Down
5 changes: 0 additions & 5 deletions op-proposer/proposer/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ import (
"github.com/ethereum-optimism/optimism/op-service/txmgr"

"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/ethclient"
"github.com/ethereum/go-ethereum/log"
)

Expand Down Expand Up @@ -74,10 +73,6 @@ type ProposerService struct {
// The service components are fully started, except for the driver,
// which will not be submitting state (if it was configured to) until the Start part of the lifecycle.
func ProposerServiceFromCLIConfig(ctx context.Context, version string, cfg *CLIConfig, log log.Logger) (*ProposerService, error) {
if err := opaws.KeyManager(context.Background(), ctx, opaws.OP_PROPOSER_SIGN_KEY); err != nil {
return err
}

var ps ProposerService
if err := ps.initFromCLIConfig(ctx, version, cfg, log); err != nil {
return nil, errors.Join(err, ps.Stop(ctx)) // try to clean up our failed initialization attempt
Expand Down
9 changes: 5 additions & 4 deletions op-service/dial/static_l2_provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ package dial
import (
"context"

"github.com/ethereum/go-ethereum/ethclient"
"github.com/ethereum-optimism/optimism/op-service/client"
"github.com/ethereum-optimism/optimism/op-service/metrics"
"github.com/ethereum/go-ethereum/log"
)

Expand All @@ -20,10 +21,10 @@ type L2EndpointProvider interface {
// It is meant for scenarios where a single, unchanging (L2 rollup node, L2 execution node) pair is used
type StaticL2EndpointProvider struct {
StaticL2RollupProvider
ethClient *ethclient.Client
ethClient client.Client
}

func NewStaticL2EndpointProvider(ctx context.Context, log log.Logger, ethClientUrl string, rollupClientUrl string) (*StaticL2EndpointProvider, error) {
func NewStaticL2EndpointProvider(ctx context.Context, log log.Logger, ethClientUrl string, rollupClientUrl string, metrics metrics.RPCMetricer) (*StaticL2EndpointProvider, error) {
ethClient, err := DialEthClientWithTimeout(ctx, DefaultDialTimeout, log, ethClientUrl)
if err != nil {
return nil, err
Expand All @@ -34,7 +35,7 @@ func NewStaticL2EndpointProvider(ctx context.Context, log log.Logger, ethClientU
}
return &StaticL2EndpointProvider{
StaticL2RollupProvider: *rollupProvider,
ethClient: ethClient,
ethClient: client.NewInstrumentedClient(ethClient, metrics),
}, nil
}

Expand Down
2 changes: 1 addition & 1 deletion op-service/sources/receipts_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ func (tc *ReceiptsTestCase) Run(t *testing.T) {
testCfg.MethodResetDuration = 0
}
logger := testlog.Logger(t, log.LevelError)
ethCl, err := NewEthClient(client.NewBaseRPCClient(cl), logger, nil, testCfg)
ethCl, err := NewEthClient(client.NewBaseRPCClient(cl), logger, nil, testCfg, true)
require.NoError(t, err)
defer ethCl.Close()

Expand Down
2 changes: 1 addition & 1 deletion op-service/txmgr/txmgr.go
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ func (m *SimpleTxManager) craftTx(ctx context.Context, candidate TxCandidate) (*
// If the gas limit is set, we can use that as the gas
if gasLimit == 0 {
// Calculate the intrinsic gas for the transaction
gas, err := m.backend.EstimateGas(ctx, bsc.ToLegacyCallMsg(ethereum.CallMsg{
gas, err := m.backend.EstimateGas(ctx, ethereum.CallMsg{
From: m.cfg.From,
To: candidate.To,
GasTipCap: gasTipCap,
Expand Down

0 comments on commit 5799648

Please sign in to comment.