Commit 32f0cf4b authored by Baptiste Oueriagli's avatar Baptiste Oueriagli

nit(op-node): use DataSourceConfig in place of rollup.Config in DataSource & DataSourceFactory

parent 4d22eb44
...@@ -28,17 +28,17 @@ type L1TransactionFetcher interface { ...@@ -28,17 +28,17 @@ type L1TransactionFetcher interface {
// This is not a stage in the pipeline, but a wrapper for another stage in the pipeline // This is not a stage in the pipeline, but a wrapper for another stage in the pipeline
type DataSourceFactory struct { type DataSourceFactory struct {
log log.Logger log log.Logger
cfg *rollup.Config dsCfg DataSourceConfig
fetcher L1TransactionFetcher fetcher L1TransactionFetcher
} }
func NewDataSourceFactory(log log.Logger, cfg *rollup.Config, fetcher L1TransactionFetcher) *DataSourceFactory { func NewDataSourceFactory(log log.Logger, cfg *rollup.Config, fetcher L1TransactionFetcher) *DataSourceFactory {
return &DataSourceFactory{log: log, cfg: cfg, fetcher: fetcher} return &DataSourceFactory{log: log, dsCfg: DataSourceConfig{l1Signer: cfg.L1Signer(), batchInboxAddress: cfg.BatchInboxAddress}, fetcher: fetcher}
} }
// OpenData returns a DataIter. This struct implements the `Next` function. // OpenData returns a DataIter. This struct implements the `Next` function.
func (ds *DataSourceFactory) OpenData(ctx context.Context, id eth.BlockID, batcherAddr common.Address) DataIter { func (ds *DataSourceFactory) OpenData(ctx context.Context, id eth.BlockID, batcherAddr common.Address) DataIter {
return NewDataSource(ctx, ds.log, ds.cfg, ds.fetcher, id, batcherAddr) return NewDataSource(ctx, ds.log, ds.dsCfg, ds.fetcher, id, batcherAddr)
} }
// DataSourceConfig regroups the mandatory rollup.Config fields needed for DataFromEVMTransactions. // DataSourceConfig regroups the mandatory rollup.Config fields needed for DataFromEVMTransactions.
...@@ -65,11 +65,9 @@ type DataSource struct { ...@@ -65,11 +65,9 @@ type DataSource struct {
// NewDataSource creates a new calldata source. It suppresses errors in fetching the L1 block if they occur. // NewDataSource creates a new calldata source. It suppresses errors in fetching the L1 block if they occur.
// If there is an error, it will attempt to fetch the result on the next call to `Next`. // If there is an error, it will attempt to fetch the result on the next call to `Next`.
func NewDataSource(ctx context.Context, log log.Logger, cfg *rollup.Config, fetcher L1TransactionFetcher, block eth.BlockID, batcherAddr common.Address) DataIter { func NewDataSource(ctx context.Context, log log.Logger, dsCfg DataSourceConfig, fetcher L1TransactionFetcher, block eth.BlockID, batcherAddr common.Address) DataIter {
_, txs, err := fetcher.InfoAndTxsByHash(ctx, block.Hash) _, txs, err := fetcher.InfoAndTxsByHash(ctx, block.Hash)
dsCfg := DataSourceConfig{cfg.L1Signer(), cfg.BatchInboxAddress}
if err != nil { if err != nil {
return &DataSource{ return &DataSource{
open: false, open: false,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment