diff --git a/packages/actions/src/types/index.ts b/packages/actions/src/types/index.ts index cdb13a35..816217d7 100644 --- a/packages/actions/src/types/index.ts +++ b/packages/actions/src/types/index.ts @@ -88,16 +88,16 @@ export type UserDocument = { * @typedef {Object} CeremonyInputData * @property {string} title - the title/name of the ceremony. * @property {string} description - a brief description of the ceremony. - * @property {Date} startDate - the start (opening to contributions) date for the ceremony. - * @property {Date} endDate - the end (closing to contributions) date for the ceremony. + * @property {number} startDate - the start (opening to contributions) date for the ceremony (in ms). + * @property {number} endDate - the end (closing to contributions) date for the ceremony (in ms). * @property {CeremonyTimeoutType} timeoutMechanismType - the timeout mechanism type used for avoiding blocking contribution behaviours. * @property {number} penalty - the amount of time expressed in minutes that the blocking contributor has to wait before joining the waiting queue again. */ export type CeremonyInputData = { title: string description: string - startDate: Date - endDate: Date + startDate: number + endDate: number timeoutMechanismType: CeremonyTimeoutType penalty: number } diff --git a/packages/actions/test/data/samples.ts b/packages/actions/test/data/samples.ts index 730de073..e5b5adbe 100644 --- a/packages/actions/test/data/samples.ts +++ b/packages/actions/test/data/samples.ts @@ -43,8 +43,8 @@ const fakeCeremonyScheduledFixed = generateFakeCeremony({ description: "Short description for Ceremony Scheduled Fixed", prefix: "ceremony-scheduled-fixed", penalty: 10, // Penalty in days (amount of time a contributor should wait after timeout). - startDate: new Date(Date.now() + 86400000), // Starts in a day. - endDate: new Date(Date.now() + 86400000 * 2), // Ends in two days. + startDate: Date.now() + 86400000, // Starts in a day. + endDate: Date.now() + 86400000 * 2, // Ends in two days. state: CeremonyState.SCHEDULED, type: CeremonyType.PHASE2, timeoutMechanismType: CeremonyTimeoutType.FIXED, @@ -60,8 +60,8 @@ const fakeCeremonyScheduledDynamic = generateFakeCeremony({ description: "Short description for Ceremony Scheduled Dynamic", prefix: "ceremony-scheduled-dynamic", penalty: 10, // Penalty in days (amount of time a contributor should wait after timeout). - startDate: new Date(Date.now() + 86400000), // Starts in a day. - endDate: new Date(Date.now() + 86400000 * 2), // Ends in two days. + startDate: Date.now() + 86400000, // Starts in a day. + endDate: Date.now() + 86400000 * 2, // Ends in two days. state: CeremonyState.SCHEDULED, type: CeremonyType.PHASE2, timeoutMechanismType: CeremonyTimeoutType.DYNAMIC, @@ -77,8 +77,8 @@ const fakeCeremonyOpenedFixed = generateFakeCeremony({ description: "Short description for Ceremony Opened Fixed", prefix: "ceremony-opened-fixed", penalty: 10, // Penalty in days (amount of time a contributor should wait after timeout). - startDate: new Date(Date.now() - 86400000), // Starts in a day. - endDate: new Date(Date.now() + 86400000), // Ends in one day. + startDate: Date.now() - 86400000, // Started a day ago. + endDate: Date.now() + 86400000, // Ends in one day. state: CeremonyState.OPENED, type: CeremonyType.PHASE2, timeoutMechanismType: CeremonyTimeoutType.FIXED, @@ -94,8 +94,8 @@ const fakeCeremonyOpenedDynamic = generateFakeCeremony({ description: "Short description for Ceremony Opened Dynamic", prefix: "ceremony-opened-dynamic", penalty: 10, // Penalty in days (amount of time a contributor should wait after timeout). - startDate: new Date(Date.now() - 86400000), // Starts in a day. - endDate: new Date(Date.now() + 86400000), // Ends in one day. + startDate: Date.now() - 86400000, // Started a day ago. + endDate: Date.now() + 86400000, // Ends in one day. state: CeremonyState.OPENED, type: CeremonyType.PHASE2, timeoutMechanismType: CeremonyTimeoutType.DYNAMIC, diff --git a/packages/backend/src/functions/contribute.ts b/packages/backend/src/functions/contribute.ts index 2a757af4..761094e0 100644 --- a/packages/backend/src/functions/contribute.ts +++ b/packages/backend/src/functions/contribute.ts @@ -1,7 +1,6 @@ import * as functions from "firebase-functions" import admin from "firebase-admin" import dotenv from "dotenv" -import { MsgType } from "types/enums" import { commonTerms, getCircuitsCollectionPath, @@ -15,6 +14,7 @@ import { CeremonyTimeoutType, TimeoutType } from "@zkmpc/actions/src/types/enums" +import { MsgType } from "../../types/enums" import { GENERIC_ERRORS, GENERIC_LOGS, logMsg } from "../lib/logs" import { getCeremonyCircuits, diff --git a/packages/phase2cli/src/commands/setup.ts b/packages/phase2cli/src/commands/setup.ts index 2884dfcf..2743c219 100644 --- a/packages/phase2cli/src/commands/setup.ts +++ b/packages/phase2cli/src/commands/setup.ts @@ -221,9 +221,9 @@ const setup = async () => { // Display ceremony summary. let summary = `${`${theme.text.bold(ceremonyInputData.title)}\n${theme.text.italic(ceremonyInputData.description)}`} \n${`Opening: ${theme.text.bold( - theme.text.underlined(ceremonyInputData.startDate.toUTCString().replace("GMT", "UTC")) + theme.text.underlined(new Date(ceremonyInputData.startDate).toUTCString().replace("GMT", "UTC")) )}\nEnding: ${theme.text.bold( - theme.text.underlined(ceremonyInputData.endDate.toUTCString().replace("GMT", "UTC")) + theme.text.underlined(new Date(ceremonyInputData.endDate).toUTCString().replace("GMT", "UTC")) )}`} \n${theme.text.bold( ceremonyInputData.timeoutMechanismType === CeremonyTimeoutType.DYNAMIC ? `Dynamic` : `Fixed`