Skip to content

Commit

Permalink
fix: system config update process
Browse files Browse the repository at this point in the history
  • Loading branch information
thinkAfCod authored and GrapeBaBa committed Jul 13, 2024
1 parent 3de59d6 commit 6bcc320
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions hildr-node/src/main/java/io/optimism/l1/InnerWatcher.java
Original file line number Diff line number Diff line change
Expand Up @@ -381,11 +381,17 @@ private void putBlockUpdate(final BlockUpdate update) {

private void updateSystemConfig(BlockInfo l1BlockInfo) throws ExecutionException, InterruptedException {
BigInteger preLastUpdateBlock = this.systemConfigUpdate.component1();
if (preLastUpdateBlock.compareTo(this.currentBlock) <= 0) {
if (preLastUpdateBlock.compareTo(this.currentBlock) < 0 || preLastUpdateBlock.equals(BigInteger.ZERO)) {
BigInteger fromBlock = preLastUpdateBlock.equals(BigInteger.ZERO)
? BigInteger.ZERO
: preLastUpdateBlock.add(BigInteger.ONE);
if (fromBlock.compareTo(this.headBlock) > 0) {
fromBlock = this.headBlock;
}
BigInteger toBlock = preLastUpdateBlock.add(BigInteger.valueOf(100L));
if (toBlock.compareTo(this.headBlock) > 0) {
toBlock = this.headBlock;
}
LOGGER.debug(
"will get system update eth log: fromBlock={} -> toBlock={}; contract={}",
fromBlock,
Expand Down Expand Up @@ -423,6 +429,7 @@ private void updateSystemConfig(BlockInfo l1BlockInfo) throws ExecutionException
}
}
}

BigInteger lastUpdateBlock = this.systemConfigUpdate.component1();
SystemConfig nextConfig = this.systemConfigUpdate.component2();
if (lastUpdateBlock.compareTo(currentBlock) == 0 && nextConfig != null) {
Expand All @@ -443,9 +450,7 @@ private Config.SystemConfig parseSystemConfigUpdate(
lastSystemConfig.l1FeeScalar(),
lastSystemConfig.unsafeBlockSigner());
} else if (configUpdate instanceof SystemConfigUpdate.Fees) {
var ecotoneTime = this.config.chainConfig().ecotoneTime();
if (ecotoneTime.compareTo(BigInteger.ZERO) > 0
&& l1BlockInfo.timestamp().compareTo(ecotoneTime) >= 0) {
if (this.config.chainConfig().isEcotone(l1BlockInfo.timestamp())) {
updateSystemConfig = new Config.SystemConfig(
lastSystemConfig.batchSender(),
lastSystemConfig.gasLimit(),
Expand Down

0 comments on commit 6bcc320

Please sign in to comment.