Skip to content

fix: init l2 refs #109

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 10, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 10 additions & 5 deletions hildr-node/src/main/java/io/optimism/derive/State.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import io.optimism.common.Epoch;
import io.optimism.config.Config;
import io.optimism.driver.HeadInfo;
import io.optimism.driver.L1AttributesDepositedTxNotFoundException;
import io.optimism.l1.L1Info;
import java.math.BigInteger;
import java.util.Map.Entry;
Expand Down Expand Up @@ -142,7 +143,7 @@ public Tuple2<BlockInfo, Epoch> l2Info(BigInteger timestamp) {
if (cache != null) {
return cache;
}

LOGGER.warn("L2 refs cache not contains, will fetch from geth: blockNum = {}", blockNum);
var res = l2Fetcher.apply(blockNum);
this.l2Refs.put(res.component1().number(), res);
return res;
Expand Down Expand Up @@ -337,10 +338,14 @@ public static TreeMap<BigInteger, Tuple2<BlockInfo, Epoch>> initL2Refs(
if (block == null) {
continue;
}
final HeadInfo l2BlockInfo = HeadInfo.from(block);
l2Refs.put(
l2BlockInfo.l2BlockInfo().number(),
new Tuple2<>(l2BlockInfo.l2BlockInfo(), l2BlockInfo.l1Epoch()));
try {
final HeadInfo l2BlockInfo = HeadInfo.from(block);
l2Refs.put(
l2BlockInfo.l2BlockInfo().number(),
new Tuple2<>(l2BlockInfo.l2BlockInfo(), l2BlockInfo.l1Epoch()));
} catch (L1AttributesDepositedTxNotFoundException ignore) {
LOGGER.debug("Can't found deposited transaction (at blockNum = %d)".formatted(i));
}
}
}
return l2Refs;
Expand Down