From 1c807c8926bb671baf242e8d996911298f5787dc Mon Sep 17 00:00:00 2001 From: Daniel Wang Date: Fri, 25 Aug 2023 11:52:53 +0800 Subject: [PATCH] allow earlier proofs from other regular provers --- packages/protocol/contracts/L1/libs/LibProving.sol | 8 ++++++-- packages/protocol/test/L1/TaikoL1Oracle.t.sol | 6 +++--- packages/status-page/src/utils/buildStatusIndicators.ts | 4 ++-- packages/status-page/src/utils/getNumProvers.ts | 2 +- packages/website/pages/docs/concepts/proving.mdx | 4 ++-- 5 files changed, 14 insertions(+), 10 deletions(-) diff --git a/packages/protocol/contracts/L1/libs/LibProving.sol b/packages/protocol/contracts/L1/libs/LibProving.sol index e733f8ee0a6..470442d1687 100644 --- a/packages/protocol/contracts/L1/libs/LibProving.sol +++ b/packages/protocol/contracts/L1/libs/LibProving.sol @@ -72,9 +72,13 @@ library LibProving { revert L1_INVALID_ORACLE_PROVER(); } } else { - // Regular prover + // A block can be proven by a regular prover in the following cases: + // 1. The actual prover is the assigned prover + // 2. The block has at least one fork choice (which must be from the + // assigned prover) + // 3. The block has become open if ( - evidence.prover != blk.prover + evidence.prover != blk.prover && blk.nextForkChoiceId == 1 && block.timestamp <= blk.proposedAt + config.proofWindow ) revert L1_NOT_PROVEABLE(); } diff --git a/packages/protocol/test/L1/TaikoL1Oracle.t.sol b/packages/protocol/test/L1/TaikoL1Oracle.t.sol index 12174dde2ea..5706c9ca87a 100644 --- a/packages/protocol/test/L1/TaikoL1Oracle.t.sol +++ b/packages/protocol/test/L1/TaikoL1Oracle.t.sol @@ -282,7 +282,7 @@ contract TaikoL1OracleTest is TaikoL1TestBase { printVariables(""); } - /// @dev Test if system proofs can be verified + /// @dev Test if oracle proofs can be verified function test_L1_if_oracle_proofs_can_be_verified_without_regular_proofs() external { @@ -433,7 +433,7 @@ contract TaikoL1OracleTest is TaikoL1TestBase { printVariables(""); } - /// @dev Test if there is no system/oracle proofs + /// @dev Test if there is no oracle proofs function test_L1_if_there_is_no_oracle_prover_there_is_no_overwrite_at_all() external { @@ -483,7 +483,7 @@ contract TaikoL1OracleTest is TaikoL1TestBase { ); // Carol could not overwrite it - vm.expectRevert(TaikoErrors.L1_NOT_PROVEABLE.selector); + vm.expectRevert(TaikoErrors.L1_ALREADY_PROVEN.selector); proveBlock( Carol, Carol, diff --git a/packages/status-page/src/utils/buildStatusIndicators.ts b/packages/status-page/src/utils/buildStatusIndicators.ts index ae83d2b41f2..dd0926f8df5 100644 --- a/packages/status-page/src/utils/buildStatusIndicators.ts +++ b/packages/status-page/src/utils/buildStatusIndicators.ts @@ -414,7 +414,7 @@ export async function buildStatusIndicators( indicators.push({ provider: config.l1Provider, contractAddress: config.l1TaikoAddress, - header: "Latest System Proof", + header: "Latest Oradle Proof", intervalInMs: 0, status: "0", watchStatusFunc: async ( @@ -449,7 +449,7 @@ export async function buildStatusIndicators( colorFunc: function (status: Status) { return "green"; // todo: whats green, yellow, red? }, - tooltip: "The timestamp of the latest system proof", + tooltip: "The timestamp of the latest oracle proof", }); indicators.push({ diff --git a/packages/status-page/src/utils/getNumProvers.ts b/packages/status-page/src/utils/getNumProvers.ts index 7d2602bed03..098d043f079 100644 --- a/packages/status-page/src/utils/getNumProvers.ts +++ b/packages/status-page/src/utils/getNumProvers.ts @@ -26,7 +26,7 @@ export const getNumProvers = async ( uniqueProversResp.data.provers.splice(index, 1); uniqueProversResp.data.uniqueProvers--; } - // Filter out the system prover address since it doesn't submit the actual zk proof + // Filter out the oracle prover address since it doesn't submit the actual zk proof const systemIndex = uniqueProversResp.data.provers.findIndex( (uniqueProver) => uniqueProver.address === "0x0000000000000000000000000000000000000001" diff --git a/packages/website/pages/docs/concepts/proving.mdx b/packages/website/pages/docs/concepts/proving.mdx index 35b83d39b01..0b93b53315b 100644 --- a/packages/website/pages/docs/concepts/proving.mdx +++ b/packages/website/pages/docs/concepts/proving.mdx @@ -58,9 +58,9 @@ Currently, you only need a single proof from any prover to verify a block. The oracle prover is a prover from a unique address (our own address) that is able to override the community prover. This is a safety mechanism we have in place while the ZK-EVM is still in development and in case an invalid block was marked as verified from a community proof. -### System prover +### Oracle prover -A system prover generates a fake proof to mark a block as verified. We only require a real proof to be generated every N blocks. Otherwise, we accept a fake, system proof, and mark the block as verified. This is a temporary testnet feature to reduce the cost for community provers. +A oracle prover generates a fake proof to mark a block as verified. We only require a real proof to be generated every N blocks. Otherwise, we accept a fake, oracle proof, and mark the block as verified. This is a temporary testnet feature to reduce the cost for community provers. ### The proof cooldown period