Skip to content

Commit

Permalink
Merge pull request #115 from privacy-scaling-explorations/issue_114
Browse files Browse the repository at this point in the history
Issue 114 - filter valid contributions
  • Loading branch information
glamperd authored Apr 22, 2024
2 parents 9d1c6bc + 3657a74 commit faf13f9
Show file tree
Hide file tree
Showing 7 changed files with 45 additions and 14 deletions.
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2023 Ethereum Foundation

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
6 changes: 6 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 5 additions & 4 deletions web/src/context/StateContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,8 @@ export const useInitialStateContext = () => {

// 2. Post-process data.
const ceremonies: CeremonyDocumentReferenceAndData[] = docs.map((document: DocumentData) => { return { uid: document.id, data: document.data() } })
const projects: Project[] = ceremonies.map((ceremony: CeremonyDocumentReferenceAndData) => { return { ceremony: ceremony } })
const ceremoniesVisibleInWeb = ceremonies.filter((ceremony) => ceremony.data.hideInWeb !== true)
const projects: Project[] = ceremoniesVisibleInWeb.map((ceremony: CeremonyDocumentReferenceAndData) => { return { ceremony: ceremony } })

const queue: WaitingQueue[] = []
for (const project of projects) {
Expand All @@ -134,22 +135,22 @@ export const useInitialStateContext = () => {
}

setWaitingQueue(queue)
// 3. Store data.
// 3. Store data.
setProjects(projects)
setLoading(false)
}

setRunTutorial(true)

fetchData()

},[])

return { waitingQueue, projects, setProjects, circuit, setCircuit, search, setSearch, loading, setLoading, runTutorial, setRunTutorial };
};

export const StateProvider: React.FC<StateProviderProps> = ({ children }) => {

const [user, setUser] = useState<string | undefined>(
localStorage.getItem("username") || undefined
);
Expand Down
2 changes: 1 addition & 1 deletion web/src/helpers/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -178,4 +178,4 @@ export const projectId = import.meta.env.VITE_FIREBASE_PROJECT_ID
export const messagingSenderId = import.meta.env.VITE_FIREBASE_MESSAGING_SENDER_ID
export const appId = import.meta.env.VITE_FIREBASE_APP_ID
export const awsRegion = import.meta.env.VITE_AWS_REGION
export const maxConstraintsForBrowser = 1500000
export const maxConstraintsForBrowser = 1500000
13 changes: 7 additions & 6 deletions web/src/helpers/interfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,7 @@ export interface CeremonyDocument {
type: CeremonyType
coordinatorId: string
lastUpdated: number
hideInWeb?: boolean
}

/**
Expand Down Expand Up @@ -494,9 +495,9 @@ export interface ZkeyDownloadLink {
* @property {number} waitingQueue - the number of participants in the waiting queue.
*/
export interface WaitingQueue {
ceremonyName: string
circuitName: string
waitingQueue: number
ceremonyName: string
circuitName: string
waitingQueue: number
}

/**
Expand All @@ -513,7 +514,7 @@ export interface Project {
circuits?: CircuitDocumentReferenceAndData[] | null
participants?: ParticipantDocumentReferenceAndData[] | null
contributions?: ContributionDocumentReferenceAndData[] | null
coordinatorId?: string
coordinatorId?: string
}

export interface State {
Expand Down Expand Up @@ -578,6 +579,6 @@ export type StateProviderProps = {
* @property {string} hash - the hash of the beacon.
*/
export interface FinalBeacon {
beacon: string
beacon: string
beaconHash: string
}
}
2 changes: 1 addition & 1 deletion web/src/pages/LandingPage/HeroComponent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,4 +66,4 @@ export function HeroComponent({ projects, waitingQueue }: HeroComponentProps) {
</VStack>
</>
);
}
}
6 changes: 4 additions & 2 deletions web/src/pages/ProjectPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ const ProjectPage: React.FC = () => {
maxTiming: Math.round((Number(circuit.data.avgTimings?.fullContribution) * 1.618) / 1000)
})) ?? [];

// parse contributions and sort by zkey name
// parse contributions and sort by zkey name. FIlter for valid contribs.
const contributionsClean =
validatedProjectData.contributions?.map((contribution) => ({
doc: contribution.data.files?.lastZkeyFilename ?? "",
Expand All @@ -112,7 +112,9 @@ const ProjectPage: React.FC = () => {
contribution.data?.files?.transcriptBlake2bHash ?? "",
10
)
})).slice().sort((a: any, b: any) => {
})).slice()
.filter((c: any) => c.valid)
.sort((a: any, b: any) => {
const docA = a.doc.toLowerCase()
const docB = b.doc.toLowerCase()

Expand Down

0 comments on commit faf13f9

Please sign in to comment.