Skip to content

Commit

Permalink
feat(protocol): make sure system proof delay is proofTimeTarget (#13742)
Browse files Browse the repository at this point in the history
  • Loading branch information
dantaik committed May 11, 2023
1 parent e4f533d commit c359dd9
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
11 changes: 10 additions & 1 deletion packages/protocol/contracts/L1/libs/LibProving.sol
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,13 @@
pragma solidity ^0.8.18;

import {AddressResolver} from "../../common/AddressResolver.sol";
import {LibMath} from "../../libs/LibMath.sol";
import {LibTokenomics} from "./LibTokenomics.sol";
import {LibUtils} from "./LibUtils.sol";
import {TaikoData} from "../../L1/TaikoData.sol";

library LibProving {
using LibMath for uint256;
using LibUtils for TaikoData.State;

event BlockProven(
Expand Down Expand Up @@ -160,9 +162,16 @@ library LibProving {
fc.blockHash = evidence.blockHash;
fc.signalRoot = evidence.signalRoot;
fc.gasUsed = evidence.gasUsed;
fc.provenAt = uint64(block.timestamp);
fc.prover = evidence.prover;

if (evidence.prover == address(1)) {
fc.provenAt = uint64(
block.timestamp.max(blk.proposedAt + config.proofTimeTarget)
);
} else {
fc.provenAt = uint64(block.timestamp);
}

if (evidence.prover != address(0) && evidence.prover != address(1)) {
uint256[9] memory inputs;

Expand Down
6 changes: 5 additions & 1 deletion packages/protocol/test/TaikoL1Oracle.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -569,7 +569,11 @@ contract TaikoL1OracleTest is TaikoL1TestBase {
if (realproof != 0)
assertEq(lastVerifiedBlockIdNow, lastVerifiedBlockId);

vm.warp(block.timestamp + conf.systemProofCooldownPeriod);
vm.warp(
block.timestamp +
conf.proofTimeTarget +
conf.systemProofCooldownPeriod
);
verifyBlock(Carol, 1);

lastVerifiedBlockIdNow = L1.getStateVariables().lastVerifiedBlockId;
Expand Down

0 comments on commit c359dd9

Please sign in to comment.