Skip to content

Commit

Permalink
change last proof from timestamp, to show the proof time
Browse files Browse the repository at this point in the history
  • Loading branch information
cyberhorsey committed May 31, 2023
1 parent 3cd655b commit c38ac34
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions packages/status-page/src/utils/buildStatusIndicators.ts
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ export async function buildStatusIndicators(
indicators.push({
provider: config.l1Provider,
contractAddress: config.l1TaikoAddress,
header: "Latest Proof",
header: "Latest Proof Time",
intervalInMs: 0,
status: "0",
watchStatusFunc: async (
Expand All @@ -376,20 +376,26 @@ export async function buildStatusIndicators(
onEvent: (value: Status) => void
) => {
const contract = new Contract(address, TaikoL1, provider);
const listener = (
const listener = async (
id,
parentHash,
blockHash,
signalRoot,
prover,
provenAt,
...args
parentGasUsed,
event
) => {
console.log(event);
// ignore oracle prover
if (
prover.toLowerCase() !== config.oracleProverAddress.toLowerCase()
) {
onEvent(new Date(provenAt).toTimeString());
const proposedBlock = await contract.getBlock(id);
const block = await event.getBlock();
const proofTime =
block.timestamp - proposedBlock._proposedAt.toNumber();

onEvent(`${proofTime} seconds`);
}
};
contract.on("BlockProven", listener);
Expand Down

0 comments on commit c38ac34

Please sign in to comment.