Skip to content

Commit 6bcc320

Browse files
thinkAfCodGrapeBaBa
authored andcommitted
fix: system config update process
1 parent 3de59d6 commit 6bcc320

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

hildr-node/src/main/java/io/optimism/l1/InnerWatcher.java

+9-4
Original file line numberDiff line numberDiff line change
@@ -381,11 +381,17 @@ private void putBlockUpdate(final BlockUpdate update) {
381381

382382
private void updateSystemConfig(BlockInfo l1BlockInfo) throws ExecutionException, InterruptedException {
383383
BigInteger preLastUpdateBlock = this.systemConfigUpdate.component1();
384-
if (preLastUpdateBlock.compareTo(this.currentBlock) <= 0) {
384+
if (preLastUpdateBlock.compareTo(this.currentBlock) < 0 || preLastUpdateBlock.equals(BigInteger.ZERO)) {
385385
BigInteger fromBlock = preLastUpdateBlock.equals(BigInteger.ZERO)
386386
? BigInteger.ZERO
387387
: preLastUpdateBlock.add(BigInteger.ONE);
388+
if (fromBlock.compareTo(this.headBlock) > 0) {
389+
fromBlock = this.headBlock;
390+
}
388391
BigInteger toBlock = preLastUpdateBlock.add(BigInteger.valueOf(100L));
392+
if (toBlock.compareTo(this.headBlock) > 0) {
393+
toBlock = this.headBlock;
394+
}
389395
LOGGER.debug(
390396
"will get system update eth log: fromBlock={} -> toBlock={}; contract={}",
391397
fromBlock,
@@ -423,6 +429,7 @@ private void updateSystemConfig(BlockInfo l1BlockInfo) throws ExecutionException
423429
}
424430
}
425431
}
432+
426433
BigInteger lastUpdateBlock = this.systemConfigUpdate.component1();
427434
SystemConfig nextConfig = this.systemConfigUpdate.component2();
428435
if (lastUpdateBlock.compareTo(currentBlock) == 0 && nextConfig != null) {
@@ -443,9 +450,7 @@ private Config.SystemConfig parseSystemConfigUpdate(
443450
lastSystemConfig.l1FeeScalar(),
444451
lastSystemConfig.unsafeBlockSigner());
445452
} else if (configUpdate instanceof SystemConfigUpdate.Fees) {
446-
var ecotoneTime = this.config.chainConfig().ecotoneTime();
447-
if (ecotoneTime.compareTo(BigInteger.ZERO) > 0
448-
&& l1BlockInfo.timestamp().compareTo(ecotoneTime) >= 0) {
453+
if (this.config.chainConfig().isEcotone(l1BlockInfo.timestamp())) {
449454
updateSystemConfig = new Config.SystemConfig(
450455
lastSystemConfig.batchSender(),
451456
lastSystemConfig.gasLimit(),

0 commit comments

Comments
 (0)