Skip to content

Commit

Permalink
fix: use l1 fetcher and check pq length
Browse files Browse the repository at this point in the history
  • Loading branch information
tchardin committed Mar 12, 2024
1 parent 73ce442 commit d829474
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 7 deletions.
6 changes: 2 additions & 4 deletions op-node/rollup/derive/data_source.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ type DataIter interface {

type L1TransactionFetcher interface {
InfoAndTxsByHash(ctx context.Context, hash common.Hash) (eth.BlockInfo, types.Transactions, error)
FetchReceipts(ctx context.Context, blockHash common.Hash) (eth.BlockInfo, types.Receipts, error)
L1BlockRefByNumber(context.Context, uint64) (eth.L1BlockRef, error)
}

type L1BlobsFetcher interface {
Expand All @@ -47,13 +45,13 @@ type PlasmaInputFetcher interface {
type DataSourceFactory struct {
log log.Logger
dsCfg DataSourceConfig
fetcher L1TransactionFetcher
fetcher L1Fetcher
blobsFetcher L1BlobsFetcher
plasmaFetcher PlasmaInputFetcher
ecotoneTime *uint64
}

func NewDataSourceFactory(log log.Logger, cfg *rollup.Config, fetcher L1TransactionFetcher, blobsFetcher L1BlobsFetcher, plasmaFetcher PlasmaInputFetcher) *DataSourceFactory {
func NewDataSourceFactory(log log.Logger, cfg *rollup.Config, fetcher L1Fetcher, blobsFetcher L1BlobsFetcher, plasmaFetcher PlasmaInputFetcher) *DataSourceFactory {
config := DataSourceConfig{
l1Signer: cfg.L1Signer(),
batchInboxAddress: cfg.BatchInboxAddress,
Expand Down
4 changes: 2 additions & 2 deletions op-node/rollup/derive/plasma_data_source.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@ type PlasmaDataSource struct {
log log.Logger
src DataIter
fetcher PlasmaInputFetcher
l1 L1TransactionFetcher
l1 L1Fetcher
id eth.BlockID
// keep track of a pending commitment so we can keep trying to fetch the input.
comm plasma.Keccak256Commitment
}

func NewPlasmaDataSource(log log.Logger, src DataIter, l1 L1TransactionFetcher, fetcher PlasmaInputFetcher, id eth.BlockID) *PlasmaDataSource {
func NewPlasmaDataSource(log log.Logger, src DataIter, l1 L1Fetcher, fetcher PlasmaInputFetcher, id eth.BlockID) *PlasmaDataSource {
return &PlasmaDataSource{
log: log,
src: src,
Expand Down
2 changes: 1 addition & 1 deletion op-plasma/dastate.go
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ func (s *State) Prune(bn uint64) {
}
// only first element is the highest priority (lowest block number).
// next highest priority is swapped to the first position after a Pop.
for s.comms[0].blockNumber < bn {
for s.comms.Len() > 0 && s.comms[0].blockNumber < bn {
c := heap.Pop(&s.comms).(*Commitment)
s.log.Debug("prune commitment", "expiresAt", c.expiresAt, "blockNumber", c.blockNumber)
delete(s.commsByKey, string(c.key))
Expand Down

0 comments on commit d829474

Please sign in to comment.