From 324579ba89f0ff10f38afe4db7b9e958c7e36045 Mon Sep 17 00:00:00 2001 From: colinlyguo Date: Mon, 18 Nov 2024 21:13:10 +0800 Subject: [PATCH] remove an unused config --- rollup/cmd/gas_oracle/app/app.go | 8 +------- rollup/internal/controller/relayer/l1_relayer.go | 7 ++----- rollup/internal/controller/relayer/l1_relayer_test.go | 7 +++---- rollup/tests/gas_oracle_test.go | 4 ++-- 4 files changed, 8 insertions(+), 18 deletions(-) diff --git a/rollup/cmd/gas_oracle/app/app.go b/rollup/cmd/gas_oracle/app/app.go index 156c6c394..43775b044 100644 --- a/rollup/cmd/gas_oracle/app/app.go +++ b/rollup/cmd/gas_oracle/app/app.go @@ -78,15 +78,9 @@ func action(ctx *cli.Context) error { log.Crit("failed to connect l2 geth", "config file", cfgFile, "error", err) } - genesisPath := ctx.String(utils.Genesis.Name) - genesis, err := utils.ReadGenesis(genesisPath) - if err != nil { - log.Crit("failed to read genesis", "genesis file", genesisPath, "error", err) - } - l1watcher := watcher.NewL1WatcherClient(ctx.Context, l1client, cfg.L1Config.StartHeight, db, registry) - l1relayer, err := relayer.NewLayer1Relayer(ctx.Context, db, cfg.L1Config.RelayerConfig, genesis.Config, relayer.ServiceTypeL1GasOracle, registry) + l1relayer, err := relayer.NewLayer1Relayer(ctx.Context, db, cfg.L1Config.RelayerConfig, relayer.ServiceTypeL1GasOracle, registry) if err != nil { log.Crit("failed to create new l1 relayer", "config file", cfgFile, "error", err) } diff --git a/rollup/internal/controller/relayer/l1_relayer.go b/rollup/internal/controller/relayer/l1_relayer.go index 232f7eaee..36aeade98 100644 --- a/rollup/internal/controller/relayer/l1_relayer.go +++ b/rollup/internal/controller/relayer/l1_relayer.go @@ -11,7 +11,6 @@ import ( "github.com/prometheus/client_golang/prometheus" "github.com/scroll-tech/go-ethereum/accounts/abi" "github.com/scroll-tech/go-ethereum/log" - "github.com/scroll-tech/go-ethereum/params" "gorm.io/gorm" "scroll-tech/common/types" @@ -30,8 +29,7 @@ import ( type Layer1Relayer struct { ctx context.Context - cfg *config.RelayerConfig - chainCfg *params.ChainConfig + cfg *config.RelayerConfig gasOracleSender *sender.Sender l1GasOracleABI *abi.ABI @@ -49,7 +47,7 @@ type Layer1Relayer struct { } // NewLayer1Relayer will return a new instance of Layer1RelayerClient -func NewLayer1Relayer(ctx context.Context, db *gorm.DB, cfg *config.RelayerConfig, chainCfg *params.ChainConfig, serviceType ServiceType, reg prometheus.Registerer) (*Layer1Relayer, error) { +func NewLayer1Relayer(ctx context.Context, db *gorm.DB, cfg *config.RelayerConfig, serviceType ServiceType, reg prometheus.Registerer) (*Layer1Relayer, error) { var gasOracleSender *sender.Sender var err error @@ -80,7 +78,6 @@ func NewLayer1Relayer(ctx context.Context, db *gorm.DB, cfg *config.RelayerConfi l1Relayer := &Layer1Relayer{ cfg: cfg, - chainCfg: chainCfg, ctx: ctx, l1BlockOrm: orm.NewL1Block(db), l2BlockOrm: orm.NewL2Block(db), diff --git a/rollup/internal/controller/relayer/l1_relayer_test.go b/rollup/internal/controller/relayer/l1_relayer_test.go index 08f6f9b50..129378eff 100644 --- a/rollup/internal/controller/relayer/l1_relayer_test.go +++ b/rollup/internal/controller/relayer/l1_relayer_test.go @@ -8,7 +8,6 @@ import ( "github.com/agiledragon/gomonkey/v2" "github.com/scroll-tech/go-ethereum/common" "github.com/scroll-tech/go-ethereum/crypto/kzg4844" - "github.com/scroll-tech/go-ethereum/params" "github.com/smartystreets/goconvey/convey" "github.com/stretchr/testify/assert" "gorm.io/gorm" @@ -36,7 +35,7 @@ func setupL1RelayerDB(t *testing.T) *gorm.DB { func testCreateNewL1Relayer(t *testing.T) { db := setupL1RelayerDB(t) defer database.CloseDB(db) - relayer, err := NewLayer1Relayer(context.Background(), db, cfg.L2Config.RelayerConfig, ¶ms.ChainConfig{}, ServiceTypeL1GasOracle, nil) + relayer, err := NewLayer1Relayer(context.Background(), db, cfg.L2Config.RelayerConfig, ServiceTypeL1GasOracle, nil) assert.NoError(t, err) assert.NotNil(t, relayer) defer relayer.StopSenders() @@ -58,7 +57,7 @@ func testL1RelayerGasOracleConfirm(t *testing.T) { l1Cfg := cfg.L1Config ctx, cancel := context.WithCancel(context.Background()) defer cancel() - l1Relayer, err := NewLayer1Relayer(ctx, db, l1Cfg.RelayerConfig, ¶ms.ChainConfig{}, ServiceTypeL1GasOracle, nil) + l1Relayer, err := NewLayer1Relayer(ctx, db, l1Cfg.RelayerConfig, ServiceTypeL1GasOracle, nil) assert.NoError(t, err) defer l1Relayer.StopSenders() @@ -91,7 +90,7 @@ func testL1RelayerProcessGasPriceOracle(t *testing.T) { l1Cfg := cfg.L1Config ctx, cancel := context.WithCancel(context.Background()) defer cancel() - l1Relayer, err := NewLayer1Relayer(ctx, db, l1Cfg.RelayerConfig, ¶ms.ChainConfig{}, ServiceTypeL1GasOracle, nil) + l1Relayer, err := NewLayer1Relayer(ctx, db, l1Cfg.RelayerConfig, ServiceTypeL1GasOracle, nil) assert.NoError(t, err) assert.NotNil(t, l1Relayer) defer l1Relayer.StopSenders() diff --git a/rollup/tests/gas_oracle_test.go b/rollup/tests/gas_oracle_test.go index c7a0b50e3..f44587dc2 100644 --- a/rollup/tests/gas_oracle_test.go +++ b/rollup/tests/gas_oracle_test.go @@ -30,7 +30,7 @@ func testImportL1GasPrice(t *testing.T) { l1Cfg := rollupApp.Config.L1Config // Create L1Relayer - l1Relayer, err := relayer.NewLayer1Relayer(context.Background(), db, l1Cfg.RelayerConfig, ¶ms.ChainConfig{LondonBlock: big.NewInt(0), BernoulliBlock: big.NewInt(0), CurieBlock: big.NewInt(0), DarwinTime: new(uint64), DarwinV2Time: new(uint64)}, relayer.ServiceTypeL1GasOracle, nil) + l1Relayer, err := relayer.NewLayer1Relayer(context.Background(), db, l1Cfg.RelayerConfig, relayer.ServiceTypeL1GasOracle, nil) assert.NoError(t, err) defer l1Relayer.StopSenders() @@ -105,7 +105,7 @@ func testImportDefaultL1GasPriceDueToL1GasPriceSpike(t *testing.T) { // set CheckCommittedBatchesWindowMinutes to zero to not pass check for commit batch timeout l1CfgCopy.RelayerConfig.GasOracleConfig.CheckCommittedBatchesWindowMinutes = 0 // Create L1Relayer - l1Relayer, err := relayer.NewLayer1Relayer(context.Background(), db, l1CfgCopy.RelayerConfig, ¶ms.ChainConfig{BernoulliBlock: big.NewInt(0), CurieBlock: big.NewInt(0)}, relayer.ServiceTypeL1GasOracle, nil) + l1Relayer, err := relayer.NewLayer1Relayer(context.Background(), db, l1CfgCopy.RelayerConfig, relayer.ServiceTypeL1GasOracle, nil) assert.NoError(t, err) defer l1Relayer.StopSenders()